import type { OctokitResponse, RequestInterface } from "@octokit/types"; import type { OAuthAppAuthentication, GitHubAppAuthenticationWithExpirationEnabled, GitHubAppAuthenticationWithExpirationDisabled, GitHubAppAuthenticationWithRefreshToken, OAuthAppCreateTokenResponseData, GitHubAppCreateTokenResponseData, GitHubAppCreateTokenWithExpirationResponseData } from "./types"; export type ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret = { clientType: "oauth-app"; clientId: string; code: string; redirectUrl?: string; state?: string; request?: RequestInterface; scopes?: string[]; }; export type ExchangeDeviceCodeOAuthAppOptions = ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret & { clientSecret: string; }; export type ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret = { clientType: "github-app"; clientId: string; code: string; redirectUrl?: string; state?: string; request?: RequestInterface; }; export type ExchangeDeviceCodeGitHubAppOptions = ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret & { clientSecret: string; }; type OAuthAppAuthenticationWithoutClientSecret = Omit; type GitHubAppAuthenticationWithoutClientSecret = Omit; type GitHubAppAuthenticationWithExpirationWithoutClientSecret = Omit; export type ExchangeDeviceCodeOAuthAppResponse = OctokitResponse & { authentication: OAuthAppAuthentication; }; export type ExchangeDeviceCodeOAuthAppResponseWithoutClientSecret = OctokitResponse & { authentication: OAuthAppAuthenticationWithoutClientSecret; }; export type ExchangeDeviceCodeGitHubAppResponse = OctokitResponse & { authentication: GitHubAppAuthenticationWithExpirationEnabled | GitHubAppAuthenticationWithExpirationDisabled | GitHubAppAuthenticationWithRefreshToken; }; export type ExchangeDeviceCodeGitHubAppResponseWithoutClientSecret = OctokitResponse & { authentication: GitHubAppAuthenticationWithoutClientSecret | GitHubAppAuthenticationWithExpirationWithoutClientSecret; }; /** * Exchange the code from GitHub's OAuth Web flow for OAuth Apps. */ export declare function exchangeDeviceCode(options: ExchangeDeviceCodeOAuthAppOptions): Promise; /** * Exchange the code from GitHub's OAuth Web flow for OAuth Apps without clientSecret */ export declare function exchangeDeviceCode(options: ExchangeDeviceCodeOAuthAppOptionsWithoutClientSecret): Promise; /** * Exchange the code from GitHub's OAuth Web flow for GitHub Apps. `scopes` are not supported by GitHub Apps. */ export declare function exchangeDeviceCode(options: ExchangeDeviceCodeGitHubAppOptions): Promise; /** * Exchange the code from GitHub's OAuth Web flow for GitHub Apps without using `clientSecret`. `scopes` are not supported by GitHub Apps. */ export declare function exchangeDeviceCode(options: ExchangeDeviceCodeGitHubAppOptionsWithoutClientSecret): Promise; export {};