Skip to content
← Public packages

@kody/google

Call Gmail, Calendar, Tasks, Drive, Docs, Sheets, People, YouTube, and Analytics through saved Google OAuth.

src/types.ts

81 lines · 2.3 KB · TypeScript
export type JsonPrimitive = string | number | boolean | null
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[]
export type JsonObject = { [key: string]: JsonValue | unknown }
export type UserInfo = {
	sub?: string
	name?: string
	given_name?: string
	family_name?: string
	picture?: string
	email?: string
	email_verified?: boolean
}
export type SmokeTestResult = {
	account: string
	integration: string
	profile: { email?: string; name?: string; emailVerified?: boolean }
}
export type { GoogleAccountInfo, GoogleAuthParams } from './accounts.ts'
export type { GoogleRequestParams, GoogleApiErrorDetails } from './core.ts'
export type {
	GmailSearchParams,
	GmailMessageParams,
	GmailRawMessageMutationParams,
	GmailReplyDraftParams,
	GmailModifyParams,
} from './gmail.ts'
export type {
	CalendarListParams,
	CalendarGetParams,
	CalendarEventsParams,
	CalendarEventsAcrossCalendarsParams,
	CalendarEventMutationParams,
	CalendarEventDeleteParams,
	CalendarEventGetParams,
	CalendarEventMoveParams,
	CalendarEventQuickAddParams,
	CalendarAclListParams,
	CalendarFreeBusyParams,
} from './calendar.ts'
export type { DriveSearchParams, DriveFileParams, DriveExportParams } from './drive.ts'
export type { PeopleSearchParams } from './people.ts'
export type {
	TasksListParams,
	TasksQueryParams,
	TaskMutationParams,
} from './tasks.ts'
export type { DocsGetParams, DocsCreateParams, DocsBatchUpdateParams } from './docs.ts'
export type {
	SheetsGetParams,
	SheetsValuesParams,
	SheetsUpdateValuesParams,
} from './sheets.ts'
export type {
	YouTubeChannelsParams,
	YouTubeSearchParams,
	YouTubeVideosParams,
	YouTubeCommentThreadsParams,
} from './youtube.ts'
export type { YouTubeAnalyticsReportParams } from './youtube-analytics.ts'
export type { AnalyticsRunReportParams } from './analytics.ts'

/** Overview of shared Google product TypeScript param and result types. */
export default function googleProductTypes() {
	return {
		auth: ['integration (exact OAuth name)', 'account (purpose suffix → google-<purpose>)'],
		defaultIntegration: 'google',
		coreTypes: ['GoogleRequestParams', 'GoogleApiErrorDetails', 'UserInfo', 'SmokeTestResult'],
		products: [
			'gmail',
			'calendar',
			'tasks',
			'drive',
			'docs',
			'sheets',
			'people',
			'youtube',
			'youtube-analytics',
			'analytics',
		],
	}
}