ciolite

package
v0.0.0-...-25f6170 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package ciolite is the Golang client library for the Lite Context.IO API

Index

Constants

View Source
const (
	// DefaultHost is the default host of CIO Lite API
	DefaultHost = "https://api.context.io"

	// DefaultRequestTimeout is the default timeout duration used on HTTP requests
	DefaultRequestTimeout = 120 * time.Second
)
View Source
const (
	UnknownStatusCode = -1
	UnknownPayload    = "UNKNOWN"
	UnknownMethod     = "UNKNOWN"
	UnknownURL        = "UNKNOWN"
)

Variables

This section is empty.

Functions

func ErrorMethod

func ErrorMethod(err error) string

ErrorMethod returns the method of the error, or an empty string

func ErrorPayload

func ErrorPayload(err error) string

ErrorPayload returns the payload of the error, or an empty string

func ErrorStatusCode

func ErrorStatusCode(err error) int

ErrorStatusCode returns the StatusCode of the error, or 0

func ErrorURL

func ErrorURL(err error) string

ErrorURL returns the URL of the error, or an empty string

func UnmarshalJSON

func UnmarshalJSON(data []byte) (error, error)

UnmarshalJSON is a helper method to unmarshal the json representation of a RequestError, getting back a valid nil error if it should be nil, and a valid RequestError error otherwise.

Pay attention to return value order: First argument is the unmarshalled RequestError as an error interface,
Second argument is any actual error encountered while unmarshalling (from json.Unmarshal).

Types

type Address

type Address struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

Address embedded data struct within GetUsersEmailAccountFolderMessageAddresses and WebhookMessageDataAddresses

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get
https://context.io/docs/lite/users/webhooks#callbacks

func (*Address) UnmarshalJSON

func (m *Address) UnmarshalJSON(b []byte) error

UnmarshalJSON is here because the empty state is an array in the json, and is a object/map when populated

type CioLite

type CioLite struct {
	Host string

	// Allow setting your own *http.Client, otherwise default is client with DefaultRequestTimeout
	HTTPClient *http.Client

	// PreRequestHook is a function (mostly for logging) that will be executed
	// before the request is made.
	// 	Its arguments are:
	// 	User ID (if present),
	// 	Account Label (if present),
	// 	Method (GET/POST/etc),
	// 	URL,
	// 	redacted body values.
	PreRequestHook func(string, string, string, string, url.Values)

	// PostRequestShouldRetryHook is a function (mostly for logging) that will be
	// executed after each request is made, and will be called at least once.
	// 	Its arguments are:
	// 	request Attempt # (starts at 1),
	// 	User ID (if present),
	// 	Account Label (if present),
	// 	Method (GET/POST/etc),
	// 	URL,
	// 	response Status Code,
	// 	response Payload,
	// 	time at start of most recent attempt,
	// 	time at start of all attempts,
	// 	any error received while attempting this request.
	// The returned boolean is whether this request should be retried or not, which
	// if False then this is the last call of this function, but if True means this
	// function will be called again.
	PostRequestShouldRetryHook func(int, string, string, string, string, int, string, time.Time, time.Time, error) bool

	// ResponseBodyCloseErrorHook is a function (purely for logging) that will
	// execute if there is an error closing the response body.
	ResponseBodyCloseErrorHook func(error)
	// contains filtered or unexported fields
}

CioLite struct contains the api key and secret, along with an optional logger, and provides convenience functions for accessing all CIO Lite endpoints.

func NewCioLite

func NewCioLite(key string, secret string) CioLite

NewCioLite returns a CIO Lite struct (without a logger) for accessing the CIO Lite API.

func NewTestCioLiteServer

func NewTestCioLiteServer(handler http.Handler) (CioLite, *httptest.Server)

NewTestCioLiteServer is a convenience function that returns a CioLite object and a *httptest.Server (which must be closed when done being used). The CioLite instance will hit the test server for all requests.

func (CioLite) CheckConnectToken

func (cioLite CioLite) CheckConnectToken(connectToken GetConnectTokenResponse, email string) error

CheckConnectToken checks and returns nil if the connect token was used, the email authorized matches the expected email, and that CIO has access to the account.

func (CioLite) CreateConnectToken

func (cioLite CioLite) CreateConnectToken(formValues CreateConnectTokenParams) (CreateConnectTokenResponse, error)

CreateConnectToken creates and obtains a new connect token. formValues requires CallbackURL, and optionally may have Email, FirstName, LastName, StatusCallbackURL

https://context.io/docs/lite/connect_tokens#post

func (CioLite) CreateOAuthProvider

func (cioLite CioLite) CreateOAuthProvider(formValues CreateOAuthProviderParams) (CreateOAuthProviderResponse, error)

CreateOAuthProvider adds a new OAuth2 provider. formValues requires Type, ProviderConsumerKey, and ProviderConsumerSecret

https://context.io/docs/lite/oauth_providers#post

func (CioLite) CreateStatusCallbackURL

func (cioLite CioLite) CreateStatusCallbackURL(formValues CreateStatusCallbackURLParams) (CreateDeleteStatusCallbackURLResponse, error)

CreateStatusCallbackURL create an app status callback url. Requires: StatusCallbackURL

https://context.io/docs/app/status_callback_url#post

func (CioLite) CreateUser

func (cioLite CioLite) CreateUser(formValues CreateUserParams) (CreateUserResponse, error)

CreateUser create a new user. formValues can optionally be empty if just creating a user without any email accounts, but if creating a user and an email account at the same time then it is required to have: Email, Server, Username, UseSSL, Port, Type, and (if OAUTH) ProviderRefreshToken and ProviderConsumerKey, and (if not OAUTH) Password, and may optionally contain MigrateAccountID, FirstName, LastName, StatusCallbackURL

https://context.io/docs/lite/users#post

func (CioLite) CreateUserConnectToken

func (cioLite CioLite) CreateUserConnectToken(userID string, formValues CreateConnectTokenParams) (CreateConnectTokenResponse, error)

CreateUserConnectToken creates and obtains a new connect_token for a specific user. formValues requires CallbackURL, and may optionally have Email, FirstName, LastName, StatusCallbackURL

https://context.io/docs/lite/users/connect_tokens#post

func (CioLite) CreateUserEmailAccount

func (cioLite CioLite) CreateUserEmailAccount(userID string, formValues CreateUserParams) (CreateEmailAccountResponse, error)

CreateUserEmailAccount adds a mailbox to a given user. formValues requires Email, Server, Username, UseSSL, Port, Type, and (if OAUTH) ProviderRefreshToken and ProviderConsumerKey, and (if not OAUTH) Password, and may optionally contain StatusCallbackURL

https://context.io/docs/lite/users/email_accounts#post

func (CioLite) CreateUserEmailAccountConnectToken

func (cioLite CioLite) CreateUserEmailAccountConnectToken(userID string, label string, formValues CreateConnectTokenParams) (CreateConnectTokenResponse, error)

CreateUserEmailAccountConnectToken creates and obtains a new connect_token for a specific user email account. formValues requires CallbackURL

https://context.io/docs/lite/users/email_accounts/connect_tokens#post

func (CioLite) CreateUserEmailAccountFolder

func (cioLite CioLite) CreateUserEmailAccountFolder(userID string, label string, folder string, formValues EmailAccountFolderDelimiterParam) (CreateEmailAccountFolderResponse, error)

CreateUserEmailAccountFolder create a folder on an email account. This call will fail if the folder already exists. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders#id-post

func (CioLite) CreateUserWebhook

func (cioLite CioLite) CreateUserWebhook(userID string, formValues CreateUserWebhookParams) (CreateUserWebhookResponse, error)

CreateUserWebhook creates a new Webhook on a user. formValues requires CallbackURL, FailureNotifUrl, and may optionally contain FilterTo, FilterFrom, FilterCC, FilterSubject, FilterThread, FilterNewImportant, FilterFileName, FilterFolderAdded, FilterToDomain, FilterFromDomain, IncludeBody, BodyType

