# coding: utf-8

"""
    World News API

    The world's news wrapped into a single API.

    The version of the OpenAPI document: 1.3.1
    Contact: mail@worldnewsapi.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 pydantic import Field, StrictBool, field_validator
from typing import Any, Dict, Optional, Union
from typing_extensions import Annotated
from worldnewsapi.models.extract_news200_response import ExtractNews200Response
from worldnewsapi.models.extract_news_links200_response import ExtractNewsLinks200Response
from worldnewsapi.models.get_geo_coordinates200_response import GetGeoCoordinates200Response
from worldnewsapi.models.newspaper_front_pages200_response import NewspaperFrontPages200Response
from worldnewsapi.models.retrieve_news_articles_by_ids200_response import RetrieveNewsArticlesByIds200Response
from worldnewsapi.models.search_news200_response import SearchNews200Response
from worldnewsapi.models.top_news200_response import TopNews200Response

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


class NewsApi:
    """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 extract_news(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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,
    ) -> ExtractNews200Response:
        """Extract News

        Extract a news article from a website to a well structure JSON object. The API will return the title, text, URL, images, videos, publish date, authors, language, source country, and sentiment of the news article.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_serialize(url=url,
                                              analyze=analyze,
                                              _request_auth=_request_auth,
                                              _content_type=_content_type,
                                              _headers=_headers,
                                              _host_index=_host_index)

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

    @validate_call
    def extract_news_with_http_info(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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[ExtractNews200Response]:
        """Extract News

        Extract a news article from a website to a well structure JSON object. The API will return the title, text, URL, images, videos, publish date, authors, language, source country, and sentiment of the news article.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_serialize(url=url,
                                              analyze=analyze,
                                              _request_auth=_request_auth,
                                              _content_type=_content_type,
                                              _headers=_headers,
                                              _host_index=_host_index)

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

    @validate_call
    def extract_news_without_preload_content(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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:
        """Extract News

        Extract a news article from a website to a well structure JSON object. The API will return the title, text, URL, images, videos, publish date, authors, language, source country, and sentiment of the news article.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_serialize(url=url,
                                              analyze=analyze,
                                              _request_auth=_request_auth,
                                              _content_type=_content_type,
                                              _headers=_headers,
                                              _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExtractNews200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _extract_news_serialize(
        self,
        url,
        analyze,
        _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
        # process the query parameters
        if url is not None:

            _query_params.append(('url', url))

        if analyze is not None:

            _query_params.append(('analyze', analyze))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/extract-news',
            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 extract_news_links(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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,
    ) -> ExtractNewsLinks200Response:
        """Extract News Links

        Extract news links from a news website.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_links_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def extract_news_links_with_http_info(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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[ExtractNewsLinks200Response]:
        """Extract News Links

        Extract news links from a news website.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_links_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def extract_news_links_without_preload_content(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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:
        """Extract News Links

        Extract news links from a news website.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._extract_news_links_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ExtractNewsLinks200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _extract_news_links_serialize(
        self,
        url,
        analyze,
        _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
        # process the query parameters
        if url is not None:

            _query_params.append(('url', url))

        if analyze is not None:

            _query_params.append(('analyze', analyze))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/extract-news-links',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth)

    @validate_call
    def get_geo_coordinates(
        self,
        location: Annotated[
            str,
            Field(strict=True,
                  max_length=1000,
                  description="The address or name of the location.")],
        _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,
    ) -> GetGeoCoordinates200Response:
        """Get Geo Coordinates

        Retrieve the latitude and longitude of a location name. Given this information you can fill the location-filter parameter in the news search endpoint.

        :param location: The address or name of the location. (required)
        :type location: 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._get_geo_coordinates_serialize(
            location=location,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def get_geo_coordinates_with_http_info(
        self,
        location: Annotated[
            str,
            Field(strict=True,
                  max_length=1000,
                  description="The address or name of the location.")],
        _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[GetGeoCoordinates200Response]:
        """Get Geo Coordinates

        Retrieve the latitude and longitude of a location name. Given this information you can fill the location-filter parameter in the news search endpoint.

        :param location: The address or name of the location. (required)
        :type location: 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._get_geo_coordinates_serialize(
            location=location,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def get_geo_coordinates_without_preload_content(
        self,
        location: Annotated[
            str,
            Field(strict=True,
                  max_length=1000,
                  description="The address or name of the location.")],
        _request_timeout: Union[None, Annotated[StrictFloat,
                                                Field(gt=0)],
                                Tuple[Annotated[StrictFloat,
                                                Field(gt=0)],
                                      Annotated[StrictFloat,
                                                Field(gt=0)]]] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Geo Coordinates

        Retrieve the latitude and longitude of a location name. Given this information you can fill the location-filter parameter in the news search endpoint.

        :param location: The address or name of the location. (required)
        :type location: 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._get_geo_coordinates_serialize(
            location=location,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetGeoCoordinates200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _get_geo_coordinates_serialize(
        self,
        location,
        _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
        # process the query parameters
        if location is not None:

            _query_params.append(('location', location))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/geo-coordinates',
            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 news_website_to_rss_feed(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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,
    ) -> object:
        """News Website to RSS Feed

        Turn a news website into an RSS feed. Any page of a news website can be turned into an RSS feed. Provide the URL to the page and the API will return an RSS feed with the latest news from that page.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._news_website_to_rss_feed_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def news_website_to_rss_feed_with_http_info(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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[object]:
        """News Website to RSS Feed

        Turn a news website into an RSS feed. Any page of a news website can be turned into an RSS feed. Provide the URL to the page and the API will return an RSS feed with the latest news from that page.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._news_website_to_rss_feed_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def news_website_to_rss_feed_without_preload_content(
        self,
        url: Annotated[str,
                       Field(strict=True,
                             max_length=1000,
                             description="The url of the news.")],
        analyze: Annotated[
            StrictBool,
            Field(description=
                  "Whether to analyze the news (extract entities etc.)")],
        _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:
        """News Website to RSS Feed

        Turn a news website into an RSS feed. Any page of a news website can be turned into an RSS feed. Provide the URL to the page and the API will return an RSS feed with the latest news from that page.

        :param url: The url of the news. (required)
        :type url: str
        :param analyze: Whether to analyze the news (extract entities etc.) (required)
        :type analyze: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._news_website_to_rss_feed_serialize(
            url=url,
            analyze=analyze,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "object",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _news_website_to_rss_feed_serialize(
        self,
        url,
        analyze,
        _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
        # process the query parameters
        if url is not None:

            _query_params.append(('url', url))

        if analyze is not None:

            _query_params.append(('analyze', analyze))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/feed.rss',
            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 newspaper_front_pages(
        self,
        source_country: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(description=
                  "The ISO 3166 country code of the newspaper publication."
                  )] = None,
        source_name: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description=
                  "The identifier of the publication see attached list."
                  )] = None,
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09."
            )] = 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,
    ) -> NewspaperFrontPages200Response:
        """Newspaper Front Pages

        Get the front pages of newspapers from around the world. The API provides images of the front pages of newspapers from different countries. Here's an example of some of today's newspapers:

        :param source_country: The ISO 3166 country code of the newspaper publication.
        :type source_country: str
        :param source_name: The identifier of the publication see attached list.
        :type source_name: str
        :param var_date: The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09.
        :type var_date: 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._newspaper_front_pages_serialize(
            source_country=source_country,
            source_name=source_name,
            var_date=var_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def newspaper_front_pages_with_http_info(
        self,
        source_country: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(description=
                  "The ISO 3166 country code of the newspaper publication."
                  )] = None,
        source_name: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description=
                  "The identifier of the publication see attached list."
                  )] = None,
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09."
            )] = 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[NewspaperFrontPages200Response]:
        """Newspaper Front Pages

        Get the front pages of newspapers from around the world. The API provides images of the front pages of newspapers from different countries. Here's an example of some of today's newspapers:

        :param source_country: The ISO 3166 country code of the newspaper publication.
        :type source_country: str
        :param source_name: The identifier of the publication see attached list.
        :type source_name: str
        :param var_date: The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09.
        :type var_date: 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._newspaper_front_pages_serialize(
            source_country=source_country,
            source_name=source_name,
            var_date=var_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def newspaper_front_pages_without_preload_content(
        self,
        source_country: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(description=
                  "The ISO 3166 country code of the newspaper publication."
                  )] = None,
        source_name: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description=
                  "The identifier of the publication see attached list."
                  )] = None,
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09."
            )] = 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:
        """Newspaper Front Pages

        Get the front pages of newspapers from around the world. The API provides images of the front pages of newspapers from different countries. Here's an example of some of today's newspapers:

        :param source_country: The ISO 3166 country code of the newspaper publication.
        :type source_country: str
        :param source_name: The identifier of the publication see attached list.
        :type source_name: str
        :param var_date: The date for which the front page should be retrieved. You can also go into the past, the earliest date is 2024-07-09.
        :type var_date: 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._newspaper_front_pages_serialize(
            source_country=source_country,
            source_name=source_name,
            var_date=var_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "NewspaperFrontPages200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _newspaper_front_pages_serialize(
        self,
        source_country,
        source_name,
        var_date,
        _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
        # process the query parameters
        if source_country is not None:

            _query_params.append(('source-country', source_country))

        if source_name is not None:

            _query_params.append(('source-name', source_name))

        if var_date is not None:

            _query_params.append(('date', var_date))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/retrieve-front-page',
            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 retrieve_news_articles_by_ids(
        self,
        ids: Annotated[
            str,
            Field(strict=True,
                  max_length=10000,
                  description="A comma separated list of news ids.")],
        _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,
    ) -> RetrieveNewsArticlesByIds200Response:
        """Retrieve News Articles by Ids

        Retrieve information about one or more news articles by their ids. The ids can be retrieved from the search news or top news APIs.

        :param ids: A comma separated list of news ids. (required)
        :type ids: 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._retrieve_news_articles_by_ids_serialize(
            ids=ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def retrieve_news_articles_by_ids_with_http_info(
        self,
        ids: Annotated[
            str,
            Field(strict=True,
                  max_length=10000,
                  description="A comma separated list of news ids.")],
        _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[RetrieveNewsArticlesByIds200Response]:
        """Retrieve News Articles by Ids

        Retrieve information about one or more news articles by their ids. The ids can be retrieved from the search news or top news APIs.

        :param ids: A comma separated list of news ids. (required)
        :type ids: 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._retrieve_news_articles_by_ids_serialize(
            ids=ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def retrieve_news_articles_by_ids_without_preload_content(
        self,
        ids: Annotated[
            str,
            Field(strict=True,
                  max_length=10000,
                  description="A comma separated list of news ids.")],
        _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:
        """Retrieve News Articles by Ids

        Retrieve information about one or more news articles by their ids. The ids can be retrieved from the search news or top news APIs.

        :param ids: A comma separated list of news ids. (required)
        :type ids: 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._retrieve_news_articles_by_ids_serialize(
            ids=ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "RetrieveNewsArticlesByIds200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _retrieve_news_articles_by_ids_serialize(
        self,
        ids,
        _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
        # process the query parameters
        if ids is not None:

            _query_params.append(('ids', ids))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/retrieve-news',
            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 search_news(
        self,
        text: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford"
            )] = None,
        source_countries: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "A comma-separated list of ISO 3166 country codes from which the news should originate."
            )] = None,
        language: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(
                description="The ISO 6391 language code of the news.")] = None,
        min_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The minimal sentiment of the news in range [-1,1]."
            )] = None,
        max_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The maximal sentiment of the news in range [-1,1]."
            )] = None,
        earliest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description="The news must have been published after this date."
            )] = None,
        latest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description=
                "The news must have been published before this date.")] = None,
        news_sources: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(
                description=
                "A comma-separated list of news sources from which the news should originate."
            )] = None,
        authors: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of author names. Only news from any of the given authors will be returned."
            )] = None,
        categories: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other."
            )] = None,
        entities: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(description="Filter news by entities (see semantic types)."
                  )] = None,
        location_filter: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers."
            )] = None,
        sort: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description="The sorting criteria (publish-time).")] = None,
        sort_direction: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=4)]],
            Field(description=
                  "Whether to sort ascending or descending (ASC or DESC)."
                  )] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(le=10000, strict=True, ge=0)]],
            Field(description="The number of news to skip in range [0,10000]"
                  )] = None,
        number: Annotated[
            Optional[Annotated[int, Field(le=100, strict=True, ge=1)]],
            Field(description="The number of news to return in range [1,100]"
                  )] = 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,
    ) -> SearchNews200Response:
        """Search News

        Search and filter news by text, date, location, category, language, and more. The API returns a list of news articles matching the given criteria. You can set as many filtering parameters as you like, but you have to set at least one, e.g. text or language.

        :param text: The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford
        :type text: str
        :param source_countries: A comma-separated list of ISO 3166 country codes from which the news should originate.
        :type source_countries: str
        :param language: The ISO 6391 language code of the news.
        :type language: str
        :param min_sentiment: The minimal sentiment of the news in range [-1,1].
        :type min_sentiment: float
        :param max_sentiment: The maximal sentiment of the news in range [-1,1].
        :type max_sentiment: float
        :param earliest_publish_date: The news must have been published after this date.
        :type earliest_publish_date: str
        :param latest_publish_date: The news must have been published before this date.
        :type latest_publish_date: str
        :param news_sources: A comma-separated list of news sources from which the news should originate.
        :type news_sources: str
        :param authors: A comma-separated list of author names. Only news from any of the given authors will be returned.
        :type authors: str
        :param categories: A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other.
        :type categories: str
        :param entities: Filter news by entities (see semantic types).
        :type entities: str
        :param location_filter: Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers.
        :type location_filter: str
        :param sort: The sorting criteria (publish-time).
        :type sort: str
        :param sort_direction: Whether to sort ascending or descending (ASC or DESC).
        :type sort_direction: str
        :param offset: The number of news to skip in range [0,10000]
        :type offset: int
        :param number: The number of news to return in range [1,100]
        :type number: 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._search_news_serialize(
            text=text,
            source_countries=source_countries,
            language=language,
            min_sentiment=min_sentiment,
            max_sentiment=max_sentiment,
            earliest_publish_date=earliest_publish_date,
            latest_publish_date=latest_publish_date,
            news_sources=news_sources,
            authors=authors,
            categories=categories,
            entities=entities,
            location_filter=location_filter,
            sort=sort,
            sort_direction=sort_direction,
            offset=offset,
            number=number,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def search_news_with_http_info(
        self,
        text: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford"
            )] = None,
        source_countries: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "A comma-separated list of ISO 3166 country codes from which the news should originate."
            )] = None,
        language: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(
                description="The ISO 6391 language code of the news.")] = None,
        min_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The minimal sentiment of the news in range [-1,1]."
            )] = None,
        max_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The maximal sentiment of the news in range [-1,1]."
            )] = None,
        earliest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description="The news must have been published after this date."
            )] = None,
        latest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description=
                "The news must have been published before this date.")] = None,
        news_sources: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(
                description=
                "A comma-separated list of news sources from which the news should originate."
            )] = None,
        authors: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of author names. Only news from any of the given authors will be returned."
            )] = None,
        categories: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other."
            )] = None,
        entities: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(description="Filter news by entities (see semantic types)."
                  )] = None,
        location_filter: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers."
            )] = None,
        sort: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description="The sorting criteria (publish-time).")] = None,
        sort_direction: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=4)]],
            Field(description=
                  "Whether to sort ascending or descending (ASC or DESC)."
                  )] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(le=10000, strict=True, ge=0)]],
            Field(description="The number of news to skip in range [0,10000]"
                  )] = None,
        number: Annotated[
            Optional[Annotated[int, Field(le=100, strict=True, ge=1)]],
            Field(description="The number of news to return in range [1,100]"
                  )] = 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[SearchNews200Response]:
        """Search News

        Search and filter news by text, date, location, category, language, and more. The API returns a list of news articles matching the given criteria. You can set as many filtering parameters as you like, but you have to set at least one, e.g. text or language.

        :param text: The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford
        :type text: str
        :param source_countries: A comma-separated list of ISO 3166 country codes from which the news should originate.
        :type source_countries: str
        :param language: The ISO 6391 language code of the news.
        :type language: str
        :param min_sentiment: The minimal sentiment of the news in range [-1,1].
        :type min_sentiment: float
        :param max_sentiment: The maximal sentiment of the news in range [-1,1].
        :type max_sentiment: float
        :param earliest_publish_date: The news must have been published after this date.
        :type earliest_publish_date: str
        :param latest_publish_date: The news must have been published before this date.
        :type latest_publish_date: str
        :param news_sources: A comma-separated list of news sources from which the news should originate.
        :type news_sources: str
        :param authors: A comma-separated list of author names. Only news from any of the given authors will be returned.
        :type authors: str
        :param categories: A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other.
        :type categories: str
        :param entities: Filter news by entities (see semantic types).
        :type entities: str
        :param location_filter: Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers.
        :type location_filter: str
        :param sort: The sorting criteria (publish-time).
        :type sort: str
        :param sort_direction: Whether to sort ascending or descending (ASC or DESC).
        :type sort_direction: str
        :param offset: The number of news to skip in range [0,10000]
        :type offset: int
        :param number: The number of news to return in range [1,100]
        :type number: 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._search_news_serialize(
            text=text,
            source_countries=source_countries,
            language=language,
            min_sentiment=min_sentiment,
            max_sentiment=max_sentiment,
            earliest_publish_date=earliest_publish_date,
            latest_publish_date=latest_publish_date,
            news_sources=news_sources,
            authors=authors,
            categories=categories,
            entities=entities,
            location_filter=location_filter,
            sort=sort,
            sort_direction=sort_direction,
            offset=offset,
            number=number,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

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

    @validate_call
    def search_news_without_preload_content(
        self,
        text: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford"
            )] = None,
        source_countries: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "A comma-separated list of ISO 3166 country codes from which the news should originate."
            )] = None,
        language: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=2)]],
            Field(
                description="The ISO 6391 language code of the news.")] = None,
        min_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The minimal sentiment of the news in range [-1,1]."
            )] = None,
        max_sentiment: Annotated[
            Optional[Union[Annotated[float,
                                     Field(le=1, strict=True, ge=-1)],
                           Annotated[int, Field(le=1, strict=True, ge=-1)]]],
            Field(
                description="The maximal sentiment of the news in range [-1,1]."
            )] = None,
        earliest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description="The news must have been published after this date."
            )] = None,
        latest_publish_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=19)]],
            Field(
                description=
                "The news must have been published before this date.")] = None,
        news_sources: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(
                description=
                "A comma-separated list of news sources from which the news should originate."
            )] = None,
        authors: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of author names. Only news from any of the given authors will be returned."
            )] = None,
        categories: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=300)]],
            Field(
                description=
                "A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other."
            )] = None,
        entities: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10000)]],
            Field(description="Filter news by entities (see semantic types)."
                  )] = None,
        location_filter: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(
                description=
                "Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers."
            )] = None,
        sort: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=100)]],
            Field(description="The sorting criteria (publish-time).")] = None,
        sort_direction: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=4)]],
            Field(description=
                  "Whether to sort ascending or descending (ASC or DESC)."
                  )] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(le=10000, strict=True, ge=0)]],
            Field(description="The number of news to skip in range [0,10000]"
                  )] = None,
        number: Annotated[
            Optional[Annotated[int, Field(le=100, strict=True, ge=1)]],
            Field(description="The number of news to return in range [1,100]"
                  )] = 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:
        """Search News

        Search and filter news by text, date, location, category, language, and more. The API returns a list of news articles matching the given criteria. You can set as many filtering parameters as you like, but you have to set at least one, e.g. text or language.

        :param text: The text to match in the news content (at least 3 characters, maximum 100 characters). By default all query terms are expected, you can use an uppercase OR to search for any terms, e.g. tesla OR ford
        :type text: str
        :param source_countries: A comma-separated list of ISO 3166 country codes from which the news should originate.
        :type source_countries: str
        :param language: The ISO 6391 language code of the news.
        :type language: str
        :param min_sentiment: The minimal sentiment of the news in range [-1,1].
        :type min_sentiment: float
        :param max_sentiment: The maximal sentiment of the news in range [-1,1].
        :type max_sentiment: float
        :param earliest_publish_date: The news must have been published after this date.
        :type earliest_publish_date: str
        :param latest_publish_date: The news must have been published before this date.
        :type latest_publish_date: str
        :param news_sources: A comma-separated list of news sources from which the news should originate.
        :type news_sources: str
        :param authors: A comma-separated list of author names. Only news from any of the given authors will be returned.
        :type authors: str
        :param categories: A comma-separated list of categories. Only news from any of the given categories will be returned. Possible categories are politics, sports, business, technology, entertainment, health, science, lifestyle, travel, culture, education, environment, other.
        :type categories: str
        :param entities: Filter news by entities (see semantic types).
        :type entities: str
        :param location_filter: Filter news by radius around a certain location. Format is \"latitude,longitude,radius in kilometers\". Radius must be between 1 and 100 kilometers.
        :type location_filter: str
        :param sort: The sorting criteria (publish-time).
        :type sort: str
        :param sort_direction: Whether to sort ascending or descending (ASC or DESC).
        :type sort_direction: str
        :param offset: The number of news to skip in range [0,10000]
        :type offset: int
        :param number: The number of news to return in range [1,100]
        :type number: 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._search_news_serialize(
            text=text,
            source_countries=source_countries,
            language=language,
            min_sentiment=min_sentiment,
            max_sentiment=max_sentiment,
            earliest_publish_date=earliest_publish_date,
            latest_publish_date=latest_publish_date,
            news_sources=news_sources,
            authors=authors,
            categories=categories,
            entities=entities,
            location_filter=location_filter,
            sort=sort,
            sort_direction=sort_direction,
            offset=offset,
            number=number,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "SearchNews200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _search_news_serialize(
        self,
        text,
        source_countries,
        language,
        min_sentiment,
        max_sentiment,
        earliest_publish_date,
        latest_publish_date,
        news_sources,
        authors,
        categories,
        entities,
        location_filter,
        sort,
        sort_direction,
        offset,
        number,
        _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
        # process the query parameters
        if text is not None:

            _query_params.append(('text', text))

        if source_countries is not None:

            _query_params.append(('source-countries', source_countries))

        if language is not None:

            _query_params.append(('language', language))

        if min_sentiment is not None:

            _query_params.append(('min-sentiment', min_sentiment))

        if max_sentiment is not None:

            _query_params.append(('max-sentiment', max_sentiment))

        if earliest_publish_date is not None:

            _query_params.append(
                ('earliest-publish-date', earliest_publish_date))

        if latest_publish_date is not None:

            _query_params.append(('latest-publish-date', latest_publish_date))

        if news_sources is not None:

            _query_params.append(('news-sources', news_sources))

        if authors is not None:

            _query_params.append(('authors', authors))

        if categories is not None:

            _query_params.append(('categories', categories))

        if entities is not None:

            _query_params.append(('entities', entities))

        if location_filter is not None:

            _query_params.append(('location-filter', location_filter))

        if sort is not None:

            _query_params.append(('sort', sort))

        if sort_direction is not None:

            _query_params.append(('sort-direction', sort_direction))

        if offset is not None:

            _query_params.append(('offset', offset))

        if number is not None:

            _query_params.append(('number', number))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/search-news',
            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 top_news(
        self,
        source_country: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 3166 country code of the country for which top news should be retrieved."
            )],
        language: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 6391 language code of the top news. The language must be one spoken in the source-country."
            )],
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the top news should be retrieved. If no date is given, the current day is assumed."
            )] = None,
        headlines_only: Annotated[
            Optional[StrictBool],
            Field(
                description=
                "Whether to only return basic information such as id, title, and url of the news."
            )] = 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,
    ) -> TopNews200Response:
        """Top News

        Get the top news from a country in a language for a specific date. The top news are clustered from multiple sources in the given country. The more news in a cluster the higher the cluster is ranked.

        :param source_country: The ISO 3166 country code of the country for which top news should be retrieved. (required)
        :type source_country: str
        :param language: The ISO 6391 language code of the top news. The language must be one spoken in the source-country. (required)
        :type language: str
        :param var_date: The date for which the top news should be retrieved. If no date is given, the current day is assumed.
        :type var_date: str
        :param headlines_only: Whether to only return basic information such as id, title, and url of the news.
        :type headlines_only: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._top_news_serialize(source_country=source_country,
                                          language=language,
                                          var_date=var_date,
                                          headlines_only=headlines_only,
                                          _request_auth=_request_auth,
                                          _content_type=_content_type,
                                          _headers=_headers,
                                          _host_index=_host_index)

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

    @validate_call
    def top_news_with_http_info(
        self,
        source_country: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 3166 country code of the country for which top news should be retrieved."
            )],
        language: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 6391 language code of the top news. The language must be one spoken in the source-country."
            )],
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the top news should be retrieved. If no date is given, the current day is assumed."
            )] = None,
        headlines_only: Annotated[
            Optional[StrictBool],
            Field(
                description=
                "Whether to only return basic information such as id, title, and url of the news."
            )] = 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[TopNews200Response]:
        """Top News

        Get the top news from a country in a language for a specific date. The top news are clustered from multiple sources in the given country. The more news in a cluster the higher the cluster is ranked.

        :param source_country: The ISO 3166 country code of the country for which top news should be retrieved. (required)
        :type source_country: str
        :param language: The ISO 6391 language code of the top news. The language must be one spoken in the source-country. (required)
        :type language: str
        :param var_date: The date for which the top news should be retrieved. If no date is given, the current day is assumed.
        :type var_date: str
        :param headlines_only: Whether to only return basic information such as id, title, and url of the news.
        :type headlines_only: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._top_news_serialize(source_country=source_country,
                                          language=language,
                                          var_date=var_date,
                                          headlines_only=headlines_only,
                                          _request_auth=_request_auth,
                                          _content_type=_content_type,
                                          _headers=_headers,
                                          _host_index=_host_index)

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

    @validate_call
    def top_news_without_preload_content(
        self,
        source_country: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 3166 country code of the country for which top news should be retrieved."
            )],
        language: Annotated[
            str,
            Field(
                strict=True,
                max_length=2,
                description=
                "The ISO 6391 language code of the top news. The language must be one spoken in the source-country."
            )],
        var_date: Annotated[
            Optional[Annotated[str, Field(strict=True, max_length=10)]],
            Field(
                description=
                "The date for which the top news should be retrieved. If no date is given, the current day is assumed."
            )] = None,
        headlines_only: Annotated[
            Optional[StrictBool],
            Field(
                description=
                "Whether to only return basic information such as id, title, and url of the news."
            )] = 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:
        """Top News

        Get the top news from a country in a language for a specific date. The top news are clustered from multiple sources in the given country. The more news in a cluster the higher the cluster is ranked.

        :param source_country: The ISO 3166 country code of the country for which top news should be retrieved. (required)
        :type source_country: str
        :param language: The ISO 6391 language code of the top news. The language must be one spoken in the source-country. (required)
        :type language: str
        :param var_date: The date for which the top news should be retrieved. If no date is given, the current day is assumed.
        :type var_date: str
        :param headlines_only: Whether to only return basic information such as id, title, and url of the news.
        :type headlines_only: bool
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._top_news_serialize(source_country=source_country,
                                          language=language,
                                          var_date=var_date,
                                          headlines_only=headlines_only,
                                          _request_auth=_request_auth,
                                          _content_type=_content_type,
                                          _headers=_headers,
                                          _host_index=_host_index)

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TopNews200Response",
            '401': None,
            '402': None,
            '403': None,
            '404': None,
            '406': None,
            '429': None,
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout)
        return response_data.response

    def _top_news_serialize(
        self,
        source_country,
        language,
        var_date,
        headlines_only,
        _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
        # process the query parameters
        if source_country is not None:

            _query_params.append(('source-country', source_country))

        if language is not None:

            _query_params.append(('language', language))

        if var_date is not None:

            _query_params.append(('date', var_date))

        if headlines_only is not None:

            _query_params.append(('headlines-only', headlines_only))

        # process the header parameters
        # process the form parameters
        # process the body parameter

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

        # authentication setting
        _auth_settings: List[str] = ['apiKey', 'headerApiKey']

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