# coding: utf-8

"""
    Kestra EE

    All API operations, except for Superadmin-only endpoints, require a tenant identifier in the HTTP path.<br/> Endpoints designated as Superadmin-only are not tenant-scoped.

    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501
# Custom imports
import requests
import sseclient
import json
from typing import Generator


import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictInt, StrictStr
from typing import Any, Dict, List, Optional
from typing_extensions import Annotated
from kestrapy.models.api_patch_super_admin_request import ApiPatchSuperAdminRequest
from kestrapy.models.api_token_list import ApiTokenList
from kestrapy.models.create_api_token_request import CreateApiTokenRequest
from kestrapy.models.create_api_token_response import CreateApiTokenResponse
from kestrapy.models.iam_tenant_access_controller_api_user_tenant_access import IAMTenantAccessControllerApiUserTenantAccess
from kestrapy.models.iam_tenant_access_controller_user_api_autocomplete import IAMTenantAccessControllerUserApiAutocomplete
from kestrapy.models.iam_user_controller_api_create_or_update_user_request import IAMUserControllerApiCreateOrUpdateUserRequest
from kestrapy.models.iam_user_controller_api_patch_restricted_request import IAMUserControllerApiPatchRestrictedRequest
from kestrapy.models.iam_user_controller_api_patch_user_password_request import IAMUserControllerApiPatchUserPasswordRequest
from kestrapy.models.iam_user_controller_api_user import IAMUserControllerApiUser
from kestrapy.models.iam_user_group_controller_api_update_user_groups_request import IAMUserGroupControllerApiUpdateUserGroupsRequest
from kestrapy.models.me_controller_api_update_password_request import MeControllerApiUpdatePasswordRequest
from kestrapy.models.me_controller_api_user_details_request import MeControllerApiUserDetailsRequest
from kestrapy.models.paged_results_iam_user_controller_api_user_summary import PagedResultsIAMUserControllerApiUserSummary

from kestrapy.api_client import ApiClient, RequestSerialized
from kestrapy.api_response import ApiResponse
from kestrapy.rest import RESTResponseType


class UsersApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client

    @validate_call
    def autocomplete_users(
        self,
        tenant: StrictStr,
        iam_tenant_access_controller_user_api_autocomplete: Annotated[IAMTenantAccessControllerUserApiAutocomplete, Field(description="Autocomplete request")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> List[IAMTenantAccessControllerApiUserTenantAccess]:
        """List users for autocomplete


        :param tenant: (required)
        :type tenant: str
                :param iam_tenant_access_controller_user_api_autocomplete: Autocomplete request (required)
        :type iam_tenant_access_controller_user_api_autocomplete: IAMTenantAccessControllerUserApiAutocomplete
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._autocomplete_users_serialize(
            tenant=tenant,
            iam_tenant_access_controller_user_api_autocomplete=iam_tenant_access_controller_user_api_autocomplete,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[IAMTenantAccessControllerApiUserTenantAccess]",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def autocomplete_users_with_http_info(
        self,
        tenant: StrictStr,
        iam_tenant_access_controller_user_api_autocomplete: Annotated[IAMTenantAccessControllerUserApiAutocomplete, Field(description="Autocomplete request")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[List[IAMTenantAccessControllerApiUserTenantAccess]]:
        """List users for autocomplete


        :param tenant: (required)
        :type tenant: str
                :param iam_tenant_access_controller_user_api_autocomplete: Autocomplete request (required)
        :type iam_tenant_access_controller_user_api_autocomplete: IAMTenantAccessControllerUserApiAutocomplete
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._autocomplete_users_serialize(
            tenant=tenant,
            iam_tenant_access_controller_user_api_autocomplete=iam_tenant_access_controller_user_api_autocomplete,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[IAMTenantAccessControllerApiUserTenantAccess]",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _autocomplete_users_serialize(
        self,
        tenant,
        iam_tenant_access_controller_user_api_autocomplete,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_tenant_access_controller_user_api_autocomplete is not None:
            _body_params = iam_tenant_access_controller_user_api_autocomplete



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/{tenant}/tenant-access/autocomplete',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def create_api_tokens_for_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        create_api_token_request: Annotated[CreateApiTokenRequest, Field(description="The create api-token request")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> CreateApiTokenResponse:
        """Create new API Token for a specific user

        Superadmin-only. Create a new API token for a user.

        :param id: The user id (required)
        :type id: str
                :param create_api_token_request: The create api-token request (required)
        :type create_api_token_request: CreateApiTokenRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._create_api_tokens_for_user_serialize(
            id=id,
            create_api_token_request=create_api_token_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "CreateApiTokenResponse",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_api_tokens_for_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        create_api_token_request: Annotated[CreateApiTokenRequest, Field(description="The create api-token request")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[CreateApiTokenResponse]:
        """Create new API Token for a specific user

        Superadmin-only. Create a new API token for a user.

        :param id: The user id (required)
        :type id: str
                :param create_api_token_request: The create api-token request (required)
        :type create_api_token_request: CreateApiTokenRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._create_api_tokens_for_user_serialize(
            id=id,
            create_api_token_request=create_api_token_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "CreateApiTokenResponse",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _create_api_tokens_for_user_serialize(
        self,
        id,
        create_api_token_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if create_api_token_request is not None:
            _body_params = create_api_token_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/users/{id}/api-tokens',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def create_user(
        self,
        iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Create a new user account

        Superadmin-only. Create a new user account with an optional password based authentication method.

        :param iam_user_controller_api_create_or_update_user_request: (required)
        :type iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._create_user_serialize(
            iam_user_controller_api_create_or_update_user_request=iam_user_controller_api_create_or_update_user_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_user_with_http_info(
        self,
        iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Create a new user account

        Superadmin-only. Create a new user account with an optional password based authentication method.

        :param iam_user_controller_api_create_or_update_user_request: (required)
        :type iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._create_user_serialize(
            iam_user_controller_api_create_or_update_user_request=iam_user_controller_api_create_or_update_user_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _create_user_serialize(
        self,
        iam_user_controller_api_create_or_update_user_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_user_controller_api_create_or_update_user_request is not None:
            _body_params = iam_user_controller_api_create_or_update_user_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/users',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def delete_api_token_for_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        token_id: Annotated[StrictStr, Field(description="The token id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Delete an API Token for specific user and token id

        Superadmin-only. Delete an API token for a user.

        :param id: The user id (required)
        :type id: str
                :param token_id: The token id (required)
        :type token_id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_api_token_for_user_serialize(
            id=id,
            token_id=token_id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_api_token_for_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        token_id: Annotated[StrictStr, Field(description="The token id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Delete an API Token for specific user and token id

        Superadmin-only. Delete an API token for a user.

        :param id: The user id (required)
        :type id: str
                :param token_id: The token id (required)
        :type token_id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_api_token_for_user_serialize(
            id=id,
            token_id=token_id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _delete_api_token_for_user_serialize(
        self,
        id,
        token_id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        if token_id is not None:
            _path_params['tokenId'] = token_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter





        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/users/{id}/api-tokens/{tokenId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def delete_refresh_token(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Delete a user refresh token


        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_refresh_token_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_refresh_token_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Delete a user refresh token


        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_refresh_token_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _delete_refresh_token_serialize(
        self,
        id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter





        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/users/{id}/refresh-token',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def delete_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Delete a user

        Superadmin-only. Delete a user including all its access.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Delete a user

        Superadmin-only. Delete a user including all its access.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _delete_user_serialize(
        self,
        id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter





        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/users/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def delete_user_auth_method(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        auth: Annotated[StrictStr, Field(description="The user auth method id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Update user password

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param auth: The user auth method id (required)
        :type auth: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_user_auth_method_serialize(
            id=id,
            auth=auth,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_user_auth_method_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        auth: Annotated[StrictStr, Field(description="The user auth method id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Update user password

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param auth: The user auth method id (required)
        :type auth: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._delete_user_auth_method_serialize(
            id=id,
            auth=auth,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _delete_user_auth_method_serialize(
        self,
        id,
        auth,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        if auth is not None:
            _path_params['auth'] = auth
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/users/{id}/auths/{auth}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def impersonate(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> object:
        """Impersonate a user

        Superadmin-only. Allows an admin to impersonate another user.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._impersonate_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def impersonate_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[object]:
        """Impersonate a user

        Superadmin-only. Allows an admin to impersonate another user.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._impersonate_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _impersonate_serialize(
        self,
        id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/users/{id}/impersonate',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def list_api_tokens_for_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiTokenList:
        """List API tokens for a specific user

        Superadmin-only. Get all API token existing for a user.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._list_api_tokens_for_user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiTokenList",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_api_tokens_for_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[ApiTokenList]:
        """List API tokens for a specific user

        Superadmin-only. Get all API token existing for a user.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._list_api_tokens_for_user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiTokenList",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _list_api_tokens_for_user_serialize(
        self,
        id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/users/{id}/api-tokens',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def list_users(
        self,
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        q: Annotated[Optional[StrictStr], Field(description="A string filter")] = None,
        sort: Annotated[Optional[List[StrictStr]], Field(description="The sort of current page")] = None,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> PagedResultsIAMUserControllerApiUserSummary:
        """Retrieve users


        :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param q: A string filter
        :type q: str
                :param sort: The sort of current page
        :type sort: List[str]
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._list_users_serialize(
            page=page,
            size=size,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsIAMUserControllerApiUserSummary",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_users_with_http_info(
        self,
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        q: Annotated[Optional[StrictStr], Field(description="A string filter")] = None,
        sort: Annotated[Optional[List[StrictStr]], Field(description="The sort of current page")] = None,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[PagedResultsIAMUserControllerApiUserSummary]:
        """Retrieve users


        :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param q: A string filter
        :type q: str
                :param sort: The sort of current page
        :type sort: List[str]
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._list_users_serialize(
            page=page,
            size=size,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsIAMUserControllerApiUserSummary",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _list_users_serialize(
        self,
        page,
        size,
        q,
        sort,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'sort': 'csv',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if q is not None:
            
            _query_params.append(('q', q))
            
        if page is not None:
            
            _query_params.append(('page', page))
            
        if size is not None:
            
            _query_params.append(('size', size))
            
        if sort is not None:
            
            _query_params.append(('sort', sort))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/users',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def patch_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        me_controller_api_user_details_request: Annotated[MeControllerApiUserDetailsRequest, Field(description="The user details")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Update user details

        Superadmin-only. Updates the the details of a user.

        :param id: The user id (required)
        :type id: str
                :param me_controller_api_user_details_request: The user details (required)
        :type me_controller_api_user_details_request: MeControllerApiUserDetailsRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_serialize(
            id=id,
            me_controller_api_user_details_request=me_controller_api_user_details_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def patch_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        me_controller_api_user_details_request: Annotated[MeControllerApiUserDetailsRequest, Field(description="The user details")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Update user details

        Superadmin-only. Updates the the details of a user.

        :param id: The user id (required)
        :type id: str
                :param me_controller_api_user_details_request: The user details (required)
        :type me_controller_api_user_details_request: MeControllerApiUserDetailsRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_serialize(
            id=id,
            me_controller_api_user_details_request=me_controller_api_user_details_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _patch_user_serialize(
        self,
        id,
        me_controller_api_user_details_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if me_controller_api_user_details_request is not None:
            _body_params = me_controller_api_user_details_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/api/v1/users/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def patch_user_demo(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_patch_restricted_request: IAMUserControllerApiPatchRestrictedRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Update user demo

        Superadmin-only. Updates whether a user is for demo.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_patch_restricted_request: (required)
        :type iam_user_controller_api_patch_restricted_request: IAMUserControllerApiPatchRestrictedRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_demo_serialize(
            id=id,
            iam_user_controller_api_patch_restricted_request=iam_user_controller_api_patch_restricted_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def patch_user_demo_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_patch_restricted_request: IAMUserControllerApiPatchRestrictedRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Update user demo

        Superadmin-only. Updates whether a user is for demo.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_patch_restricted_request: (required)
        :type iam_user_controller_api_patch_restricted_request: IAMUserControllerApiPatchRestrictedRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_demo_serialize(
            id=id,
            iam_user_controller_api_patch_restricted_request=iam_user_controller_api_patch_restricted_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _patch_user_demo_serialize(
        self,
        id,
        iam_user_controller_api_patch_restricted_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_user_controller_api_patch_restricted_request is not None:
            _body_params = iam_user_controller_api_patch_restricted_request




        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/api/v1/users/{id}/restricted',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def patch_user_password(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_patch_user_password_request: IAMUserControllerApiPatchUserPasswordRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Update user password

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_patch_user_password_request: (required)
        :type iam_user_controller_api_patch_user_password_request: IAMUserControllerApiPatchUserPasswordRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_password_serialize(
            id=id,
            iam_user_controller_api_patch_user_password_request=iam_user_controller_api_patch_user_password_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def patch_user_password_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_patch_user_password_request: IAMUserControllerApiPatchUserPasswordRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Update user password

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_patch_user_password_request: (required)
        :type iam_user_controller_api_patch_user_password_request: IAMUserControllerApiPatchUserPasswordRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_password_serialize(
            id=id,
            iam_user_controller_api_patch_user_password_request=iam_user_controller_api_patch_user_password_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _patch_user_password_serialize(
        self,
        id,
        iam_user_controller_api_patch_user_password_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_user_controller_api_patch_user_password_request is not None:
            _body_params = iam_user_controller_api_patch_user_password_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/api/v1/users/{id}/password',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def patch_user_super_admin(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        api_patch_super_admin_request: ApiPatchSuperAdminRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Update user superadmin privileges

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param api_patch_super_admin_request: (required)
        :type api_patch_super_admin_request: ApiPatchSuperAdminRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_super_admin_serialize(
            id=id,
            api_patch_super_admin_request=api_patch_super_admin_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def patch_user_super_admin_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        api_patch_super_admin_request: ApiPatchSuperAdminRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Update user superadmin privileges

        Superadmin-only. Updates whether a user is a superadmin.

        :param id: The user id (required)
        :type id: str
                :param api_patch_super_admin_request: (required)
        :type api_patch_super_admin_request: ApiPatchSuperAdminRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._patch_user_super_admin_serialize(
            id=id,
            api_patch_super_admin_request=api_patch_super_admin_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _patch_user_super_admin_serialize(
        self,
        id,
        api_patch_super_admin_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if api_patch_super_admin_request is not None:
            _body_params = api_patch_super_admin_request




        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/api/v1/users/{id}/superadmin',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def update_current_user_password(
        self,
        me_controller_api_update_password_request: MeControllerApiUpdatePasswordRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> object:
        """Update authenticated user password

        Changes the login password for the authenticated user.

        :param me_controller_api_update_password_request: (required)
        :type me_controller_api_update_password_request: MeControllerApiUpdatePasswordRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_current_user_password_serialize(
            me_controller_api_update_password_request=me_controller_api_update_password_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def update_current_user_password_with_http_info(
        self,
        me_controller_api_update_password_request: MeControllerApiUpdatePasswordRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[object]:
        """Update authenticated user password

        Changes the login password for the authenticated user.

        :param me_controller_api_update_password_request: (required)
        :type me_controller_api_update_password_request: MeControllerApiUpdatePasswordRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_current_user_password_serialize(
            me_controller_api_update_password_request=me_controller_api_update_password_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _update_current_user_password_serialize(
        self,
        me_controller_api_update_password_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if me_controller_api_update_password_request is not None:
            _body_params = me_controller_api_update_password_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PUT',
            resource_path='/api/v1/me/password',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def update_user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Update a user account

        Superadmin-only. Update an existing user account with an optional password based authentication method.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_create_or_update_user_request: (required)
        :type iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_user_serialize(
            id=id,
            iam_user_controller_api_create_or_update_user_request=iam_user_controller_api_create_or_update_user_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def update_user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Update a user account

        Superadmin-only. Update an existing user account with an optional password based authentication method.

        :param id: The user id (required)
        :type id: str
                :param iam_user_controller_api_create_or_update_user_request: (required)
        :type iam_user_controller_api_create_or_update_user_request: IAMUserControllerApiCreateOrUpdateUserRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_user_serialize(
            id=id,
            iam_user_controller_api_create_or_update_user_request=iam_user_controller_api_create_or_update_user_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _update_user_serialize(
        self,
        id,
        iam_user_controller_api_create_or_update_user_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_user_controller_api_create_or_update_user_request is not None:
            _body_params = iam_user_controller_api_create_or_update_user_request



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PUT',
            resource_path='/api/v1/users/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def update_user_groups(
        self,
        id: Annotated[StrictStr, Field(description="The user ID")],
        tenant: StrictStr,
        iam_user_group_controller_api_update_user_groups_request: IAMUserGroupControllerApiUpdateUserGroupsRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Update the list of groups a user belongs to for the given tenant


        :param id: The user ID (required)
        :type id: str
                :param tenant: (required)
        :type tenant: str
                :param iam_user_group_controller_api_update_user_groups_request: (required)
        :type iam_user_group_controller_api_update_user_groups_request: IAMUserGroupControllerApiUpdateUserGroupsRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_user_groups_serialize(
            id=id,
            tenant=tenant,
            iam_user_group_controller_api_update_user_groups_request=iam_user_group_controller_api_update_user_groups_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '400': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def update_user_groups_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user ID")],
        tenant: StrictStr,
        iam_user_group_controller_api_update_user_groups_request: IAMUserGroupControllerApiUpdateUserGroupsRequest,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[None]:
        """Update the list of groups a user belongs to for the given tenant


        :param id: The user ID (required)
        :type id: str
                :param tenant: (required)
        :type tenant: str
                :param iam_user_group_controller_api_update_user_groups_request: (required)
        :type iam_user_group_controller_api_update_user_groups_request: IAMUserGroupControllerApiUpdateUserGroupsRequest
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._update_user_groups_serialize(
            id=id,
            tenant=tenant,
            iam_user_group_controller_api_update_user_groups_request=iam_user_group_controller_api_update_user_groups_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
            '400': None,
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _update_user_groups_serialize(
        self,
        id,
        tenant,
        iam_user_group_controller_api_update_user_groups_request,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if iam_user_group_controller_api_update_user_groups_request is not None:
            _body_params = iam_user_group_controller_api_update_user_groups_request




        # set the HTTP header `Content-Type`

        _default_content_type = (
            self.api_client.select_header_content_type(
                [
                    'application/json'
                ]
            )
        )
        if _default_content_type is not None:
            _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PUT',
            resource_path='/api/v1/{tenant}/users/{id}/groups',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )





    @validate_call
    def user(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMUserControllerApiUser:
        """Get a user

        Superadmin-only. Get user account details.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def user_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The user id")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMUserControllerApiUser]:
        """Get a user

        Superadmin-only. Get user account details.

        :param id: The user id (required)
        :type id: str
        ,
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        """ # noqa: E501

        _param = self._user_serialize(
            id=id,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMUserControllerApiUser",
            '404': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    def _user_serialize(
        self,
        id,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter



        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/users/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats
        )




