export type ConsumerId = string; export type CardProductId = string; export type State = 'ACTIVE' | 'SUSPENDED'; export type UpdateApiV2IssuersIssuerIdCardsCardIdArgs = {body: {consumerId: ConsumerId, cardProductId: CardProductId, state?: State | undefined, name: string, secondName?: string | undefined, encryptedData: string}}; export type UpdateApiV2IssuersIssuerIdCardsCardIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Register Card * * PUT /v2/issuers/{issuerId}/cards/{cardId} */ export const updateApiV2IssuersIssuerIdCardsCardId = async (args: UpdateApiV2IssuersIssuerIdCardsCardIdArgs, options?: UpdateApiV2IssuersIssuerIdCardsCardIdOptions) => { const {baseUrl = "https://api.d1.thalescloud.io/authz/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/issuers/${encodeURIComponent(String(args.issuerId))}/cards/${encodeURIComponent(String(args.cardId))}${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 };