/* * 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 VaultConnectionConsentUpdateGlobals = { /** * 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 VaultConnectionConsentUpdateRequest = { /** * 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; /** * Service ID of the resource to return */ serviceId: string; /** * Unified API */ unifiedApi: string; /** * New consent state */ updateConsentRequest: components.UpdateConsentRequest; }; export type VaultConnectionConsentUpdateResponse = { httpMeta: components.HTTPMetadata; /** * Consent updated */ updateConsentResponse?: components.UpdateConsentResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type VaultConnectionConsentUpdateRequest$Outbound = { consumerId?: string | undefined; appId?: string | undefined; service_id: string; unified_api: string; UpdateConsentRequest: components.UpdateConsentRequest$Outbound; }; /** @internal */ export const VaultConnectionConsentUpdateRequest$outboundSchema: z.ZodType< VaultConnectionConsentUpdateRequest$Outbound, z.ZodTypeDef, VaultConnectionConsentUpdateRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ consumerId: z.string().optional(), appId: z.string().optional(), serviceId: z.string(), unifiedApi: z.string(), updateConsentRequest: components.UpdateConsentRequest$outboundSchema, }).transform((v) => { return remap$(v, { serviceId: "service_id", unifiedApi: "unified_api", updateConsentRequest: "UpdateConsentRequest", }); }) ); export function vaultConnectionConsentUpdateRequestToJSON( vaultConnectionConsentUpdateRequest: VaultConnectionConsentUpdateRequest, ): string { return JSON.stringify( VaultConnectionConsentUpdateRequest$outboundSchema.parse( vaultConnectionConsentUpdateRequest, ), ); } /** @internal */ export const VaultConnectionConsentUpdateResponse$inboundSchema: z.ZodType< VaultConnectionConsentUpdateResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, UpdateConsentResponse: types.optional( components.UpdateConsentResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "UpdateConsentResponse": "updateConsentResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function vaultConnectionConsentUpdateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VaultConnectionConsentUpdateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VaultConnectionConsentUpdateResponse' from JSON`, ); }