api

package
v0.0.0-...-b10e7cb Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: BSD-3-Clause Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// iota+1 is used to distinguish from one of this to a just initialized int
	// Constants used to know which kind of state the event is in
	Created = iota + 1
	Updated
	Deleted

	// Different kinds of accounts used
	GOOGLE  = 1
	OUTLOOK = 2
)

Variables

This section is empty.

Functions

func GetChangeType

func GetChangeType(onCloud bool, onDB bool) int

Function to know in which state the event is

Types

type AccountManager

type AccountManager interface {
	// Method to refresh the access to the account
	Refresh() error

	// Method that retrieves all calendars from account
	GetAllCalendars() ([]CalendarManager, error)
	// Method that retrieves one calendar given an ID
	GetCalendar(string) (CalendarManager, error)
	// Method that returns the principal calendar from the account
	GetPrimaryCalendar() (CalendarManager, error)
	// Method that format the authorization request
	AuthorizationRequest() string
	// Method that returns the mail associated with the account
	Mail() string

	// Method that sets which kind of account is
	SetKind(int)
	// Method that returns the token type
	GetTokenType() string
	// Method that returns the refresh token
	GetRefreshToken() string
	// Method that returns the kind of the account
	GetKind() int
	// Method that returns the access token
	GetAccessToken() string

	// Method that returns the internal ID given to the account on DB
	GetInternalID() int
	// Method that sets all synced calendars associated with the account
	SetCalendars([]CalendarManager)
	// Method that returns all synced calendars associated with the account
	GetSyncCalendars() []CalendarManager
}

Interface for account that defines the needed method to work inside the project

type CalendarManager

type CalendarManager interface {
	// Method that sets the account which the calendar belongs
	SetAccount(AccountManager) error
	// Method that sets the synced calendars
	SetCalendars([]CalendarManager)
	// Method that returns the synced calendar
	GetCalendars() []CalendarManager

	// Method that updates the calendar
	Update() error
	// Method that deletes the calendar
	Delete() error
	// Method that creates the calendar
	Create() error

	// Method that returns all events inside the calendar
	GetAllEvents() ([]EventManager, error)
	// Method that returns a single event given the ID
	GetEvent(string) (EventManager, error)

	// Method that returns the ID of the calendar
	GetID() string
	// Method that returns the ID formatted for a query request
	GetQueryID() string
	// Method that returns the name of the calendar
	GetName() string
	// Method that returns the account
	GetAccount() AccountManager
	// Method that returns the internal UUID given to the calendar
	GetUUID() string
	// Method that sets the internal UUID for the calendar
	SetUUID(string)
	// Method that creates an empty event
	CreateEmptyEvent(string) EventManager
}

Interface for calendar that defines the needed method to work inside the project

type EventManager

type EventManager interface {
	// Method that sets the calendar which have the event
	SetCalendar(CalendarManager) error
	// Method that sets the events syncing with this
	SetRelations([]EventManager)

	// Method that creates the event
	Create() error
	// Method that updates the event
	Update() error
	// Method that deletes the event
	Delete() error
	// Method that returns the ID of the event
	GetID() string

	// Method that returns the calendar which have this event
	GetCalendar() CalendarManager

	// Method that returns the syncing events with this
	GetRelations() []EventManager

	// Method that returns the last update date
	GetUpdatedAt() (time.Time, error)
	// Method that returns the state of the event
	GetState() int
	// Method that sets the state of the event
	SetState(int)
	// Method that checks if the event can try sync again
	CanProcessAgain() bool
	// Method that increments the number of failed attempts to sync
	IncrementBackoff()
	// Method that sets the internal ID generated on db
	SetInternalID(int)
	// Method that gets the internal ID of the event
	GetInternalID() int
	// contains filtered or unexported methods
}

Interface for event that defines the needed method to work inside the project

type GoogleAccount

type GoogleAccount struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TokenID      string `json:"id_token"`
	Email        string `json:"-"`
	Kind         int    `json:"-"`
	InternID     int    `json:"-"`
	// contains filtered or unexported fields
}

func NewGoogleAccount

func NewGoogleAccount(contents []byte) (a *GoogleAccount, err error)

Function that parses the JSON of the request to a GoogleAccount

func RetrieveGoogleAccount

func RetrieveGoogleAccount(tokenType string, refreshToken string, email string, kind int, accessToken string) (a *GoogleAccount)

Function that returns a GoogleAccount given specific info

func (*GoogleAccount) AuthorizationRequest

func (a *GoogleAccount) AuthorizationRequest() string

Method that format the authorization request

func (*GoogleAccount) GetAccessToken

func (a *GoogleAccount) GetAccessToken() string

Method that returns the access token

func (*GoogleAccount) GetAllCalendars

func (a *GoogleAccount) GetAllCalendars() (calendars []CalendarManager, err error)

Method that retrieves all calendars from account

GET https://www.googleapis.com/calendar/v3/users/me/calendarList

func (*GoogleAccount) GetCalendar

func (a *GoogleAccount) GetCalendar(calendarID string) (calendar CalendarManager, err error)

Method that retrieves one calendar given an ID

GET https://www.googleapis.com/calendar/v3/users/me/calendarList/{calendarID}

func (*GoogleAccount) GetInternalID

func (a *GoogleAccount) GetInternalID() int

Method that returns the internal ID given to the account on DB

func (*GoogleAccount) GetKind

func (a *GoogleAccount) GetKind() int

Method that returns the kind of the account

func (*GoogleAccount) GetPrimaryCalendar

func (a *GoogleAccount) GetPrimaryCalendar() (calendar CalendarManager, err error)

Method that returns the principal calendar from the account

GET https://www.googleapis.com/calendar/v3/calendars/primary

func (*GoogleAccount) GetRefreshToken

func (a *GoogleAccount) GetRefreshToken() string

Method that returns the refresh token

func (*GoogleAccount) GetSyncCalendars

func (a *GoogleAccount) GetSyncCalendars() []CalendarManager

Method that returns all synced calendars associated with the account

