o365

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package o365 implements an imap client, using Office 365 Mail REST API.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrNotSupported = errors.New("not supported")

Functions

func NewClient

func NewClient(clientID, clientSecret, redirectURL string, options ...ClientOption) *client

func NewConfidentialTokenSource added in v0.11.0

func NewConfidentialTokenSource(conf *oauth2.Config, tenantID string) *confidentialTokenSource

func NewGraphMailClient added in v0.11.0

func NewGraphMailClient(ctx context.Context, clientID, clientSecret, tenantID, userID string) (*graphMailClient, error)

func NewIMAPClient

func NewIMAPClient(c *client) imapclient.Client

Types

type Attachment

type Attachment struct {
	// The date and time when the attachment was last modified. The date and time use ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 would look like this: '2014-01-01T00:00:00Z'
	LastModifiedDateTime time.Time `json:",omitempty"`
	// The MIME type of the attachment.
	ContentType string `json:",omitempty"`
	// The display name of the attachment. This does not need to be the actual file name.
	Name string `json:",omitempty"`
	// The length of the attachment in bytes.
	Size int32 `json:",omitempty"`
	// true if the attachment is an inline attachment; otherwise, false.
	IsInline bool `json:",omitempty"`
}

type ClientOption

type ClientOption func(*clientOptions)

func Impersonate

func Impersonate(email string) ClientOption

func ReadOnly

func ReadOnly(readOnly bool) ClientOption

func TLS

func TLS(certFile, keyFile string) ClientOption

func TenantID added in v0.10.0

func TenantID(tenantID string) ClientOption

func TokensFile

func TokensFile(file string) ClientOption

type EmailAddress

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

type Folder

type Folder struct {
	ID          string `json:"Id"`
	Name        string `json:"DisplayName"`
	ParentID    string `json:"ParentFolderId,omitempty"`
	ChildCount  uint32 `json:"ChildFolderCount,omitempty"`
	UnreadCount uint32 `json:"UnreadItemCount,omitempty"`
	TotalCount  uint32 `json:"TotalItemCount,omitempty"`
}

type Importance

type Importance string

type InferenceClassificationType

type InferenceClassificationType string

type ItemBody

type ItemBody struct {
	// The content type: Text = 0, HTML = 1.
	ContentType string `json:",omitempty"`
	// The text or HTML content.
	Content string `json:",omitempty"`
}

type Message

type Message struct {
	// The date and time the message was created.
	// -F-
	Created *time.Time `json:"CreatedDateTime,omitempty"`
	// The date and time the message was last changed.
	// -F-
	LastModified *time.Time `json:"LastModifiedDateTime,omitempty"`
	// The date and time the message was sent.
	// -F-
	Sent *time.Time `json:"SentDateTime,omitempty"`
	// The date and time the message was received.
	// -FS
	Received *time.Time `json:"ReceivedDateTime,omitempty"`
	// A collection of multi-value extended properties of type MultiValueLegacyExtendedProperty. This is a navigation property. Find more information about extended properties.
	// WF-
	MultiValueExtendedProperties *MultiValueLegacyExtendedProperty `json:",omitempty"`
	// A collection of single-value extended properties of type SingleValueLegacyExtendedProperty. This is a navigation property. Find more information about extended properties.
	// WF-
	SingleValueExtendedProperties *SingleValueLegacyExtendedProperty `json:",omitempty"`
	// The mailbox owner and sender of the message.
	// WFS
	From *Recipient `json:",omitempty"`
	// The account that is actually used to generate the message.
	// WF-
	Sender *Recipient `json:",omitempty"`
	// The body of the message that is unique to the conversation.
	// ---
	UniqueBody *ItemBody `json:",omitempty"`
	// The body of the message.
	// W--
	Body ItemBody `json:",omitempty"`
	// The importance of the message: Low = 0, Normal = 1, High = 2.
	// WFS
	Importance Importance `json:",omitempty"`

	// The classification of this message for the user, based on inferred relevance or importance, or on an explicit override.
	// WFS
	InferenceClassification InferenceClassificationType `json:",omitempty"`
	// The version of the message.
	// ---
	ChangeKey string `json:",omitempty"`
	// The ID of the conversation the email belongs to.
	// -F-
	ConversationID string `json:"ConversationId,omitempty"`
	// The unique identifier of the message.
	// ---
	ID string `json:"Id,omitempty"`
	// The unique identifier for the message's parent folder.
	// ---
	ParentFolderID string `json:"ParentFolderId,omitempty"`
	// The subject of the message.
	// WF-
	Subject string `json:",omitempty"`
	// The URL to open the message in Outlook Web App.
	// You can append an ispopout argument to the end of the URL to change how the message is displayed. If ispopout is not present or if it is set to 1, then the message is shown in a popout window. If ispopout is set to 0, then the browser will show the message in the Outlook Web App review pane.
	// The message will open in the browser if you are logged in to your mailbox via Outlook Web App. You will be prompted to login if you are not already logged in with the browser.
	// This URL can be accessed from within an iFrame.
	// -F-
	WebLink string `json:",omitempty"`
	// The first 255 characters of the message body content.
	// --S
	BodyPreview string `json:",omitempty"`

	// The Bcc recipients for the message.
	// W-S
	Bcc []Recipient `json:"BccRecipients,omitempty"`
	// The email addresses to use when replying.
	// ---
	ReplyTo []Recipient `json:",omitempty"`
	// The To recipients for the message.
	// W-S
	To []Recipient `json:"ToRecipients,omitempty"`
	// The Cc recipients for the message.
	// W-S
	Cc []Recipient `json:"CcRecipients,omitempty"`

	// The FileAttachment and ItemAttachment attachments for the message. Navigation property.
	// W-S
	Attachments []Attachment `json:",omitempty"`

	// The categories associated with the message.
	// WFS
	Categories []string `json:",omitempty"`
	// The collection of open type data extensions defined for the message. Navigation property.
	// -F-
	Extensions []string `json:",omitempty"`

	// Indicates whether the message has attachments.
	// -FS
	HasAttachments bool `json:",omitempty"`
	// Indicates whether a read receipt is requested for the message.
	// WF-
	IsDeliveryReceiptRequested bool `json:",omitempty"`
	// Indicates whether the message is a draft. A message is a draft if it hasn't been sent yet.
	// -F-
	IsDraft bool `json:",omitempty"`
	// Indicates whether the message has been read.
	// WF-
	IsRead bool `json:",omitempty"`
	// Indicates whether a read receipt is requested for the message.
	// WF-
	IsReadReceiptRequested bool `json:",omitempty"`
}

https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#MessageResource The fields last word designates the Writable/Filterable/Searchable property of the field.

type MultiValueLegacyExtendedProperty

type MultiValueLegacyExtendedProperty struct {
	// The property ID. This is used to identify the property.
	PropertyID string `json:"PropertyId,omitempty"`
	// A collection of property values.
	Value []string `json:",omitempty"`
}

type Recipient

type Recipient struct {
	EmailAddress EmailAddress `json:",omitempty"`
}

type SingleValueLegacyExtendedProperty

type SingleValueLegacyExtendedProperty struct {
	// The property ID. This is used to identify the property.
	PropertyID string `json:"PropertyId,omitempty"`
	// A property values.
	Value string `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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