@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
77 lines (68 loc) • 2.15 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type ApisCreateApiResponseData = {
/**
* The id of the API
*/
apiId: string;
/**
* The name of the API
*/
name: string;
};
/** @internal */
export const ApisCreateApiResponseData$inboundSchema: z.ZodType<
ApisCreateApiResponseData,
z.ZodTypeDef,
unknown
> = z.object({
apiId: z.string(),
name: z.string(),
});
/** @internal */
export type ApisCreateApiResponseData$Outbound = {
apiId: string;
name: string;
};
/** @internal */
export const ApisCreateApiResponseData$outboundSchema: z.ZodType<
ApisCreateApiResponseData$Outbound,
z.ZodTypeDef,
ApisCreateApiResponseData
> = z.object({
apiId: z.string(),
name: z.string(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ApisCreateApiResponseData$ {
/** @deprecated use `ApisCreateApiResponseData$inboundSchema` instead. */
export const inboundSchema = ApisCreateApiResponseData$inboundSchema;
/** @deprecated use `ApisCreateApiResponseData$outboundSchema` instead. */
export const outboundSchema = ApisCreateApiResponseData$outboundSchema;
/** @deprecated use `ApisCreateApiResponseData$Outbound` instead. */
export type Outbound = ApisCreateApiResponseData$Outbound;
}
export function apisCreateApiResponseDataToJSON(
apisCreateApiResponseData: ApisCreateApiResponseData,
): string {
return JSON.stringify(
ApisCreateApiResponseData$outboundSchema.parse(apisCreateApiResponseData),
);
}
export function apisCreateApiResponseDataFromJSON(
jsonString: string,
): SafeParseResult<ApisCreateApiResponseData, SDKValidationError> {
return safeParse(
jsonString,
(x) => ApisCreateApiResponseData$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ApisCreateApiResponseData' from JSON`,
);
}