Documentation
¶
Index ¶
- Constants
- type Attachment
- type AttachmentContent
- type AttachmentFile
- type BackoffError
- type CalendarItem
- type CalendarItemInput
- type CalendarItemUpdate
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateAttachment(ctx context.Context, parentID, parentChangeKey string, file AttachmentFile) (string, error)
- func (c *Client) CreateCalendarItem(ctx context.Context, parentFolderID string, item CalendarItemInput, ...) (string, string, error)
- func (c *Client) CreateContactItem(ctx context.Context, parentFolderID string, contact ContactItem) (string, string, error)
- func (c *Client) CreateDraft(ctx context.Context, message DraftMessage) (Message, error)
- func (c *Client) CreateMeetingResponse(ctx context.Context, referenceItemID, changeKey string, ...) error
- func (c *Client) CreateMessageInFolder(ctx context.Context, folderID string, mime []byte, markRead bool) (Message, error)
- func (c *Client) CreateTaskItem(ctx context.Context, parentFolderID string, item TaskInput) (itemID, changeKey string, err error)
- func (c *Client) CreateTasksFolder(ctx context.Context, input TasksFolderInput) (folderID, changeKey string, err error)
- func (c *Client) DeleteCalendarItem(ctx context.Context, itemID string, sendCancellations string) error
- func (c *Client) DeleteContactItem(ctx context.Context, itemID string) error
- func (c *Client) DeleteFolder(ctx context.Context, folderID string) error
- func (c *Client) DeleteItems(ctx context.Context, ids []string, hardDelete bool) error
- func (c *Client) DeleteTaskItem(ctx context.Context, itemID string) error
- func (c *Client) FindFolderByName(ctx context.Context, name string) (*Folder, error)
- func (c *Client) FindMessages(ctx context.Context, folderID string, offset, max int) (FindItemsResult, error)
- func (c *Client) FindMessagesByQuery(ctx context.Context, folderID string, offset, max int, queryString string, ...) (FindItemsResult, error)
- func (c *Client) FindMessagesRestricted(ctx context.Context, folderID string, offset, max int, ...) (FindItemsResult, error)
- func (c *Client) GetAttachment(ctx context.Context, attachmentID string) (AttachmentContent, error)
- func (c *Client) GetCalendarEvents(ctx context.Context, folderID string, offset, max int) ([]Event, error)
- func (c *Client) GetCalendarItem(ctx context.Context, itemID string) (CalendarItem, error)
- func (c *Client) GetContactItem(ctx context.Context, itemID string) (ContactItem, error)
- func (c *Client) GetContacts(ctx context.Context, folderID string, offset, max int) ([]Contact, error)
- func (c *Client) GetDelegate(ctx context.Context, mailbox string) ([]DelegateUser, error)
- func (c *Client) GetInboxRules(ctx context.Context) ([]Rule, error)
- func (c *Client) GetMessageMIME(ctx context.Context, id string) ([]byte, error)
- func (c *Client) GetMessageSummaries(ctx context.Context, ids []string) ([]Message, error)
- func (c *Client) GetMessages(ctx context.Context, ids []string) ([]Message, error)
- func (c *Client) GetTaskItem(ctx context.Context, itemID string) (Task, error)
- func (c *Client) GetTasks(ctx context.Context, folderID string, offset, max int) ([]Task, error)
- func (c *Client) GetUserOofSettings(ctx context.Context, mailbox string) (OofSettings, error)
- func (c *Client) ListCalendarItems(ctx context.Context, folderID string, rng TimeRange) ([]CalendarItem, error)
- func (c *Client) ListContactItems(ctx context.Context, folderID string, offset, max int) ([]ContactItem, error)
- func (c *Client) ListFolders(ctx context.Context) ([]Folder, error)
- func (c *Client) ListTasksFolders(ctx context.Context) ([]Folder, error)
- func (c *Client) MoveItems(ctx context.Context, ids []string, folderID string) ([]string, error)
- func (c *Client) ResolveNames(ctx context.Context, unresolved string, includeFullContactData bool) ([]ResolvedContact, error)
- func (c *Client) SendDraft(ctx context.Context, itemID string) error
- func (c *Client) SetCategories(ctx context.Context, ids []string, categories []string) error
- func (c *Client) SetFlag(ctx context.Context, ids []string, status string, dueAt time.Time) error
- func (c *Client) SetReadState(ctx context.Context, ids []string, isRead bool) error
- func (c *Client) SetUserOofSettings(ctx context.Context, mailbox string, settings OofSettings) error
- func (c *Client) SyncFolderItems(ctx context.Context, folderID, syncState string, maxChanges int) (SyncItemsResult, error)
- func (c *Client) UpdateCalendarItem(ctx context.Context, itemID, changeKey string, updates CalendarItemUpdate, ...) (string, error)
- func (c *Client) UpdateContactItem(ctx context.Context, itemID, changeKey string, updates ContactUpdate) (string, error)
- func (c *Client) UpdateDraft(ctx context.Context, itemID string, message DraftMessage) (Message, error)
- func (c *Client) UpdateInboxRules(ctx context.Context, operations []RuleOperation) error
- func (c *Client) UpdateTaskItem(ctx context.Context, itemID, changeKey string, updates TaskUpdate) (newChangeKey string, err error)
- func (c *Client) Watch(ctx context.Context, opts WatchOptions, onEvents func(StreamBatch) error) error
- type Config
- type Contact
- type ContactEmail
- type ContactItem
- type ContactPhone
- type ContactPhysicalAddress
- type ContactUpdate
- type DelegatePermissions
- type DelegateUser
- type DraftMessage
- type Event
- type EventAttendee
- type FindItemsResult
- type FindRestriction
- type Folder
- type FolderKind
- type Mailbox
- type MeetingResponseKind
- type Message
- type OofExternalAudience
- type OofSettings
- type OofState
- type ResolvedContact
- type Rule
- type RuleActions
- type RuleConditions
- type RuleOperation
- type RuleOperationKind
- type SOAPFaultError
- type StreamBatch
- type StreamEvent
- type SyncItemsResult
- type Task
- type TaskInput
- type TaskUpdate
- type TasksFolderInput
- type TimeRange
- type WatchOptions
Constants ¶
const ( FlagStatusNotFlagged = "NotFlagged" FlagStatusFlagged = "Flagged" FlagStatusComplete = "Complete" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type AttachmentContent ¶
type AttachmentFile ¶
type BackoffError ¶
type BackoffError struct {
Operation string
ResponseCode string
Message string
Backoff time.Duration
}
func (*BackoffError) Error ¶
func (e *BackoffError) Error() string
type CalendarItem ¶
type CalendarItem struct {
ID string
ChangeKey string
ParentFolderID string
Subject string
Body string
BodyType string
Location string
Start time.Time
End time.Time
IsAllDay bool
UID string
Organizer string
RequiredAttendees []EventAttendee
OptionalAttendees []EventAttendee
Recurrence string
Status string
}
type CalendarItemInput ¶
type CalendarItemUpdate ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateAttachment ¶
func (*Client) CreateCalendarItem ¶
func (*Client) CreateContactItem ¶
func (c *Client) CreateContactItem(ctx context.Context, parentFolderID string, contact ContactItem) (string, string, error)
CreateContactItem creates a Contact item in the given folder and returns the new EWS item id and change key. A blank parentFolderID defaults to the `contacts` distinguished folder.
func (*Client) CreateDraft ¶
func (*Client) CreateMeetingResponse ¶
func (*Client) CreateMessageInFolder ¶
func (*Client) CreateTaskItem ¶
func (c *Client) CreateTaskItem(ctx context.Context, parentFolderID string, item TaskInput) (itemID, changeKey string, err error)
CreateTaskItem inserts a new task into the given folder and returns the server-assigned ItemId and ChangeKey.
func (*Client) CreateTasksFolder ¶
func (c *Client) CreateTasksFolder(ctx context.Context, input TasksFolderInput) (folderID, changeKey string, err error)
CreateTasksFolder creates a new tasks subfolder under the given parent and returns the folder ID and change key.
func (*Client) DeleteCalendarItem ¶
func (*Client) DeleteContactItem ¶
DeleteContactItem permanently removes a contact via DeleteItem with DeleteType=HardDelete.
func (*Client) DeleteFolder ¶
DeleteFolder removes a folder via DeleteFolder with MoveToDeletedItems.
func (*Client) DeleteItems ¶
func (*Client) DeleteTaskItem ¶
DeleteTaskItem permanently removes a task via DeleteItem with MoveToDeletedItems.
func (*Client) FindFolderByName ¶
func (*Client) FindMessages ¶
func (*Client) FindMessagesByQuery ¶
func (c *Client) FindMessagesByQuery(ctx context.Context, folderID string, offset, max int, queryString string, deep bool) (FindItemsResult, error)
FindMessagesByQuery searches a folder using EWS Advanced Query Syntax (AQS) via the <QueryString> element. AQS is the indexed full-text search engine the Outlook client uses, so this returns hits in milliseconds across arbitrary mailbox sizes — unlike Restriction-based scans it does not require downloading every item to filter client-side. Pass Traversal="Deep" via MsgFolderRoot at the call site if you want a whole-mailbox sweep.
func (*Client) FindMessagesRestricted ¶
func (c *Client) FindMessagesRestricted(ctx context.Context, folderID string, offset, max int, restriction FindRestriction) (FindItemsResult, error)
func (*Client) GetAttachment ¶
func (*Client) GetCalendarEvents ¶
func (*Client) GetCalendarItem ¶
func (*Client) GetContactItem ¶
GetContactItem fetches a single contact by id and returns its parsed fields. Used by the contacts EWS adapter to implement GetContact against the shared EWS client.
func (*Client) GetContacts ¶
func (*Client) GetDelegate ¶
GetDelegate invokes the EWS `GetDelegate` SOAP operation for the given mailbox SMTP address and returns the delegate users Exchange reports. The request includes IncludePermissions="true" so each delegate carries its per-folder permission levels.
func (*Client) GetMessageMIME ¶
func (*Client) GetMessageSummaries ¶
func (*Client) GetMessages ¶
func (*Client) GetTaskItem ¶
GetTaskItem fetches a single task item by its ItemId.
func (*Client) GetUserOofSettings ¶
GetUserOofSettings invokes the EWS `GetUserOofSettings` SOAP operation for the given mailbox SMTP address.
func (*Client) ListCalendarItems ¶
func (*Client) ListContactItems ¶
func (c *Client) ListContactItems(ctx context.Context, folderID string, offset, max int) ([]ContactItem, error)
ListContactItems enumerates contacts in the given folder with all properties populated. Empty folderID defaults to the distinguished `contacts` folder. The returned slice preserves server order. offset/max map to FindItem paging; pass max<=0 for the client's configured batch size.
func (*Client) ListTasksFolders ¶
ListTasksFolders enumerates all tasks folders under the distinguished tasks folder, including the primary tasks folder itself and any subfolders.
func (*Client) ResolveNames ¶
func (c *Client) ResolveNames(ctx context.Context, unresolved string, includeFullContactData bool) ([]ResolvedContact, error)
ResolveNames invokes the EWS `ResolveNames` operation. It matches against the user's contacts and, when permitted, the Global Address List, and returns every resolution the server found. When includeFullContactData is true each resolution may carry a populated Contact element.
func (*Client) SetCategories ¶
func (*Client) SetReadState ¶
func (*Client) SetUserOofSettings ¶
func (c *Client) SetUserOofSettings(ctx context.Context, mailbox string, settings OofSettings) error
SetUserOofSettings invokes the EWS `SetUserOofSettings` SOAP operation for the given mailbox SMTP address. State==Disabled clears the responder; the Duration window is only emitted when State==Scheduled and both endpoints are set, matching the EWS schema requirement.
func (*Client) SyncFolderItems ¶
func (*Client) UpdateCalendarItem ¶
func (*Client) UpdateContactItem ¶
func (c *Client) UpdateContactItem(ctx context.Context, itemID, changeKey string, updates ContactUpdate) (string, error)
UpdateContactItem issues an UpdateItem SOAP call against an existing contact. It returns the new change key. Non-nil fields in updates are translated into SetItemField or DeleteItemField changes per the EWS schema.
func (*Client) UpdateDraft ¶
func (*Client) UpdateInboxRules ¶
func (c *Client) UpdateInboxRules(ctx context.Context, operations []RuleOperation) error
func (*Client) UpdateTaskItem ¶
func (c *Client) UpdateTaskItem(ctx context.Context, itemID, changeKey string, updates TaskUpdate) (newChangeKey string, err error)
UpdateTaskItem applies field-level updates to an existing task. It returns the new ChangeKey. Nil fields in updates are left untouched; empty-string pointers clear the field via DeleteItemField.
func (*Client) Watch ¶
func (c *Client) Watch(ctx context.Context, opts WatchOptions, onEvents func(StreamBatch) error) error
type ContactEmail ¶
ContactEmail is one entry in the EWS `EmailAddresses` collection. Key must be one of EmailAddress1, EmailAddress2, or EmailAddress3.
type ContactItem ¶
type ContactItem struct {
ID string
ChangeKey string
ParentFolderID string
DisplayName string
GivenName string
Surname string
CompanyName string
JobTitle string
Department string
Notes string
EmailAddresses []ContactEmail
PhoneNumbers []ContactPhone
PhysicalAddresses []ContactPhysicalAddress
Birthday *time.Time
}
ContactItem is the EWS-side representation of a contact used by create/read/update paths. It mirrors the fields of the SOAP `Contact` element that the adapter in `internal/contacts` maps to providerdata.Contact.
type ContactPhone ¶
ContactPhone is one entry in the EWS `PhoneNumbers` collection. Key follows the EWS `PhoneNumberKeyType` vocabulary (BusinessPhone, HomePhone, MobilePhone, OtherTelephone, ...).
type ContactPhysicalAddress ¶
type ContactPhysicalAddress struct {
Key string
Street string
City string
State string
PostalCode string
CountryOrRegion string
}
ContactPhysicalAddress is one entry in the EWS `PhysicalAddresses` collection. Key is Home, Business, or Other.
type ContactUpdate ¶
type ContactUpdate struct {
DisplayName *string
GivenName *string
Surname *string
CompanyName *string
JobTitle *string
Department *string
Notes *string
Birthday *time.Time
ClearBirthday bool
EmailAddresses *[]ContactEmail
PhoneNumbers *[]ContactPhone
PhysicalAddresses *[]ContactPhysicalAddress
}
ContactUpdate describes a partial write against an existing contact item. Non-nil scalar pointers replace the matching EWS property; an empty string clears it via DeleteItemField. Nil scalars are left untouched. Collection pointers follow the same rule: nil skips, non-nil replaces the whole collection (an empty slice clears it).
type DelegatePermissions ¶
type DelegatePermissions struct {
CalendarFolder string
TasksFolder string
InboxFolder string
ContactsFolder string
NotesFolder string
JournalFolder string
}
DelegatePermissions mirrors the EWS DelegatePermissions element. Each field is the raw permission-level string per Exchange folder; an empty value means the server omitted that folder (commonly "None").
type DelegateUser ¶
type DelegateUser struct {
PrimarySmtpAddress string
DisplayName string
Permissions DelegatePermissions
ViewPrivateItems bool
ReceiveCopiesOfMR bool
}
DelegateUser is one entry returned by GetDelegate, carrying the delegate's identity and per-folder permission levels. Exchange reports permissions as enumerated strings (None, Reviewer, Author, Editor, Custom, ...); callers should treat them as opaque tokens suitable for display.
type DraftMessage ¶
type EventAttendee ¶
type FindItemsResult ¶
type FindRestriction ¶
type FolderKind ¶
type FolderKind string
const ( FolderKindGeneric FolderKind = "folder" FolderKindCalendar FolderKind = "calendar" FolderKindContacts FolderKind = "contacts" FolderKindTasks FolderKind = "tasks" )
type MeetingResponseKind ¶
type MeetingResponseKind string
const ( MeetingAccept MeetingResponseKind = "accept" MeetingTentativelyAccept MeetingResponseKind = "tentative" MeetingDecline MeetingResponseKind = "decline" )
type Message ¶
type Message struct {
ID string
ChangeKey string
ParentFolderID string
ConversationID string
ConversationTopic string
InternetMessageID string
Subject string
Body string
BodyType string
From Mailbox
Sender Mailbox
To []Mailbox
Cc []Mailbox
DisplayTo string
DisplayCc string
WebLink string
IsRead bool
IsDraft bool
HasAttachments bool
ReceivedAt time.Time
SentAt time.Time
CreatedAt time.Time
FlagStatus string
FlagDueAt time.Time
Attachments []Attachment
}
type OofExternalAudience ¶
type OofExternalAudience string
OofExternalAudience mirrors the EWS `ExternalAudience` enumeration. None only replies to internal senders, Known replies to contacts, All replies to every external sender.
const ( OofAudienceNone OofExternalAudience = "None" OofAudienceKnown OofExternalAudience = "Known" OofAudienceAll OofExternalAudience = "All" )
type OofSettings ¶
type OofSettings struct {
State OofState
ExternalAudience OofExternalAudience
Start time.Time
End time.Time
InternalReply string
ExternalReply string
}
OofSettings is the canonical EWS-side representation of the user's out-of-office configuration. The mailboxsettings package converts it to and from providerdata.OOFSettings.
type OofState ¶
type OofState string
OofState mirrors the EWS `OofState` enumeration. Disabled means no auto-reply, Enabled means always-on, Scheduled means active only inside the optional Duration window.
type ResolvedContact ¶
type ResolvedContact struct {
Mailbox Mailbox
Contact ContactItem
}
ResolvedContact pairs a mailbox with the optional Contact element that ResolveNames returns when IncludeFullContactData is set.
type Rule ¶
type Rule struct {
ID string
Name string
Priority int
Enabled bool
Conditions RuleConditions
Exceptions RuleConditions
Actions RuleActions
}
type RuleActions ¶
type RuleConditions ¶
type RuleOperation ¶
type RuleOperation struct {
Kind RuleOperationKind
Rule Rule
}
type RuleOperationKind ¶
type RuleOperationKind string
const ( RuleOperationCreate RuleOperationKind = "create" RuleOperationSet RuleOperationKind = "set" RuleOperationDelete RuleOperationKind = "delete" )
type SOAPFaultError ¶
type SOAPFaultError struct {
Operation string
StatusCode int
FaultCode string
ResponseCode string
Message string
}
func (*SOAPFaultError) Error ¶
func (e *SOAPFaultError) Error() string
type StreamBatch ¶
type StreamBatch struct {
SubscriptionID string
PreviousWatermark string
MoreEvents bool
Events []StreamEvent
}
type StreamEvent ¶
type SyncItemsResult ¶
type TaskInput ¶
type TaskInput struct {
Subject string
Body string
BodyType string
StartDate *time.Time
DueDate *time.Time
Status string
Importance string
ReminderSet bool
ReminderDueBy *time.Time
}
TaskInput carries the fields needed to create a new EWS Task item.
type TaskUpdate ¶
type TaskUpdate struct {
Subject *string
Body *string
BodyType *string
StartDate *time.Time
DueDate *time.Time
Status *string
Importance *string
IsComplete *bool
CompleteDate *time.Time
ReminderSet *bool
ReminderDueBy *time.Time
}
TaskUpdate carries the optional fields for updating an existing EWS Task item. A nil pointer means "leave the field unchanged"; an empty string means "clear it".
type TasksFolderInput ¶
TasksFolderInput carries the fields needed to create a new tasks folder.