# 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 List, Optional
from typing_extensions import Annotated
from kestrapy.models.api_autocomplete import ApiAutocomplete
from kestrapy.models.api_group_summary import ApiGroupSummary
from kestrapy.models.api_ids import ApiIds
from kestrapy.models.group_identifier_membership import GroupIdentifierMembership
from kestrapy.models.iam_group_controller_api_create_group_request import IAMGroupControllerApiCreateGroupRequest
from kestrapy.models.iam_group_controller_api_group_detail import IAMGroupControllerApiGroupDetail
from kestrapy.models.iam_group_controller_api_group_member import IAMGroupControllerApiGroupMember
from kestrapy.models.iam_group_controller_api_update_group_request import IAMGroupControllerApiUpdateGroupRequest
from kestrapy.models.paged_results_api_group_summary import PagedResultsApiGroupSummary
from kestrapy.models.paged_results_iam_group_controller_api_group_member import PagedResultsIAMGroupControllerApiGroupMember

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


class GroupsApi:
    """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 add_user_to_group(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user to add to the group")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupMember:
        """Add a user to a group

        Adds the specified user to the given group. If the user does not already have access to the tenant, tenant access will be created automatically.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user to add to the group (required)
        :type user_id: str
                :param tenant: (required)
        :type tenant: 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._add_user_to_group_serialize(
            id=id,
            user_id=user_id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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 add_user_to_group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user to add to the group")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupMember]:
        """Add a user to a group

        Adds the specified user to the given group. If the user does not already have access to the tenant, tenant access will be created automatically.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user to add to the group (required)
        :type user_id: str
                :param tenant: (required)
        :type tenant: 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._add_user_to_group_serialize(
            id=id,
            user_id=user_id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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 _add_user_to_group_serialize(
        self,
        id,
        user_id,
        tenant,
    ) -> 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 user_id is not None:
            _path_params['userId'] = user_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



        # 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='PUT',
            resource_path='/api/v1/{tenant}/groups/{id}/members/{userId}',
            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 autocomplete_groups(
        self,
        tenant: StrictStr,
        api_autocomplete: Annotated[ApiAutocomplete, 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[ApiGroupSummary]:
        """List groups for autocomplete


        :param tenant: (required)
        :type tenant: str
                :param api_autocomplete: Autocomplete request (required)
        :type api_autocomplete: ApiAutocomplete
        ,
        :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_groups_serialize(
            tenant=tenant,
            api_autocomplete=api_autocomplete,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ApiGroupSummary]",
        }
        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_groups_with_http_info(
        self,
        tenant: StrictStr,
        api_autocomplete: Annotated[ApiAutocomplete, 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[ApiGroupSummary]]:
        """List groups for autocomplete


        :param tenant: (required)
        :type tenant: str
                :param api_autocomplete: Autocomplete request (required)
        :type api_autocomplete: ApiAutocomplete
        ,
        :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_groups_serialize(
            tenant=tenant,
            api_autocomplete=api_autocomplete,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ApiGroupSummary]",
        }
        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_groups_serialize(
        self,
        tenant,
        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 api_autocomplete is not None:
            _body_params = 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}/groups/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_group(
        self,
        tenant: StrictStr,
        iam_group_controller_api_create_group_request: Annotated[IAMGroupControllerApiCreateGroupRequest, Field(description="The group")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupDetail:
        """Create a group


        :param tenant: (required)
        :type tenant: str
                :param iam_group_controller_api_create_group_request: The group (required)
        :type iam_group_controller_api_create_group_request: IAMGroupControllerApiCreateGroupRequest
        ,
        :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_group_serialize(
            tenant=tenant,
            iam_group_controller_api_create_group_request=iam_group_controller_api_create_group_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '409': 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_group_with_http_info(
        self,
        tenant: StrictStr,
        iam_group_controller_api_create_group_request: Annotated[IAMGroupControllerApiCreateGroupRequest, Field(description="The group")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupDetail]:
        """Create a group


        :param tenant: (required)
        :type tenant: str
                :param iam_group_controller_api_create_group_request: The group (required)
        :type iam_group_controller_api_create_group_request: IAMGroupControllerApiCreateGroupRequest
        ,
        :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_group_serialize(
            tenant=tenant,
            iam_group_controller_api_create_group_request=iam_group_controller_api_create_group_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '409': 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_group_serialize(
        self,
        tenant,
        iam_group_controller_api_create_group_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 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_group_controller_api_create_group_request is not None:
            _body_params = iam_group_controller_api_create_group_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/{tenant}/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 delete_group(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> None:
        """Delete a group


        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: 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_group_serialize(
            id=id,
            tenant=tenant,
        )

        _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 delete_group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        _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 group


        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: 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_group_serialize(
            id=id,
            tenant=tenant,
        )

        _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 _delete_group_serialize(
        self,
        id,
        tenant,
    ) -> 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





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

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/{tenant}/groups/{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_from_group(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user to remove from the group")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupMember:
        """Remove a user from a group

        Removes the specified user from the given group. If the user has no other group bindings within the tenant, their access to the tenant will also be revoked.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user to remove from the group (required)
        :type user_id: str
                :param tenant: (required)
        :type tenant: 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_from_group_serialize(
            id=id,
            user_id=user_id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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_from_group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user to remove from the group")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupMember]:
        """Remove a user from a group

        Removes the specified user from the given group. If the user has no other group bindings within the tenant, their access to the tenant will also be revoked.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user to remove from the group (required)
        :type user_id: str
                :param tenant: (required)
        :type tenant: 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_from_group_serialize(
            id=id,
            user_id=user_id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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_from_group_serialize(
        self,
        id,
        user_id,
        tenant,
    ) -> 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 user_id is not None:
            _path_params['userId'] = user_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



        # 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/{tenant}/groups/{id}/members/{userId}',
            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 group(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupDetail:
        """Retrieve a group

        Retrieves details of a specific group by its ID within the current tenant.

        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: 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._group_serialize(
            id=id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '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 group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupDetail]:
        """Retrieve a group

        Retrieves details of a specific group by its ID within the current tenant.

        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: 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._group_serialize(
            id=id,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '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 _group_serialize(
        self,
        id,
        tenant,
    ) -> 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



        # 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/{tenant}/groups/{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 list_group_ids(
        self,
        tenant: StrictStr,
        api_ids: Annotated[ApiIds, Field(description="The ids that must be present on results")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> List[ApiGroupSummary]:
        """List groups by ids


        :param tenant: (required)
        :type tenant: str
                :param api_ids: The ids that must be present on results (required)
        :type api_ids: ApiIds
        ,
        :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_group_ids_serialize(
            tenant=tenant,
            api_ids=api_ids,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ApiGroupSummary]",
        }
        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_group_ids_with_http_info(
        self,
        tenant: StrictStr,
        api_ids: Annotated[ApiIds, Field(description="The ids that must be present on results")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[List[ApiGroupSummary]]:
        """List groups by ids


        :param tenant: (required)
        :type tenant: str
                :param api_ids: The ids that must be present on results (required)
        :type api_ids: ApiIds
        ,
        :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_group_ids_serialize(
            tenant=tenant,
            api_ids=api_ids,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ApiGroupSummary]",
        }
        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_group_ids_serialize(
        self,
        tenant,
        api_ids,
    ) -> 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 api_ids is not None:
            _body_params = api_ids



        # 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}/groups/ids',
            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 search_group_members(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        tenant: StrictStr,
        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
    ) -> PagedResultsIAMGroupControllerApiGroupMember:
        """Search for users in a group


        :param id: The group id (required)
        :type id: str
                :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param tenant: (required)
        :type tenant: str
                :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._search_group_members_serialize(
            id=id,
            page=page,
            size=size,
            tenant=tenant,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsIAMGroupControllerApiGroupMember",
        }
        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 search_group_members_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        tenant: StrictStr,
        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[PagedResultsIAMGroupControllerApiGroupMember]:
        """Search for users in a group


        :param id: The group id (required)
        :type id: str
                :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param tenant: (required)
        :type tenant: str
                :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._search_group_members_serialize(
            id=id,
            page=page,
            size=size,
            tenant=tenant,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsIAMGroupControllerApiGroupMember",
        }
        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 _search_group_members_serialize(
        self,
        id,
        page,
        size,
        tenant,
        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
        if id is not None:
            _path_params['id'] = id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # 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/{tenant}/groups/{id}/members',
            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 search_groups(
        self,
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        tenant: StrictStr,
        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
    ) -> PagedResultsApiGroupSummary:
        """Search for groups


        :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param tenant: (required)
        :type tenant: str
                :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._search_groups_serialize(
            page=page,
            size=size,
            tenant=tenant,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsApiGroupSummary",
        }
        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 search_groups_with_http_info(
        self,
        page: Annotated[StrictInt, Field(description="The current page")],
        size: Annotated[StrictInt, Field(description="The current page size")],
        tenant: StrictStr,
        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[PagedResultsApiGroupSummary]:
        """Search for groups


        :param page: The current page (required)
        :type page: int
                :param size: The current page size (required)
        :type size: int
                :param tenant: (required)
        :type tenant: str
                :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._search_groups_serialize(
            page=page,
            size=size,
            tenant=tenant,
            q=q,
            sort=sort,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsApiGroupSummary",
        }
        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 _search_groups_serialize(
        self,
        page,
        size,
        tenant,
        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
        if tenant is not None:
            _path_params['tenant'] = tenant
        # 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/{tenant}/groups/search',
            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 set_user_membership_for_group(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user whose membership is being updated")],
        membership: Annotated[GroupIdentifierMembership, Field(description="The new membership type to assign to the user.")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupMember:
        """Update a user's membership type in a group

        Allows a group owner or an authorized user to change the role of a user within a group to OWNER or MEMBER.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user whose membership is being updated (required)
        :type user_id: str
                :param membership: The new membership type to assign to the user. (required)
        :type membership: GroupIdentifierMembership
                :param tenant: (required)
        :type tenant: 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._set_user_membership_for_group_serialize(
            id=id,
            user_id=user_id,
            membership=membership,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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 set_user_membership_for_group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the group")],
        user_id: Annotated[StrictStr, Field(description="The ID of the user whose membership is being updated")],
        membership: Annotated[GroupIdentifierMembership, Field(description="The new membership type to assign to the user.")],
        tenant: StrictStr,
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupMember]:
        """Update a user's membership type in a group

        Allows a group owner or an authorized user to change the role of a user within a group to OWNER or MEMBER.

        :param id: The ID of the group (required)
        :type id: str
                :param user_id: The ID of the user whose membership is being updated (required)
        :type user_id: str
                :param membership: The new membership type to assign to the user. (required)
        :type membership: GroupIdentifierMembership
                :param tenant: (required)
        :type tenant: 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._set_user_membership_for_group_serialize(
            id=id,
            user_id=user_id,
            membership=membership,
            tenant=tenant,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupMember",
            '404': None,
            '409': 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 _set_user_membership_for_group_serialize(
        self,
        id,
        user_id,
        membership,
        tenant,
    ) -> 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 user_id is not None:
            _path_params['userId'] = user_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if membership is not None:
            
            _query_params.append(('membership', membership.value))
            
        # 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='PUT',
            resource_path='/api/v1/{tenant}/groups/{id}/members/membership/{userId}',
            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_group(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        iam_group_controller_api_update_group_request: Annotated[IAMGroupControllerApiUpdateGroupRequest, Field(description="The group")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> IAMGroupControllerApiGroupDetail:
        """Update a group


        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: str
                :param iam_group_controller_api_update_group_request: The group (required)
        :type iam_group_controller_api_update_group_request: IAMGroupControllerApiUpdateGroupRequest
        ,
        :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_group_serialize(
            id=id,
            tenant=tenant,
            iam_group_controller_api_update_group_request=iam_group_controller_api_update_group_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '404': None,
            '409': 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_group_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The group id")],
        tenant: StrictStr,
        iam_group_controller_api_update_group_request: Annotated[IAMGroupControllerApiUpdateGroupRequest, Field(description="The group")],
        _request_timeout: Union[
        None,
        Annotated[StrictFloat, Field(gt=0)],
        Tuple[
        Annotated[StrictFloat, Field(gt=0)],
        Annotated[StrictFloat, Field(gt=0)]
        ]
        ] = None
    ) -> ApiResponse[IAMGroupControllerApiGroupDetail]:
        """Update a group


        :param id: The group id (required)
        :type id: str
                :param tenant: (required)
        :type tenant: str
                :param iam_group_controller_api_update_group_request: The group (required)
        :type iam_group_controller_api_update_group_request: IAMGroupControllerApiUpdateGroupRequest
        ,
        :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_group_serialize(
            id=id,
            tenant=tenant,
            iam_group_controller_api_update_group_request=iam_group_controller_api_update_group_request,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "IAMGroupControllerApiGroupDetail",
            '404': None,
            '409': 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_group_serialize(
        self,
        id,
        tenant,
        iam_group_controller_api_update_group_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_group_controller_api_update_group_request is not None:
            _body_params = iam_group_controller_api_update_group_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/{tenant}/groups/{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
        )




