import { Result } from "../core/result.mjs"; import { GscError } from "../core/errors.mjs"; interface OAuthTokens { accessToken: string; /** Unix seconds. */ expiresAt: number; /** Space-delimited scopes Google granted for this token, when returned. */ scope?: string; } /** Normalized response from Google's access-token introspection endpoint. */ interface OAuthTokenInfo { issuedTo?: string; audience?: string; authorizedParty?: string; userId?: string; subject?: string; scope?: string; /** Seconds remaining when Google inspected the token. */ expiresIn?: number; /** Unix seconds. */ expiresAt?: number; email?: string; emailVerified?: boolean; accessType?: string; } /** * Exchange a refresh token for an access token. Retries transient network * failures; surfaces HTTP failures (invalid_grant, etc.) immediately as * `GscApiError` so callers can mark the refresh token as bad. */ declare function refreshAccessToken(refreshToken: string, clientId: string, clientSecret: string): Promise; /** * Exchange an authorization code (from the OAuth consent redirect) for * access + refresh tokens. Same retry / surface model and `auth-expired` vs * `transport` classification as {@link refreshAccessTokenResult}. */ declare function exchangeAuthCodeResult(code: string, clientId: string, clientSecret: string, redirectUri: string): Promise>; /** Inspect an access token without throwing on expected OAuth failures. */ declare function introspectAccessTokenResult(accessToken: string): Promise>; /** Throwing convenience wrapper for {@link introspectAccessTokenResult}. */ declare function introspectAccessToken(accessToken: string): Promise; /** Revoke an access or refresh token without throwing on expected OAuth failures. */ declare function revokeOAuthTokenResult(token: string): Promise>; /** Throwing convenience wrapper for {@link revokeOAuthTokenResult}. */ declare function revokeOAuthToken(token: string): Promise; export { OAuthTokenInfo, OAuthTokens, exchangeAuthCodeResult, introspectAccessToken, introspectAccessTokenResult, refreshAccessToken, revokeOAuthToken, revokeOAuthTokenResult };