protonmail: go fmt
This commit is contained in:
parent
d04c241914
commit
9ea16a03dd
|
@ -1,16 +1,16 @@
|
||||||
package protonmail
|
package protonmail
|
||||||
|
|
||||||
type Attachment struct {
|
type Attachment struct {
|
||||||
ID string
|
ID string
|
||||||
Name string
|
Name string
|
||||||
Size int
|
Size int
|
||||||
MIMEType string
|
MIMEType string
|
||||||
KeyPackets string
|
KeyPackets string
|
||||||
//Headers map[string]string
|
//Headers map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type AttachmentKey struct {
|
type AttachmentKey struct {
|
||||||
ID string
|
ID string
|
||||||
Key string
|
Key string
|
||||||
Algo string
|
Algo string
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,12 +150,12 @@ func entityPrimaryKey(e *openpgp.Entity) *openpgp.Key {
|
||||||
}
|
}
|
||||||
|
|
||||||
type detachedSignatureReader struct {
|
type detachedSignatureReader struct {
|
||||||
md *openpgp.MessageDetails
|
md *openpgp.MessageDetails
|
||||||
body io.Reader
|
body io.Reader
|
||||||
signed bytes.Buffer
|
signed bytes.Buffer
|
||||||
signature io.Reader
|
signature io.Reader
|
||||||
keyring openpgp.KeyRing
|
keyring openpgp.KeyRing
|
||||||
eof bool
|
eof bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *detachedSignatureReader) Read(p []byte) (n int, err error) {
|
func (r *detachedSignatureReader) Read(p []byte) (n int, err error) {
|
||||||
|
@ -212,9 +212,9 @@ func (card *ContactCard) Read(keyring openpgp.KeyRing) (*openpgp.MessageDetails,
|
||||||
|
|
||||||
if card.Type.Signed() {
|
if card.Type.Signed() {
|
||||||
r := &detachedSignatureReader{
|
r := &detachedSignatureReader{
|
||||||
md: md,
|
md: md,
|
||||||
signature: strings.NewReader(card.Signature),
|
signature: strings.NewReader(card.Signature),
|
||||||
keyring: keyring,
|
keyring: keyring,
|
||||||
}
|
}
|
||||||
r.body = io.TeeReader(md.UnverifiedBody, &r.signed)
|
r.body = io.TeeReader(md.UnverifiedBody, &r.signed)
|
||||||
|
|
||||||
|
|
|
@ -17,35 +17,35 @@ type MessageEncryption int
|
||||||
|
|
||||||
type MessageAddress struct {
|
type MessageAddress struct {
|
||||||
Address string
|
Address string
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
ID string
|
ID string
|
||||||
Order int64
|
Order int64
|
||||||
Subject string
|
Subject string
|
||||||
IsRead int
|
IsRead int
|
||||||
Type MessageType
|
Type MessageType
|
||||||
Sender *MessageAddress
|
Sender *MessageAddress
|
||||||
ReplyTo *MessageAddress
|
ReplyTo *MessageAddress
|
||||||
ToList []*MessageAddress
|
ToList []*MessageAddress
|
||||||
Time int64
|
Time int64
|
||||||
Size int64
|
Size int64
|
||||||
IsEncrypted MessageEncryption
|
IsEncrypted MessageEncryption
|
||||||
ExpirationTime int64
|
ExpirationTime int64
|
||||||
IsReplied int
|
IsReplied int
|
||||||
IsRepliedAll int
|
IsRepliedAll int
|
||||||
IsForwarded int
|
IsForwarded int
|
||||||
SpamScore int
|
SpamScore int
|
||||||
AddressID string
|
AddressID string
|
||||||
Body string
|
Body string
|
||||||
MIMEType string
|
MIMEType string
|
||||||
CCList []*MessageAddress
|
CCList []*MessageAddress
|
||||||
BCCList []*MessageAddress
|
BCCList []*MessageAddress
|
||||||
Header string
|
Header string
|
||||||
Attachments []*Attachment
|
Attachments []*Attachment
|
||||||
LabelIDs []string
|
LabelIDs []string
|
||||||
ExternalID string
|
ExternalID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetMessage(id string) (*Message, error) {
|
func (c *Client) GetMessage(id string) (*Message, error) {
|
||||||
|
@ -67,9 +67,9 @@ func (c *Client) GetMessage(id string) (*Message, error) {
|
||||||
|
|
||||||
func (c *Client) CreateDraftMessage(msg *Message, parentID string) (*Message, error) {
|
func (c *Client) CreateDraftMessage(msg *Message, parentID string) (*Message, error) {
|
||||||
reqData := struct {
|
reqData := struct {
|
||||||
Message *Message
|
Message *Message
|
||||||
ParentID string `json:",omitempty"`
|
ParentID string `json:",omitempty"`
|
||||||
Action *int `json:",omitempty"`
|
Action *int `json:",omitempty"`
|
||||||
}{msg, parentID, nil}
|
}{msg, parentID, nil}
|
||||||
req, err := c.newJSONRequest(http.MethodPost, "/messages", &reqData)
|
req, err := c.newJSONRequest(http.MethodPost, "/messages", &reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -108,30 +108,30 @@ func (c *Client) UpdateDraftMessage(msg *Message) (*Message, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageKeyPacket struct {
|
type MessageKeyPacket struct {
|
||||||
ID string
|
ID string
|
||||||
KeyPackets string
|
KeyPackets string
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessagePackageType int
|
type MessagePackageType int
|
||||||
|
|
||||||
type MessagePackage struct {
|
type MessagePackage struct {
|
||||||
Address string
|
Address string
|
||||||
Type MessagePackageType
|
Type MessagePackageType
|
||||||
Body string
|
Body string
|
||||||
KeyPackets []*MessageKeyPacket
|
KeyPackets []*MessageKeyPacket
|
||||||
|
|
||||||
Token string
|
Token string
|
||||||
EncToken string
|
EncToken string
|
||||||
PasswordHint string `json:",omitempty"`
|
PasswordHint string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageOutgoing struct {
|
type MessageOutgoing struct {
|
||||||
ID string
|
ID string
|
||||||
|
|
||||||
ClearBody string
|
ClearBody string
|
||||||
ExpirationTime int64
|
ExpirationTime int64
|
||||||
AttachmentKeys []*AttachmentKey
|
AttachmentKeys []*AttachmentKey
|
||||||
Packages []*MessagePackage
|
Packages []*MessagePackage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) SendMessage(msg *MessageOutgoing) (sent, parent *Message, err error) {
|
func (c *Client) SendMessage(msg *MessageOutgoing) (sent, parent *Message, err error) {
|
||||||
|
|
Loading…
Reference in New Issue