func (*GoogleAccount) GetTokenType

func (a *GoogleAccount) GetTokenType() string

Method that returns the token type

func (*GoogleAccount) Mail

func (a *GoogleAccount) Mail() string

Method that returns the mail associated with the account

func (*GoogleAccount) Refresh

func (a *GoogleAccount) Refresh() (err error)

Method to refresh the access to the google account

func (*GoogleAccount) SetCalendars

func (a *GoogleAccount) SetCalendars(calendars []CalendarManager)

Method that sets all synced calendars associated with the account

func (*GoogleAccount) SetKind

func (a *GoogleAccount) SetKind(kind int)

Method that sets which kind of account is

type GoogleAttachment

type GoogleAttachment struct {
	FileURL  string `json:"fileUrl,omitempty"`
	Title    string `json:"title,omitempty"`
	MimeType string `json:"mimeType,omitempty"`
	IconLink string `json:"iconLink,omitempty"`
	FileID   string `json:"fileId,omitempty"`
}

type GoogleCalendar

type GoogleCalendar struct {

	//From CalendarLIST resource
	ID              string `json:"id"`
	Name            string `json:"summary" convert:"Name"`
	Description     string `json:"description,omitempty"`
	Location        string `json:"location,omitempty"`
	TmeZone         string `json:"timeZone,omitempty"`
	SummaryOverride string `json:"summaryOverride,omitempty"`
	ColorId         string `json:"colorId,omitempty"`
	BackgroundColor string `json:"backgroundColor,omitempty"`
	ForegroundColor string `json:"foregroundColor,omitempty"`
	Hidden          bool   `json:"hidden,omitempty"`
	Selected        bool   `json:"selected,omitempty"`
	// Only valid accessRoles with 'writer' or 'owner'
	AccessRole                 string           `json:"accessRole,omitempty"`
	DefaultReminders           []GoogleReminder `json:"defaultReminders,omitempty"`
	Primary                    bool             `json:"primary,omitempty"`
	Deleted                    bool             `json:"deleted,omitempty"`
	GoogleConferenceProperties `json:"conferenceProperties,omitempty"`
	GoogleNotificationSetting  `json:"notificationSettings,omitempty"`
	// contains filtered or unexported fields
}

func RetrieveGoogleCalendar

func RetrieveGoogleCalendar(ID string, uid string, account *GoogleAccount) *GoogleCalendar

Method that returns a GoogleCalendar given specific info

func (*GoogleCalendar) Create

func (calendar *GoogleCalendar) Create() (err error)

Method that creates the calendar

POST https://www.googleapis.com/calendar/v3/calendars

func (*GoogleCalendar) CreateEmptyEvent

func (calendar *GoogleCalendar) CreateEmptyEvent(ID string) EventManager

Method that creates an empty event

func (*GoogleCalendar) Delete

func (calendar *GoogleCalendar) Delete() (err error)

Method that deletes the calendar

DELETE https://www.googleapis.com/calendar/v3/users/me/calendarList/{calendarId}

func (*GoogleCalendar) GetAccount

func (calendar *GoogleCalendar) GetAccount() AccountManager

Method that returns the account

func (*GoogleCalendar) GetAllEvents

func (calendar *GoogleCalendar) GetAllEvents() (events []EventManager, err error)

Method that returns all events inside the calendar

GET https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events

func (*GoogleCalendar) GetCalendars

func (calendar *GoogleCalendar) GetCalendars() []CalendarManager

Method that returns the synced calendar

func (*GoogleCalendar) GetEvent

func (calendar *GoogleCalendar) GetEvent(eventID string) (event EventManager, err error)

Method that returns a single event given the ID

GET https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events/{eventID}

func (*GoogleCalendar) GetID

func (calendar *GoogleCalendar) GetID() string

Method that returns the ID of the calendar

func (*GoogleCalendar) GetName

func (calendar *GoogleCalendar) GetName() string

Method that returns the name of the calendar

func (*GoogleCalendar) GetQueryID

func (calendar *GoogleCalendar) GetQueryID() string

Method that returns the ID formatted for a query request

func (*GoogleCalendar) GetUUID

func (calendar *GoogleCalendar) GetUUID() string

Method that returns the internal UUID given to the calendar

func (*GoogleCalendar) SetAccount

func (calendar *GoogleCalendar) SetAccount(a AccountManager) (err error)

Method that sets the account which the calendar belongs

func (*GoogleCalendar) SetCalendars

func (calendar *GoogleCalendar) SetCalendars(calendars []CalendarManager)

Method that sets the synced calendars

func (*GoogleCalendar) SetUUID

func (calendar *GoogleCalendar) SetUUID(id string)

Method that sets the internal UUID for the calendar

func (*GoogleCalendar) Update

func (calendar *GoogleCalendar) Update() (err error)

Method that updates the calendar

PUT https://www.googleapis.com/calendar/v3/users/me/calendarList/{calendarId}

type GoogleCalendarListResponse

type GoogleCalendarListResponse struct {
	Kind          string            `json:"kind"`
	Etag          string            `json:"etag"`
	NextPageToken string            `json:"nextPageToken"`
	NextSyncToken string            `json:"nextSyncToken"`
	Calendars     []*GoogleCalendar `json:"items"`
}

type GoogleConcreteError

type GoogleConcreteError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type GoogleConferenceData

type GoogleConferenceData struct {
	CreateRequest *GoogleCreateRequest `json:"createRequest,omitempty"`
	EntryPoints   []GoogleEntryPoint   `json:"entryPoints,omitempty"`
	//ConferenceSolution ConferenceSolution `json:"conferenceSolution"`
	ConferenceID string `json:"conferenceId,omitempty"`
	Signature    string `json:"signature,omitempty"`
}

type GoogleConferenceProperties

type GoogleConferenceProperties struct {
	AllowedConferenceSolutionTypes []string `json:"allowedConferenceSolutionTypes,omitempty"`
}

type GoogleCreateRequest

