export type DeleteApiRolesIdArgs = {id: string, orgkey?: string | undefined}; export type DeleteApiRolesIdOptions = {baseUrl?: string | undefined, cognitoJwtAuthorizer?: string | undefined, fetch?: typeof fetch | undefined}; /** * deleteRole * * DELETE /roles/{id} */ export const deleteApiRolesId = async (args: DeleteApiRolesIdArgs, options?: DeleteApiRolesIdOptions) => { const {baseUrl = "https://api-hub.extensiv.com", fetch: fetchFn = fetch, cognitoJwtAuthorizer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.orgkey != null) query.append("orgkey", String(args.orgkey)) if (cognitoJwtAuthorizer !== undefined) headers.set('authorization', `Bearer ${cognitoJwtAuthorizer}`) const url = `${baseUrl.replace(/\/+$/, '')}/roles/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };