//=========================================== // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template //=========================================== import { KnownErrors } from "@hexclave/shared"; import { Result } from "@hexclave/shared/dist/utils/results"; export type Connection = { /** * @deprecated Use `provider` instead. This field returns the provider for backward compatibility. */ id: string, /** Provider config ID (e.g., "google", "github") */ provider: string, /** Account ID from the OAuth provider (e.g., Google user ID) */ providerAccountId: string, }; export type OAuthConnection = { /** * Get an OAuth access token for this connected account. * * Returns `{ status: "ok", data: { accessToken } }` on success, or * `{ status: "error", error: KnownErrors["OAuthAccessTokenNotAvailable"] }` if the * refresh token has been revoked/expired or the requested scopes are not available. * * @param options.scopes - If provided, only returns a token that has all of these scopes. */ getAccessToken(options?: { scopes?: string[] }): Promise>, /** * React hook to get an OAuth access token for this connected account. * * Returns `{ status: "ok", data: { accessToken } }` on success, or * `{ status: "error", error: KnownErrors["OAuthAccessTokenNotAvailable"] }` if the * refresh token has been revoked/expired or the requested scopes are not available. * * @param options.scopes - If provided, only returns a token that has all of these scopes. */ } & Connection; /** * @deprecated Used by legacy `getConnectedAccount(providerId)`. Use `OAuthConnection` instead, * which returns a `Result` from `getAccessToken`/`useAccessToken` instead of throwing. */ export type DeprecatedOAuthConnection = { getAccessToken(): Promise<{ accessToken: string }>, } & Connection;