Documentation ¶
Index ¶
- Constants
- type CalendarAPI
- func (c *CalendarAPI) CreateEvent(ctx context.Context, e models.Event) error
- func (c *CalendarAPI) DeleteEvent(ctx context.Context, e models.Event) error
- func (c *CalendarAPI) EventsInTimeframe(ctx context.Context, start time.Time, end time.Time) ([]models.Event, error)
- func (c *CalendarAPI) GetCalendarID() string
- func (c *CalendarAPI) Initialize(ctx context.Context, openBrowser bool, config map[string]interface{}) error
- func (c *CalendarAPI) Name() string
- func (c *CalendarAPI) SetLogger(logger *log.Logger)
- func (c *CalendarAPI) SetupOauth2(ctx context.Context, credentials auth.Credentials, storage auth.Storage, ...) error
- func (c *CalendarAPI) UpdateEvent(ctx context.Context, e models.Event) error
- type GCalClient
- func (g *GCalClient) CreateEvent(ctx context.Context, event models.Event) error
- func (g *GCalClient) DeleteEvent(ctx context.Context, event models.Event) error
- func (g *GCalClient) GetCalendarID() string
- func (g *GCalClient) InitGoogleCalendarClient(CalendarId string, logger *log.Logger) error
- func (g *GCalClient) InitRateLimiter()
- func (g *GCalClient) ListEvents(ctx context.Context, starttime time.Time, endtime time.Time) ([]models.Event, error)
- func (g *GCalClient) UpdateEvent(ctx context.Context, event models.Event) error
- type GoogleCalendarClient
Constants ¶
const (
ExtensionName = "inovex.calendarsync."
)
Total key length must be at most 44 characters
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalendarAPI ¶
type CalendarAPI struct {
// contains filtered or unexported fields
}
CalendarAPI is our Google Calendar client wrapper which adapts the base api to the needs of CalendarSync.
func (*CalendarAPI) CreateEvent ¶
CreateEvent inserts a new event in the configured Google Calendar based on a given sync.Event.
func (*CalendarAPI) DeleteEvent ¶
DeleteEvent removes the given event from the calendar.
func (*CalendarAPI) EventsInTimeframe ¶
func (c *CalendarAPI) EventsInTimeframe(ctx context.Context, start time.Time, end time.Time) ([]models.Event, error)
EventsInTimeframe returns all events in a Google calendar within the given start and end times.
func (*CalendarAPI) GetCalendarID ¶ added in v0.8.0
func (c *CalendarAPI) GetCalendarID() string
GetCalendarID calculates a unique ID for this adapter based on the current calendar. This is used to distinguish between adapters in order to not overwrite or delete events which are maintained by different adapters. A simple use-case for this is if you have multiple google calendars as source adapters configured.
func (*CalendarAPI) Initialize ¶
func (c *CalendarAPI) Initialize(ctx context.Context, openBrowser bool, config map[string]interface{}) error
Initialize implements the Configurable interface and allows the adapter to be dynamically configured. The given config is presumably unknown and is validated and loaded in order to construct a valid CalendarAPI struct. If anything fails, an error is returned and the CalendarAPI should be considered non-functional.
func (*CalendarAPI) Name ¶
func (c *CalendarAPI) Name() string
Name implements the NamedComponent interface and provides a very fancy name.
func (*CalendarAPI) SetLogger ¶
func (c *CalendarAPI) SetLogger(logger *log.Logger)
func (*CalendarAPI) SetupOauth2 ¶
func (c *CalendarAPI) SetupOauth2(ctx context.Context, credentials auth.Credentials, storage auth.Storage, bindPort uint) error
func (*CalendarAPI) UpdateEvent ¶
UpdateEvent updates an event in the calendar with the given sync.Event. The event which is going to be updated must have the same ID as the given sync.Event. Custom metadata inserted by CalendarSync will be added to the EventExtendedProperties.
type GCalClient ¶
type GCalClient struct { Client *calendar.Service RateLimiter ratelimit.Limiter CalendarId string // contains filtered or unexported fields }
GCalClient implements the GoogleCalendarClient interface
func (*GCalClient) CreateEvent ¶
func (*GCalClient) DeleteEvent ¶
func (*GCalClient) GetCalendarID ¶ added in v0.8.0
func (g *GCalClient) GetCalendarID() string
GetCalendarID calculates a unique ID for this adapter based on the current calendar. This is used to distinguish between adapters in order to not overwrite or delete events which are maintained by different adapters. A simple use-case for this is if you have multiple google calendars as source adapters configured.
func (*GCalClient) InitGoogleCalendarClient ¶
func (g *GCalClient) InitGoogleCalendarClient(CalendarId string, logger *log.Logger) error
func (*GCalClient) InitRateLimiter ¶
func (g *GCalClient) InitRateLimiter()
func (*GCalClient) ListEvents ¶
func (*GCalClient) UpdateEvent ¶
type GoogleCalendarClient ¶
type GoogleCalendarClient interface { ListEvents(ctx context.Context, starttime time.Time, enddtime time.Time) ([]models.Event, error) CreateEvent(ctx context.Context, event models.Event) error UpdateEvent(ctx context.Context, event models.Event) error DeleteEvent(ctx context.Context, event models.Event) error GetCalendarID() string InitGoogleCalendarClient(calId string, log *log.Logger) error }