@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>
68 lines (59 loc) • 1.72 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { AuthToken, AuthToken$inboundSchema } from "./authtoken.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetAuthTokenRequest = {
/**
* The identifier of the token to retrieve. The special value "current" may be supplied, which returns the metadata for the token that the current HTTP request is authenticated with.
*/
tokenId: string;
};
/**
* Successful response.
*/
export type GetAuthTokenResponseBody = {
/**
* Authentication token metadata.
*/
token: AuthToken;
};
/** @internal */
export type GetAuthTokenRequest$Outbound = {
tokenId: string;
};
/** @internal */
export const GetAuthTokenRequest$outboundSchema: z.ZodType<
GetAuthTokenRequest$Outbound,
z.ZodTypeDef,
GetAuthTokenRequest
> = z.object({
tokenId: z.string(),
});
export function getAuthTokenRequestToJSON(
getAuthTokenRequest: GetAuthTokenRequest,
): string {
return JSON.stringify(
GetAuthTokenRequest$outboundSchema.parse(getAuthTokenRequest),
);
}
/** @internal */
export const GetAuthTokenResponseBody$inboundSchema: z.ZodType<
GetAuthTokenResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
token: AuthToken$inboundSchema,
});
export function getAuthTokenResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetAuthTokenResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetAuthTokenResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetAuthTokenResponseBody' from JSON`,
);
}