// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class OAuthTokens extends APIResource { /** * Create an OAuth Token * * @example * ```ts * const oauthToken = await client.oauthTokens.create({ * grant_type: 'authorization_code', * }); * ``` */ create(body: OAuthTokenCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/oauth/tokens', { body, ...options }); } } /** * A token that is returned to your application when a user completes the OAuth * flow and may be used to authenticate requests. Learn more about OAuth * [here](/documentation/oauth). */ export interface OAuthToken { /** * You may use this token in place of an API key to make OAuth requests on a user's * behalf. */ access_token: string; /** * The Group's identifier. A Group is the top-level organization in Increase. */ group_id: string; /** * The type of OAuth token. */ token_type: 'bearer'; /** * A constant representing the object's type. For this resource it will always be * `oauth_token`. */ type: 'oauth_token'; } export interface OAuthTokenCreateParams { /** * The credential you request in exchange for the code. In Production, this is * always `authorization_code`. In Sandbox, you can pass either enum value. * * - `authorization_code` - An OAuth authorization code. * - `production_token` - An OAuth production token. */ grant_type: 'authorization_code' | 'production_token'; /** * The public identifier for your application. */ client_id?: string; /** * The secret that confirms you own the application. This is redundant given that * the request is made with your API key but it's a required component of OAuth * 2.0. */ client_secret?: string; /** * The authorization code generated by the user and given to you as a query * parameter. */ code?: string; /** * The production token you want to exchange for a sandbox token. This is only * available in Sandbox. Set `grant_type` to `production_token` to use this * parameter. */ production_token?: string; [k: string]: unknown; } export declare namespace OAuthTokens { export { type OAuthToken as OAuthToken, type OAuthTokenCreateParams as OAuthTokenCreateParams }; }