/* * 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 ListGiftCardsGlobals = { merchantAccountId?: string | undefined; }; export type ListGiftCardsRequest = { buyerExternalIdentifier?: string | null | undefined; buyerId?: string | null | undefined; cursor?: string | null | undefined; limit?: number | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListGiftCardsResponse = { result: components.GiftCards; }; /** @internal */ export type ListGiftCardsRequest$Outbound = { buyer_external_identifier?: string | null | undefined; buyer_id?: string | null | undefined; cursor?: string | null | undefined; limit: number; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListGiftCardsRequest$outboundSchema: z.ZodType< ListGiftCardsRequest$Outbound, z.ZodTypeDef, ListGiftCardsRequest > = z.object({ buyerExternalIdentifier: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { buyerExternalIdentifier: "buyer_external_identifier", buyerId: "buyer_id", }); }); export function listGiftCardsRequestToJSON( listGiftCardsRequest: ListGiftCardsRequest, ): string { return JSON.stringify( ListGiftCardsRequest$outboundSchema.parse(listGiftCardsRequest), ); } /** @internal */ export const ListGiftCardsResponse$inboundSchema: z.ZodType< ListGiftCardsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.GiftCards$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listGiftCardsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListGiftCardsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListGiftCardsResponse' from JSON`, ); }