export type ChangeRoleRequest = {roles?: Array | undefined}; export type DeleteApiApiV1OrganizationsOrganizationIdUsersUsernameRolesArgs = {organizationId: string, username: string, body: ChangeRoleRequest}; export type DeleteApiApiV1OrganizationsOrganizationIdUsersUsernameRolesOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove role(s) from user * * DELETE /api/v1/organizations/{organizationId}/users/{username}/roles */ export const deleteApiApiV1OrganizationsOrganizationIdUsersUsernameRoles = async (args: DeleteApiApiV1OrganizationsOrganizationIdUsersUsernameRolesArgs, options: DeleteApiApiV1OrganizationsOrganizationIdUsersUsernameRolesOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/organizations/${encodeURIComponent(String(args.organizationId))}/users/${encodeURIComponent(String(args.username))}/roles${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };