export type CreateAPIUser = {role: string, name: string, csrPem: string, coSignerSetupType?: string | undefined, coSignerSetupIsFirstUser?: boolean | undefined}; export type CreateApiManagementApiUsersArgs = {'Idempotency-Key'?: string | undefined, body: CreateAPIUser}; export type CreateApiManagementApiUsersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create API Key * * POST /management/api_users */ export const createApiManagementApiUsers = async (args: CreateApiManagementApiUsersArgs, options?: CreateApiManagementApiUsersOptions) => { 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(/\/+$/, '')}/management/api_users${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };