export type CreateApiV1MeCardsCardIdBlockArgs = {cardId: number}; export type CreateApiV1MeCardsCardIdBlockOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Block a Fire debit card * * POST /v1/me/cards/{cardId}/block */ export const createApiV1MeCardsCardIdBlock = async (args: CreateApiV1MeCardsCardIdBlockArgs, options?: CreateApiV1MeCardsCardIdBlockOptions) => { const {baseUrl = "https://api.fire.com/business", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/me/cards/${encodeURIComponent(String(args.cardId))}/block${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };