fakeapi

package
v1.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	GET    method = "GET"
	POST   method = "POST"
	PUT    method = "PUT"
	DELETE method = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(cm *pmapi.ClientManager) *Controller

func (*Controller) AddUser

func (ctl *Controller) AddUser(user *pmapi.User, addresses *pmapi.AddressList, password string, twoFAEnabled bool) error

func (*Controller) AddUserLabel

func (ctl *Controller) AddUserLabel(username string, label *pmapi.Label) error

func (*Controller) AddUserMessage

func (ctl *Controller) AddUserMessage(username string, message *pmapi.Message) (string, error)

func (*Controller) GetCalls

func (ctl *Controller) GetCalls(method, path string) [][]byte

func (*Controller) GetLabelIDs

func (ctl *Controller) GetLabelIDs(username string, labelNames []string) ([]string, error)

func (*Controller) GetMessages

func (ctl *Controller) GetMessages(username, labelID string) ([]*pmapi.Message, error)

func (*Controller) PrintCalls

func (ctl *Controller) PrintCalls()

func (*Controller) ReorderAddresses

func (ctl *Controller) ReorderAddresses(user *pmapi.User, addressIDs []string) error

func (*Controller) TurnInternetConnectionOff

func (ctl *Controller) TurnInternetConnectionOff()

func (*Controller) TurnInternetConnectionOn

func (ctl *Controller) TurnInternetConnectionOn()

func (*Controller) WasCalled

func (ctl *Controller) WasCalled(method, path string, expectedRequest []byte) bool

type FakePMAPI

type FakePMAPI struct {
	// contains filtered or unexported fields
}

func New

func New(controller *Controller, userID string) *FakePMAPI

func (*FakePMAPI) Addresses

func (api *FakePMAPI) Addresses() pmapi.AddressList

func (*FakePMAPI) Auth

func (api *FakePMAPI) Auth(username, password string, authInfo *pmapi.AuthInfo) (*pmapi.Auth, error)

func (*FakePMAPI) Auth2FA

func (api *FakePMAPI) Auth2FA(twoFactorCode string, auth *pmapi.Auth) error

func (*FakePMAPI) AuthInfo

func (api *FakePMAPI) AuthInfo(username string) (*pmapi.AuthInfo, error)

func (*FakePMAPI) AuthRefresh

func (api *FakePMAPI) AuthRefresh(token string) (*pmapi.Auth, error)

func (*FakePMAPI) AuthSalt

func (api *FakePMAPI) AuthSalt() (string, error)

func (*FakePMAPI) ClearData

func (api *FakePMAPI) ClearData()

func (*FakePMAPI) CloseConnections

func (api *FakePMAPI) CloseConnections()

func (*FakePMAPI) CountMessages

func (api *FakePMAPI) CountMessages(addressID string) ([]*pmapi.MessagesCount, error)

func (*FakePMAPI) CreateAttachment

func (api *FakePMAPI) CreateAttachment(attachment *pmapi.Attachment, data io.Reader, signature io.Reader) (*pmapi.Attachment, error)

func (*FakePMAPI) CreateDraft

func (api *FakePMAPI) CreateDraft(message *pmapi.Message, parentID string, action int) (*pmapi.Message, error)

func (*FakePMAPI) CreateLabel

func (api *FakePMAPI) CreateLabel(label *pmapi.Label) (*pmapi.Label, error)

func (*FakePMAPI) CurrentUser

func (api *FakePMAPI) CurrentUser() (*pmapi.User, error)

func (*FakePMAPI) DecryptAndVerifyCards

func (api *FakePMAPI) DecryptAndVerifyCards(cards []pmapi.Card) ([]pmapi.Card, error)

func (*FakePMAPI) DeleteAttachment

func (api *FakePMAPI) DeleteAttachment(attID string) error

func (*FakePMAPI) DeleteAuth

func (api *FakePMAPI) DeleteAuth() error

func (*FakePMAPI) DeleteLabel

func (api *FakePMAPI) DeleteLabel(labelID string) error

func (*FakePMAPI) DeleteMessages

func (api *FakePMAPI) DeleteMessages(apiIDs []string) error

func (*FakePMAPI) EmptyFolder

func (api *FakePMAPI) EmptyFolder(labelID string, addressID string) error

