export type DeleteApiPublicV1UsersUserIdRolesRoleNameArgs = {userId: number, roleName: string}; export type DeleteApiPublicV1UsersUserIdRolesRoleNameOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revoke a specific role from a user * * DELETE /public/v1/users/{userId}/roles/{roleName} */ export const deleteApiPublicV1UsersUserIdRolesRoleName = async (args: DeleteApiPublicV1UsersUserIdRolesRoleNameArgs, options?: DeleteApiPublicV1UsersUserIdRolesRoleNameOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/users/${encodeURIComponent(String(args.userId))}/roles/${encodeURIComponent(String(args.roleName))}${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 };