@betha-plataforma/oauth
Version:
Biblioteca JavaScript para lidar com o fluxo do OAuth 2.0 em aplicações Web, com suporte a TypeScript.
36 lines (35 loc) • 933 B
TypeScript
declare type HttpRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
interface HttpRequestOptions {
/**
* the request's body.
*/
readonly body?: object;
/**
* the HTTP method to execute.
*/
readonly method?: HttpRequestMethod;
/**
* the query params.
*/
readonly query?: object;
/**
* the number of retries.
*/
readonly retries?: number;
/**
* the `Content-Type` header value.
*/
readonly type?: string;
/**
* the full URL to call.
*/
readonly url: string;
}
/**
* Sends an asynchronous request to a server and returns the response as an instance of `B`.
* @typeparam B type of response body.
* @method authServerRequest
* @returns the result of the request as a promise.
*/
export declare const authServerRequest: <B>({ body, method, query, retries, type, url, }: HttpRequestOptions) => Promise<B>;
export {};