export type UpdateApiCardsCardIdBlockArgs = {cardId: string, 'Accept-Version': string, body: {reason: string}}; export type UpdateApiCardsCardIdBlockOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Block card * * PUT /cards/{cardId}/block */ export const updateApiCardsCardIdBlock = async (args: UpdateApiCardsCardIdBlockArgs, options?: UpdateApiCardsCardIdBlockOptions) => { 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))}/block${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 };