import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient"; import * as core from "../../../../core"; import type * as Square from "../../../index"; export declare namespace OAuthClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class OAuthClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: OAuthClient.Options); /** * Revokes an access token generated with the OAuth flow. * * If an account has more than one OAuth access token for your application, this * endpoint revokes all of them, regardless of which token you specify. * * __Important:__ The `Authorization` header for this endpoint must have the * following format: * * ``` * Authorization: Client APPLICATION_SECRET * ``` * * Replace `APPLICATION_SECRET` with the application secret on the **OAuth** * page for your application in the Developer Dashboard. * * @param {Square.RevokeTokenRequest} request * @param {OAuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.oAuth.revokeToken({ * clientId: "CLIENT_ID", * accessToken: "ACCESS_TOKEN" * }) */ revokeToken(request?: Square.RevokeTokenRequest, requestOptions?: OAuthClient.RequestOptions): core.HttpResponsePromise; private __revokeToken; /** * Returns an OAuth access token and refresh token using the `authorization_code` * or `refresh_token` grant type. * * When `grant_type` is `authorization_code`: * - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow), * provide `code`, `client_id`, and `client_secret`. * - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow), * provide `code`, `client_id`, and `code_verifier`. * * When `grant_type` is `refresh_token`: * - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`. * The response returns the same refresh token provided in the request. * - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns * a new refresh token. * * You can use the `scopes` parameter to limit the set of permissions authorized by the * access token. You can use the `short_lived` parameter to create an access token that * expires in 24 hours. * * __Important:__ OAuth tokens should be encrypted and stored on a secure server. * Application clients should never interact directly with OAuth tokens. * * @param {Square.ObtainTokenRequest} request * @param {OAuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.oAuth.obtainToken({ * clientId: "sq0idp-uaPHILoPzWZk3tlJqlML0g", * clientSecret: "sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM", * code: "sq0cgb-l0SBqxs4uwxErTVyYOdemg", * grantType: "authorization_code" * }) */ obtainToken(request: Square.ObtainTokenRequest, requestOptions?: OAuthClient.RequestOptions): core.HttpResponsePromise; private __obtainToken; /** * Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). * * Add the access token to the Authorization header of the request. * * __Important:__ The `Authorization` header you provide to this endpoint must have the following format: * * ``` * Authorization: Bearer ACCESS_TOKEN * ``` * * where `ACCESS_TOKEN` is a * [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). * * If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. * * @param {OAuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.oAuth.retrieveTokenStatus() */ retrieveTokenStatus(requestOptions?: OAuthClient.RequestOptions): core.HttpResponsePromise; private __retrieveTokenStatus; /** * @param {OAuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.oAuth.authorize() */ authorize(requestOptions?: OAuthClient.RequestOptions): core.HttpResponsePromise; private __authorize; }