mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 09:01:19 +00:00
chore: remove obvious comments from types
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -1,14 +1,6 @@
|
|||||||
/**
|
|
||||||
* Provider interface for Google OAuth credentials.
|
|
||||||
* Consumers implement this to supply tokens from their auth storage/flow.
|
|
||||||
* The source never stores or manages tokens itself.
|
|
||||||
*/
|
|
||||||
export interface GoogleOAuthProvider {
|
export interface GoogleOAuthProvider {
|
||||||
/** Return a valid access token, refreshing internally if necessary. */
|
|
||||||
fetchAccessToken(): Promise<string>
|
fetchAccessToken(): Promise<string>
|
||||||
/** Force a token refresh and return the new access token. */
|
|
||||||
refresh(): Promise<string>
|
refresh(): Promise<string>
|
||||||
/** Revoke the current credentials. */
|
|
||||||
revoke(): Promise<void>
|
revoke(): Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,14 +12,13 @@ export const EventStatus = {
|
|||||||
|
|
||||||
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]
|
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]
|
||||||
|
|
||||||
/** Google Calendar API event datetime object. Exactly one of dateTime or date is present. */
|
/** Exactly one of dateTime or date is present. */
|
||||||
export interface ApiEventDateTime {
|
export interface ApiEventDateTime {
|
||||||
dateTime?: string
|
dateTime?: string
|
||||||
date?: string
|
date?: string
|
||||||
timeZone?: string
|
timeZone?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Google Calendar API event resource shape. */
|
|
||||||
export interface ApiCalendarEvent {
|
export interface ApiCalendarEvent {
|
||||||
id: string
|
id: string
|
||||||
status: EventStatus
|
status: EventStatus
|
||||||
@@ -58,33 +49,24 @@ export interface ListEventsOptions {
|
|||||||
timeMax: Date
|
timeMax: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstraction over the Google Calendar REST API.
|
|
||||||
* Inject a mock for testing.
|
|
||||||
*/
|
|
||||||
export interface GoogleCalendarClient {
|
export interface GoogleCalendarClient {
|
||||||
/** List all calendar IDs accessible by the user. */
|
|
||||||
listCalendarIds(): Promise<string[]>
|
listCalendarIds(): Promise<string[]>
|
||||||
/** List events matching the given options. Returns raw API event objects. */
|
|
||||||
listEvents(options: ListEventsOptions): Promise<ApiCalendarEvent[]>
|
listEvents(options: ListEventsOptions): Promise<ApiCalendarEvent[]>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GoogleCalendarSourceBaseOptions {
|
interface GoogleCalendarSourceBaseOptions {
|
||||||
/** Calendar IDs to fetch. Defaults to all user calendars. */
|
|
||||||
calendarIds?: string[]
|
calendarIds?: string[]
|
||||||
/** How far ahead to look for events, in hours. Default: 24 */
|
/** Default: 24 */
|
||||||
lookaheadHours?: number
|
lookaheadHours?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GoogleCalendarSourceWithProvider extends GoogleCalendarSourceBaseOptions {
|
interface GoogleCalendarSourceWithProvider extends GoogleCalendarSourceBaseOptions {
|
||||||
/** OAuth provider for authenticating with Google Calendar API */
|
|
||||||
oauthProvider: GoogleOAuthProvider
|
oauthProvider: GoogleOAuthProvider
|
||||||
client?: never
|
client?: never
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GoogleCalendarSourceWithClient extends GoogleCalendarSourceBaseOptions {
|
interface GoogleCalendarSourceWithClient extends GoogleCalendarSourceBaseOptions {
|
||||||
oauthProvider?: never
|
oauthProvider?: never
|
||||||
/** Injectable API client (for testing) */
|
|
||||||
client: GoogleCalendarClient
|
client: GoogleCalendarClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user