Add Client.GetCurrentUser
This commit is contained in:
parent
1978c7ced0
commit
f7c8ce8d9f
|
@ -0,0 +1,21 @@
|
|||
package protonmail
|
||||
|
||||
type (
|
||||
AddressSend int
|
||||
AddressStatus int
|
||||
AddressType int
|
||||
)
|
||||
|
||||
type Address struct {
|
||||
ID string
|
||||
DomainID string
|
||||
Email string
|
||||
Send AddressSend
|
||||
Receive int
|
||||
Status AddressStatus
|
||||
Type AddressType
|
||||
DisplayName string
|
||||
Signature string // HTML
|
||||
HasKeys int
|
||||
Keys []*Key
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package protonmail
|
||||
|
||||
type Key struct {
|
||||
ID string
|
||||
Version int
|
||||
PublicKey string
|
||||
PrivateKey string
|
||||
Fingerprint string
|
||||
Activation interface{} // TODO
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package protonmail
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type (
|
||||
LogAuth int
|
||||
ComposerMode int
|
||||
MessageButtons int
|
||||
ImagesMode int
|
||||
ViewMode int
|
||||
ViewLayout int
|
||||
SwipeAction int
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID string
|
||||
Name string
|
||||
NotificationEmail string
|
||||
Signature string // HTML
|
||||
NumMessagePerPage int
|
||||
UsedSpace int
|
||||
Notify int
|
||||
AutoSaveContacts int
|
||||
Language string // e.g. en_US
|
||||
LogAuth LogAuth
|
||||
ComposerMode ComposerMode
|
||||
MessageButtons MessageButtons
|
||||
Images ImagesMode
|
||||
Moved int
|
||||
ShowImages int
|
||||
ShowEmbedded int
|
||||
ViewMode ViewMode
|
||||
ViewLayout ViewLayout
|
||||
SwipeLeft SwipeAction
|
||||
SwipeRight SwipeAction
|
||||
Theme string
|
||||
Currency string // e.g. EUR
|
||||
Credit int
|
||||
InvoiceText string
|
||||
AlsoArchive int
|
||||
Hotkeys int
|
||||
PMSignature int
|
||||
TwoFactor int
|
||||
PasswordReset int
|
||||
PasswordMode PasswordMode
|
||||
News int
|
||||
AutoResponder interface{} // TODO
|
||||
AutoWildcardSearch int
|
||||
DraftMIMEType string
|
||||
ReceiveMIMEType string
|
||||
ImageProxy int
|
||||
DisplayName string
|
||||
MaxSpace int
|
||||
MaxUpload int
|
||||
Subscribed int // TODO
|
||||
Services int // TODO
|
||||
Role int // TODO
|
||||
Private int
|
||||
VPN interface{} // TODO
|
||||
Delinquent int
|
||||
Addresses []*Address
|
||||
Keys []*Key
|
||||
}
|
||||
|
||||
func (c *Client) GetCurrentUser() (*User, error) {
|
||||
req, err := c.newRequest(http.MethodGet, "/users", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var respData struct {
|
||||
resp
|
||||
User *User
|
||||
}
|
||||
if err := c.doJSON(req, &respData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respData.User, nil
|
||||
}
|
Loading…
Reference in New Issue