@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
41 lines (36 loc) • 1.26 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 components from "../components/index.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type PortalCreateSessionResponse = {
headers: { [k: string]: Array<string> };
result: components.V2PortalCreateSessionResponseBody;
};
/** @internal */
export const PortalCreateSessionResponse$inboundSchema: z.ZodType<
PortalCreateSessionResponse,
z.ZodTypeDef,
unknown
> = z.object({
Headers: z.record(z.array(z.string())).default({}),
Result: components.V2PortalCreateSessionResponseBody$inboundSchema,
}).transform((v) => {
return remap$(v, {
"Headers": "headers",
"Result": "result",
});
});
export function portalCreateSessionResponseFromJSON(
jsonString: string,
): SafeParseResult<PortalCreateSessionResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => PortalCreateSessionResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PortalCreateSessionResponse' from JSON`,
);
}