@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
114 lines (107 loc) • 3.87 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { authenticationCreateAuthToken } from "../funcs/authenticationCreateAuthToken.js";
import { authenticationDeleteAuthToken } from "../funcs/authenticationDeleteAuthToken.js";
import { authenticationGetAuthToken } from "../funcs/authenticationGetAuthToken.js";
import { authenticationListAuthTokens } from "../funcs/authenticationListAuthTokens.js";
import { marketplaceExchangeSsoToken } from "../funcs/marketplaceExchangeSsoToken.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
CreateAuthTokenRequest,
CreateAuthTokenResponseBody,
} from "../models/createauthtokenop.js";
import {
DeleteAuthTokenRequest,
DeleteAuthTokenResponseBody,
} from "../models/deleteauthtokenop.js";
import {
ExchangeSsoTokenRequestBody,
ExchangeSsoTokenResponseBody,
} from "../models/exchangessotokenop.js";
import {
GetAuthTokenRequest,
GetAuthTokenResponseBody,
} from "../models/getauthtokenop.js";
import { ListAuthTokensResponseBody } from "../models/listauthtokensop.js";
import { unwrapAsync } from "../types/fp.js";
export class Authentication extends ClientSDK {
/**
* SSO Token Exchange
*
* @remarks
* During the autorization process, Vercel sends the user to the provider [redirectLoginUrl](https://vercel.com/docs/integrations/create-integration/submit-integration#redirect-login-url), that includes the OAuth authorization `code` parameter. The provider then calls the SSO Token Exchange endpoint with the sent code and receives the OIDC token. They log the user in based on this token and redirects the user back to the Vercel account using deep-link parameters included the redirectLoginUrl. Providers should not persist the returned `id_token` in a database since the token will expire. See [**Authentication with SSO**](https://vercel.com/docs/integrations/create-integration/marketplace-api#authentication-with-sso) for more details.
*/
async exchangeSsoToken(
request: ExchangeSsoTokenRequestBody,
options?: RequestOptions,
): Promise<ExchangeSsoTokenResponseBody> {
return unwrapAsync(marketplaceExchangeSsoToken(
this,
request,
options,
));
}
/**
* List Auth Tokens
*
* @remarks
* Retrieve a list of the current User's authentication tokens.
*/
async listAuthTokens(
options?: RequestOptions,
): Promise<ListAuthTokensResponseBody> {
return unwrapAsync(authenticationListAuthTokens(
this,
options,
));
}
/**
* Create an Auth Token
*
* @remarks
* Creates and returns a new authentication token for the currently authenticated User. The `bearerToken` property is only provided once, in the response body, so be sure to save it on the client for use with API requests.
*/
async createAuthToken(
request: CreateAuthTokenRequest,
options?: RequestOptions,
): Promise<CreateAuthTokenResponseBody> {
return unwrapAsync(authenticationCreateAuthToken(
this,
request,
options,
));
}
/**
* Get Auth Token Metadata
*
* @remarks
* Retrieve metadata about an authentication token belonging to the currently authenticated User.
*/
async getAuthToken(
request: GetAuthTokenRequest,
options?: RequestOptions,
): Promise<GetAuthTokenResponseBody> {
return unwrapAsync(authenticationGetAuthToken(
this,
request,
options,
));
}
/**
* Delete an authentication token
*
* @remarks
* Invalidate an authentication token, such that it will no longer be valid for future HTTP requests.
*/
async deleteAuthToken(
request: DeleteAuthTokenRequest,
options?: RequestOptions,
): Promise<DeleteAuthTokenResponseBody> {
return unwrapAsync(authenticationDeleteAuthToken(
this,
request,
options,
));
}
}