# coding: utf-8

"""
    Elastic Email REST API

    This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.    Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.    The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request.    To start using this API, you will need your Access Token (available <a target=\"_blank\" href=\"https://app.elasticemail.com/marketing/settings/new/manage-api\">here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description.    Downloadable library clients can be found in our Github repository <a target=\"_blank\" href=\"https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme\">here</a>

    The version of the OpenAPI document: 4.0.0
    Contact: support@elasticemail.com
    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 datetime import datetime
from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from ElasticEmail.models.compression_format import CompressionFormat
from ElasticEmail.models.event_type import EventType
from ElasticEmail.models.events_order_by import EventsOrderBy
from ElasticEmail.models.export_file_formats import ExportFileFormats
from ElasticEmail.models.export_link import ExportLink
from ElasticEmail.models.export_status import ExportStatus
from ElasticEmail.models.recipient_event import RecipientEvent

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


class EventsApi:
    """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 events_by_transactionid_get(
        self,
        transactionid: Annotated[StrictStr, Field(description="ID number of transaction")],
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of returned items.")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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,
    ) -> List[RecipientEvent]:
        """Load Email Events

        Returns a log of delivery events for the specific transaction ID. Required Access Level: ViewReports

        :param transactionid: ID number of transaction (required)
        :type transactionid: str
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: Maximum number of returned items.
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_by_transactionid_get_serialize(
            transactionid=transactionid,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_by_transactionid_get_with_http_info(
        self,
        transactionid: Annotated[StrictStr, Field(description="ID number of transaction")],
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of returned items.")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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[List[RecipientEvent]]:
        """Load Email Events

        Returns a log of delivery events for the specific transaction ID. Required Access Level: ViewReports

        :param transactionid: ID number of transaction (required)
        :type transactionid: str
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: Maximum number of returned items.
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_by_transactionid_get_serialize(
            transactionid=transactionid,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_by_transactionid_get_without_preload_content(
        self,
        transactionid: Annotated[StrictStr, Field(description="ID number of transaction")],
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Maximum number of returned items.")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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:
        """Load Email Events

        Returns a log of delivery events for the specific transaction ID. Required Access Level: ViewReports

        :param transactionid: ID number of transaction (required)
        :type transactionid: str
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: Maximum number of returned items.
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_by_transactionid_get_serialize(
            transactionid=transactionid,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_by_transactionid_get_serialize(
        self,
        transactionid,
        var_from,
        to,
        order_by,
        limit,
        offset,
        _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]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if transactionid is not None:
            _path_params['transactionid'] = transactionid
        # process the query parameters
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if order_by is not None:
            
            _query_params.append(('orderBy', order_by.value))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/events/{transactionid}',
            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 events_channels_by_name_export_post(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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,
    ) -> ExportLink:
        """Export Channel Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_by_name_export_post_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '202': "ExportLink",
        }
        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 events_channels_by_name_export_post_with_http_info(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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[ExportLink]:
        """Export Channel Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_by_name_export_post_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '202': "ExportLink",
        }
        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 events_channels_by_name_export_post_without_preload_content(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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:
        """Export Channel Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_by_name_export_post_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_channels_by_name_export_post_serialize(
        self,
        name,
        event_types,
        var_from,
        to,
        file_format,
        compression_format,
        file_name,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'eventTypes': '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]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if name is not None:
            _path_params['name'] = name
        # process the query parameters
        if event_types is not None:
            
            _query_params.append(('eventTypes', event_types))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if file_format is not None:
            
            _query_params.append(('fileFormat', file_format.value))
            
        if compression_format is not None:
            
            _query_params.append(('compressionFormat', compression_format.value))
            
        if file_name is not None:
            
            _query_params.append(('fileName', file_name))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/events/channels/{name}/export',
            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 events_channels_by_name_get(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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,
    ) -> List[RecipientEvent]:
        """Load Channel Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_channels_by_name_get_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_channels_by_name_get_with_http_info(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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[List[RecipientEvent]]:
        """Load Channel Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_channels_by_name_get_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_channels_by_name_get_without_preload_content(
        self,
        name: Annotated[StrictStr, Field(description="Name of selected channel.")],
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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:
        """Load Channel Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param name: Name of selected channel. (required)
        :type name: str
        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_channels_by_name_get_serialize(
            name=name,
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_channels_by_name_get_serialize(
        self,
        name,
        event_types,
        var_from,
        to,
        order_by,
        limit,
        offset,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'eventTypes': '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]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if name is not None:
            _path_params['name'] = name
        # process the query parameters
        if event_types is not None:
            
            _query_params.append(('eventTypes', event_types))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if order_by is not None:
            
            _query_params.append(('orderBy', order_by.value))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/events/channels/{name}',
            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 events_channels_export_by_id_status_get(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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,
    ) -> ExportStatus:
        """Check Channel Export Status

        Check the current status of the channel export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExportStatus",
        }
        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 events_channels_export_by_id_status_get_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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[ExportStatus]:
        """Check Channel Export Status

        Check the current status of the channel export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExportStatus",
        }
        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 events_channels_export_by_id_status_get_without_preload_content(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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:
        """Check Channel Export Status

        Check the current status of the channel export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_channels_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_channels_export_by_id_status_get_serialize(
        self,
        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]] = {}
        _body_params: Optional[bytes] = None

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


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/events/channels/export/{id}/status',
            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 events_export_by_id_status_get(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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,
    ) -> ExportStatus:
        """Check Export Status

        Check the current status of the export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExportStatus",
        }
        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 events_export_by_id_status_get_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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[ExportStatus]:
        """Check Export Status

        Check the current status of the export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExportStatus",
        }
        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 events_export_by_id_status_get_without_preload_content(
        self,
        id: Annotated[StrictStr, Field(description="ID of the exported file")],
        _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:
        """Check Export Status

        Check the current status of the export. Required Access Level: Export

        :param id: ID of the exported file (required)
        :type id: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_by_id_status_get_serialize(
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_export_by_id_status_get_serialize(
        self,
        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]] = {}
        _body_params: Optional[bytes] = None

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


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/events/export/{id}/status',
            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 events_export_post(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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,
    ) -> ExportLink:
        """Export Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_post_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '202': "ExportLink",
        }
        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 events_export_post_with_http_info(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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[ExportLink]:
        """Export Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_post_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '202': "ExportLink",
        }
        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 events_export_post_without_preload_content(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        file_format: Annotated[Optional[ExportFileFormats], Field(description="Format of the exported file")] = None,
        compression_format: Annotated[Optional[CompressionFormat], Field(description="FileResponse compression format. None or Zip.")] = None,
        file_name: Annotated[Optional[StrictStr], Field(description="Name of your file including extension.")] = 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:
        """Export Events

        Export delivery events log information to the specified file format. Required Access Level: Export

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param file_format: Format of the exported file
        :type file_format: ExportFileFormats
        :param compression_format: FileResponse compression format. None or Zip.
        :type compression_format: CompressionFormat
        :param file_name: Name of your file including extension.
        :type file_name: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :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._events_export_post_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            file_format=file_format,
            compression_format=compression_format,
            file_name=file_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_export_post_serialize(
        self,
        event_types,
        var_from,
        to,
        file_format,
        compression_format,
        file_name,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'eventTypes': '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]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if event_types is not None:
            
            _query_params.append(('eventTypes', event_types))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if file_format is not None:
            
            _query_params.append(('fileFormat', file_format.value))
            
        if compression_format is not None:
            
            _query_params.append(('compressionFormat', compression_format.value))
            
        if file_name is not None:
            
            _query_params.append(('fileName', file_name))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/events/export',
            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 events_get(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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,
    ) -> List[RecipientEvent]:
        """Load Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_get_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_get_with_http_info(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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[List[RecipientEvent]]:
        """Load Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_get_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[RecipientEvent]",
        }
        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 events_get_without_preload_content(
        self,
        event_types: Annotated[Optional[List[EventType]], Field(description="Types of Events to return")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Starting date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        to: Annotated[Optional[datetime], Field(description="Ending date for search in YYYY-MM-DDThh:mm:ss format.")] = None,
        order_by: Optional[EventsOrderBy] = None,
        limit: Annotated[Optional[StrictInt], Field(description="How many items to load. Maximum for this request is 1000 items")] = None,
        offset: Annotated[Optional[StrictInt], Field(description="How many items should be returned ahead.")] = 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:
        """Load Events

        Returns a log of delivery events filtered by specified parameters. Required Access Level: ViewReports

        :param event_types: Types of Events to return
        :type event_types: List[EventType]
        :param var_from: Starting date for search in YYYY-MM-DDThh:mm:ss format.
        :type var_from: datetime
        :param to: Ending date for search in YYYY-MM-DDThh:mm:ss format.
        :type to: datetime
        :param order_by:
        :type order_by: EventsOrderBy
        :param limit: How many items to load. Maximum for this request is 1000 items
        :type limit: int
        :param offset: How many items should be returned ahead.
        :type offset: int
        :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._events_get_serialize(
            event_types=event_types,
            var_from=var_from,
            to=to,
            order_by=order_by,
            limit=limit,
            offset=offset,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _events_get_serialize(
        self,
        event_types,
        var_from,
        to,
        order_by,
        limit,
        offset,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'eventTypes': '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]] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if event_types is not None:
            
            _query_params.append(('eventTypes', event_types))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if order_by is not None:
            
            _query_params.append(('orderBy', order_by.value))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'apikey'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/events',
            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
        )


