/*
 * NewsCatcher News API V2
 *
 * NewsCatcher is a data-as-a-service startup that has one main goal: to build the largest database of structured news articles published online. In other words, we're like Google for the news part of the web, which you can access as a source of data.  Some useful links: - [How NewsCatcher Works](https://docs.newscatcherapi.com/knowledge-base/how-newscatcher-works) - [GitHub for the Python SDK](https://github.com/NewscatcherAPI/newscatcherapi-sdk-python) 
 *
 * The version of the OpenAPI document: 1.0.1
 * Contact: lyhxr@example.com
 * Generated by: https://konfigthis.com
 */


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Net.Mime;
using Newscatcherapi.Net.Client;
using Newscatcherapi.Net.Model;

namespace Newscatcherapi.Net.Api
{

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface ISearchApiSync : IApiAccessor
    {
        #region Synchronous Operations
        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>Model200Response</returns>
        Model200Response Get(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0);

        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Model200Response</returns>
        ApiResponse<Model200Response> GetWithHttpInfo(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0);
        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>Model200Response</returns>
        Model200Response Post(Search search = default(Search), int operationIndex = 0);

        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Model200Response</returns>
        ApiResponse<Model200Response> PostWithHttpInfo(Search search = default(Search), int operationIndex = 0);
        #endregion Synchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface ISearchApiAsync : IApiAccessor
    {
        #region Asynchronous Operations
        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Model200Response</returns>
        System.Threading.Tasks.Task<Model200Response> GetAsync(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (Model200Response)</returns>
        System.Threading.Tasks.Task<ApiResponse<Model200Response>> GetWithHttpInfoAsync(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Model200Response</returns>
        System.Threading.Tasks.Task<Model200Response> PostAsync(Search search = default(Search), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Search for specific news articles
        /// </summary>
        /// <remarks>
        /// Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </remarks>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (Model200Response)</returns>
        System.Threading.Tasks.Task<ApiResponse<Model200Response>> PostWithHttpInfoAsync(Search search = default(Search), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        #endregion Asynchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface ISearchApi : ISearchApiSync, ISearchApiAsync
    {

    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public partial class SearchApi : ISearchApi
    {
        private Newscatcherapi.Net.Client.ExceptionFactory _exceptionFactory = (name, response) => null;

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchApi"/> class.
        /// </summary>
        /// <returns></returns>
        public SearchApi() : this((string)null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchApi"/> class.
        /// </summary>
        /// <returns></returns>
        public SearchApi(string basePath)
        {
            this.Configuration = Newscatcherapi.Net.Client.Configuration.MergeConfigurations(
                Newscatcherapi.Net.Client.GlobalConfiguration.Instance,
                new Newscatcherapi.Net.Client.Configuration { BasePath = basePath }
            );
            this.Client = new Newscatcherapi.Net.Client.ApiClient(this.Configuration.BasePath);
            this.AsynchronousClient = new Newscatcherapi.Net.Client.ApiClient(this.Configuration.BasePath);
            this.ExceptionFactory = Newscatcherapi.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public SearchApi(Newscatcherapi.Net.Client.Configuration configuration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");

            this.Configuration = Newscatcherapi.Net.Client.Configuration.MergeConfigurations(
                Newscatcherapi.Net.Client.GlobalConfiguration.Instance,
                configuration
            );
            this.Client = new Newscatcherapi.Net.Client.ApiClient(this.Configuration.BasePath);
            this.AsynchronousClient = new Newscatcherapi.Net.Client.ApiClient(this.Configuration.BasePath);
            ExceptionFactory = Newscatcherapi.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchApi"/> class
        /// using a Configuration object and client instance.
        /// </summary>
        /// <param name="client">The client interface for synchronous API access.</param>
        /// <param name="asyncClient">The client interface for asynchronous API access.</param>
        /// <param name="configuration">The configuration object.</param>
        public SearchApi(Newscatcherapi.Net.Client.ISynchronousClient client, Newscatcherapi.Net.Client.IAsynchronousClient asyncClient, Newscatcherapi.Net.Client.IReadableConfiguration configuration)
        {
            if (client == null) throw new ArgumentNullException("client");
            if (asyncClient == null) throw new ArgumentNullException("asyncClient");
            if (configuration == null) throw new ArgumentNullException("configuration");

            this.Client = client;
            this.AsynchronousClient = asyncClient;
            this.Configuration = configuration;
            this.ExceptionFactory = Newscatcherapi.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// The client for accessing this underlying API asynchronously.
        /// </summary>
        public Newscatcherapi.Net.Client.IAsynchronousClient AsynchronousClient { get; set; }

        /// <summary>
        /// The client for accessing this underlying API synchronously.
        /// </summary>
        public Newscatcherapi.Net.Client.ISynchronousClient Client { get; set; }

        /// <summary>
        /// Gets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        public string GetBasePath()
        {
            return this.Configuration.BasePath;
        }

        /// <summary>
        /// Gets or sets the configuration object
        /// </summary>
        /// <value>An instance of the Configuration</value>
        public Newscatcherapi.Net.Client.IReadableConfiguration Configuration { get; set; }

        /// <summary>
        /// Provides a factory method hook for the creation of exceptions.
        /// </summary>
        public Newscatcherapi.Net.Client.ExceptionFactory ExceptionFactory
        {
            get
            {
                if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
                {
                    throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
                }
                return _exceptionFactory;
            }
            set { _exceptionFactory = value; }
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>Model200Response</returns>
        public Model200Response Get(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0)
        {
            Newscatcherapi.Net.Client.ApiResponse<Model200Response> localVarResponse = GetWithHttpInfo(q, lang, notLang, publishedDatePrecision, from, to, searchIn, countries, notCountries, topic, sources, notSources, rankedOnly, fromRank, toRank, sortBy, pageSize, page);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Model200Response</returns>
        public Newscatcherapi.Net.Client.ApiResponse<Model200Response> GetWithHttpInfo(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0)
        {
            // verify the required parameter 'q' is set
            if (q == null)
            {
                throw new Newscatcherapi.Net.Client.ApiException(400, "Missing required parameter 'q' when calling SearchApi->Get");
            }

            Newscatcherapi.Net.Client.RequestOptions localVarRequestOptions = new Newscatcherapi.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "q", q));
            if (lang != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "lang", lang));
            }
            if (notLang != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_lang", notLang));
            }
            if (publishedDatePrecision != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "published_date_precision", publishedDatePrecision));
            }
            if (from != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "from", from));
            }
            if (to != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "to", to));
            }
            if (searchIn != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "search_in", searchIn));
            }
            if (countries != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "countries", countries));
            }
            if (notCountries != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_countries", notCountries));
            }
            if (topic != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "topic", topic));
            }
            if (sources != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "sources", sources));
            }
            if (notSources != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_sources", notSources));
            }
            if (rankedOnly != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "ranked_only", rankedOnly));
            }
            if (fromRank != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "from_rank", fromRank));
            }
            if (toRank != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "to_rank", toRank));
            }
            if (sortBy != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "sort_by", sortBy));
            }
            if (pageSize != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "page_size", pageSize));
            }
            if (page != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "page", page));
            }

            localVarRequestOptions.Operation = "SearchApi.Get";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (api_key) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-api-key")))
            {
                localVarRequestOptions.HeaderParameters.Add("x-api-key", this.Configuration.GetApiKeyWithPrefix("x-api-key"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get<Model200Response>("/search", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Get", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Model200Response</returns>
        public async System.Threading.Tasks.Task<Model200Response> GetAsync(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Newscatcherapi.Net.Client.ApiResponse<Model200Response> localVarResponse = await GetWithHttpInfoAsync(q, lang, notLang, publishedDatePrecision, from, to, searchIn, countries, notCountries, topic, sources, notSources, rankedOnly, fromRank, toRank, sortBy, pageSize, page, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="q">Keyword/keywords you&#39;re searching for. This is the most important part of your query. Please, refer to the **Advanced Query Parameter** section below of the docs for more examples and explanations </param>
        /// <param name="lang">Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)</param>
        /// <param name="notLang">Inverse to the &#x60;lang&#x60; parameter  (optional)</param>
        /// <param name="publishedDatePrecision">There are 3 types of date precision we define: &#x60;full&#x60; — day and time of an article is correctly identified with the appropriate timezone &#x60;timezone unknown&#x60; — day and time of an article is correctly identified without timezone &#x60;date&#x60; — only the day is identified without an exact time  (optional)</param>
        /// <param name="from">&#x60;YYYY/mm/dd&#x60; From which point in time to start the search. The default timezone is UTC. Defaults to the past week.  (optional)</param>
        /// <param name="to">&#x60;YYYY/mm/dd&#x60; Until which point in time to search for. The default timezone is UTC.  (optional)</param>
        /// <param name="searchIn">By default, we search what you specified in the &#x60;q&#x60; parameter in both &#x60;title&#x60; and &#x60;summary&#x60; of the article. However, you can limit this to either &#x60;title&#x60; or &#x60;summary&#x60;  (optional)</param>
        /// <param name="countries">Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)</param>
        /// <param name="notCountries">The inverse of the &#x60;countries&#x60; parameter.  (optional)</param>
        /// <param name="topic">Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)</param>
        /// <param name="sources">One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)</param>
        /// <param name="notSources">One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)</param>
        /// <param name="rankedOnly">Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)</param>
        /// <param name="fromRank">&#x60;[0:999999]&#x60; The lowest boundary of the rank of a news website to filter by. Important: lower rank means that a source is more popular  (optional)</param>
        /// <param name="toRank">&#x60;[0:999999]&#x60; The upper boundary of the rank of a news website to filter by.  (optional)</param>
        /// <param name="sortBy">&#x60;relevancy&#x60; (default value) — the most relevant results first &#x60;date&#x60; — the most recently published results first &#x60;rank&#x60; — the results from the highest-ranked sources first  (optional)</param>
        /// <param name="pageSize">&#x60;[1:100]&#x60; How many articles to return per page.  (optional)</param>
        /// <param name="page">The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (Model200Response)</returns>
        public async System.Threading.Tasks.Task<Newscatcherapi.Net.Client.ApiResponse<Model200Response>> GetWithHttpInfoAsync(string q, string lang = default(string), string notLang = default(string), PublishDatePrecision? publishedDatePrecision = default(PublishDatePrecision?), string from = default(string), string to = default(string), SearchIn? searchIn = default(SearchIn?), string countries = default(string), string notCountries = default(string), Topic? topic = default(Topic?), string sources = default(string), string notSources = default(string), bool? rankedOnly = default(bool?), int? fromRank = default(int?), int? toRank = default(int?), SortBy? sortBy = default(SortBy?), int? pageSize = default(int?), int? page = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'q' is set
            if (q == null)
            {
                throw new Newscatcherapi.Net.Client.ApiException(400, "Missing required parameter 'q' when calling SearchApi->Get");
            }


            Newscatcherapi.Net.Client.RequestOptions localVarRequestOptions = new Newscatcherapi.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "q", q));
            if (lang != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "lang", lang));
            }
            if (notLang != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_lang", notLang));
            }
            if (publishedDatePrecision != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "published_date_precision", publishedDatePrecision));
            }
            if (from != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "from", from));
            }
            if (to != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "to", to));
            }
            if (searchIn != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "search_in", searchIn));
            }
            if (countries != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "countries", countries));
            }
            if (notCountries != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_countries", notCountries));
            }
            if (topic != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "topic", topic));
            }
            if (sources != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "sources", sources));
            }
            if (notSources != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "not_sources", notSources));
            }
            if (rankedOnly != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "ranked_only", rankedOnly));
            }
            if (fromRank != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "from_rank", fromRank));
            }
            if (toRank != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "to_rank", toRank));
            }
            if (sortBy != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "sort_by", sortBy));
            }
            if (pageSize != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "page_size", pageSize));
            }
            if (page != null)
            {
                localVarRequestOptions.QueryParameters.Add(Newscatcherapi.Net.Client.ClientUtils.ParameterToMultiMap("", "page", page));
            }

            localVarRequestOptions.Operation = "SearchApi.Get";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (api_key) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-api-key")))
            {
                localVarRequestOptions.HeaderParameters.Add("x-api-key", this.Configuration.GetApiKeyWithPrefix("x-api-key"));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.GetAsync<Model200Response>("/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Get", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>Model200Response</returns>
        public Model200Response Post(Search search = default(Search), int operationIndex = 0)
        {
            Newscatcherapi.Net.Client.ApiResponse<Model200Response> localVarResponse = PostWithHttpInfo(search);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Model200Response</returns>
        public Newscatcherapi.Net.Client.ApiResponse<Model200Response> PostWithHttpInfo(Search search = default(Search), int operationIndex = 0)
        {
            Newscatcherapi.Net.Client.RequestOptions localVarRequestOptions = new Newscatcherapi.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = search;

            localVarRequestOptions.Operation = "SearchApi.Post";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (api_key) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-api-key")))
            {
                localVarRequestOptions.HeaderParameters.Add("x-api-key", this.Configuration.GetApiKeyWithPrefix("x-api-key"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Post<Model200Response>("/search", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Post", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of Model200Response</returns>
        public async System.Threading.Tasks.Task<Model200Response> PostAsync(Search search = default(Search), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Newscatcherapi.Net.Client.ApiResponse<Model200Response> localVarResponse = await PostWithHttpInfoAsync(search, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Search for specific news articles Main endpoint that allows you to find news article by keyword, date, language, country, etc.
        /// </summary>
        /// <exception cref="Newscatcherapi.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="search"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (Model200Response)</returns>
        public async System.Threading.Tasks.Task<Newscatcherapi.Net.Client.ApiResponse<Model200Response>> PostWithHttpInfoAsync(Search search = default(Search), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {

            Newscatcherapi.Net.Client.RequestOptions localVarRequestOptions = new Newscatcherapi.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Newscatcherapi.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = search;

            localVarRequestOptions.Operation = "SearchApi.Post";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (api_key) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-api-key")))
            {
                localVarRequestOptions.HeaderParameters.Add("x-api-key", this.Configuration.GetApiKeyWithPrefix("x-api-key"));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.PostAsync<Model200Response>("/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Post", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

    }
}
