/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AccountPaymentMethodDeleteRequest = { /** * The ID of the payment method to delete */ id: string; /** * The publicly shareable identifier used to identify your Bolt merchant division. */ xPublishableKey: string; /** * A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with `Bolt.state.merchantClientId` in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. */ xMerchantClientId?: string | undefined; }; export type AccountPaymentMethodDeleteResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; }; /** @internal */ export const AccountPaymentMethodDeleteRequest$inboundSchema: z.ZodType< AccountPaymentMethodDeleteRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), "X-Publishable-Key": z.string(), "X-Merchant-Client-Id": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Publishable-Key": "xPublishableKey", "X-Merchant-Client-Id": "xMerchantClientId", }); }); /** @internal */ export type AccountPaymentMethodDeleteRequest$Outbound = { id: string; "X-Publishable-Key": string; "X-Merchant-Client-Id"?: string | undefined; }; /** @internal */ export const AccountPaymentMethodDeleteRequest$outboundSchema: z.ZodType< AccountPaymentMethodDeleteRequest$Outbound, z.ZodTypeDef, AccountPaymentMethodDeleteRequest > = z.object({ id: z.string(), xPublishableKey: z.string(), xMerchantClientId: z.string().optional(), }).transform((v) => { return remap$(v, { xPublishableKey: "X-Publishable-Key", xMerchantClientId: "X-Merchant-Client-Id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountPaymentMethodDeleteRequest$ { /** @deprecated use `AccountPaymentMethodDeleteRequest$inboundSchema` instead. */ export const inboundSchema = AccountPaymentMethodDeleteRequest$inboundSchema; /** @deprecated use `AccountPaymentMethodDeleteRequest$outboundSchema` instead. */ export const outboundSchema = AccountPaymentMethodDeleteRequest$outboundSchema; /** @deprecated use `AccountPaymentMethodDeleteRequest$Outbound` instead. */ export type Outbound = AccountPaymentMethodDeleteRequest$Outbound; } export function accountPaymentMethodDeleteRequestToJSON( accountPaymentMethodDeleteRequest: AccountPaymentMethodDeleteRequest, ): string { return JSON.stringify( AccountPaymentMethodDeleteRequest$outboundSchema.parse( accountPaymentMethodDeleteRequest, ), ); } export function accountPaymentMethodDeleteRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountPaymentMethodDeleteRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountPaymentMethodDeleteRequest' from JSON`, ); } /** @internal */ export const AccountPaymentMethodDeleteResponse$inboundSchema: z.ZodType< AccountPaymentMethodDeleteResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", }); }); /** @internal */ export type AccountPaymentMethodDeleteResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; }; /** @internal */ export const AccountPaymentMethodDeleteResponse$outboundSchema: z.ZodType< AccountPaymentMethodDeleteResponse$Outbound, z.ZodTypeDef, AccountPaymentMethodDeleteResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountPaymentMethodDeleteResponse$ { /** @deprecated use `AccountPaymentMethodDeleteResponse$inboundSchema` instead. */ export const inboundSchema = AccountPaymentMethodDeleteResponse$inboundSchema; /** @deprecated use `AccountPaymentMethodDeleteResponse$outboundSchema` instead. */ export const outboundSchema = AccountPaymentMethodDeleteResponse$outboundSchema; /** @deprecated use `AccountPaymentMethodDeleteResponse$Outbound` instead. */ export type Outbound = AccountPaymentMethodDeleteResponse$Outbound; } export function accountPaymentMethodDeleteResponseToJSON( accountPaymentMethodDeleteResponse: AccountPaymentMethodDeleteResponse, ): string { return JSON.stringify( AccountPaymentMethodDeleteResponse$outboundSchema.parse( accountPaymentMethodDeleteResponse, ), ); } export function accountPaymentMethodDeleteResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountPaymentMethodDeleteResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountPaymentMethodDeleteResponse' from JSON`, ); }