https://context.io/docs/lite/users/webhooks#post

func (CioLite) CreateWebhook

func (cioLite CioLite) CreateWebhook(formValues CreateUserWebhookParams) (CreateUserWebhookResponse, error)

CreateWebhook creates a new Webhook for the application. formValues requires CallbackURL, FailureNotifUrl, and may optionally contain FilterTo, FilterFrom, FilterCC, FilterSubject, FilterThread, FilterNewImportant, FilterFileName, FilterFolderAdded, FilterToDomain, FilterFromDomain, IncludeBody, BodyType

https://context.io/docs/lite/webhooks#post

func (CioLite) DeleteConnectToken

func (cioLite CioLite) DeleteConnectToken(token string) (DeleteConnectTokenResponse, error)

DeleteConnectToken removes a given connect token

https://context.io/docs/lite/connect_tokens#id-delete

func (CioLite) DeleteOAuthProvider

func (cioLite CioLite) DeleteOAuthProvider(key string) (DeleteOAuthProviderResponse, error)

DeleteOAuthProvider removes a given OAuth provider.

https://context.io/docs/lite/oauth_providers#id-delete

func (CioLite) DeleteStatusCallbackURL

func (cioLite CioLite) DeleteStatusCallbackURL() (CreateDeleteStatusCallbackURLResponse, error)

DeleteStatusCallbackURL removes an app status callback url.

https://context.io/docs/app/status_callback_url#delete

func (CioLite) DeleteUser

func (cioLite CioLite) DeleteUser(userID string) (DeleteUserResponse, error)

DeleteUser removes a given user.

https://context.io/docs/lite/users#id-delete

func (CioLite) DeleteUserConnectToken

func (cioLite CioLite) DeleteUserConnectToken(userID string, token string) (DeleteConnectTokenResponse, error)

DeleteUserConnectToken removes a given connect token for a specific user.

https://context.io/docs/lite/users/connect_tokens#id-delete

func (CioLite) DeleteUserEmailAccount

func (cioLite CioLite) DeleteUserEmailAccount(userID string, label string) (DeleteEmailAccountResponse, error)

DeleteUserEmailAccount deletes an email account of a user.

https://context.io/docs/lite/users/email_accounts#id-delete

func (CioLite) DeleteUserEmailAccountConnectToken

func (cioLite CioLite) DeleteUserEmailAccountConnectToken(userID string, label string, token string) (DeleteConnectTokenResponse, error)

DeleteUserEmailAccountConnectToken removes a given connect token for a specific user email account.

https://context.io/docs/lite/users/email_accounts/connect_tokens#id-delete

func (CioLite) DeleteUserWebhookAccount

func (cioLite CioLite) DeleteUserWebhookAccount(userID string, webhookID string) (DeleteWebhookResponse, error)

DeleteUserWebhookAccount cancels a Webhook.

https://context.io/docs/lite/users/webhooks#id-delete

func (CioLite) DeleteWebhookAccount

func (cioLite CioLite) DeleteWebhookAccount(webhookID string) (DeleteWebhookResponse, error)

DeleteWebhookAccount cancels a Webhook.

https://context.io/docs/lite/webhooks#id-delete

func (CioLite) GetConnectToken

func (cioLite CioLite) GetConnectToken(token string) (GetConnectTokenResponse, error)

GetConnectToken gets information about a given connect token.

https://context.io/docs/lite/connect_tokens#id-get

func (CioLite) GetConnectTokens

func (cioLite CioLite) GetConnectTokens() ([]GetConnectTokenResponse, error)

GetConnectTokens get a list of connect tokens created with your API key.

https://context.io/docs/lite/connect_tokens#get

func (CioLite) GetDiscovery

func (cioLite CioLite) GetDiscovery(queryValues GetDiscoveryParams) (GetDiscoveryResponse, error)

GetDiscovery attempts to discover connection settings for a given email address. queryValues requires Email to be set.

https://context.io/docs/lite/discovery#get

func (CioLite) GetOAuthProvider

func (cioLite CioLite) GetOAuthProvider(key string) (GetOAuthProvidersResponse, error)

GetOAuthProvider gets information about a given OAuth provider.

https://context.io/docs/lite/oauth_providers#id-get

func (CioLite) GetOAuthProviders

func (cioLite CioLite) GetOAuthProviders() ([]GetOAuthProvidersResponse, error)

GetOAuthProviders get the list of OAuth providers configured.

https://context.io/docs/lite/oauth_providers#get

func (CioLite) GetStatusCallbackURL

func (cioLite CioLite) GetStatusCallbackURL() (GetStatusCallbackURLResponse, error)

GetStatusCallbackURL gets a list of app status callback url's.

https://context.io/docs/app/status_callback_url#get

func (CioLite) GetUser

func (cioLite CioLite) GetUser(userID string) (GetUsersResponse, error)

GetUser get details about a given user.

https://context.io/docs/lite/users#id-get

func (CioLite) GetUserConnectToken

func (cioLite CioLite) GetUserConnectToken(userID string, token string) (GetConnectTokenResponse, error)

GetUserConnectToken gets information about a given connect token for a specific user.

https://context.io/docs/lite/users/connect_tokens#id-get

func (CioLite) GetUserConnectTokens

func (cioLite CioLite) GetUserConnectTokens(userID string) ([]GetConnectTokenResponse, error)

GetUserConnectTokens gets a list of connect tokens created for a user.

https://context.io/docs/lite/users/connect_tokens#get

func (CioLite) GetUserEmailAccount

func (cioLite CioLite) GetUserEmailAccount(userID string, label string) (GetUsersEmailAccountsResponse, error)

GetUserEmailAccount gets the parameters and status for an email account.

https://context.io/docs/lite/users/email_accounts#id-get

Status can be one of: OK, CONNECTION_IMPOSSIBLE, INVALID_CREDENTIALS, TEMP_DISABLED, DISABLED

func (CioLite) GetUserEmailAccountConnectToken

func (cioLite CioLite) GetUserEmailAccountConnectToken(userID string, label string, token string) (GetConnectTokenResponse, error)

GetUserEmailAccountConnectToken gets information about a given connect token for a specific user email account.

https://context.io/docs/lite/users/email_accounts/connect_tokens#id-get

func (CioLite) GetUserEmailAccountConnectTokens

func (cioLite CioLite) GetUserEmailAccountConnectTokens(userID string, label string) ([]GetConnectTokenResponse, error)

GetUserEmailAccountConnectTokens gets a list of connect tokens created for a user email account.

https://context.io/docs/lite/users/email_accounts/connect_tokens#get

func (CioLite) GetUserEmailAccountFolder

func (cioLite CioLite) GetUserEmailAccountFolder(userID string, label string, folder string, queryValues EmailAccountFolderDelimiterParam) (GetUsersEmailAccountFoldersResponse, error)

GetUserEmailAccountFolder gets information about a given folder. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders#id-get

func (CioLite) GetUserEmailAccountFolderMessage

func (cioLite CioLite) GetUserEmailAccountFolderMessage(userID string, label string, folder string, messageID string, queryValues GetUserEmailAccountsFolderMessageParams) (GetUsersEmailAccountFolderMessagesResponse, error)

GetUserEmailAccountFolderMessage gets file, contact and other information about a given email message. queryValues may optionally contain Delimiter, IncludeBody, BodyType, IncludeHeaders, IncludeFlags

https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

func (CioLite) GetUserEmailAccounts

func (cioLite CioLite) GetUserEmailAccounts(userID string, queryValues GetUserEmailAccountsParams) ([]GetUsersEmailAccountsResponse, error)

GetUserEmailAccounts gets a list of email accounts assigned to a user. queryValues may optionally contain Status, StatusOK

https://context.io/docs/lite/users/email_accounts#get

func (CioLite) GetUserEmailAccountsFolderMessageAttachment

