export type UpdateApiCardsCardIdReplaceArgs = {cardId: string, 'Accept-Version': string, body: {renewOption?: ('IDENTICAL_TO_THE_CURRENT_CARD' | 'CALCULATE_NEW_EXPIRY_DATE' | 'NEW_CARD_NUMBER_WITH_SAME_EXPIRY_DATE' | 'NEW_CARD_NUMBER_WITH_NEW_EXPIRY_DATE' | 'SAME_CARD_NUMBER_WITH_NEW_CUSTOM_EXPIRY' | 'NEW_CARD_NUMBER_WITH_NEW_CUSTOM_EXPIRY') | undefined, expiryDate?: string | undefined, shippingInformation?: ({shippingAddress?: ({line1: string, line2?: (string | null) | undefined, zone?: (string | null) | undefined, city: string, postalCode: string, country: string}) | undefined, recipientFirstName?: string | undefined, recipientLastName?: string | undefined, recipientPhoneNumber?: string | undefined, recipientDialCode?: number | undefined, recipientEmail?: string | undefined, cardDesign?: string | undefined}) | undefined}}; export type UpdateApiCardsCardIdReplaceOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reissue Card * * PUT /cards/{cardId}/replace */ export const updateApiCardsCardIdReplace = async (args: UpdateApiCardsCardIdReplaceArgs, options?: UpdateApiCardsCardIdReplaceOptions) => { const {baseUrl = "https://sandbox.api.caas.reap.global", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Version'] != null) headers.set("Accept-Version", String(args['Accept-Version'])) if (ApiKeyAuth !== undefined) headers.set("x-reap-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/cards/${encodeURIComponent(String(args.cardId))}/replace${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };