import { ApplicationToken, IdentityToken } from './schema.js'; import { API } from '../api.js'; import { Result } from '../../../public/node/result.js'; import { ExtendableError } from '../../../public/node/error.js'; export declare class InvalidGrantError extends ExtendableError { } export declare class InvalidRequestError extends ExtendableError { } export interface ExchangeScopes { admin: string[]; partners: string[]; storefront: string[]; businessPlatform: string[]; appManagement: string[]; } /** * Given an identity token, request an application token. * @param identityToken - access token obtained in a previous step * @param store - the store to use, only needed for admin API * @returns An array with the application access tokens. */ export declare function exchangeAccessForApplicationTokens(identityToken: IdentityToken, scopes: ExchangeScopes, store?: string): Promise>; /** * Given an expired access token, refresh it to get a new one. */ export declare function refreshAccessToken(currentToken: IdentityToken): Promise; /** * Given a custom app automation token passed as ENV variable, request a valid Partners API token. * This token does not accept extra scopes, just the cli one. * @param token - The app automation token passed as ENV variable `SHOPIFY_APP_AUTOMATION_TOKEN` * @returns An instance with the application access tokens. */ export declare function exchangeCustomPartnerToken(token: string): Promise<{ accessToken: string; userId: string; }>; /** * Given a custom app automation token passed as ENV variable, request a valid App Management API token. * @param token - The app automation token passed as ENV variable `SHOPIFY_APP_AUTOMATION_TOKEN` * @returns An instance with the application access tokens. */ export declare function exchangeAppAutomationTokenForAppManagementAccessToken(token: string): Promise<{ accessToken: string; userId: string; }>; /** * Given a custom app automation token passed as ENV variable, request a valid Business Platform API token. * @param token - The app automation token passed as ENV variable `SHOPIFY_APP_AUTOMATION_TOKEN` * @returns An instance with the application access tokens. */ export declare function exchangeAppAutomationTokenForBusinessPlatformAccessToken(token: string): Promise<{ accessToken: string; userId: string; }>; type IdentityDeviceError = 'authorization_pending' | 'access_denied' | 'expired_token' | 'slow_down' | 'unknown_failure'; /** * Given a deviceCode obtained after starting a device identity flow, request an identity token. * @param deviceCode - The device code obtained after starting a device identity flow * @param scopes - The scopes to request * @returns An instance with the identity access tokens. */ export declare function exchangeDeviceCodeForAccessToken(deviceCode: string): Promise>; export declare function requestAppToken(api: API, token: string, scopes?: string[], store?: string): Promise>; export {};