type GoogleCreateRequest struct {
	RequestID             string             `json:"requestId,omitempty"`
	ConferenceSolutionKey *GoogleSolutionKey `json:"conferenceSolutionKey,omitempty"`
	Status                *GoogleStatus      `json:"status,omitempty"`
}

type GoogleEntryPoint

type GoogleEntryPoint struct {
	EntryPointType string `json:"entryPointType,omitempty"`
	URI            string `json:"uri,omitempty"`
	Label          string `json:"label,omitempty"`
	Pin            string `json:"pin,omitempty"`
	AccessCode     string `json:"accessCode,omitempty"`
	MeetingCode    string `json:"meetingCode,omitempty"`
	Passcode       string `json:"passcode,omitempty"`
	Password       string `json:"password,omitempty"`
}

type GoogleError

type GoogleError struct {
	GoogleConcreteError `json:"error,omitempty"`
}

func (GoogleError) Error

func (err GoogleError) Error() string

type GoogleEvent

type GoogleEvent struct {
	ID string `json:"id"`

	Subject     string      `json:"summary,omitempty" convert:"Subject"`
	Description string      `json:"description,omitempty" convert:"Description"`
	Start       *GoogleTime `json:"start,omitempty"convert:"start"`
	End         *GoogleTime `json:"end,omitempty"convert:"end"`
	IsAllDay    bool        `json:"-"convert:"allDay"`

	Status             string           `json:"status,omitempty"`
	ColorID            string           `json:"colorId,omitempty"`
	EndTimeUnspecified bool             `json:"endTimeUnspecified,omitempty"`
	Recurrences        GoogleRecurrence `json:"recurrence,omitempty"`
	RecurringEventId   string           `json:"recurringEventId,omitempty"`
	Transparency       string           `json:"transparency,omitempty"`
	Visibility         string           `json:"visibility,omitempty"`
	ICalUID            string           `json:"iCalUID,omitempty"`
	Sequence           int32            `json:"sequence,omitempty"`
	HangoutLink        string           `json:"hangoutLink,omitempty"`
	Locked             bool             `json:"locked,omitempty"`

	OriginalStartTime *GoogleTime           `json:"originalStartTime,omitempty"`
	Attendees         []GooglePerson        `json:"attendees,omitempty"`
	Gadget            *GoogleGadget         `json:"gadget,omitempty"`
	ConferenceData    *GoogleConferenceData `json:"conferenceData,omitempty"`
	Reminders         *GoogleEventReminder  `json:"reminders,omitempty"`
	Source            *GoogleSource         `json:"source,omitempty"`
	Attachments       []GoogleAttachment    `json:"attachments,omitempty"`
	Organizer         *GooglePerson         `json:"organizer,omitempty"`

	//Not to sync
	Link                    string `json:"htmlLink,omitempty"`
	Created                 string `json:"created,omitempty"`
	Updated                 string `json:"updated,omitempty"`
	Location                string `json:"location,omitempty"`
	AttendeesOmitted        bool   `json:"attendeesOmitted,omitempty"`
	AnyoneCanAddSelf        bool   `json:"anyoneCanAddSelf,omitempty"`
	GuestsCanInviteOthers   bool   `json:"guestsCanInviteOthers,omitempty"`
	GuestsCanModify         bool   `json:"guestsCanModify,omitempty"`
	GuestsCanSeeOtherGuests bool   `json:"guestsCanSeeOtherGuests,omitempty"`
	PrivateCopy             bool   `json:"privateCopy,omitempty"`
	// contains filtered or unexported fields
}

func (*GoogleEvent) CanProcessAgain

func (event *GoogleEvent) CanProcessAgain() bool

Method that checks if the event can try sync again

func (*GoogleEvent) Create

func (event *GoogleEvent) Create() (err error)

Method that creates the event

POST https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events

func (*GoogleEvent) Delete

func (event *GoogleEvent) Delete() (err error)

Method that deletes the event

DELETE https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events/{eventID}

func (*GoogleEvent) GetCalendar

func (event *GoogleEvent) GetCalendar() CalendarManager

Method that returns the calendar which have this event

func (*GoogleEvent) GetID

func (event *GoogleEvent) GetID() string

Method that returns the ID of the event

func (*GoogleEvent) GetInternalID

func (event *GoogleEvent) GetInternalID() int

Method that gets the internal ID of the event

func (*GoogleEvent) GetRelations

func (event *GoogleEvent) GetRelations() []EventManager

Method that returns the syncing events with this

func (*GoogleEvent) GetState

func (event *GoogleEvent) GetState() int

Method that returns the state of the event

func (*GoogleEvent) GetUpdatedAt

func (event *GoogleEvent) GetUpdatedAt() (t time.Time, err error)

Method that returns the last update date

func (*GoogleEvent) IncrementBackoff

func (event *GoogleEvent) IncrementBackoff()

Method that increments the number of failed attempts to sync

func (*GoogleEvent) SetCalendar

func (event *GoogleEvent) SetCalendar(calendar CalendarManager) (err error)

Method that returns the calendar which have this event

func (*GoogleEvent) SetInternalID

func (event *GoogleEvent) SetInternalID(internalID int)

Method that sets the internal ID generated on db

func (*GoogleEvent) SetRelations

func (event *GoogleEvent) SetRelations(relations []EventManager)

Method that sets the events syncing with this

func (*GoogleEvent) SetState

func (event *GoogleEvent) SetState(stateInformed int)

Method that sets the state of the event

func (*GoogleEvent) Update

func (event *GoogleEvent) Update() (err error)

Method that updates the event

PUT https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events/{eventID}

type GoogleEventList

type GoogleEventList struct {
	Events []*GoogleEvent `json:"items"`
}

type GoogleEventReminder

type GoogleEventReminder struct {
	UseDefault bool             `json:"useDefault,omitempty"`
	Overrides  []GoogleReminder `json:"overrides,omitempty"`
}

type GoogleGadget

type GoogleGadget struct {
	Type     string `json:"type,omitempty"`
	Title    string `json:"title,omitempty"`
	Link     string `json:"link,omitempty"`
	IconLink string `json:"iconLink,omitempty"`
	Width    int32  `json:"width,omitempty"`
	Height   int32  `json:"height,omitempty"`
	Display  string `json:"display,omitempty"`
}

type GoogleNotification

type GoogleNotification struct {
	Type   string `json:"type,omitempty"`
	Method string `json:"method,omitempty"`
}

type GoogleNotificationSetting

type GoogleNotificationSetting struct {
	Notifications []GoogleNotification `json:"notifications,omitempty"`
}

type GooglePerson

type GooglePerson struct {
	ID               string `json:"id,omitempty"`
	Email            string `json:"email,omitempty"`
	Name             string `json:"displayName,omitempty"`
	Self             bool   `json:"self,omitempty"`
	Organizer        bool   `json:"organizer,omitempty"`
	Resource         bool   `json:"resource,omitempty"`
	Optional         bool   `json:"optional,omitempty"`
	ResponseStatus   string `json:"responseStatus,omitempty"`
	Comment          string `json:"comment,omitempty"`
	AdditionalGuests int32  `json:"additionalGuests,omitempty"`
}

type GoogleRecurrence

type GoogleRecurrence []string

func (*GoogleRecurrence) MarshalJSON

func (recurrences *GoogleRecurrence) MarshalJSON() ([]byte, error)

Method that converts from a JSON to a GoogleRecurrence struct. This method implements Unmarshaler interface

func (*GoogleRecurrence) UnmarshalJSON

func (recurrences *GoogleRecurrence) UnmarshalJSON(b []byte) error

Method that converts from GoogleRecurrence struct to a json. This method implements Marshaler interface

type GoogleReminder

type GoogleReminder struct {
	Method  string `json:"method,omitempty"`
	Minutes int32  `json:"minutes,omitempty"`
}

type GoogleSolutionKey

type GoogleSolutionKey struct {
	Type string `json:"type,omitempty"`
}

type GoogleSource

type GoogleSource struct {
	URL   string `json:"url,omitempty"`
	Title string `json:"title,omitempty"`
}

type GoogleStatus

type GoogleStatus struct {
	Code string `json:"statusCode,omitempty"`
}

type GoogleSubscription

type GoogleSubscription struct {
	ID              string    `json:"id"`
	Type            string    `json:"type,omitempty"`
	NotificationURL string    `json:"address,omitempty"`
	ResourceID      string    `json:"resourceId,omitempty"`
	ResourceURI     string    `json:"resourceUri,omitempty"`
	Token           string    `json:"token,omitempty"`
	Expiration      int64     `json:"expiration,omitempty,string"`
	Uuid            uuid.UUID `json:"-"`
	// contains filtered or unexported fields
}

func NewGoogleSubscription

func NewGoogleSubscription(ID string) (subscription *GoogleSubscription)

Function that creates a new GoogleSubscription given specific info

func RetrieveGoogleSubscription

func RetrieveGoogleSubscription(ID string, uid uuid.UUID, calendar CalendarManager, resourceID string) (subscription *GoogleSubscription)

Function that returns a GoogleSubscription given specific info

func (*GoogleSubscription) Delete

func (subscription *GoogleSubscription) Delete() (err error)

Method that deletes subscription

POST https://www.googleapis.com/calendar/v3/channels/stop

func (*GoogleSubscription) GetAccount

func (subscription *GoogleSubscription) GetAccount() AccountManager

Method that returns the account of the subscription

func (*GoogleSubscription) GetExpirationDate

func (subscription *GoogleSubscription) GetExpirationDate() time.Time

Method that returns the expiration date of the subscription

func (*GoogleSubscription) GetID

func (subscription *GoogleSubscription) GetID() string

Method that returns the ID of the subscription

func (*GoogleSubscription) GetResourceID

func (subscription *GoogleSubscription) GetResourceID() string

Method that returns the resourceID of the subscription

func (*GoogleSubscription) GetType

func (subscription *GoogleSubscription) GetType() string

Method that returns the type of the subscription

func (*GoogleSubscription) GetUUID

func (subscription *GoogleSubscription) GetUUID() uuid.UUID

Method that returns the UUID of the subscription

func (*GoogleSubscription) Renew

func (subscription *GoogleSubscription) Renew() (err error)

Method that renews subscription. Google does not let a subscription be renewed so a new subscription must be request

func (*GoogleSubscription) Subscribe

func (subscription *GoogleSubscription) Subscribe(calendar CalendarManager) (err error)

Method that subscribes calendar for notifications

POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch

type GoogleTime

type GoogleTime struct {
	Date time.Time `json:"date,omitempty"`
	//time.RFC3339 gives TimeZone inside string
	DateTime time.Time `json:"dateTime,omitempty"convert:"dateTime"`
	//Ignore TimeZone as the json returns the original TimeZon
	//Although it is always asked in UTC it may cause confusion
	TimeZone *time.Location `json:"-"convert:"timeZone"`
	IsAllDay bool           `json:"-" convert:"isAllDay"`
}

func (*GoogleTime) Convert

func (*GoogleTime) Convert(m interface{}, tag string, opts string) (convert.Converter, error)

Method that converts an interface{} ti a GoogleTime struct. This method implements Converter interface

func (*GoogleTime) Deconvert

func (date *GoogleTime) Deconvert() interface{}

Method that converts a GoogleTime struct to a interface{}. This method implements Deconverter interface

func (*GoogleTime) MarshalJSON

func (date *GoogleTime) MarshalJSON() ([]byte, error)

Method that converts from GoogleTime struct to a json. This method implements Marshaler interface

func (*GoogleTime) UnmarshalJSON

func (date *GoogleTime) UnmarshalJSON(b []byte) error

Method that converts from a JSON to a GoogleTime struct. This method implements Unmarshaler interface

type OutlookAccount

type OutlookAccount struct {
	TokenType         string `json:"token_type"`
	ExpiresIn         int    `json:"expires_in"`
	AccessToken       string `json:"access_token"`
	RefreshToken      string `json:"refresh_token"`
	TokenID           string `json:"id_token"`
	AnchorMailbox     string `json:"-"`
	PreferredUsername bool   `json:"-"`
	Kind              int    `json:"-"`
	InternID          int    `json:"-"`
	// contains filtered or unexported fields
}

func NewOutlookAccount

func NewOutlookAccount(contents []byte) (a *OutlookAccount, err error)

Function that parses the JSON of the request to a OutlookAccount

func RetrieveOutlookAccount

func RetrieveOutlookAccount(tokenType string, refreshToken string, email string, kind int, accessToken string) (a *OutlookAccount)

Function that returns a OutlookAccount given specific info

func (*OutlookAccount) AuthorizationRequest

func (a *OutlookAccount) AuthorizationRequest() (auth string)

Method that format the authorization request

func (*OutlookAccount) GetAccessToken

func (a *OutlookAccount) GetAccessToken() string

Method that returns the access token

func (*OutlookAccount) GetAllCalendars

func (a *OutlookAccount) GetAllCalendars() (calendars []CalendarManager, err error)

Method that retrieves all calendars from account

GET https://outlook.office.com/api/v2.0/me/calendars

func (*OutlookAccount) GetCalendar

func (a *OutlookAccount) GetCalendar(calendarID string) (calendar CalendarManager, err error)

Method that retrieves one calendar given an ID

GET https://outlook.office.com/api/v2.0/me/calendars/{calendarID}

func (*OutlookAccount) GetInternalID

func (a *OutlookAccount) GetInternalID() int

Method that returns the internal ID given to the account on DB

func (*OutlookAccount) GetKind

func (a *OutlookAccount) GetKind() int

Method that returns the kind of the account

func (*OutlookAccount) GetPrimaryCalendar

func (a *OutlookAccount) GetPrimaryCalendar() (calendar CalendarManager, err error)

Method that returns the principal calendar from the account

GET https://outlook.office.com/api/v2.0/me/calendar

func (*OutlookAccount) GetRefreshToken

func (a *OutlookAccount) GetRefreshToken() string

Method that returns the refresh token

func (*OutlookAccount) GetSyncCalendars

func (a *OutlookAccount) GetSyncCalendars() []CalendarManager

Method that returns all synced calendars associated with the account

func (*OutlookAccount) GetTokenType

func (a *OutlookAccount) GetTokenType() string

Method that returns the token type

func (*OutlookAccount) Mail

func (a *OutlookAccount) Mail() string

Method that returns the mail associated with the account

func (*OutlookAccount) Refresh

func (a *OutlookAccount) Refresh() (err error)

Method to refresh the access to the outlook account

func (*OutlookAccount) SetCalendars

func (a *OutlookAccount) SetCalendars(calendars []CalendarManager)

Method that sets all synced calendars associated with the account

func (*OutlookAccount) SetKind

func (a *OutlookAccount) SetKind(kind int)

Method that sets which kind of account is

type OutlookAttachment

type OutlookAttachment struct {
	ContentType          string `json:"ContentType,omitempty"`
	IsInline             bool   `json:"IsInline,omitempty"`
	LastModifiedDateTime string `json:"LastModifiedDateTime,omitempty"`
	Name                 string `json:"Name,omitempty"`
	Size                 int32  `json:"Size,omitempty"`
}

type OutlookAttendee

type OutlookAttendee struct {
	Recipient *OutlookRecipient `json:"EmailAddress,omitempty"`
	Status    *OutlookStatus    `json:"Status,omitempty"`
	Type      string            `json:"Type,omitempty"`
}

type OutlookCalendar

type OutlookCalendar struct {
	OdataID string `json:"@odata.id,omitempty"`

	CalendarView        []OutlookEvent       `json:"CalendarView,omitempty"`
	CanEdit             bool                 `json:"CanEdit,omitempty"`
	CanShare            bool                 `json:"CanShare,omitempty"`
	CanViewPrivateItems bool                 `json:"CanViewPrivateItems,omitempty"`
	ChangeKey           string               `json:"ChangeKey,omitempty"`
	Color               OutlookCalendarColor `json:"Color,omitempty"`
	Events              []OutlookEvent       `json:"-"`
	ID                  string               `json:"Id"`
	Name                string               `json:"Name,omitempty" convert:"Name"`
	Owner               OutlookEmailAddress  `json:"Owner,omitempty"`
	// contains filtered or unexported fields
}

CalendarInfo TODO

func RetrieveOutlookCalendar

func RetrieveOutlookCalendar(ID string, uid string, account *OutlookAccount) *OutlookCalendar

Method that returns a OutlookCalendar given specific info

func (*OutlookCalendar) Create

func (calendar *OutlookCalendar) Create() (err error)

Method that creates the calendar

POST https://outlook.office.com/api/v2.0/me/calendars

func (*OutlookCalendar) CreateEmptyEvent

func (calendar *OutlookCalendar) CreateEmptyEvent(ID string) EventManager

Method that creates an empty event

func (*OutlookCalendar) Delete

func (calendar *OutlookCalendar) Delete() (err error)

Method that deletes the calendar

DELETE https://outlook.office.com/api/v2.0/me/calendars/{calendarID}

func (*OutlookCalendar) GetAccount

func (calendar *OutlookCalendar) GetAccount() AccountManager

Method that returns the account

func (*OutlookCalendar) GetAllEvents

func (calendar *OutlookCalendar) GetAllEvents() (events []EventManager, err error)

Method that returns all events inside the calendar

GET https://outlook.office.com/api/v2.0/me/calendars/{calendarID}/events

func (*OutlookCalendar) GetCalendars

func (calendar *OutlookCalendar) GetCalendars() []CalendarManager

Method that returns the synced calendar

func (*OutlookCalendar) GetEvent

func (calendar *OutlookCalendar) GetEvent(ID string) (event EventManager, err error)

Method that returns a single event given the ID

GET https://outlook.office.com/api/v2.0/me/events/{eventID}

func (*OutlookCalendar) GetID

func (calendar *OutlookCalendar) GetID() string

Method that returns the ID of the calendar

func (*OutlookCalendar) GetName

func (calendar *OutlookCalendar) GetName() string

Method that returns the name of the calendar

func (*OutlookCalendar) GetQueryID

func (calendar *OutlookCalendar) GetQueryID() string

Method that returns the ID formatted for a query request

func (*OutlookCalendar) GetUUID

func (calendar *OutlookCalendar) GetUUID() string

Method that returns the internal UUID given to the calendar

func (*OutlookCalendar) SetAccount

func (calendar *OutlookCalendar) SetAccount(a AccountManager) (err error)

Method that sets the account which the calendar belongs

func (*OutlookCalendar) SetCalendars

func (calendar *OutlookCalendar) SetCalendars(calendars []CalendarManager)

Method that sets the synced calendars

func (*OutlookCalendar) SetUUID

func (calendar *OutlookCalendar) SetUUID(id string)

Method that sets the internal UUID for the calendar

func (*OutlookCalendar) Update

func (calendar *OutlookCalendar) Update() error

Method that updates the calendar

PUT https://outlook.office.com/api/v2.0/me/calendars/{calendarID}

type OutlookCalendarColor

type OutlookCalendarColor string

Specifies the color theme to distinguish the calendar from other calendars in a UI. The property values are: LightBlue=0, LightGreen=1, LightOrange=2, LightGray=3, LightYellow=4, LightTeal=5, LightPink=6, LightBrown=7, LightRed=8, MaxColor=9, Auto=-1

type OutlookCalendarListResponse

type OutlookCalendarListResponse struct {
	OdataContext string             `json:"@odata.context"`
	Calendars    []*OutlookCalendar `json:"value"`
}

type OutlookCalendarResponse

type OutlookCalendarResponse struct {
	OdataContext string `json:"@odata.context"`
	*OutlookCalendar
}

type OutlookConcreteError

type OutlookConcreteError struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type OutlookDateTimeTimeZone

type OutlookDateTimeTimeZone struct {
	DateTime time.Time      `json:"DateTime,omitempty"convert:"dateTime"`
	TimeZone *time.Location `json:"TimeZone,omitempty"convert:"timeZone"`
	IsAllDay bool           `json:"-"convert:"isAllDay"`
}

func (*OutlookDateTimeTimeZone) Convert

func (*OutlookDateTimeTimeZone) Convert(m interface{}, tag string, opts string) (conv.Converter, error)

Method that converts an interface{} ti a OutlookDateTimeTimeZone struct. This method implements Converter interface

func (*OutlookDateTimeTimeZone) Deconvert

func (date *OutlookDateTimeTimeZone) Deconvert() interface{}

Method that converts a OutlookDateTimeTimeZone struct to a interface{}. This method implements Deconverter interface

func (*OutlookDateTimeTimeZone) MarshalJSON

func (date *OutlookDateTimeTimeZone) MarshalJSON() (b []byte, err error)

Method that converts from OutlookDateTimeTimeZone struct to a json. This method implements Marshaler interface

func (*OutlookDateTimeTimeZone) UnmarshalJSON

func (date *OutlookDateTimeTimeZone) UnmarshalJSON(b []byte) error

Method that converts from a JSON to a OutlookDateTimeTimeZone struct. This method implements Unmarshaler interface

type OutlookEmailAddress

type OutlookEmailAddress struct {
	Address string `json:"Address,omitempty"`
	Name    string `json:"Name,omitempty"`
}

type OutlookError

type OutlookError struct {
	OutlookConcreteError `json:"error,omitempty"`
}

func (OutlookError) Error

func (err OutlookError) Error() string

type OutlookEvent

type OutlookEvent struct {
	ID string `json:"Id"`

	Subject     string           `json:"Subject,omitempty" convert:"Subject"`
	Description string           `json:"BodyPreview,omitempty"`
	IsAllDay    bool             `json:"IsAllDay,omitempty"convert:"allDay"`
	Body        *OutlookItemBody `json:"Body,omitempty"convert:"Description"`

	Start                      *OutlookDateTimeTimeZone `json:"Start,omitempty" convert:"start"`
	End                        *OutlookDateTimeTimeZone `json:"End,omitempty" convert:"end"`
	Categories                 []string                 `json:"Categories,omitempty"`
	ChangeKey                  string                   `json:"ChangeKey,omitempty"`
	OnlineMeetingUrl           string                   `json:"OnlineMeetingUrl,omitempty"`
	OriginalStartTimeZone      string                   `json:"OriginalStartTimeZone,omitempty"`
	OriginalEndTimeZone        string                   `json:"OriginalEndTimeZone,omitempty"`
	ReminderMinutesBeforeStart int32                    `json:"ReminderMinutesBeforeStart,omitempty"`
	ResponseRequested          bool                     `json:"ResponseRequested,omitempty"`
	SeriesMasterID             string                   `json:"SeriesMasterId,omitempty"`

	Organizer   *OutlookRecipient   `json:"Organizer,omitempty"`
	Attachments []OutlookAttachment `json:"Attachments,omitempty"`
	//Don't update
	//This will go to Body to have a list
	Attendees []OutlookAttendee `json:"Attendees,omitempty"`
	Instances []OutlookEvent    `json:"Instances,omitempty"`

	Importance OutlookImportance `json:"Importance,omitempty"`

	Recurrence     *OutlookPatternedRecurrence `json:"Recurrence,omitempty"`
	ResponseStatus *OutlookResponseStatus      `json:"ResponseStatus,omitempty"`
	Sensitivity    OutlookSensitivity          `json:"Sensitivity,omitempty"`
	ShowAs         OutlookFreeBusyStatus       `json:"ShowAs,omitempty"`

	Type OutlookEventType `json:"Type,omitempty"`

	//Not to sync
	Link string `json:"WebLink,omitempty"`

	//Not to sync and use
	Location             *OutlookLocation `json:"Location,omitempty"`
	IsCancelled          bool             `json:"IsCancelled,omitempty"`
	IsOrganizer          bool             `json:"IsOrganizer,omitempty"`
	IsReminderOn         bool             `json:"IsReminderOn,omitempty"`
	CreatedDateTime      string           `json:"CreatedDateTime,omitempty"`      //"2014-10-19T23:13:47.3959685Z"
	LastModifiedDateTime string           `json:"LastModifiedDateTime,omitempty"` //"2014-10-19T23:13:47.6772234Z"
	// contains filtered or unexported fields
}

func (*OutlookEvent) CanProcessAgain

func (event *OutlookEvent) CanProcessAgain() bool

Method that checks if the event can try sync again

func (*OutlookEvent) Create

func (event *OutlookEvent) Create() (err error)

Method that creates the event

POST https://outlook.office.com/api/v2.0/me/calendars/{calendarID}/events

func (*OutlookEvent) Delete

func (event *OutlookEvent) Delete() (err error)

Method that deletes the event

DELETE https://outlook.office.com/api/v2.0/me/events/{eventID}

func (*OutlookEvent) GetCalendar

func (event *OutlookEvent) GetCalendar() CalendarManager

Method that returns the calendar which have this event

func (*OutlookEvent) GetID

func (event *OutlookEvent) GetID() string

Method that returns the ID of the event

func (*OutlookEvent) GetInternalID

func (event *OutlookEvent) GetInternalID() int

Method that gets the internal ID of the event

func (*OutlookEvent) GetRelations

func (event *OutlookEvent) GetRelations() []EventManager

Method that returns the syncing events with this

func (*OutlookEvent) GetState

func (event *OutlookEvent) GetState() int

Method that returns the state of the event

func (*OutlookEvent) GetUpdatedAt

func (event *OutlookEvent) GetUpdatedAt() (t time.Time, err error)

Method that returns the last update date

func (*OutlookEvent) IncrementBackoff

func (event *OutlookEvent) IncrementBackoff()

Method that increments the number of failed attempts to sync

func (*OutlookEvent) SetCalendar

func (event *OutlookEvent) SetCalendar(calendar CalendarManager) (err error)

Method that returns the calendar which have this event

func (*OutlookEvent) SetInternalID

func (event *OutlookEvent) SetInternalID(internalID int)

Method that sets the internal ID generated on db

func (*OutlookEvent) SetRelations

func (event *OutlookEvent) SetRelations(relations []EventManager)

Method that sets the events syncing with this

func (*OutlookEvent) SetState

func (event *OutlookEvent) SetState(stateInformed int)

Method that sets the state of the event

func (*OutlookEvent) Update

func (event *OutlookEvent) Update() (err error)

Method that updates the event

PATCH https://outlook.office.com/api/v2.0/me/events/{eventID}

type OutlookEventListResponse

type OutlookEventListResponse struct {
	OdataContext string          `json:"@odata.context"`
	Events       []*OutlookEvent `json:"value"`
}

type OutlookEventResponse

type OutlookEventResponse struct {
	OdataContext string `json:"@odata.context"`
	*OutlookEvent
}

type OutlookEventType

type OutlookEventType string

The event type: SingleInstance, Occurrence, Exception, SeriesMaster.

type OutlookFreeBusyStatus

type OutlookFreeBusyStatus string

The status to show: Free, Tentative, Busy, Oof, WorkingElsewhere, Unknown.

type OutlookGeoCoordinates

type OutlookGeoCoordinates struct {
	Altitude         float64 `json:"Altitude,omitempty"`
	Latitude         float64 `json:"Latitude,omitempty"`
	Longitude        float64 `json:"Longitude,omitempty"`
	Accuracy         float64 `json:"Accuracy,omitempty"`
	AltitudeAccuracy float64 `json:"AltitudeAccuracy,omitempty"`
}

type OutlookImportance

type OutlookImportance string

The importance of the event: Low, Normal, High.

type OutlookItemBody

type OutlookItemBody struct {
	ContentType string `json:"ContentType,omitempty"`
	Description string `json:"Content,omitempty"`
}

func (*OutlookItemBody) Convert

func (*OutlookItemBody) Convert(m interface{}, tag string, opts string) (conv.Converter, error)

Method that converts an interface{} ti a OutlookItemBody struct. This method implements Converter interface

func (*OutlookItemBody) Deconvert

func (body *OutlookItemBody) Deconvert() interface{}

Method that converts a OutlookItemBody struct to a interface{}. This method implements Deconverter interface

type OutlookLocation

type OutlookLocation struct {
	Address              OutlookPhysicalAddress `json:"Address,omitempty"`
	Coordinates          OutlookGeoCoordinates  `json:"Coordinates,omitempty"`
	DisplayName          string                 `json:"DisplayName,omitempty"`
	LocationEmailAddress string                 `json:"LocationEmailAddress,omitempty"`
}

type OutlookLocationType

type OutlookLocationType int32

The type of location: Default, ConferenceRoom, HomeAddress, BusinessAddress,OutlookGeoCoordinates, StreetAddress, Hotel, Restaurant, LocalBusiness, PostalAddress.

type OutlookNotification

type OutlookNotification struct {
	Subscriptions []OutlookSubscriptionNotification `json:"value"`
}

type OutlookPatternedRecurrence

type OutlookPatternedRecurrence struct {
	Pattern            OutlookRecurrencePattern `json:"Pattern,omitempty"`
	RecurrenceTimeZone string                   `json:"RecurrenceTimeZone,omitempty"`
	Range              OutlookRecurrenceRange   `json:"Range,omitempty"`
}

type OutlookPhysicalAddress

type OutlookPhysicalAddress struct {
	Street          string `json:"Street,omitempty"`
	City            string `json:"City,omitempty"`
	State           string `json:"State,omitempty"`
	CountryOrRegion string `json:"CountryOrRegion,omitempty"`
	PostalCode      string `json:"PostalCode,omitempty"`
}

type OutlookRecipient

type OutlookRecipient struct {
	EmailAddress *OutlookEmailAddress `json:"EmailAddress,omitempty"`
}

type OutlookRecurrencePattern

type OutlookRecurrencePattern struct {
	// The recurrence pattern type: Daily, Weekly, AbsoluteMonthly, RelativeMonthly, AbsoluteYearly, RelativeYearly.
	Type       string `json:"Type,omitempty"`
	Interval   int    `json:"Interval,omitempty"`
	DayOfMonth int    `json:"DayOfMonth,omitempty"`
	Month      int    `json:"Month,omitempty"`
	// The day of the week: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
	DaysOfWeek     []string `json:"DaysOfWeek,omitempty"`
	FirstDayOfWeek string   `json:"FirstDayOfWeek,omitempty"`
	// The week index: First, Second, Third, Fourth, Last.
	Index string `json:"Index,omitempty"`
}

type OutlookRecurrenceRange

type OutlookRecurrenceRange struct {
	// The recurrence range: EndDate, NoEnd, Numbered.
	Type                string `json:"Type,omitempty"`
	StartDate           string `json:"StartDate,omitempty"` //"2014-10-19T23:13:47.3959685Z" TODO
	EndDate             string `json:"EndDate,omitempty"`   //"2014-10-19T23:13:47.3959685Z" TODO
	NumberOfOccurrences int    `json:"NumberOfOccurrences,omitempty"`
}

type OutlookResourceData

type OutlookResourceData struct {
	ID string `json:"Id"`
}

type OutlookResponseStatus

type OutlookResponseStatus struct {
	Response OutlookResponseType `json:"Response,omitempty"`
	Time     string              `json:"Time,omitempty"`
}

type OutlookResponseType

type OutlookResponseType string

The response type: None, Organizer, TentativelyAccepted, Accepted, Declined, NotResponded.

type OutlookSensitivity

type OutlookSensitivity string

Indicates the level of privacy for the event: Normal, Personal, Private, Confidential.

type OutlookStatus

type OutlookStatus struct {
	Response string `json:"Response,omitempty"`
	Time     string `json:"Time,omitempty"`
}

type OutlookSubscription

type OutlookSubscription struct {
	Type            string `json:"@odata.type,omitempty"`
	Resource        string `json:"Resource,omitempty"`
	NotificationURL string `json:"NotificationURL,omitempty"`
	//Created,Deleted,Updated
	ChangeType         string    `json:"ChangeType,omitempty"`
	ID                 string    `json:"id,omitempty"`
	ClientState        string    `json:"ClientState,omitempty"`
	ExpirationDateTime string    `json:"SubscriptionExpirationDateTime,omitempty"`
	Uuid               uuid.UUID `json:"-"`
	// contains filtered or unexported fields
}

func NewOutlookSubscription

func NewOutlookSubscription() (subscription *OutlookSubscription)

Function that creates a new GoogleSubscription given specific info

func RetrieveOutlookSubscription

func RetrieveOutlookSubscription(ID string, uid uuid.UUID, calendar CalendarManager, typ string) (subscription *OutlookSubscription)

Function that returns a GoogleSubscription given specific info

func (*OutlookSubscription) Delete

func (subscription *OutlookSubscription) Delete() (err error)

Method that deletes subscription

DELETE https://outlook.office.com/api/v2.0/me/subscriptions('{subscriptionId}')

func (*OutlookSubscription) GetAccount

func (subscription *OutlookSubscription) GetAccount() AccountManager

Method that returns the account of the subscription

func (*OutlookSubscription) GetExpirationDate

func (subscription *OutlookSubscription) GetExpirationDate() time.Time

Method that returns the expiration date of the subscription

func (*OutlookSubscription) GetID

func (subscription *OutlookSubscription) GetID() string

Method that returns the ID of the subscription

func (*OutlookSubscription) GetResourceID

func (subscription *OutlookSubscription) GetResourceID() string

Method that returns the resourceID of the subscription

func (*OutlookSubscription) GetType

func (subscription *OutlookSubscription) GetType() string

Method that returns the type of the subscription

func (*OutlookSubscription) GetUUID

func (subscription *OutlookSubscription) GetUUID() uuid.UUID

Method that returns the UUID of the subscription

func (*OutlookSubscription) Renew

func (subscription *OutlookSubscription) Renew() (err error)

Method that renews subscription.

PATCH https://outlook.office.com/api/v2.0/me/subscriptions/{subscriptionId}

func (*OutlookSubscription) Subscribe

func (subscription *OutlookSubscription) Subscribe(calendar CalendarManager) (err error)

Method that subscribes calendar for notifications

POST https://outlook.office.com/api/v2.0/me/subscriptions

type OutlookSubscriptionNotification

type OutlookSubscriptionNotification struct {
	SubscriptionID                 string              `json:"SubscriptionId"`
	SubscriptionExpirationDateTime string              `json:"SubscriptionExpirationDateTime"`
	SequenceNumber                 int32               `json:"SequenceNumber"`
	Data                           OutlookResourceData `json:"ResourceData"`
	//Created,Deleted,Updated
	ChangeType string `json:"ChangeType,omitempty"`
}

type RefreshError

type RefreshError struct {
	Code    string `json:"error,omitempty"`
	Message string `json:"error_description,omitempty"`
}

Specific error for a refresh try

func (RefreshError) Error

func (err RefreshError) Error() string

Method implementing error interface

type SubscriptionManager

type SubscriptionManager interface {
	// Method that subscribes calendar for notifications
	Subscribe(CalendarManager) error
	// Method that renews subscription
	Renew() error
	// Method that deletes subscription
	Delete() error
	// Method that returns the ID of the subscription
	GetID() string
	// Method that returns the UUID of the subscription
	GetUUID() uuid.UUID
	// Method that returns the account of the subscription
	GetAccount() AccountManager
	// Method that returns the type of the subscription
	GetType() string
	// Method that returns the expiration date of the subscription
	GetExpirationDate() time.Time
	// Method that returns the resourceID of the subscription
	GetResourceID() string
}

Interface for subscription that defines the needed method to work inside the project

Jump to

Keyboard shortcuts

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