func (*FakePMAPI) GetAddresses

func (api *FakePMAPI) GetAddresses() (pmapi.AddressList, error)

func (*FakePMAPI) GetAttachment

func (api *FakePMAPI) GetAttachment(attachmentID string) (io.ReadCloser, error)

func (*FakePMAPI) GetContactByID

func (api *FakePMAPI) GetContactByID(contactID string) (pmapi.Contact, error)

func (*FakePMAPI) GetContactEmailByEmail

func (api *FakePMAPI) GetContactEmailByEmail(email string, page int, pageSize int) ([]pmapi.ContactEmail, error)

func (*FakePMAPI) GetEvent

func (api *FakePMAPI) GetEvent(eventID string) (*pmapi.Event, error)

func (*FakePMAPI) GetMailSettings

func (api *FakePMAPI) GetMailSettings() (pmapi.MailSettings, error)

func (*FakePMAPI) GetMessage

func (api *FakePMAPI) GetMessage(apiID string) (*pmapi.Message, error)

func (*FakePMAPI) GetPublicKeysForEmail

func (api *FakePMAPI) GetPublicKeysForEmail(email string) (keys []pmapi.PublicKey, internal bool, err error)

func (*FakePMAPI) Import

func (api *FakePMAPI) Import(importMessageRequests []*pmapi.ImportMsgReq) ([]*pmapi.ImportMsgRes, error)

func (*FakePMAPI) IsConnected

func (api *FakePMAPI) IsConnected() bool

func (*FakePMAPI) IsUnlocked

func (api *FakePMAPI) IsUnlocked() bool

func (*FakePMAPI) KeyRingForAddressID

func (api *FakePMAPI) KeyRingForAddressID(addrID string) (*crypto.KeyRing, error)

func (*FakePMAPI) LabelMessages

func (api *FakePMAPI) LabelMessages(apiIDs []string, labelID string) error

func (*FakePMAPI) ListLabels

func (api *FakePMAPI) ListLabels() ([]*pmapi.Label, error)

func (*FakePMAPI) ListMessages

func (api *FakePMAPI) ListMessages(filter *pmapi.MessagesFilter) ([]*pmapi.Message, int, error)

ListMessages does not implement following filters:

  • Sort (it sorts by ID only), but Desc works
  • Keyword
  • To
  • Subject
  • ID
  • Attachments
  • AutoWildcard

func (*FakePMAPI) Logout

func (api *FakePMAPI) Logout()

func (*FakePMAPI) MarkMessagesRead

func (api *FakePMAPI) MarkMessagesRead(apiIDs []string) error

func (*FakePMAPI) MarkMessagesUnread

func (api *FakePMAPI) MarkMessagesUnread(apiIDs []string) error

func (*FakePMAPI) ReloadKeys

func (api *FakePMAPI) ReloadKeys(passphrase []byte) (err error)

func (*FakePMAPI) ReorderAddresses

func (api *FakePMAPI) ReorderAddresses(addressIDs []string) error

func (*FakePMAPI) Report

func (api *FakePMAPI) Report(report pmapi.ReportReq) error

func (*FakePMAPI) ReportSentryCrash

func (api *FakePMAPI) ReportSentryCrash(err error) error

func (*FakePMAPI) SendMessage

func (api *FakePMAPI) SendMessage(messageID string, sendMessageRequest *pmapi.SendMessageReq) (sent, parent *pmapi.Message, err error)

func (*FakePMAPI) SendSimpleMetric

func (api *FakePMAPI) SendSimpleMetric(category, action, label string) error

func (*FakePMAPI) SetAuths

func (api *FakePMAPI) SetAuths(auths chan<- *pmapi.Auth)

func (*FakePMAPI) UnlabelMessages

func (api *FakePMAPI) UnlabelMessages(apiIDs []string, labelID string) error

func (*FakePMAPI) Unlock

func (api *FakePMAPI) Unlock(passphrase []byte) (err error)

func (*FakePMAPI) UpdateLabel

func (api *FakePMAPI) UpdateLabel(label *pmapi.Label) (*pmapi.Label, error)

func (*FakePMAPI) UpdateUser

func (api *FakePMAPI) UpdateUser() (*pmapi.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL