graph

package
v0.0.0-...-44ad6d2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ascending  = odata.Ascending
	Descending = odata.Descending
)

Variables

View Source
var WellKnownFolders = map[string][]string{
	"archive":                   {"Archive"},
	"clutter":                   nil,
	"conflicts":                 nil,
	"conversationhistory":       nil,
	"deleteditems":              {"Trash", "Deleted", "Deleted Items"},
	"drafts":                    {"Drafts"},
	"inbox":                     {"INBOX"},
	"junkemail":                 {"Spam", "Junk", "Junk Email"},
	"localfailures":             nil,
	"msgfolderroot":             nil,
	"outbox":                    nil,
	"recoverableitemsdeletions": nil,
	"scheduled":                 nil,
	"searchfolders":             nil,
	"sentitems":                 {"Sent", "Sent Items"},
	"serverfailures":            nil,
	"syncissues":                nil,
}

WellKnownFolders folder names

Functions

func EscapeSingleQuote

func EscapeSingleQuote(s string) string

func NewGraphMailClient

func NewGraphMailClient(
	ctx context.Context,
	tenantID, clientID, clientSecret, redirectURI string,
) (GraphMailClient, []User, error)

Types

type Change

type Change struct {
	Type           string          `json:"@odata.type"`
	ETag           string          `json:"@odata.etag"`
	ID             string          `json:"id"`
	ParentFolderID string          `json:"parentFolderId"`
	Removed        json.RawMessage `json:"removed"`
	Read           bool            `json:"isRead"`
}

type Content

type Content struct {
	ContentType string `json:"contentType"`
	Content     string `json:"content"`
}

type EmailAddress

type EmailAddress struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type Folder

type Folder struct {
	ID               string `json:"id"`
	DisplayName      string `json:"displayName"`
	ParentFolderID   string `json:"parentFolderId"`
	WellKnownName    string `json:"wellKnownName"`
	ChildFolderCount int    `json:"childFolderCount"`
	UnreadItemCount  int    `json:"unreadItemCount"`
	TotalItemCount   int    `json:"totalItemCount"`
	SizeInBytes      int    `json:"sizeInBytes"`
	Hidden           bool   `json:"isHidden"`
}

func (Folder) Name

func (f Folder) Name() string

type GraphMailClient

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

func (GraphMailClient) CopyMessage

func (g GraphMailClient) CopyMessage(ctx context.Context, userID, srcFolderID, msgID, destFolderID string) (Message, error)

func (GraphMailClient) CreateChildFolder

func (g GraphMailClient) CreateChildFolder(ctx context.Context, userID, parentID, displayName string) (Folder, error)

func (GraphMailClient) CreateFolder

func (g GraphMailClient) CreateFolder(ctx context.Context, userID, displayName string) (Folder, error)

func (GraphMailClient) CreateMessage

func (g GraphMailClient) CreateMessage(ctx context.Context, userID, folderID string, msg Message) (Message, error)

func (GraphMailClient) DeleteChildFolder

func (g GraphMailClient) DeleteChildFolder(ctx context.Context, userID, parentID, folderID string) error

func (GraphMailClient) DeleteFolder

func (g GraphMailClient) DeleteFolder(ctx context.Context, userID, folderID string) error

func (GraphMailClient) DeleteMessage

func (g GraphMailClient) DeleteMessage(ctx context.Context, userID, folderID, msgID string) error

func (GraphMailClient) DeltaMailFolders

func (g GraphMailClient) DeltaMailFolders(ctx context.Context, userID, deltaLink string) ([]Change, string, error)

func (GraphMailClient) DeltaMails

func (g GraphMailClient) DeltaMails(ctx context.Context, userID, folderID, deltaLink string) ([]Change, string, error)

func (GraphMailClient) GetMIMEMessage

func (g GraphMailClient) GetMIMEMessage(ctx context.Context, w io.Writer, userID, messageID string) (int64, error)

func (GraphMailClient) GetMessage

func (g GraphMailClient) GetMessage(ctx context.Context, userID, messageID string, query odata.Query) (Message, error)

func (GraphMailClient) GetMessageHeaders

func (g GraphMailClient) GetMessageHeaders(ctx context.Context, userID, messageID string, query odata.Query) (map[string][]string, error)

func (GraphMailClient) ListChildFolders

func (g GraphMailClient) ListChildFolders(ctx context.Context, userID, folderID string, recursive bool, query odata.Query) ([]Folder, error)

func (GraphMailClient) ListMailFolders

func (g GraphMailClient) ListMailFolders(ctx context.Context, userID string, query odata.Query) ([]Folder, error)

func (GraphMailClient) ListMessages

func (g GraphMailClient) ListMessages(ctx context.Context, userID, folderID string, query odata.Query) ([]Message, error)

func (GraphMailClient) MoveMessage

func (g GraphMailClient) MoveMessage(ctx context.Context, userID, srcFolderID, msgID, destFolderID string) (Message, error)

func (GraphMailClient) RenameFolder

func (g GraphMailClient) RenameFolder(ctx context.Context, userID, folderID, displayName string) error

func (GraphMailClient) SetLimit

func (g GraphMailClient) SetLimit(limit rate.Limit)

func (GraphMailClient) UpdateMessage

func (g GraphMailClient) UpdateMessage(ctx context.Context, userID, messageID string, update json.RawMessage) (Message, error)

func (GraphMailClient) Users

func (g GraphMailClient) Users(ctx context.Context) ([]msgraph.User, error)

type Message

type Message struct {
	Created        time.Time      `json:"createdDateTime,omitempty"`
	Modified       time.Time      `json:"lastModifiedDateTime,omitempty"`
	Received       time.Time      `json:"receivedDateTime,omitempty"`
	Sent           time.Time      `json:"sentDateTime,omitempty"`
	Body           Content        `json:"body,omitempty"`
	Sender         EmailAddress   `json:"sender,omitempty"`
	From           EmailAddress   `json:"from,omitempty"`
	UniqueBody     Content        `json:"uniqueBody,omitempty"`
	ReplyTo        []EmailAddress `json:"replyTo,omitempty"`
	ID             string         `json:"id,omitempty"`
	Subject        string         `json:"subject,omitempty"`
	BodyPreview    string         `json:"bodyPreview,omitempty"`
	ChangeKey      string         `json:"changeKey,omitempty"`
	ConversationID string         `json:"conversationId,omitempty"`
	Flag           struct {
		Status string `json:"flagStatus,omitempty"`
	} `json:"flag,omitempty"`
	Importance     string         `json:"importance,omitempty"`
	MessageID      string         `json:"internetMessageId,omitempty"`
	FolderID       string         `json:"parentFolderId,omitempty"`
	WebLink        string         `json:"webLink,omitempty"`
	To             []EmailAddress `json:"toRecipients,omitempty"`
	Cc             []EmailAddress `json:"bccRecipients,omitempty"`
	Bcc            []EmailAddress `json:"ccRecipients,omitempty"`
	Headers        []imh          `json:"internetMessageHeaders,omitempty"`
	HasAttachments bool           `json:"hasAttachments,omitempty"`
	Draft          bool           `json:"isDraft",omitempty`
	Read           bool           `json:"isRead,omitempty"`
}

type OrderBy

type OrderBy = odata.OrderBy

type Query

type Query = odata.Query

Query is a re-export of odata.Query to save the users of importing that package, too.

type User

type User = msgraph.User

Jump to

Keyboard shortcuts

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