export type EnableDevice = {enabled: boolean}; export type PatchApiNcwWalletsWalletIdDevicesDeviceIdStatusArgs = {'Idempotency-Key'?: string | undefined, walletId: string, deviceId: string, body: EnableDevice}; export type PatchApiNcwWalletsWalletIdDevicesDeviceIdStatusOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update device status * * PATCH /ncw/wallets/{walletId}/devices/{deviceId}/status */ export const patchApiNcwWalletsWalletIdDevicesDeviceIdStatus = async (args: PatchApiNcwWalletsWalletIdDevicesDeviceIdStatusArgs, options?: PatchApiNcwWalletsWalletIdDevicesDeviceIdStatusOptions) => { const {baseUrl = "https://api.fireblocks.io/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/ncw/wallets/${encodeURIComponent(String(args.walletId))}/devices/${encodeURIComponent(String(args.deviceId))}/status${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };