/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type VaultSessionsCreateGlobals = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; }; export type VaultSessionsCreateRequest = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; /** * Additional redirect uri and/or consumer metadata */ session?: components.Session | undefined; }; export type VaultSessionsCreateResponse = { httpMeta: components.HTTPMetadata; /** * Session created */ createSessionResponse?: components.CreateSessionResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type VaultSessionsCreateRequest$Outbound = { consumerId?: string | undefined; appId?: string | undefined; Session?: components.Session$Outbound | undefined; }; /** @internal */ export const VaultSessionsCreateRequest$outboundSchema: z.ZodType< VaultSessionsCreateRequest$Outbound, z.ZodTypeDef, VaultSessionsCreateRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ consumerId: z.string().optional(), appId: z.string().optional(), session: components.Session$outboundSchema.optional(), }).transform((v) => { return remap$(v, { session: "Session", }); }) ); export function vaultSessionsCreateRequestToJSON( vaultSessionsCreateRequest: VaultSessionsCreateRequest, ): string { return JSON.stringify( VaultSessionsCreateRequest$outboundSchema.parse(vaultSessionsCreateRequest), ); } /** @internal */ export const VaultSessionsCreateResponse$inboundSchema: z.ZodType< VaultSessionsCreateResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateSessionResponse: types.optional( components.CreateSessionResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateSessionResponse": "createSessionResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function vaultSessionsCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VaultSessionsCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VaultSessionsCreateResponse' from JSON`, ); }