@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>
123 lines (110 loc) • 3.37 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type RevokeInstallationCredentialRequestBody = {
token: string;
clientSecret: string;
clientId?: string | undefined;
};
export type RevokeInstallationCredentialRequest = {
integrationConfigurationId: string;
requestBody?: RevokeInstallationCredentialRequestBody | undefined;
};
export type RevokeInstallationCredentialResponseBody = {
revoked: boolean;
alreadyRevoked: boolean;
};
/** @internal */
export type RevokeInstallationCredentialRequestBody$Outbound = {
token: string;
client_secret: string;
client_id?: string | undefined;
};
/** @internal */
export const RevokeInstallationCredentialRequestBody$outboundSchema: z.ZodType<
RevokeInstallationCredentialRequestBody$Outbound,
z.ZodTypeDef,
RevokeInstallationCredentialRequestBody
> = z.object({
token: z.string(),
clientSecret: z.string(),
clientId: z.string().optional(),
}).transform((v) => {
return remap$(v, {
clientSecret: "client_secret",
clientId: "client_id",
});
});
export function revokeInstallationCredentialRequestBodyToJSON(
revokeInstallationCredentialRequestBody:
RevokeInstallationCredentialRequestBody,
): string {
return JSON.stringify(
RevokeInstallationCredentialRequestBody$outboundSchema.parse(
revokeInstallationCredentialRequestBody,
),
);
}
/** @internal */
export type RevokeInstallationCredentialRequest$Outbound = {
integrationConfigurationId: string;
RequestBody?: RevokeInstallationCredentialRequestBody$Outbound | undefined;
};
/** @internal */
export const RevokeInstallationCredentialRequest$outboundSchema: z.ZodType<
RevokeInstallationCredentialRequest$Outbound,
z.ZodTypeDef,
RevokeInstallationCredentialRequest
> = z.object({
integrationConfigurationId: z.string(),
requestBody: z.lazy(() =>
RevokeInstallationCredentialRequestBody$outboundSchema
).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function revokeInstallationCredentialRequestToJSON(
revokeInstallationCredentialRequest: RevokeInstallationCredentialRequest,
): string {
return JSON.stringify(
RevokeInstallationCredentialRequest$outboundSchema.parse(
revokeInstallationCredentialRequest,
),
);
}
/** @internal */
export const RevokeInstallationCredentialResponseBody$inboundSchema: z.ZodType<
RevokeInstallationCredentialResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
revoked: types.boolean(),
already_revoked: types.boolean(),
}).transform((v) => {
return remap$(v, {
"already_revoked": "alreadyRevoked",
});
});
export function revokeInstallationCredentialResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
RevokeInstallationCredentialResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
RevokeInstallationCredentialResponseBody$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'RevokeInstallationCredentialResponseBody' from JSON`,
);
}