/* * 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 SubscribersControllerUpdateSubscriberPreferencesRequest = { /** * The identifier of the subscriber */ subscriberId: string; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; patchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto; }; export type SubscribersControllerUpdateSubscriberPreferencesResponse = { headers: { [k: string]: Array }; result: components.GetSubscriberPreferencesDto; }; /** @internal */ export type SubscribersControllerUpdateSubscriberPreferencesRequest$Outbound = { subscriberId: string; "idempotency-key"?: string | undefined; PatchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto$Outbound; }; /** @internal */ export const SubscribersControllerUpdateSubscriberPreferencesRequest$outboundSchema: z.ZodType< SubscribersControllerUpdateSubscriberPreferencesRequest$Outbound, z.ZodTypeDef, SubscribersControllerUpdateSubscriberPreferencesRequest > = z.object({ subscriberId: z.string(), idempotencyKey: z.string().optional(), patchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", patchSubscriberPreferencesDto: "PatchSubscriberPreferencesDto", }); }); export function subscribersControllerUpdateSubscriberPreferencesRequestToJSON( subscribersControllerUpdateSubscriberPreferencesRequest: SubscribersControllerUpdateSubscriberPreferencesRequest, ): string { return JSON.stringify( SubscribersControllerUpdateSubscriberPreferencesRequest$outboundSchema .parse(subscribersControllerUpdateSubscriberPreferencesRequest), ); } /** @internal */ export const SubscribersControllerUpdateSubscriberPreferencesResponse$inboundSchema: z.ZodType< SubscribersControllerUpdateSubscriberPreferencesResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.GetSubscriberPreferencesDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerUpdateSubscriberPreferencesResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerUpdateSubscriberPreferencesResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerUpdateSubscriberPreferencesResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'SubscribersControllerUpdateSubscriberPreferencesResponse' from JSON`, ); }