# coding: utf-8

"""
    Conversations Custom Channels

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v3
    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, StrictBool, StrictInt, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from hubspot.conversations.custom_channels.models.collection_response_with_total_public_channel_account_forward_paging import CollectionResponseWithTotalPublicChannelAccountForwardPaging
from hubspot.conversations.custom_channels.models.public_channel_account import PublicChannelAccount
from hubspot.conversations.custom_channels.models.public_channel_account_egg import PublicChannelAccountEgg
from hubspot.conversations.custom_channels.models.public_channel_account_update_request import PublicChannelAccountUpdateRequest

from hubspot.conversations.custom_channels.api_client import ApiClient, RequestSerialized
from hubspot.conversations.custom_channels.api_response import ApiResponse
from hubspot.conversations.custom_channels.rest import RESTResponseType


class ChannelAccountsApi:
    """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 get_conversations_v3_custom_channels_channel_id_channel_accounts(
        self,
        channel_id: StrictInt,
        delivery_identifier_type: Optional[List[StrictStr]] = None,
        delivery_identifier_value: Optional[List[StrictStr]] = None,
        after: Optional[StrictStr] = None,
        limit: Optional[StrictInt] = None,
        sort: Optional[List[StrictStr]] = None,
        default_page_length: Optional[StrictInt] = None,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> CollectionResponseWithTotalPublicChannelAccountForwardPaging:
        """Query channel accounts


        :param channel_id:  (required)
        :type channel_id: int
        :param delivery_identifier_type: 
        :type delivery_identifier_type: List[str]
        :param delivery_identifier_value: 
        :type delivery_identifier_value: List[str]
        :param after: 
        :type after: str
        :param limit: 
        :type limit: int
        :param sort: 
        :type sort: List[str]
        :param default_page_length: 
        :type default_page_length: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            delivery_identifier_type=delivery_identifier_type,
            delivery_identifier_value=delivery_identifier_value,
            after=after,
            limit=limit,
            sort=sort,
            default_page_length=default_page_length,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CollectionResponseWithTotalPublicChannelAccountForwardPaging",
        }
        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 get_conversations_v3_custom_channels_channel_id_channel_accounts_with_http_info(
        self,
        channel_id: StrictInt,
        delivery_identifier_type: Optional[List[StrictStr]] = None,
        delivery_identifier_value: Optional[List[StrictStr]] = None,
        after: Optional[StrictStr] = None,
        limit: Optional[StrictInt] = None,
        sort: Optional[List[StrictStr]] = None,
        default_page_length: Optional[StrictInt] = None,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[CollectionResponseWithTotalPublicChannelAccountForwardPaging]:
        """Query channel accounts


        :param channel_id:  (required)
        :type channel_id: int
        :param delivery_identifier_type: 
        :type delivery_identifier_type: List[str]
        :param delivery_identifier_value: 
        :type delivery_identifier_value: List[str]
        :param after: 
        :type after: str
        :param limit: 
        :type limit: int
        :param sort: 
        :type sort: List[str]
        :param default_page_length: 
        :type default_page_length: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            delivery_identifier_type=delivery_identifier_type,
            delivery_identifier_value=delivery_identifier_value,
            after=after,
            limit=limit,
            sort=sort,
            default_page_length=default_page_length,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CollectionResponseWithTotalPublicChannelAccountForwardPaging",
        }
        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,
        )


    @validate_call
    def get_conversations_v3_custom_channels_channel_id_channel_accounts_without_preload_content(
        self,
        channel_id: StrictInt,
        delivery_identifier_type: Optional[List[StrictStr]] = None,
        delivery_identifier_value: Optional[List[StrictStr]] = None,
        after: Optional[StrictStr] = None,
        limit: Optional[StrictInt] = None,
        sort: Optional[List[StrictStr]] = None,
        default_page_length: Optional[StrictInt] = None,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Query channel accounts


        :param channel_id:  (required)
        :type channel_id: int
        :param delivery_identifier_type: 
        :type delivery_identifier_type: List[str]
        :param delivery_identifier_value: 
        :type delivery_identifier_value: List[str]
        :param after: 
        :type after: str
        :param limit: 
        :type limit: int
        :param sort: 
        :type sort: List[str]
        :param default_page_length: 
        :type default_page_length: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            delivery_identifier_type=delivery_identifier_type,
            delivery_identifier_value=delivery_identifier_value,
            after=after,
            limit=limit,
            sort=sort,
            default_page_length=default_page_length,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _get_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
        self,
        channel_id,
        delivery_identifier_type,
        delivery_identifier_value,
        after,
        limit,
        sort,
        default_page_length,
        archived,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'deliveryIdentifierType': 'multi',
            'deliveryIdentifierValue': 'multi',
            'sort': 'multi',
        }

        _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['channelId'] = channel_id
        # process the query parameters
        if delivery_identifier_type is not None:
            
            _query_params.append(('deliveryIdentifierType', delivery_identifier_type))
            
        if delivery_identifier_value is not None:
            
            _query_params.append(('deliveryIdentifierValue', delivery_identifier_value))
            
        if after is not None:
            
            _query_params.append(('after', after))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if sort is not None:
            
            _query_params.append(('sort', sort))
            
        if default_page_length is not None:
            
            _query_params.append(('defaultPageLength', default_page_length))
            
        if archived is not None:
            
            _query_params.append(('archived', archived))
            
        # 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] = [
            'oauth2', 
            'private_apps'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/conversations/v3/custom-channels/{channelId}/channel-accounts',
            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_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id(
        self,
        channel_id: StrictInt,
        channel_account_id: StrictInt,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PublicChannelAccount:
        """Get a channel account by id

        Retrieve a PublicChannelAccount that contains all the metadata about your channel account. This includes information like its channel, associated inbox id, and delivery identifier information.

        :param channel_id:  (required)
        :type channel_id: int
        :param channel_account_id:  (required)
        :type channel_account_id: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PublicChannelAccount",
        }
        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 get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_with_http_info(
        self,
        channel_id: StrictInt,
        channel_account_id: StrictInt,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PublicChannelAccount]:
        """Get a channel account by id

        Retrieve a PublicChannelAccount that contains all the metadata about your channel account. This includes information like its channel, associated inbox id, and delivery identifier information.

        :param channel_id:  (required)
        :type channel_id: int
        :param channel_account_id:  (required)
        :type channel_account_id: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PublicChannelAccount",
        }
        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,
        )


    @validate_call
    def get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_without_preload_content(
        self,
        channel_id: StrictInt,
        channel_account_id: StrictInt,
        archived: Optional[StrictBool] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get a channel account by id

        Retrieve a PublicChannelAccount that contains all the metadata about your channel account. This includes information like its channel, associated inbox id, and delivery identifier information.

        :param channel_id:  (required)
        :type channel_id: int
        :param channel_account_id:  (required)
        :type channel_account_id: int
        :param archived: 
        :type archived: bool
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            archived=archived,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _get_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
        self,
        channel_id,
        channel_account_id,
        archived,
        _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['channelId'] = channel_id
        if channel_account_id is not None:
            _path_params['channelAccountId'] = channel_account_id
        # process the query parameters
        if archived is not None:
            
            _query_params.append(('archived', archived))
            
        # 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] = [
            'oauth2', 
            'private_apps'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/conversations/v3/custom-channels/{channelId}/channel-accounts/{channelAccountId}',
            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 patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id(
        self,
        channel_id: Annotated[StrictInt, Field(description="The channel to update")],
        channel_account_id: Annotated[StrictInt, Field(description="The channel account to update")],
        public_channel_account_update_request: PublicChannelAccountUpdateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PublicChannelAccount:
        """Update a channel account

        This API is used to update the name of the channel account and it's isAuthorized status. Setting to isAuthorized flag to False disables the channel account.

        :param channel_id: The channel to update (required)
        :type channel_id: int
        :param channel_account_id: The channel account to update (required)
        :type channel_account_id: int
        :param public_channel_account_update_request: (required)
        :type public_channel_account_update_request: PublicChannelAccountUpdateRequest
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            public_channel_account_update_request=public_channel_account_update_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    @validate_call
    def patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_with_http_info(
        self,
        channel_id: Annotated[StrictInt, Field(description="The channel to update")],
        channel_account_id: Annotated[StrictInt, Field(description="The channel account to update")],
        public_channel_account_update_request: PublicChannelAccountUpdateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PublicChannelAccount]:
        """Update a channel account

        This API is used to update the name of the channel account and it's isAuthorized status. Setting to isAuthorized flag to False disables the channel account.

        :param channel_id: The channel to update (required)
        :type channel_id: int
        :param channel_account_id: The channel account to update (required)
        :type channel_account_id: int
        :param public_channel_account_update_request: (required)
        :type public_channel_account_update_request: PublicChannelAccountUpdateRequest
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            public_channel_account_update_request=public_channel_account_update_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PublicChannelAccount",
        }
        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,
        )


    @validate_call
    def patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_without_preload_content(
        self,
        channel_id: Annotated[StrictInt, Field(description="The channel to update")],
        channel_account_id: Annotated[StrictInt, Field(description="The channel account to update")],
        public_channel_account_update_request: PublicChannelAccountUpdateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Update a channel account

        This API is used to update the name of the channel account and it's isAuthorized status. Setting to isAuthorized flag to False disables the channel account.

        :param channel_id: The channel to update (required)
        :type channel_id: int
        :param channel_account_id: The channel account to update (required)
        :type channel_account_id: int
        :param public_channel_account_update_request: (required)
        :type public_channel_account_update_request: PublicChannelAccountUpdateRequest
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
            channel_id=channel_id,
            channel_account_id=channel_account_id,
            public_channel_account_update_request=public_channel_account_update_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _patch_conversations_v3_custom_channels_channel_id_channel_accounts_channel_account_id_serialize(
        self,
        channel_id,
        channel_account_id,
        public_channel_account_update_request,
        _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['channelId'] = channel_id
        if channel_account_id is not None:
            _path_params['channelAccountId'] = channel_account_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if public_channel_account_update_request is not None:
            _body_params = public_channel_account_update_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`
        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] = [
            'oauth2', 
            'private_apps'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/conversations/v3/custom-channels/{channelId}/channel-accounts/{channelAccountId}',
            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 post_conversations_v3_custom_channels_channel_id_channel_accounts(
        self,
        channel_id: StrictInt,
        public_channel_account_egg: PublicChannelAccountEgg,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PublicChannelAccount:
        """Create a channel account

        This API allows you to create one or more accounts that all talk over a single channel but using different delivery identifiers.

        :param channel_id:  (required)
        :type channel_id: int
        :param public_channel_account_egg: (required)
        :type public_channel_account_egg: PublicChannelAccountEgg
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            public_channel_account_egg=public_channel_account_egg,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "PublicChannelAccount",
        }
        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 post_conversations_v3_custom_channels_channel_id_channel_accounts_with_http_info(
        self,
        channel_id: StrictInt,
        public_channel_account_egg: PublicChannelAccountEgg,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PublicChannelAccount]:
        """Create a channel account

        This API allows you to create one or more accounts that all talk over a single channel but using different delivery identifiers.

        :param channel_id:  (required)
        :type channel_id: int
        :param public_channel_account_egg: (required)
        :type public_channel_account_egg: PublicChannelAccountEgg
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            public_channel_account_egg=public_channel_account_egg,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "PublicChannelAccount",
        }
        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,
        )


    @validate_call
    def post_conversations_v3_custom_channels_channel_id_channel_accounts_without_preload_content(
        self,
        channel_id: StrictInt,
        public_channel_account_egg: PublicChannelAccountEgg,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Create a channel account

        This API allows you to create one or more accounts that all talk over a single channel but using different delivery identifiers.

        :param channel_id:  (required)
        :type channel_id: int
        :param public_channel_account_egg: (required)
        :type public_channel_account_egg: PublicChannelAccountEgg
        :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
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
            channel_id=channel_id,
            public_channel_account_egg=public_channel_account_egg,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "PublicChannelAccount",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _post_conversations_v3_custom_channels_channel_id_channel_accounts_serialize(
        self,
        channel_id,
        public_channel_account_egg,
        _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['channelId'] = channel_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if public_channel_account_egg is not None:
            _body_params = public_channel_account_egg


        # 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] = [
            'oauth2', 
            'private_apps'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/conversations/v3/custom-channels/{channelId}/channel-accounts',
            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
        )


