export type UpdateApiCardsCardIdCardControlsArgs = {cardId: string, body: {categories?: ({type: 'MCC' | 'CATEGORY', values: Array, restriction: 'ALLOWED' | 'BLOCKED'} | null) | undefined, merchants?: ({type: 'MATCH_TERM' | 'MID', values: Array, restriction: 'ALLOWED' | 'BLOCKED'} | null) | undefined, dates?: ({type: 'YEARLY' | 'MONTHLY' | 'WEEKLY' | 'FIXED', values: Array, timezone: string, restriction: 'ALLOWED' | 'BLOCKED'} | null) | undefined, times?: ({type: 'TIMERANGE', values: Array, timezone: string, restriction: 'ALLOWED' | 'BLOCKED'} | null) | undefined, locations?: ({type: 'POSTAL_CODE' | 'REGION', values: Array, restriction: 'ALLOWED' | 'BLOCKED'} | null) | undefined, countries?: ({restriction: 'ALLOWED' | 'BLOCKED', values: Array} | null) | undefined, currencies?: ({restriction: 'ALLOWED' | 'BLOCKED', values: Array} | null) | undefined, acceptanceMethods?: ({type: 'ACCEPTANCE_METHOD', values: Array<'ONLINE' | 'MOBILE_WALLET' | 'MANUAL_ENTRY' | 'CONTACTLESS' | 'CHIP_DIP' | 'NOT_AVAILABLE' | 'MAGNETIC_STRIPE' | 'OTHER'>, restriction: 'ALLOWED'} | null) | undefined}}; export type UpdateApiCardsCardIdCardControlsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change Card Controls * * PUT /cards/{cardId}/card-controls */ export const updateApiCardsCardIdCardControls = async (args: UpdateApiCardsCardIdCardControlsArgs, options?: UpdateApiCardsCardIdCardControlsOptions) => { const {baseUrl = "https://partner-api.getpliant.com/api", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/cards/${encodeURIComponent(String(args.cardId))}/card-controls${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 };