Skip to content

masterplan-optimizer-frontend


masterplan-optimizer-frontend / googleCalendarApi

Variable: googleCalendarApi

const googleCalendarApi: object

Defined in: src/lib/api.ts:2069

Client wrapper for Google OAuth, calendar selection, and publishing.

Type Declaration

connect

connect: () => Promise\<{ auth_url: string; state: string; }>

Start OAuth2 connect flow - returns { auth_url, state }.

Returns

Promise\<{ auth_url: string; state: string; }>

deleteConnection

deleteConnection: (connectionId) => Promise\<void>

Delete a connection.

Parameters

connectionId

number

Returns

Promise\<void>

getConnections

getConnections: () => Promise\<GoogleCalendarConnection[]>

Get all saved connections.

Returns

Promise\<GoogleCalendarConnection[]>

getEventColors

getEventColors: () => Promise\<object[]>

Fetch available event colours from Google Calendar API.

Returns

Promise\<object[]>

handleCallback

handleCallback: (code, state) => Promise\<GoogleCalendarConnection>

Exchange OAuth2 callback code.

Parameters

code

string

state

string

Returns

Promise\<GoogleCalendarConnection>

listCalendars

listCalendars: (connectionId) => Promise\<GoogleCalendar[]>

List calendars for a connection.

Parameters

connectionId

number

Returns

Promise\<GoogleCalendar[]>

listMembers

listMembers: (connectionId, calendarId?) => Promise\<CalendarMember[]>

List calendar members for a connection + calendar.

Parameters

connectionId

number

calendarId?

string

Returns

Promise\<CalendarMember[]>

publish

publish: (eventId, dates?) => Promise\<GooglePublishResponse>

Publish tasks to Google Calendar.

Parameters

eventId

number

dates?

string[]

Returns

Promise\<GooglePublishResponse>

setCalendar

setCalendar: (connectionId, calendarId, calendarName) => Promise\<GoogleCalendarConnection>

Set the calendar for a connection.

Parameters

connectionId

number

calendarId

string

calendarName

string

Returns

Promise\<GoogleCalendarConnection>