# coding: utf-8

"""
    Ephor.ai

    Collaborative AI

    The version of the OpenAPI document: 1.3.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

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, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from ephor_server_ti_client.models.channel import Channel
from ephor_server_ti_client.models.channel_create import ChannelCreate
from ephor_server_ti_client.models.channel_message import ChannelMessage
from ephor_server_ti_client.models.channel_update import ChannelUpdate
from ephor_server_ti_client.models.create_channel200_response import CreateChannel200Response

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


class ChannelsApi:
    """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 create_channel_api_v1_projects_project_id_channels_post_0(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_create: Optional[ChannelCreate] = None,
    ) -> CreateChannel200Response:
        """Create a new channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_create:
        :type channel_create: ChannelCreate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_channel_api_v1_projects_project_id_channels_post_0_serialize(
            project_id=project_id,
            channel_create=channel_create,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def create_channel_api_v1_projects_project_id_channels_post_0_with_http_info(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_create: Optional[ChannelCreate] = None,
    ) -> ApiResponse[CreateChannel200Response]:
        """Create a new channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_create:
        :type channel_create: ChannelCreate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_channel_api_v1_projects_project_id_channels_post_0_serialize(
            project_id=project_id,
            channel_create=channel_create,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def create_channel_api_v1_projects_project_id_channels_post_0_without_preload_content(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_create: Optional[ChannelCreate] = None,
    ) -> RESTResponseType:
        """Create a new channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_create:
        :type channel_create: ChannelCreate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_channel_api_v1_projects_project_id_channels_post_0_serialize(
            project_id=project_id,
            channel_create=channel_create,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CreateChannel200Response",
            '422': "HTTPValidationError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _create_channel_api_v1_projects_project_id_channels_post_0_serialize(
        self,
        project_id,
        channel_create,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 project_id is not None:
            _path_params['project_id'] = project_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if channel_create is not None:
            _body_params = channel_create


        # 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`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/projects/{project_id}/channels',
            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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to delete")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> Channel:
        """Delete a channel by ID


        :param channel_id: The id of the channel to delete (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_with_http_info(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to delete")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> ApiResponse[Channel]:
        """Delete a channel by ID


        :param channel_id: The id of the channel to delete (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_without_preload_content(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to delete")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> RESTResponseType:
        """Delete a channel by ID


        :param channel_id: The id of the channel to delete (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Channel",
            '404': None,
            '422': "HTTPValidationError",
            '500': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _delete_channel_api_v1_projects_project_id_channels_channel_id_delete_0_serialize(
        self,
        channel_id,
        project_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 channel_id is not None:
            _path_params['channel_id'] = channel_id
        if project_id is not None:
            _path_params['project_id'] = project_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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/projects/{project_id}/channels/{channel_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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to fork")],
    ) -> Channel:
        """Fork a channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to fork (required)
        :type channel_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_with_http_info(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to fork")],
    ) -> ApiResponse[Channel]:
        """Fork a channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to fork (required)
        :type channel_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_without_preload_content(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to fork")],
    ) -> RESTResponseType:
        """Fork a channel


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to fork (required)
        :type channel_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Channel",
            '404': None,
            '422': "HTTPValidationError",
            '500': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _fork_channel_api_v1_projects_project_id_channels_channel_id_fork_post_0_serialize(
        self,
        project_id,
        channel_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 project_id is not None:
            _path_params['project_id'] = project_id
        if channel_id is not None:
            _path_params['channel_id'] = channel_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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/api/v1/projects/{project_id}/channels/{channel_id}/fork',
            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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_channel_api_v1_projects_project_id_channels_channel_id_get_0(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> Channel:
        """Get a channel by ID


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_api_v1_projects_project_id_channels_channel_id_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channel_api_v1_projects_project_id_channels_channel_id_get_0_with_http_info(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> ApiResponse[Channel]:
        """Get a channel by ID


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_api_v1_projects_project_id_channels_channel_id_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channel_api_v1_projects_project_id_channels_channel_id_get_0_without_preload_content(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> RESTResponseType:
        """Get a channel by ID


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_api_v1_projects_project_id_channels_channel_id_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Channel",
            '404': None,
            '422': "HTTPValidationError",
            '500': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _get_channel_api_v1_projects_project_id_channels_channel_id_get_0_serialize(
        self,
        channel_id,
        project_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 channel_id is not None:
            _path_params['channel_id'] = channel_id
        if project_id is not None:
            _path_params['project_id'] = project_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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/projects/{project_id}/channels/{channel_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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> List[ChannelMessage]:
        """Get messages for a channel


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_with_http_info(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> ApiResponse[List[ChannelMessage]]:
        """Get messages for a channel


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_without_preload_content(
        self,
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to retrieve")],
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
    ) -> RESTResponseType:
        """Get messages for a channel


        :param channel_id: The id of the channel to retrieve (required)
        :type channel_id: str
        :param project_id: The id of the project (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_serialize(
            channel_id=channel_id,
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ChannelMessage]",
            '422': "HTTPValidationError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _get_channel_messages_api_v1_projects_project_id_channels_channel_id_messages_get_0_serialize(
        self,
        channel_id,
        project_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 channel_id is not None:
            _path_params['channel_id'] = channel_id
        if project_id is not None:
            _path_params['project_id'] = project_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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/projects/{project_id}/channels/{channel_id}/messages',
            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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_channels_api_v1_projects_project_id_channels_get_0(
        self,
        project_id: StrictStr,
    ) -> List[Channel]:
        """Get channels for a project


        :param project_id: (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channels_api_v1_projects_project_id_channels_get_0_serialize(
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channels_api_v1_projects_project_id_channels_get_0_with_http_info(
        self,
        project_id: StrictStr,
    ) -> ApiResponse[List[Channel]]:
        """Get channels for a project


        :param project_id: (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channels_api_v1_projects_project_id_channels_get_0_serialize(
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def get_channels_api_v1_projects_project_id_channels_get_0_without_preload_content(
        self,
        project_id: StrictStr,
    ) -> RESTResponseType:
        """Get channels for a project


        :param project_id: (required)
        :type project_id: str
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_channels_api_v1_projects_project_id_channels_get_0_serialize(
            project_id=project_id,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[Channel]",
            '422': "HTTPValidationError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _get_channels_api_v1_projects_project_id_channels_get_0_serialize(
        self,
        project_id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 project_id is not None:
            _path_params['project_id'] = project_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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/projects/{project_id}/channels',
            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,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to update")],
        channel_update: ChannelUpdate,
    ) -> Channel:
        """Update the channel name


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to update (required)
        :type channel_id: str
        :param channel_update: (required)
        :type channel_update: ChannelUpdate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            channel_update=channel_update,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_with_http_info(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to update")],
        channel_update: ChannelUpdate,
    ) -> ApiResponse[Channel]:
        """Update the channel name


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to update (required)
        :type channel_id: str
        :param channel_update: (required)
        :type channel_update: ChannelUpdate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            channel_update=channel_update,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

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


    @validate_call
    def update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_without_preload_content(
        self,
        project_id: Annotated[StrictStr, Field(description="The id of the project")],
        channel_id: Annotated[StrictStr, Field(description="The id of the channel to update")],
        channel_update: ChannelUpdate,
    ) -> RESTResponseType:
        """Update the channel name


        :param project_id: The id of the project (required)
        :type project_id: str
        :param channel_id: The id of the channel to update (required)
        :type channel_id: str
        :param channel_update: (required)
        :type channel_update: ChannelUpdate
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_serialize(
            project_id=project_id,
            channel_id=channel_id,
            channel_update=channel_update,
            _request_auth=None,
            _content_type=None,
            _headers=None,
            _host_index=0
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Channel",
            '400': None,
            '404': None,
            '422': "HTTPValidationError",
            '500': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=None
        )
        return response_data.response


    def _update_channel_name_api_v1_projects_project_id_channels_channel_id_patch_0_serialize(
        self,
        project_id,
        channel_id,
        channel_update,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> 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]] = _headers or {}
        _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 project_id is not None:
            _path_params['project_id'] = project_id
        if channel_id is not None:
            _path_params['channel_id'] = channel_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if channel_update is not None:
            _body_params = channel_update


        # 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`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _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] = [
            'APIKeyHeader'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/api/v1/projects/{project_id}/channels/{channel_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,
            _host=_host,
            _request_auth=_request_auth
        )


