export type CreateApiCustodianDecryptArgs = {'x-tenant-id'?: string | undefined}; export type CreateApiCustodianDecryptOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Unlock the locker * * POST /custodian/decrypt */ export const createApiCustodianDecrypt = async (args: CreateApiCustodianDecryptArgs, options: CreateApiCustodianDecryptOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args['x-tenant-id'] != null) headers.set("x-tenant-id", String(args['x-tenant-id'])) const url = `${baseUrl.replace(/\/+$/, '')}/custodian/decrypt${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 res.text() };