func (cioLite CioLite) GetUserEmailAccountsFolderMessageAttachment(userID string, label string, folder string, messageID string, attachmentID string, queryValues EmailAccountFolderDelimiterParam) (GetUserEmailAccountsFolderMessageAttachmentsResponse, error)

GetUserEmailAccountsFolderMessageAttachment retrieves an email attachment. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#id-get

func (CioLite) GetUserEmailAccountsFolderMessageAttachments

func (cioLite CioLite) GetUserEmailAccountsFolderMessageAttachments(userID string, label string, folder string, messageID string, queryValues EmailAccountFolderDelimiterParam) ([]GetUserEmailAccountsFolderMessageAttachmentsResponse, error)

GetUserEmailAccountsFolderMessageAttachments gets listings of email attachments. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#get

func (CioLite) GetUserEmailAccountsFolderMessageBody

func (cioLite CioLite) GetUserEmailAccountsFolderMessageBody(userID string, label string, folder string, messageID string, queryValues GetUserEmailAccountsFolderMessageBodyParams) ([]GetUserEmailAccountsFolderMessageBodyResponse, error)

GetUserEmailAccountsFolderMessageBody fetches the message body of a given email. queryValues may optionally contain Delimiter, Type

https://context.io/docs/lite/users/email_accounts/folders/messages/body#get

func (CioLite) GetUserEmailAccountsFolderMessageFlags

func (cioLite CioLite) GetUserEmailAccountsFolderMessageFlags(userID string, label string, folder string, messageID string, queryValues EmailAccountFolderDelimiterParam) (GetUserEmailAccountsFolderMessageFlagsResponse, error)

GetUserEmailAccountsFolderMessageFlags returns the message flags. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/flags#get

func (CioLite) GetUserEmailAccountsFolderMessageHeaders

func (cioLite CioLite) GetUserEmailAccountsFolderMessageHeaders(userID string, label string, folder string, messageID string, queryValues GetUserEmailAccountsFolderMessageHeadersParams) (GetUserEmailAccountsFolderMessageHeadersResponse, error)

GetUserEmailAccountsFolderMessageHeaders gets the complete headers of a given email message. queryValues may optionally contain Delimiter, Raw

https://context.io/docs/lite/users/email_accounts/folders/messages/headers#get

func (CioLite) GetUserEmailAccountsFolderMessageRaw

func (cioLite CioLite) GetUserEmailAccountsFolderMessageRaw(userID string, label string, folder string, messageID string, queryValues EmailAccountFolderDelimiterParam) (GetUserEmailAccountsFolderMessageRawResponse, error)

GetUserEmailAccountsFolderMessageRaw fetches the raw RFC-822 message text of a given email. queryValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/raw#get

func (CioLite) GetUserEmailAccountsFolderMessages

func (cioLite CioLite) GetUserEmailAccountsFolderMessages(userID string, label string, folder string, queryValues GetUserEmailAccountsFolderMessageParams) ([]GetUsersEmailAccountFolderMessagesResponse, error)

GetUserEmailAccountsFolderMessages gets listings of email messages for a user. queryValues may optionally contain Delimiter, IncludeBody, BodyType, IncludeHeaders, IncludeFlags, Limit, Offset

https://context.io/docs/lite/users/email_accounts/folders/messages#get

func (CioLite) GetUserEmailAccountsFolders

func (cioLite CioLite) GetUserEmailAccountsFolders(userID string, label string, queryValues GetUserEmailAccountsFoldersParams) ([]GetUsersEmailAccountFoldersResponse, error)

GetUserEmailAccountsFolders gets a list of folders in an email account. queryValues may optionally contain IncludeNamesOnly

https://context.io/docs/lite/users/email_accounts/folders#get

func (CioLite) GetUserWebhook

func (cioLite CioLite) GetUserWebhook(userID string, webhookID string) (GetUsersWebhooksResponse, error)

GetUserWebhook gets the properties of a given Webhook.

https://context.io/docs/lite/users/webhooks#id-get

func (CioLite) GetUserWebhooks

func (cioLite CioLite) GetUserWebhooks(userID string) ([]GetUsersWebhooksResponse, error)

GetUserWebhooks gets listings of Webhooks configured for a user.

https://context.io/docs/lite/users/webhooks#get

func (CioLite) GetUsers

func (cioLite CioLite) GetUsers(queryValues GetUsersParams) ([]GetUsersResponse, error)

GetUsers gets a list of users. queryValues may optionally contain Email, Status, StatusOK, Limit, Offset

https://context.io/docs/lite/users#get

func (CioLite) GetWebhook

func (cioLite CioLite) GetWebhook(webhookID string) (GetUsersWebhooksResponse, error)

GetWebhook gets the properties of a given Webhook.

https://context.io/docs/lite/webhooks#id-get

func (CioLite) GetWebhooks

func (cioLite CioLite) GetWebhooks() ([]GetUsersWebhooksResponse, error)

GetWebhooks gets listings of Webhooks configured for the application.

https://context.io/docs/lite/webhooks#get

func (CioLite) MarkUserEmailAccountsFolderMessageRead

func (cioLite CioLite) MarkUserEmailAccountsFolderMessageRead(userID string, label string, folder string, messageID string, formValues EmailAccountFolderDelimiterParam) (UserEmailAccountsFolderMessageReadResponse, error)

MarkUserEmailAccountsFolderMessageRead marks the message as read. formValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/read#post

func (CioLite) MarkUserEmailAccountsFolderMessageUnRead

func (cioLite CioLite) MarkUserEmailAccountsFolderMessageUnRead(userID string, label string, folder string, messageID string, formValues EmailAccountFolderDelimiterParam) (UserEmailAccountsFolderMessageReadResponse, error)

MarkUserEmailAccountsFolderMessageUnRead marks the message as unread. formValues may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages/read#delete

func (CioLite) ModifyUser

func (cioLite CioLite) ModifyUser(userID string, formValues ModifyUserParams) (ModifyUserResponse, error)

ModifyUser modifies a given user. formValues requires FirstName, LastName

https://context.io/docs/lite/users#id-post

func (CioLite) ModifyUserEmailAccount

func (cioLite CioLite) ModifyUserEmailAccount(userID string, label string, formValues ModifyUserEmailAccountParams) (ModifyEmailAccountResponse, error)

ModifyUserEmailAccount modifies an email account on a given user. formValues optionally may contain Status, ForceStatusCheck, Password, ProviderRefreshToken, ProviderConsumerKey, StatusCallbackURL

https://context.io/docs/lite/users/email_accounts#id-post

func (CioLite) ModifyUserWebhook

func (cioLite CioLite) ModifyUserWebhook(userID string, webhookID string, formValues ModifyUserWebhookParams) (ModifyWebhookResponse, error)

ModifyUserWebhook changes the properties of a given Webhook. formValues requires Active

https://context.io/docs/lite/users/webhooks#id-post

func (CioLite) ModifyWebhook

func (cioLite CioLite) ModifyWebhook(webhookID string, formValues ModifyUserWebhookParams) (ModifyWebhookResponse, error)

ModifyWebhook changes the properties of a given Webhook. formValues requires Active

https://context.io/docs/lite/webhooks#id-post

func (CioLite) MoveUserEmailAccountFolderMessage

func (cioLite CioLite) MoveUserEmailAccountFolderMessage(userID string, label string, folder string, messageID string, queryValues MoveUserEmailAccountFolderMessageParams) (MoveUserEmailAccountFolderMessageResponse, error)

MoveUserEmailAccountFolderMessage moves a message. formValues requires NewFolderID, and may optionally contain Delimiter

https://context.io/docs/lite/users/email_accounts/folders/messages#id-put

func (CioLite) SafeCreateUserEmailAccountFolder

func (cioLite CioLite) SafeCreateUserEmailAccountFolder(userID string, label string, folder string, formValues EmailAccountFolderDelimiterParam) (bool, error)

SafeCreateUserEmailAccountFolder will safely check if a folder exists, and create it if it does not. This function returns a bool representing whether it had to create a folder, and any errors it received. queryValues may optionally contain Delimiter

func (CioLite) ValidateCallback

func (cio CioLite) ValidateCallback(token string, signature string, timestamp int) bool

ValidateCallback returns true if this Webhook Callback or User Account Status Callback authenticates

type CreateConnectTokenParams

type CreateConnectTokenParams struct {
	// Required:
	CallbackURL string `json:"callback_url"`

	// Optional:
	Email             string `json:"email,omitempty"`
	FirstName         string `json:"first_name,omitempty"`
	LastName          string `json:"last_name,omitempty"`
	StatusCallbackURL string `json:"status_callback_url,omitempty"`
}

CreateConnectTokenParams form values data struct. Requires CallbackURL, and optionally may have Email, FirstName, LastName, StatusCallbackURL.

https://context.io/docs/lite/connect_tokens#post
https://context.io/docs/lite/users/connect_tokens#post

type CreateConnectTokenResponse

type CreateConnectTokenResponse struct {
	Success            bool   `json:"success,omitempty"`
	Token              string `json:"token,omitempty"`
	ResourceURL        string `json:"resource_url,omitempty"`
	BrowserRedirectURL string `json:"browser_redirect_url,omitempty"`
	AccessToken        string `json:"access_token,omitempty"`
	AccessTokenSecret  string `json:"access_token_secret,omitempty"`
}

CreateConnectTokenResponse data struct

https://context.io/docs/lite/connect_tokens#post

type CreateDeleteStatusCallbackURLResponse

type CreateDeleteStatusCallbackURLResponse struct {
	Success bool `json:"success,omitempty"`
}

CreateDeleteStatusCallbackURLResponse data struct

https://context.io/docs/app/status_callback_url#post
https://context.io/docs/app/status_callback_url#delete

type CreateEmailAccountFolderResponse

type CreateEmailAccountFolderResponse struct {
	Success bool `json:"success,omitempty"`
}

CreateEmailAccountFolderResponse data struct

https://context.io/docs/lite/users/email_accounts/folders#id-post

type CreateEmailAccountResponse

type CreateEmailAccountResponse struct {
	Status      string `json:"stats,omitempty"`
	Label       string `json:"label,omitempty"`
	ResourceURL string `json:"resource_url,omitempty"`
}

CreateEmailAccountResponse data struct

https://context.io/docs/lite/users/email_accounts#post

type CreateOAuthProviderParams

type CreateOAuthProviderParams struct {
	// Requires:
	Type                   string `json:"type"`
	ProviderConsumerKey    string `json:"provider_consumer_key"`
	ProviderConsumerSecret string `json:"provider_consumer_secret"`
}

CreateOAuthProviderParams form values data struct. Requires Type, ProviderConsumerKey, ProviderConsumerSecret.

https://context.io/docs/lite/oauth_providers#post

type CreateOAuthProviderResponse

type CreateOAuthProviderResponse struct {
	Success             bool   `json:"success,omitempty"`
	ProviderConsumerKey string `json:"provider_consumer_key,omitempty"`
	ResourceURL         string `json:"resource_url,omitempty"`
}

CreateOAuthProviderResponse data struct

https://context.io/docs/lite/oauth_providers#post

type CreateStatusCallbackURLParams

type CreateStatusCallbackURLParams struct {
	StatusCallbackURL string `json:"status_callback_url,omitempty"`
}

CreateStatusCallbackURLParams form values data struct. Requires: StatusCallbackURL

https://context.io/docs/app/status_callback_url#post

type CreateUserParams

type CreateUserParams struct {
	// Optional, but Required for creating an Email Account
	Email    string `json:"email"`
	Server   string `json:"server"`
	Username string `json:"username"`
	Type     string `json:"type"`
	UseSSL   bool   `json:"use_ssl"`
	Port     int    `json:"port"`

	// Optional, but Required for OAUTH:
	ProviderRefreshToken string `json:"provider_refresh_token,omitempty"`
	ProviderConsumerKey  string `json:"provider_consumer_key,omitempty"`

	// Optional, but Required for non-OAUTH:
	Password string `json:"password,omitempty"`

	// Optional:
	StatusCallbackURL string `json:"status_callback_url,omitempty"`

	// Optional for CreaseUser only (not used by CreateUserEmailAccount):
	MigrateAccountID string `json:"migrate_account_id,omitempty"`
	FirstName        string `json:"first_name,omitempty"`
	LastName         string `json:"last_name,omitempty"`
}

CreateUserParams form values data struct. Can optionally be empty if just creating a user without any email accounts, but if creating a user and an email account at the same time then it is required to have: Email, Server, Username, UseSSL, Port, Type, and (if OAUTH) ProviderRefreshToken and ProviderConsumerKey, and (if not OAUTH) Password, and may optionally contain StatusCallbackURL, and (only for CreateUser) MigrateAccountID, FirstName, LastName.

https://context.io/docs/lite/users#post
https://context.io/docs/lite/users/email_accounts#post

type CreateUserResponse

type CreateUserResponse struct {
	Success bool   `json:"success,omitempty"`
	ID      string `json:"id,omitempty"`

	EmailAccount CreateEmailAccountResponse `json:"email_account,omitempty"`

	ResourceURL       string `json:"resource_url,omitempty"`
	AccessToken       string `json:"access_token,omitempty"`
	AccessTokenSecret string `json:"access_token_secret,omitempty"`

	ConnectionLog string `json:"connection_log,omitempty"`
	FeedbackCode  string `json:"feedback_code,omitempty"`
}

CreateUserResponse data struct

https://context.io/docs/lite/users#post

type CreateUserWebhookParams

type CreateUserWebhookParams struct {
	// Requires:
	CallbackURL     string `json:"callback_url"`
	FailureNotifURL string `json:"failure_notif_url"`

	// Optional:
	FilterTo           string `json:"filter_to,omitempty"`
	FilterFrom         string `json:"filter_from,omitempty"`
	FilterCC           string `json:"filter_cc,omitempty"`
	FilterSubject      string `json:"filter_subject,omitempty"`
	FilterThread       string `json:"filter_thread,omitempty"`
	FilterNewImportant string `json:"filter_new_important,omitempty"`
	FilterFileName     string `json:"filter_file_name,omitempty"`
	FilterFolderAdded  string `json:"filter_folder_added,omitempty"`
	FilterToDomain     string `json:"filter_to_domain,omitempty"`
	FilterFromDomain   string `json:"filter_from_domain,omitempty"`
	BodyType           string `json:"body_type,omitempty"`
	IncludeBody        bool   `json:"include_body,omitempty"`
	IncludeHeader      bool   `json:"include_header,omitempty"`
	ReceiveDrafts      bool   `json:"receive_drafts,omitempty"`
	ReceiveAllChanges  bool   `json:"receive_all_changes,omitempty"`
	ReceiveHistorical  bool   `json:"receive_historical,omitempty"`
}

CreateUserWebhookParams form values data struct. Requires: CallbackURL, FailureNotifUrl, and may optionally contain FilterTo, FilterFrom, FilterCC, FilterSubject, FilterThread, FilterNewImportant, FilterFileName, FilterFolderAdded, FilterToDomain, FilterFromDomain, IncludeBody, BodyType

https://context.io/docs/lite/users/webhooks#post

type CreateUserWebhookResponse

type CreateUserWebhookResponse struct {
	WebhookID   string `json:"webhook_id,omitempty"`
	ResourceURL string `json:"resource_url,omitempty"`

	Success bool `json:"success,omitempty"`
}

CreateUserWebhookResponse data struct

https://context.io/docs/lite/users/webhooks#post

type DeleteConnectTokenResponse

type DeleteConnectTokenResponse struct {
	Success bool `json:"success,omitempty"`
}

DeleteConnectTokenResponse data struct

https://context.io/docs/lite/connect_tokens#id-delete

type DeleteEmailAccountResponse

type DeleteEmailAccountResponse struct {
	Success      bool   `json:"success,omitempty"`
	ResourceURL  string `json:"resource_url,omitempty"`
	FeedbackCode string `json:"feedback_code,omitempty"`
}

DeleteEmailAccountResponse data struct

https://context.io/docs/lite/users/email_accounts#id-delete

type DeleteOAuthProviderResponse

type DeleteOAuthProviderResponse struct {
	Success bool `json:"success,omitempty"`
}

DeleteOAuthProviderResponse data struct

https://context.io/docs/lite/oauth_providers#id-delete

type DeleteUserResponse

type DeleteUserResponse struct {
	Success     bool   `json:"success,omitempty"`
	ResourceURL string `json:"resource_url,omitempty"`
}

DeleteUserResponse data struct

https://context.io/docs/lite/users#id-delete

type DeleteWebhookResponse

type DeleteWebhookResponse struct {
	Success bool `json:"success,omitempty"`
}

DeleteWebhookResponse data struct

https://context.io/docs/lite/users/webhooks#id-delete

type EmailAccountFolderDelimiterParam

type EmailAccountFolderDelimiterParam struct {
	// Optional:
	Delimiter string `json:"delimiter,omitempty"`
}

EmailAccountFolderDelimiterParam query values data struct. Optional: Delimiter

	https://context.io/docs/lite/users/email_accounts/folders#id-get
	https://context.io/docs/lite/users/email_accounts/folders#id-post
	https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#get
	https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#id-get
	https://context.io/docs/lite/users/email_accounts/folders/messages/flags#get
 https://context.io/docs/lite/users/email_accounts/folders/messages/raw#get
	https://context.io/docs/lite/users/email_accounts/folders/messages/read#post
	https://context.io/docs/lite/users/email_accounts/folders/messages/read#delete

type ErrorMetaData

type ErrorMetaData struct {
	StatusCode int
	Payload    string
	Method     string
	URL        string
}

ErrorMetaData holds some meta-data about the error: StatusCode, Response Payload, Method used, and URL

type ExpiresMixed

type ExpiresMixed struct {
	Expires *int
}

ExpiresMixed is a special type to handle the fact that 'expires' can be an int or false.

Unix timestamp of when this token will expire and be purged.
Once the token is used, this property will be set to false
https://context.io/docs/lite/users/connect_tokens

func (ExpiresMixed) MarshalJSON

func (expires ExpiresMixed) MarshalJSON() ([]byte, error)

MarshalJSON allows ExpiresMixed to implement json.Marshaler

func (*ExpiresMixed) Timestamp

func (expires *ExpiresMixed) Timestamp() int

Timestamp returns the expires timestamp if the token is unused, and returns -1 if the token has been used.

func (*ExpiresMixed) UnmarshalJSON

func (expires *ExpiresMixed) UnmarshalJSON(data []byte) error

UnmarshalJSON allows ExpiresMixed to implement json.Unmarshaler

func (*ExpiresMixed) Unused

func (expires *ExpiresMixed) Unused() bool

Unused returns true if Expires is a Unix timestamp, and returns false if this token has been used.

type GetConnectTokenResponse

type GetConnectTokenResponse struct {
	Token              string `json:"token,omitempty"`
	Email              string `json:"email,omitempty"`
	EmailAccountID     string `json:"email_account_id,omitempty"`
	CallbackURL        string `json:"callback_url,omitempty"`
	StatusCallbackURL  string `json:"status_callback_url,omitempty"`
	FirstName          string `json:"first_name,omitempty"`
	LastName           string `json:"last_name,omitempty"`
	ResourceURL        string `json:"resource_url,omitempty"`
	BrowserRedirectURL string `json:"browser_redirect_url,omitempty"` // TODO: reconfirm which fields the response includes
	ServerLabel        string `json:"server_label,omitempty"`

	AccountLite bool `json:"account_lite,omitempty"`

	Created int `json:"created,omitempty"`
	Used    int `json:"used,omitempty"`

	Expires ExpiresMixed `json:"expires,omitempty"`

	User GetConnectTokenUserResponse `json:"user,omitempty"`
}

GetConnectTokenResponse data struct

https://context.io/docs/lite/connect_tokens#get
https://context.io/docs/lite/connect_tokens#id-get

type GetConnectTokenUserResponse

type GetConnectTokenUserResponse struct {
	ID             string   `json:"id,omitempty"`
	EmailAddresses []string `json:"email_addresses,omitempty"`
	FirstName      string   `json:"first_name,omitempty"`
	LastName       string   `json:"last_name,omitempty"`
	Created        int      `json:"created,omitempty"`

	EmailAccounts []GetUsersEmailAccountsResponse `json:"email_accounts,omitempty"`
}

GetConnectTokenUserResponse data struct within GetConnectTokenResponse

https://context.io/docs/lite/connect_tokens#get
https://context.io/docs/lite/connect_tokens#id-get

func (GetConnectTokenUserResponse) EmailAccountMatching

func (user GetConnectTokenUserResponse) EmailAccountMatching(email string) (GetUsersEmailAccountsResponse, error)

EmailAccountMatching searches its EmailAccounts array for the provided email address, and returns the GetUsersEmailAccountsResponse Email Account that matches it.

type GetDiscoveryIMAPResponse

type GetDiscoveryIMAPResponse struct {
	Server   string `json:"server,omitempty"`
	Username string `json:"username,omitempty"`

	UseSSL bool `json:"use_ssl,omitempty"`
	OAuth  bool `json:"oauth,omitempty"`

	Port int `json:"port,omitempty"`
}

GetDiscoveryIMAPResponse embedded data struct

https://context.io/docs/lite/discovery#get

type GetDiscoveryParams

type GetDiscoveryParams struct {
	// Required:
	Email string `json:"email"`
}

GetDiscoveryParams query values data struct. Requires Email.

https://context.io/docs/lite/discovery#get

type GetDiscoveryResponse

type GetDiscoveryResponse struct {
	Email string `json:"email,omitempty"`
	Type  string `json:"type,omitempty"`

	// Value only appears if there is an error message
	Value string `json:"value,omitempty"`

	Documentation []interface{} `json:"documentation,omitempty"`

	Found bool `json:"found,omitempty"`

	IMAP GetDiscoveryIMAPResponse `json:"imap,omitempty"`
}

GetDiscoveryResponse data struct

https://context.io/docs/lite/discovery#get

type GetOAuthProvidersResponse

type GetOAuthProvidersResponse struct {
	Type                   string `json:"type,omitempty"`
	ProviderConsumerKey    string `json:"provider_consumer_key,omitempty"`
	ProviderConsumerSecret string `json:"provider_consumer_secret,omitempty"`
	ResourceURL            string `json:"resource_url,omitempty"`
}

GetOAuthProvidersResponse data struct

https://context.io/docs/lite/oauth_providers#get
https://context.io/docs/lite/oauth_providers#id-get

type GetStatusCallbackURLResponse

type GetStatusCallbackURLResponse struct {
	StatusCallbackURL string `json:"status_callback_url,omitempty"`
	ResourceURL       string `json:"resource_url,omitempty"`
}

GetStatusCallbackURLResponse data struct

https://context.io/docs/app/status_callback_url#get

type GetUserEmailAccountsFolderMessageAttachmentsResponse

type GetUserEmailAccountsFolderMessageAttachmentsResponse struct {
	Type               string `json:"type,omitempty"`
	FileName           string `json:"file_name,omitempty"`
	BodySection        string `json:"body_section,omitempty"`
	ContentDisposition string `json:"content_disposition,omitempty"`
	EmailMessageID     string `json:"email_message_id,omitempty"`
	XAttachmentID      string `json:"x_attachment_id,omitempty"`

	Size         int `json:"size,omitempty"`
	AttachmentID int `json:"attachment_id,omitempty"`
}

GetUserEmailAccountsFolderMessageAttachmentsResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#get
https://context.io/docs/lite/users/email_accounts/folders/messages/attachments#id-get

type GetUserEmailAccountsFolderMessageBodyParams

type GetUserEmailAccountsFolderMessageBodyParams struct {
	// Optional:
	Delimiter string `json:"delimiter,omitempty"`
	Type      string `json:"type,omitempty"`
}

GetUserEmailAccountsFolderMessageBodyParams query values data struct. Optional: Delimiter, Type.

https://context.io/docs/lite/users/email_accounts/folders/messages/body#get

type GetUserEmailAccountsFolderMessageBodyResponse

type GetUserEmailAccountsFolderMessageBodyResponse struct {
	Type        string `json:"type,omitempty"`
	Charset     string `json:"charset,omitempty"`
	Content     string `json:"content,omitempty"`
	BodySection string `json:"body_section,omitempty"`
}

GetUserEmailAccountsFolderMessageBodyResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/body#get

type GetUserEmailAccountsFolderMessageFlagsResponse

type GetUserEmailAccountsFolderMessageFlagsResponse struct {
	ResourceURL string `json:"resource_url,omitempty"`

	Flags UserEmailAccountsFolderMessageFlags `json:"flags,omitempty"`
}

GetUserEmailAccountsFolderMessageFlagsResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/flags#get

type GetUserEmailAccountsFolderMessageHeadersParams

type GetUserEmailAccountsFolderMessageHeadersParams struct {
	// Optional:
	Delimiter string `json:"delimiter,omitempty"`
	Raw       bool   `json:"raw,omitempty"`
}

GetUserEmailAccountsFolderMessageHeadersParams query values data struct. Optional: Delimiter, Raw.

https://context.io/docs/lite/users/email_accounts/folders/messages/headers#get

type GetUserEmailAccountsFolderMessageHeadersResponse

type GetUserEmailAccountsFolderMessageHeadersResponse struct {
	ResourceURL string `json:"resource_url,omitempty"`

	Headers map[string][]string `json:"headers,omitempty"`
}

GetUserEmailAccountsFolderMessageHeadersResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/headers#get

type GetUserEmailAccountsFolderMessageParams

type GetUserEmailAccountsFolderMessageParams struct {
	// Optional:
	Delimiter    string `json:"delimiter,omitempty"`
	BodyType     string `json:"body_type,omitempty"`
	IncludeBody  bool   `json:"include_body,omitempty"`
	IncludeFlags bool   `json:"include_flags,omitempty"`

	// IncludeHeaders can be "0", "1", or "raw"
	IncludeHeaders string `json:"include_headers,omitempty"`

	// Optional for GetUserEmailAccountsFolderMessages (not used by GetUserEmailAccountFolderMessage):
	Limit  int `json:"limit,omitempty"`
	Offset int `json:"offset,omitempty"`
}

GetUserEmailAccountsFolderMessageParams query values data struct. Optional: Delimiter, IncludeBody, BodyType, IncludeHeaders, IncludeFlags, and (for GetUserEmailAccountsFolderMessages only) Limit, Offset.

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

type GetUserEmailAccountsFolderMessageRawResponse

type GetUserEmailAccountsFolderMessageRawResponse string

GetUserEmailAccountsFolderMessageRawResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/body#get

type GetUserEmailAccountsFoldersParams

type GetUserEmailAccountsFoldersParams struct {
	// Optional:
	IncludeNamesOnly bool `json:"include_names_only,omitempty"`
}

GetUserEmailAccountsFoldersParams query values data struct. Optional: IncludeNamesOnly.

https://context.io/docs/lite/users/email_accounts/folders#get

type GetUserEmailAccountsParams

type GetUserEmailAccountsParams struct {
	// Optional:
	Status   string `json:"status,omitempty"`
	StatusOK string `json:"status_ok,omitempty"`
}

GetUserEmailAccountsParams query values data struct. Optional: Status, StatusOK

https://context.io/docs/lite/users#get

type GetUsersEmailAccountFolderMessageAddresses

type GetUsersEmailAccountFolderMessageAddresses struct {
	From    []Address `json:"from,omitempty"`
	To      []Address `json:"to,omitempty"`
	Cc      []Address `json:"cc,omitempty"`
	Bcc     []Address `json:"bcc,omitempty"`
	Sender  []Address `json:"sender,omitempty"`
	ReplyTo []Address `json:"reply_to,omitempty"`
}

GetUsersEmailAccountFolderMessageAddresses data struct within GetUsersEmailAccountFolderMessagesResponse

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

func (*GetUsersEmailAccountFolderMessageAddresses) UnmarshalJSON

UnmarshalJSON is here because the empty state is an array in the json, and is a object/map when populated

type GetUsersEmailAccountFolderMessagesResponse

type GetUsersEmailAccountFolderMessagesResponse struct {
	EmailMessageID string `json:"email_message_id,omitempty"`
	Subject        string `json:"subject,omitempty"`
	MessageID      string `json:"message_id,omitempty"`
	InReplyTo      string `json:"in_reply_to,omitempty"`
	ResourceURL    string `json:"resource_url,omitempty"`

	Folders         []string `json:"folders,omitempty"`
	References      []string `json:"references,omitempty"`
	ReceivedHeaders []string `json:"received_headers,omitempty"`

	ListHeaders ListHeaders `json:"list_headers,omitempty"`

	Addresses GetUsersEmailAccountFolderMessageAddresses `json:"addresses,omitempty"`

	PersonInfo PersonInfo `json:"person_info,omitempty"`

	Attachments []UsersEmailAccountFolderMessageAttachment `json:"attachments,omitempty"`

	Bodies []UsersEmailAccountFolderMessageBody `json:"bodies,omitempty"`

	SentAt     int `json:"sent_at,omitempty"`
	ReceivedAt int `json:"received_at,omitempty"`
}

GetUsersEmailAccountFolderMessagesResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

type GetUsersEmailAccountFoldersResponse

type GetUsersEmailAccountFoldersResponse struct {
	Name             string `json:"name,omitempty"`
	SymbolicName     string `json:"symbolic_name,omitempty"`
	NbMessages       int    `json:"nb_messages,omitempty"`
	NbUnseenMessages int    `json:"nb_unseen_messages,omitempty"`
	Delimiter        string `json:"delimiter,omitempty"`
	ResourceURL      string `json:"resource_url,omitempty"`
}

GetUsersEmailAccountFoldersResponse data struct

https://context.io/docs/lite/users/email_accounts/folders#get
https://context.io/docs/lite/users/email_accounts/folders#id-get

type GetUsersEmailAccountsResponse

type GetUsersEmailAccountsResponse struct {
	Status             string `json:"status,omitempty"`
	ResourceURL        string `json:"resource_url,omitempty"`
	Type               string `json:"type,omitempty"`
	AuthenticationType string `json:"authentication_type,omitempty"`
	Server             string `json:"server,omitempty"`
	Label              string `json:"label,omitempty"`
	Username           string `json:"username,omitempty"`

	UseSSL bool `json:"use_ssl,omitempty"`

	Port int `json:"port,omitempty"`
}

GetUsersEmailAccountsResponse data struct

https://context.io/docs/lite/users/email_accounts#get
https://context.io/docs/lite/users/email_accounts#id-get

func FindEmailAccountMatching

func FindEmailAccountMatching(emailAccounts []GetUsersEmailAccountsResponse, email string) (GetUsersEmailAccountsResponse, error)

FindEmailAccountMatching searches an array of GetUsersEmailAccountsResponse's for the one that matches the provided email address, and returns it.

type GetUsersParams

