/* 
 * bSDD API prototype
 *
 * API to access the buildingSMART Data Dictionary
 *
 * OpenAPI spec version: v1
 * Contact: bsdd_support@buildingsmart.org
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace IO.Swagger.Api
{
    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
        public interface ISearchListOpenApi : IApiAccessor
    {
        #region Synchronous Operations
        /// <summary>
        /// Search the bSDD database, get list of Classifications without details.
        /// </summary>
        /// <remarks>
        /// The details can be requested per Classification via the Classification API
        /// </remarks>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>SearchResultContractV2</returns>
        SearchResultContractV2 ApiSearchListOpenV2Get (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null);

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details.
        /// </summary>
        /// <remarks>
        /// The details can be requested per Classification via the Classification API
        /// </remarks>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>ApiResponse of SearchResultContractV2</returns>
        ApiResponse<SearchResultContractV2> ApiSearchListOpenV2GetWithHttpInfo (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null);
        #endregion Synchronous Operations
        #region Asynchronous Operations
        /// <summary>
        /// Search the bSDD database, get list of Classifications without details.
        /// </summary>
        /// <remarks>
        /// The details can be requested per Classification via the Classification API
        /// </remarks>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>Task of SearchResultContractV2</returns>
        System.Threading.Tasks.Task<SearchResultContractV2> ApiSearchListOpenV2GetAsync (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null);

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details.
        /// </summary>
        /// <remarks>
        /// The details can be requested per Classification via the Classification API
        /// </remarks>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>Task of ApiResponse (SearchResultContractV2)</returns>
        System.Threading.Tasks.Task<ApiResponse<SearchResultContractV2>> ApiSearchListOpenV2GetAsyncWithHttpInfo (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null);
        #endregion Asynchronous Operations
    }

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

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchListOpenApi"/> class.
        /// </summary>
        /// <returns></returns>
        public SearchListOpenApi(String basePath)
        {
            this.Configuration = new IO.Swagger.Client.Configuration { BasePath = basePath };

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchListOpenApi"/> class
        /// </summary>
        /// <returns></returns>
        public SearchListOpenApi()
        {
            this.Configuration = IO.Swagger.Client.Configuration.Default;

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SearchListOpenApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public SearchListOpenApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            else
                this.Configuration = configuration;

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Gets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        public String GetBasePath()
        {
            return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
        }

        /// <summary>
        /// Sets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
        public void SetBasePath(String basePath)
        {
            // do nothing
        }

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

        /// <summary>
        /// Provides a factory method hook for the creation of exceptions.
        /// </summary>
        public IO.Swagger.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>
        /// Gets the default header.
        /// </summary>
        /// <returns>Dictionary of HTTP header</returns>
        [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
        public IDictionary<String, String> DefaultHeader()
        {
            return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
        }

        /// <summary>
        /// Add default header.
        /// </summary>
        /// <param name="key">Header field name.</param>
        /// <param name="value">Header field value.</param>
        /// <returns></returns>
        [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
        public void AddDefaultHeader(string key, string value)
        {
            this.Configuration.AddDefaultHeader(key, value);
        }

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details. The details can be requested per Classification via the Classification API
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>SearchResultContractV2</returns>
        public SearchResultContractV2 ApiSearchListOpenV2Get (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null)
        {
             ApiResponse<SearchResultContractV2> localVarResponse = ApiSearchListOpenV2GetWithHttpInfo(domainNamespaceUri, searchText, languageCode, relatedIfcEntity);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details. The details can be requested per Classification via the Classification API
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>ApiResponse of SearchResultContractV2</returns>
        public ApiResponse< SearchResultContractV2 > ApiSearchListOpenV2GetWithHttpInfo (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null)
        {
            // verify the required parameter 'domainNamespaceUri' is set
            if (domainNamespaceUri == null)
                throw new ApiException(400, "Missing required parameter 'domainNamespaceUri' when calling SearchListOpenApi->ApiSearchListOpenV2Get");

            var localVarPath = "/api/SearchListOpen/v2";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (domainNamespaceUri != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "DomainNamespaceUri", domainNamespaceUri)); // query parameter
            if (searchText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "SearchText", searchText)); // query parameter
            if (languageCode != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "LanguageCode", languageCode)); // query parameter
            if (relatedIfcEntity != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "RelatedIfcEntity", relatedIfcEntity)); // query parameter

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ApiSearchListOpenV2Get", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<SearchResultContractV2>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                (SearchResultContractV2) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultContractV2)));
        }

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details. The details can be requested per Classification via the Classification API
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>Task of SearchResultContractV2</returns>
        public async System.Threading.Tasks.Task<SearchResultContractV2> ApiSearchListOpenV2GetAsync (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null)
        {
             ApiResponse<SearchResultContractV2> localVarResponse = await ApiSearchListOpenV2GetAsyncWithHttpInfo(domainNamespaceUri, searchText, languageCode, relatedIfcEntity);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Search the bSDD database, get list of Classifications without details. The details can be requested per Classification via the Classification API
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="domainNamespaceUri">The namespace uri of the Domain to filter on (required)</param>
        /// <param name="searchText">The text to search for (case and accent insensitive) (optional)</param>
        /// <param name="languageCode">The ISO language code to search in and to return the text in (case sensitive)  If no language code specified or the text is not available in the requested language, the text will be returned in the default language of the Domain.  If a language code has been given, the search takes place in texts of that language, otherwise searches will be done in the default language of the Domain.  If an invalid or not supported language code is given, a Bad Request will be returned. (optional)</param>
        /// <param name="relatedIfcEntity">The official IFC entity name to filter on (case sensitive) (optional)</param>
        /// <returns>Task of ApiResponse (SearchResultContractV2)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<SearchResultContractV2>> ApiSearchListOpenV2GetAsyncWithHttpInfo (string domainNamespaceUri, string searchText = null, string languageCode = null, string relatedIfcEntity = null)
        {
            // verify the required parameter 'domainNamespaceUri' is set
            if (domainNamespaceUri == null)
                throw new ApiException(400, "Missing required parameter 'domainNamespaceUri' when calling SearchListOpenApi->ApiSearchListOpenV2Get");

            var localVarPath = "/api/SearchListOpen/v2";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (domainNamespaceUri != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "DomainNamespaceUri", domainNamespaceUri)); // query parameter
            if (searchText != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "SearchText", searchText)); // query parameter
            if (languageCode != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "LanguageCode", languageCode)); // query parameter
            if (relatedIfcEntity != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "RelatedIfcEntity", relatedIfcEntity)); // query parameter

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ApiSearchListOpenV2Get", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<SearchResultContractV2>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                (SearchResultContractV2) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(SearchResultContractV2)));
        }

    }
}
