@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
89 lines (80 loc) • 2.93 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";
import {
IdentitiesCreateIdentityResponseData,
IdentitiesCreateIdentityResponseData$inboundSchema,
IdentitiesCreateIdentityResponseData$Outbound,
IdentitiesCreateIdentityResponseData$outboundSchema,
} from "./identitiescreateidentityresponsedata.js";
import {
Meta,
Meta$inboundSchema,
Meta$Outbound,
Meta$outboundSchema,
} from "./meta.js";
export type V2IdentitiesCreateIdentityResponseBody = {
meta: Meta;
data: IdentitiesCreateIdentityResponseData;
};
/** @internal */
export const V2IdentitiesCreateIdentityResponseBody$inboundSchema: z.ZodType<
V2IdentitiesCreateIdentityResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
meta: Meta$inboundSchema,
data: IdentitiesCreateIdentityResponseData$inboundSchema,
});
/** @internal */
export type V2IdentitiesCreateIdentityResponseBody$Outbound = {
meta: Meta$Outbound;
data: IdentitiesCreateIdentityResponseData$Outbound;
};
/** @internal */
export const V2IdentitiesCreateIdentityResponseBody$outboundSchema: z.ZodType<
V2IdentitiesCreateIdentityResponseBody$Outbound,
z.ZodTypeDef,
V2IdentitiesCreateIdentityResponseBody
> = z.object({
meta: Meta$outboundSchema,
data: IdentitiesCreateIdentityResponseData$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace V2IdentitiesCreateIdentityResponseBody$ {
/** @deprecated use `V2IdentitiesCreateIdentityResponseBody$inboundSchema` instead. */
export const inboundSchema =
V2IdentitiesCreateIdentityResponseBody$inboundSchema;
/** @deprecated use `V2IdentitiesCreateIdentityResponseBody$outboundSchema` instead. */
export const outboundSchema =
V2IdentitiesCreateIdentityResponseBody$outboundSchema;
/** @deprecated use `V2IdentitiesCreateIdentityResponseBody$Outbound` instead. */
export type Outbound = V2IdentitiesCreateIdentityResponseBody$Outbound;
}
export function v2IdentitiesCreateIdentityResponseBodyToJSON(
v2IdentitiesCreateIdentityResponseBody:
V2IdentitiesCreateIdentityResponseBody,
): string {
return JSON.stringify(
V2IdentitiesCreateIdentityResponseBody$outboundSchema.parse(
v2IdentitiesCreateIdentityResponseBody,
),
);
}
export function v2IdentitiesCreateIdentityResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<V2IdentitiesCreateIdentityResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
V2IdentitiesCreateIdentityResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'V2IdentitiesCreateIdentityResponseBody' from JSON`,
);
}