type GetUsersParams struct {
	// Optional:
	Email    string `json:"email,omitempty"`
	Status   string `json:"status,omitempty"`
	StatusOK string `json:"status_ok,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
}

GetUsersParams query values data struct. Optional: Email, Status, StatusOK, Limit, Offset.

https://context.io/docs/lite/users#get

type GetUsersResponse

type GetUsersResponse struct {
	ID             string   `json:"id,omitempty"`
	Username       string   `json:"username,omitempty"`
	EmailAddresses []string `json:"email_addresses,omitempty"`
	FirstName      string   `json:"first_name,omitempty"`
	LastName       string   `json:"last_name,omitempty"`
	ResourceURL    string   `json:"resource_url,omitempty"`

	EmailAccounts []GetUsersEmailAccountsResponse `json:"email_accounts,omitempty"`

	Created         int `json:"created,omitempty"`
	Suspended       int `json:"suspended,omitempty"`
	PasswordExpired int `json:"password_expired,omitempty"`
}

GetUsersResponse data struct

https://context.io/docs/lite/users#get
https://context.io/docs/lite/users#id-get

func (GetUsersResponse) EmailAccountMatching

func (user GetUsersResponse) EmailAccountMatching(email string) (GetUsersEmailAccountsResponse, error)

EmailAccountMatching searches its EmailAccounts array for the provided email address, and returns the GetUsersEmailAccountsResponse Email Account that matches it.

type GetUsersWebhooksResponse

type GetUsersWebhooksResponse struct {
	CallbackURL        string `json:"callback_url,omitempty"`
	FailureNotifURL    string `json:"failure_notif_url,omitempty"`
	WebhookID          string `json:"webhook_id,omitempty"`
	FilterTo           string `json:"filter_to,omitempty"`
	FilterFrom         string `json:"filter_from,omitempty"`
	FilterCc           string `json:"filter_cc,omitempty"`
	FilterSubject      string `json:"filter_subject,omitempty"`
	FilterThread       string `json:"filter_thread,omitempty"`
	FilterNewImportant string `json:"filter_new_important,omitempty"`
	FilterFileName     string `json:"filter_file_name,omitempty"`
	FilterFolderAdded  string `json:"filter_folder_added,omitempty"`
	FilterToDomain     string `json:"filter_to_domain,omitempty"`
	FilterFromDomain   string `json:"filter_from_domain,omitempty"`
	BodyType           string `json:"body_type,omitempty"`
	ResourceURL        string `json:"resource_url,omitempty"`

	Active            bool `json:"active,omitempty"`
	Failure           bool `json:"failure,omitempty"`
	IncludeBody       bool `json:"include_body,omitempty"`
	IncludeHeader     bool `json:"include_header,omitempty"`
	ReceiveDrafts     bool `json:"receive_drafts,omitempty"`
	ReceiveAllChanges bool `json:"receive_all_changes,omitempty"`
	ReceiveHistorical bool `json:"receive_historical,omitempty"`
}

GetUsersWebhooksResponse data struct

https://context.io/docs/lite/users/webhooks#get
https://context.io/docs/lite/users/webhooks#id-get

type ListHeaders

type ListHeaders map[string]string

ListHeaders embedded data struct within GetUsersEmailAccountFolderMessagesResponse

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

func (*ListHeaders) UnmarshalJSON

func (m *ListHeaders) UnmarshalJSON(b []byte) error

UnmarshalJSON is here because the empty state is an array in the json, and is a object/map when populated

type ModifyEmailAccountResponse

type ModifyEmailAccountResponse struct {
	Success       bool   `json:"success,omitempty"`
	ResourceURL   string `json:"resource_url,omitempty"`
	FeedbackCode  string `json:"feedback_code,omitempty"`
	ConnectionLog string `json:"connection_log,omitempty"`
}

ModifyEmailAccountResponse data struct

https://context.io/docs/lite/users/email_accounts#id-post

type ModifyUserEmailAccountParams

type ModifyUserEmailAccountParams struct {
	// Optional:
	Status               string `json:"status,omitempty"`
	Password             string `json:"password,omitempty"`
	ProviderRefreshToken string `json:"provider_refresh_token,omitempty"`
	ProviderConsumerKey  string `json:"provider_consumer_key,omitempty"`
	StatusCallbackURL    string `json:"status_callback_url,omitempty"`
	ForceStatusCheck     bool   `json:"force_status_check,omitempty"`
}

ModifyUserEmailAccountParams form values data struct. formValues optionally may contain Status, ForceStatusCheck, Password, ProviderRefreshToken, ProviderConsumerKey, StatusCallbackURL

https://context.io/docs/lite/users/email_accounts#id-post

type ModifyUserParams

type ModifyUserParams struct {
	// Requires:
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

ModifyUserParams form values data struct. Requires: FirstName, LastName.

https://context.io/docs/lite/users#id-post

type ModifyUserResponse

type ModifyUserResponse struct {
	Success     bool   `json:"success,omitempty"`
	ResourceURL string `json:"resource_url,omitempty"`
}

ModifyUserResponse data struct

https://context.io/docs/lite/users#id-post

type ModifyUserWebhookParams

type ModifyUserWebhookParams struct {
	// Required:
	Active bool `json:"active"`
}

ModifyUserWebhookParams form values data struct. formValues requires Active

https://context.io/docs/lite/users/webhooks#id-post

type ModifyWebhookResponse

type ModifyWebhookResponse struct {
	ResourceURL string `json:"resource_url,omitempty"`

	Success bool `json:"success,omitempty"`
}

ModifyWebhookResponse data struct

https://context.io/docs/lite/users/webhooks#id-post

type MoveUserEmailAccountFolderMessageParams

type MoveUserEmailAccountFolderMessageParams struct {
	// Required:
	NewFolderID string `json:"new_folder_id"`
	// Optional:
	Delimiter string `json:"delimiter,omitempty"`
}

MoveUserEmailAccountFolderMessageParams form values data struct. Requires: NewFolderID, and may optionally contain Delimiter.

https://context.io/docs/lite/users/email_accounts/folders/messages#id-put

type MoveUserEmailAccountFolderMessageResponse

type MoveUserEmailAccountFolderMessageResponse struct {
	Success bool `json:"success,omitempty"`
}

MoveUserEmailAccountFolderMessageResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages#id-put

type PersonInfo

type PersonInfo map[string]map[string]string

PersonInfo embedded data struct within GetUsersEmailAccountFolderMessagesResponse and WebhookMessageData

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

func (*PersonInfo) UnmarshalJSON

func (m *PersonInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON is here because the empty state is an array in the json, and is a object/map when populated

type RequestError

type RequestError struct {
	Err error
	ErrorMetaData
}

RequestError is the error type returned by DoFormRequest and all cio api calls

func (RequestError) Cause

func (e RequestError) Cause() error

Cause returns the cause of any wrapped errors, or just the base error if no wrapped error. Can use with github.com/pkg/errors

func (RequestError) Error

func (e RequestError) Error() string

Error returns the Error string, any Wrapped Causes, and any StatusCode, Payload, Method, and URL that were set

func (RequestError) ErrorMethod

func (e RequestError) ErrorMethod() string

ErrorMethod returns the RequestError's Method (ex: GET, POST, etc)

func (RequestError) ErrorPayload

func (e RequestError) ErrorPayload() string

ErrorPayload returns the RequestError's payload, if present

func (RequestError) ErrorStatusCode

func (e RequestError) ErrorStatusCode() int

ErrorStatusCode returns the RequestError's StatusCode (ex: 200 for OK, 0 if no status code)

func (RequestError) ErrorURL

func (e RequestError) ErrorURL() string

ErrorURL returns the RequestError's URL

func (RequestError) Format

func (e RequestError) Format(s fmt.State, verb rune)

Format prints out the error, any causes, a stacktrace, and the other fields in the struct

func (RequestError) MarshalJSON

func (e RequestError) MarshalJSON() ([]byte, error)

MarshalJSON allows RequestError to implement json.Marshaler (for use with logging in json)

func (RequestError) String

func (e RequestError) String() string

String returns the same as Error()

func (*RequestError) UnmarshalJSON

func (e *RequestError) UnmarshalJSON(data []byte) error

UnmarshalJSON allows RequestError to implement json.Unmarshaler (for completeness since RequestError implements Marshaler).

Note that if the json property is possibly null, you must unmarshal to *RequestError, as the cioutil.UnmarshalJSON helper does.
Use of this loses the ability to unwrap errors with errors.Cause() or get the original stacktrace

type StatusCallback

type StatusCallback struct {
	AccountID      string `json:"account_id,omitempty"`
	UserID         string `json:"user_id,omitempty"`
	ServerLabel    string `json:"server_label,omitempty"`
	EmailAccount   string `json:"email_account,omitempty"`
	Failure        string `json:"failure,omitempty"`
	FailureMessage string `json:"failure_message,omitempty"`

	Token     string `json:"token,omitempty" valid:"required"`
	Signature string `json:"signature,omitempty" valid:"required"`

	Timestamp int `json:"timestamp,omitempty" valid:"required"`
}

StatusCallback data struct that will be received from CIO when a user's status changes

https://context.io/docs/lite/users/email_accounts#post
https://context.io/docs/lite/users/email_accounts#id-post

type UserEmailAccountsFolderMessageFlags

type UserEmailAccountsFolderMessageFlags struct {
	Read     bool `json:"read,omitempty"`
	Answered bool `json:"answered,omitempty"`
	Flagged  bool `json:"flagged,omitempty"`
	Draft    bool `json:"draft,omitempty"`
}

UserEmailAccountsFolderMessageFlags embedded data struct within GetUserEmailAccountsFolderMessageFlagsResponse

https://context.io/docs/lite/users/email_accounts/folders/messages/flags#get

type UserEmailAccountsFolderMessageReadResponse

type UserEmailAccountsFolderMessageReadResponse struct {
	Success bool `json:"success,omitempty"`
}

UserEmailAccountsFolderMessageReadResponse data struct

https://context.io/docs/lite/users/email_accounts/folders/messages/read#post
https://context.io/docs/lite/users/email_accounts/folders/messages/read#delete

type UsersEmailAccountFolderMessageAttachment

type UsersEmailAccountFolderMessageAttachment struct {
	Type               string `json:"type,omitempty"`
	FileName           string `json:"file_name,omitempty"`
	BodySection        string `json:"body_section,omitempty"`
	ContentDisposition string `json:"content_disposition,omitempty"`
	EmailMessageID     string `json:"email_message_id,omitempty"`

	Size         int `json:"size,omitempty"`
	AttachmentID int `json:"attachment_id,omitempty"`
}

UsersEmailAccountFolderMessageAttachment embedded data struct within GetUsersEmailAccountFolderMessagesResponse

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

type UsersEmailAccountFolderMessageBody

type UsersEmailAccountFolderMessageBody struct {
	BodySection string `json:"body_section,omitempty"`
	Type        string `json:"type,omitempty"`
	Encoding    string `json:"encoding,omitempty"`

	Size int `json:"size,omitempty"`
}

UsersEmailAccountFolderMessageBody embedded data struct within GetUsersEmailAccountFolderMessagesResponse

https://context.io/docs/lite/users/email_accounts/folders/messages#get
https://context.io/docs/lite/users/email_accounts/folders/messages#id-get

type WebhookBody

type WebhookBody struct {
	Type        string `json:"type,omitempty"`
	Charset     string `json:"charset,omitempty"`
	BodySection string `json:"body_section,omitempty"`
	Content     string `json:"content,omitempty"`
}

WebhookBody embedded data struct within WebhookMessageData

https://context.io/docs/lite/users/webhooks#callbacks

type WebhookCallback

type WebhookCallback struct {
	AccountID string `json:"account_id,omitempty"`
	WebhookID string `json:"webhook_id,omitempty"`
	Token     string `json:"token,omitempty" valid:"required"`
	Signature string `json:"signature,omitempty" valid:"required"`

	Timestamp int `json:"timestamp,omitempty" valid:"required"`

	// Data is an error message that gives more information about the cause of failure
	Data string `json:"data,omitempty"`

	MessageData WebhookMessageData `json:"message_data,omitempty"`
}

WebhookCallback data struct that will be received from CIO

https://context.io/docs/lite/users/webhooks#callbacks

type WebhookMessageData

type WebhookMessageData struct {
	MessageID      string `json:"message_id,omitempty"`
	EmailMessageID string `json:"email_message_id,omitempty"`
	Subject        string `json:"subject,omitempty"`

	References []string `json:"references,omitempty"`
	Folders    []string `json:"folders,omitempty"`

	Date         int `json:"date,omitempty"`
	DateReceived int `json:"date_received,omitempty"`

	ID uint64 `json:"id,omitempty"` // Unique message identifier or body hash

	Addresses WebhookMessageDataAddresses `json:"addresses,omitempty"`

	PersonInfo PersonInfo `json:"person_info,omitempty"`

	Flags WebhookMessageDataFlags `json:"flags,omitempty"`

	Sources []WebhookMessageDataAccount `json:"sources,omitempty"`

	EmailAccounts []WebhookMessageDataAccount `json:"email_accounts,omitempty"`

	Files []WebhookMessageDataFile `json:"files,omitempty"`

	Bodies []WebhookBody `json:"bodies,omitempty"`

	Headers mail.Header `json:"headers,omitempty"`
}

WebhookMessageData data struct within WebhookCallback

https://context.io/docs/lite/users/webhooks#callbacks

type WebhookMessageDataAccount

type WebhookMessageDataAccount struct {
	Label       string `json:"label,omitempty"`
	Folder      string `json:"folder,omitempty"`
	UID         int    `json:"uid,omitempty"`
	ResourceURL string `json:"resource_url,omitempty"`
}

WebhookMessageDataAccount embedded data struct within WebhookMessageData

https://context.io/docs/lite/users/webhooks#callbacks

type WebhookMessageDataAddresses

type WebhookMessageDataAddresses struct {
	From       Address   `json:"from,omitempty"`
	To         []Address `json:"to,omitempty"`
	Cc         []Address `json:"cc,omitempty"`
	Bcc        []Address `json:"bcc,omitempty"`
	Sender     []Address `json:"sender,omitempty"`
	ReplyTo    []Address `json:"reply_to,omitempty"`
	ReturnPath []Address `json:"return_path,omitempty"`
}

WebhookMessageDataAddresses struct within WebhookMessageData

https://context.io/docs/lite/users/webhooks#callbacks

func (*WebhookMessageDataAddresses) UnmarshalJSON

func (m *WebhookMessageDataAddresses) UnmarshalJSON(b []byte) error

UnmarshalJSON is here because the empty state is an array in the json, and is a object/map when populated

type WebhookMessageDataFile

type WebhookMessageDataFile struct {
	ContentID          string `json:"content_id,omitempty"`
	Type               string `json:"type,omitempty"`
	FileName           string `json:"file_name,omitempty"`
	BodySection        string `json:"body_section,omitempty"`
	ContentDisposition string `json:"content_disposition,omitempty"`
	MainFileName       string `json:"main_file_name,omitempty"`

	XAttachmentID interface{} `json:"x_attachment_id,omitempty"` // appears to be a single string and also an array of strings

	FileNameStructure [][]string `json:"file_name_structure,omitempty"`

	AttachmentID int `json:"attachment_id,omitempty"`
	Size         int `json:"size,omitempty"`

	IsEmbedded bool `json:"is_embedded,omitempty"`
}

WebhookMessageDataFile embedded data struct within WebhookMessageData

https://context.io/docs/lite/users/webhooks#callbacks

type WebhookMessageDataFlags

type WebhookMessageDataFlags struct {
	Flagged  bool `json:"flagged,omitempty"`
	Answered bool `json:"answered,omitempty"`
	Draft    bool `json:"draft,omitempty"`
	Seen     bool `json:"seen,omitempty"`
}

WebhookMessageDataFlags embedded data struct within WebhookMessageData

https://context.io/docs/lite/users/webhooks#callbacks

Jump to

Keyboard shortcuts

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