/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { RoleEnum } from '../models/RoleEnum';
import type { User } from '../models/User';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class UserService {
    /**
     * Get the logged in user
     * Return the user associated with the used JWT.
     * Permission `user:read` required.
     * @returns User Successful Response
     * @throws ApiError
     */
    public static userGetLoggedInUser(): CancelablePromise<User> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users/me',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
            },
        });
    }
    /**
     * List users and search by their name
     * Return the users that have a specific substring in their name.
     *
     * Permission `user:read_any` required, except when `name_substring` as only query parameter is set,
     * then permission `user:search` required.
     * @param nameSubstring Filter users by a substring in their name. Permission `user:search` required
     * @param filterRoles Filter users by their role. If multiple are selected, they are concatenating by an OR Expression. Permission `user:read_any` required
     * @param includeRoles Flag whether to include the roles of the users in the response. If True, permission `user:read_any` required.
     * @returns User Successful Response
     * @throws ApiError
     */
    public static userListUsers(
        nameSubstring?: string,
        filterRoles?: Array<RoleEnum>,
        includeRoles: boolean = false,
    ): CancelablePromise<Array<User>> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users',
            query: {
                'name_substring': nameSubstring,
                'filter_roles': filterRoles,
                'include_roles': includeRoles,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Get a user by its uid
     * Return the user with the specific uid.
     *
     * Permission `user:read` required if the current user has the same uid as `uid` otherwise `user:read_any` required.
     * @param uid UID of a user
     * @param includeRoles Flag whether to include the roles of the users in the response. If True, permission `user:read_any` required.
     * @returns User Successful Response
     * @throws ApiError
     */
    public static userGetUser(
        uid: string,
        includeRoles: boolean = false,
    ): CancelablePromise<User> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users/{uid}',
            path: {
                'uid': uid,
            },
            query: {
                'include_roles': includeRoles,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
}