mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-22 01:56:44 +00:00
GODT-35: New pmapi client and manager using resty
This commit is contained in:
@ -17,9 +17,13 @@
|
||||
|
||||
package fakeapi
|
||||
|
||||
import "github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
import (
|
||||
"context"
|
||||
|
||||
func (api *FakePMAPI) CountMessages(addressID string) ([]*pmapi.MessagesCount, error) {
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
)
|
||||
|
||||
func (api *FakePMAPI) CountMessages(_ context.Context, addressID string) ([]*pmapi.MessagesCount, error) {
|
||||
if err := api.checkAndRecordCall(GET, "/mail/v4/messages/count?AddressID="+addressID, nil); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -43,10 +47,16 @@ func (api *FakePMAPI) getCounts(addressID string) []*pmapi.MessagesCount {
|
||||
counts.Unread++
|
||||
}
|
||||
} else {
|
||||
var unread int
|
||||
|
||||
if message.Unread == pmapi.True {
|
||||
unread = 1
|
||||
}
|
||||
|
||||
allCounts[labelID] = &pmapi.MessagesCount{
|
||||
LabelID: labelID,
|
||||
Total: 1,
|
||||
Unread: message.Unread,
|
||||
Unread: unread,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user