import { TypedError } from 'typed-error'; import { OauthProviderContract } from '../contracts/oauth-provider'; export declare class OAuthInvalidOption extends TypedError { } export declare class OAuthRequestError extends TypedError { } export declare class OAuthUnsuccessfulResponse extends TypedError { } /** * @summary Send an HTTP request * @function * @public * * @description * If the access token is passed, then we set the * "Authorization" header out of the box, and then * delegate to the `request` module. * * @param {(Object|Undefined)} accessToken - Access token * @param {Object} options - Request options * @param {Number} [retries] - Number of retries * @returns {Object} HTTP response (code, body) */ export declare const request: (accessToken: { access_token: any; } | null, options: { url: any; form: string; headers?: { [key: string]: string; } | undefined; }, retries?: number) => Promise<{ code: number; body: any; }>; /** * @summary Swap a short lived token for an access token * @function * @public * * @description * This function takes a short lived token an exchanges it * for a proper access token that looks like this: * * { * "access_token": "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", * "token_type": "bearer", * "expires_in": 3600, * "refresh_token": "IwOGYzYTlmM2YxOTQ5MGE3YmNmMDFkNTVk", * "scope": "create" * } * * @param {OauthProviderContract} provider - Oauth provider contract to get info from * @param {String} code - Short-lived token * @returns {Object} New access token * @returns {Object} Access token */ export declare const getAccessToken: (provider: OauthProviderContract, code: string) => Promise; /** * @summary Refresh an expired access token * @public * @function * * @description The `accessToken` argument should be previously * adquired through `.getAccessToken()`. The result of this * function is the same as `.getAccessToken()`. * * @param {OauthProviderContract} provider - Oauth provider contract to get info from * @param {String} refreshToken - The refresh token * @returns {Object} New access token */ export declare const refreshAccessToken: (provider: OauthProviderContract, refreshToken: string) => Promise;