# coding: utf-8

"""
    Nexus Repository Manager REST API

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

    The version of the OpenAPI document: 3.20.1-01
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from nexus_api_python_client.api_client import ApiClient
from nexus_api_python_client.exceptions import (
    ApiTypeError,
    ApiValueError
)


class SearchApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def search(self, **kwargs):  # noqa: E501
        """Search components  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str continuation_token: A token returned by a prior request. If present, the next page of results are returned
        :param str sort: The field to sort the results against, if left empty, a sort based on match weight will be used.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: PageComponentXO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.search_with_http_info(**kwargs)  # noqa: E501

    def search_with_http_info(self, **kwargs):  # noqa: E501
        """Search components  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str continuation_token: A token returned by a prior request. If present, the next page of results are returned
        :param str sort: The field to sort the results against, if left empty, a sort based on match weight will be used.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(PageComponentXO, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['continuation_token', 'sort', 'direction', 'timeout', 'q', 'repository', 'format', 'group', 'name', 'version', 'md5', 'sha1', 'sha256', 'sha512', 'prerelease', 'docker_image_name', 'docker_image_tag', 'docker_layer_id', 'docker_content_digest', 'maven_group_id', 'maven_artifact_id', 'maven_base_version', 'maven_extension', 'maven_classifier', 'npm_scope', 'nuget_id', 'nuget_tags', 'pypi_classifiers', 'pypi_description', 'pypi_keywords', 'pypi_summary', 'rubygems_description', 'rubygems_platform', 'rubygems_summary', 'yum_architecture']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'continuation_token' in local_var_params and local_var_params['continuation_token'] is not None:  # noqa: E501
            query_params.append(('continuationToken', local_var_params['continuation_token']))  # noqa: E501
        if 'sort' in local_var_params and local_var_params['sort'] is not None:  # noqa: E501
            query_params.append(('sort', local_var_params['sort']))  # noqa: E501
        if 'direction' in local_var_params and local_var_params['direction'] is not None:  # noqa: E501
            query_params.append(('direction', local_var_params['direction']))  # noqa: E501
        if 'timeout' in local_var_params and local_var_params['timeout'] is not None:  # noqa: E501
            query_params.append(('timeout', local_var_params['timeout']))  # noqa: E501
        if 'q' in local_var_params and local_var_params['q'] is not None:  # noqa: E501
            query_params.append(('q', local_var_params['q']))  # noqa: E501
        if 'repository' in local_var_params and local_var_params['repository'] is not None:  # noqa: E501
            query_params.append(('repository', local_var_params['repository']))  # noqa: E501
        if 'format' in local_var_params and local_var_params['format'] is not None:  # noqa: E501
            query_params.append(('format', local_var_params['format']))  # noqa: E501
        if 'group' in local_var_params and local_var_params['group'] is not None:  # noqa: E501
            query_params.append(('group', local_var_params['group']))  # noqa: E501
        if 'name' in local_var_params and local_var_params['name'] is not None:  # noqa: E501
            query_params.append(('name', local_var_params['name']))  # noqa: E501
        if 'version' in local_var_params and local_var_params['version'] is not None:  # noqa: E501
            query_params.append(('version', local_var_params['version']))  # noqa: E501
        if 'md5' in local_var_params and local_var_params['md5'] is not None:  # noqa: E501
            query_params.append(('md5', local_var_params['md5']))  # noqa: E501
        if 'sha1' in local_var_params and local_var_params['sha1'] is not None:  # noqa: E501
            query_params.append(('sha1', local_var_params['sha1']))  # noqa: E501
        if 'sha256' in local_var_params and local_var_params['sha256'] is not None:  # noqa: E501
            query_params.append(('sha256', local_var_params['sha256']))  # noqa: E501
        if 'sha512' in local_var_params and local_var_params['sha512'] is not None:  # noqa: E501
            query_params.append(('sha512', local_var_params['sha512']))  # noqa: E501
        if 'prerelease' in local_var_params and local_var_params['prerelease'] is not None:  # noqa: E501
            query_params.append(('prerelease', local_var_params['prerelease']))  # noqa: E501
        if 'docker_image_name' in local_var_params and local_var_params['docker_image_name'] is not None:  # noqa: E501
            query_params.append(('docker.imageName', local_var_params['docker_image_name']))  # noqa: E501
        if 'docker_image_tag' in local_var_params and local_var_params['docker_image_tag'] is not None:  # noqa: E501
            query_params.append(('docker.imageTag', local_var_params['docker_image_tag']))  # noqa: E501
        if 'docker_layer_id' in local_var_params and local_var_params['docker_layer_id'] is not None:  # noqa: E501
            query_params.append(('docker.layerId', local_var_params['docker_layer_id']))  # noqa: E501
        if 'docker_content_digest' in local_var_params and local_var_params['docker_content_digest'] is not None:  # noqa: E501
            query_params.append(('docker.contentDigest', local_var_params['docker_content_digest']))  # noqa: E501
        if 'maven_group_id' in local_var_params and local_var_params['maven_group_id'] is not None:  # noqa: E501
            query_params.append(('maven.groupId', local_var_params['maven_group_id']))  # noqa: E501
        if 'maven_artifact_id' in local_var_params and local_var_params['maven_artifact_id'] is not None:  # noqa: E501
            query_params.append(('maven.artifactId', local_var_params['maven_artifact_id']))  # noqa: E501
        if 'maven_base_version' in local_var_params and local_var_params['maven_base_version'] is not None:  # noqa: E501
            query_params.append(('maven.baseVersion', local_var_params['maven_base_version']))  # noqa: E501
        if 'maven_extension' in local_var_params and local_var_params['maven_extension'] is not None:  # noqa: E501
            query_params.append(('maven.extension', local_var_params['maven_extension']))  # noqa: E501
        if 'maven_classifier' in local_var_params and local_var_params['maven_classifier'] is not None:  # noqa: E501
            query_params.append(('maven.classifier', local_var_params['maven_classifier']))  # noqa: E501
        if 'npm_scope' in local_var_params and local_var_params['npm_scope'] is not None:  # noqa: E501
            query_params.append(('npm.scope', local_var_params['npm_scope']))  # noqa: E501
        if 'nuget_id' in local_var_params and local_var_params['nuget_id'] is not None:  # noqa: E501
            query_params.append(('nuget.id', local_var_params['nuget_id']))  # noqa: E501
        if 'nuget_tags' in local_var_params and local_var_params['nuget_tags'] is not None:  # noqa: E501
            query_params.append(('nuget.tags', local_var_params['nuget_tags']))  # noqa: E501
        if 'pypi_classifiers' in local_var_params and local_var_params['pypi_classifiers'] is not None:  # noqa: E501
            query_params.append(('pypi.classifiers', local_var_params['pypi_classifiers']))  # noqa: E501
        if 'pypi_description' in local_var_params and local_var_params['pypi_description'] is not None:  # noqa: E501
            query_params.append(('pypi.description', local_var_params['pypi_description']))  # noqa: E501
        if 'pypi_keywords' in local_var_params and local_var_params['pypi_keywords'] is not None:  # noqa: E501
            query_params.append(('pypi.keywords', local_var_params['pypi_keywords']))  # noqa: E501
        if 'pypi_summary' in local_var_params and local_var_params['pypi_summary'] is not None:  # noqa: E501
            query_params.append(('pypi.summary', local_var_params['pypi_summary']))  # noqa: E501
        if 'rubygems_description' in local_var_params and local_var_params['rubygems_description'] is not None:  # noqa: E501
            query_params.append(('rubygems.description', local_var_params['rubygems_description']))  # noqa: E501
        if 'rubygems_platform' in local_var_params and local_var_params['rubygems_platform'] is not None:  # noqa: E501
            query_params.append(('rubygems.platform', local_var_params['rubygems_platform']))  # noqa: E501
        if 'rubygems_summary' in local_var_params and local_var_params['rubygems_summary'] is not None:  # noqa: E501
            query_params.append(('rubygems.summary', local_var_params['rubygems_summary']))  # noqa: E501
        if 'yum_architecture' in local_var_params and local_var_params['yum_architecture'] is not None:  # noqa: E501
            query_params.append(('yum.architecture', local_var_params['yum_architecture']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/search', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PageComponentXO',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def search_and_download_assets(self, **kwargs):  # noqa: E501
        """Search and download asset  # noqa: E501

        Returns a 302 Found with location header field set to download URL. Unless a sort parameter is supplied, the search must return a single asset to receive download URL.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_and_download_assets(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str sort: The field to sort the results against, if left empty and more than 1 result is returned, the request will fail.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.search_and_download_assets_with_http_info(**kwargs)  # noqa: E501

    def search_and_download_assets_with_http_info(self, **kwargs):  # noqa: E501
        """Search and download asset  # noqa: E501

        Returns a 302 Found with location header field set to download URL. Unless a sort parameter is supplied, the search must return a single asset to receive download URL.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_and_download_assets_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str sort: The field to sort the results against, if left empty and more than 1 result is returned, the request will fail.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['sort', 'direction', 'timeout', 'q', 'repository', 'format', 'group', 'name', 'version', 'md5', 'sha1', 'sha256', 'sha512', 'prerelease', 'docker_image_name', 'docker_image_tag', 'docker_layer_id', 'docker_content_digest', 'maven_group_id', 'maven_artifact_id', 'maven_base_version', 'maven_extension', 'maven_classifier', 'npm_scope', 'nuget_id', 'nuget_tags', 'pypi_classifiers', 'pypi_description', 'pypi_keywords', 'pypi_summary', 'rubygems_description', 'rubygems_platform', 'rubygems_summary', 'yum_architecture']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search_and_download_assets" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'sort' in local_var_params and local_var_params['sort'] is not None:  # noqa: E501
            query_params.append(('sort', local_var_params['sort']))  # noqa: E501
        if 'direction' in local_var_params and local_var_params['direction'] is not None:  # noqa: E501
            query_params.append(('direction', local_var_params['direction']))  # noqa: E501
        if 'timeout' in local_var_params and local_var_params['timeout'] is not None:  # noqa: E501
            query_params.append(('timeout', local_var_params['timeout']))  # noqa: E501
        if 'q' in local_var_params and local_var_params['q'] is not None:  # noqa: E501
            query_params.append(('q', local_var_params['q']))  # noqa: E501
        if 'repository' in local_var_params and local_var_params['repository'] is not None:  # noqa: E501
            query_params.append(('repository', local_var_params['repository']))  # noqa: E501
        if 'format' in local_var_params and local_var_params['format'] is not None:  # noqa: E501
            query_params.append(('format', local_var_params['format']))  # noqa: E501
        if 'group' in local_var_params and local_var_params['group'] is not None:  # noqa: E501
            query_params.append(('group', local_var_params['group']))  # noqa: E501
        if 'name' in local_var_params and local_var_params['name'] is not None:  # noqa: E501
            query_params.append(('name', local_var_params['name']))  # noqa: E501
        if 'version' in local_var_params and local_var_params['version'] is not None:  # noqa: E501
            query_params.append(('version', local_var_params['version']))  # noqa: E501
        if 'md5' in local_var_params and local_var_params['md5'] is not None:  # noqa: E501
            query_params.append(('md5', local_var_params['md5']))  # noqa: E501
        if 'sha1' in local_var_params and local_var_params['sha1'] is not None:  # noqa: E501
            query_params.append(('sha1', local_var_params['sha1']))  # noqa: E501
        if 'sha256' in local_var_params and local_var_params['sha256'] is not None:  # noqa: E501
            query_params.append(('sha256', local_var_params['sha256']))  # noqa: E501
        if 'sha512' in local_var_params and local_var_params['sha512'] is not None:  # noqa: E501
            query_params.append(('sha512', local_var_params['sha512']))  # noqa: E501
        if 'prerelease' in local_var_params and local_var_params['prerelease'] is not None:  # noqa: E501
            query_params.append(('prerelease', local_var_params['prerelease']))  # noqa: E501
        if 'docker_image_name' in local_var_params and local_var_params['docker_image_name'] is not None:  # noqa: E501
            query_params.append(('docker.imageName', local_var_params['docker_image_name']))  # noqa: E501
        if 'docker_image_tag' in local_var_params and local_var_params['docker_image_tag'] is not None:  # noqa: E501
            query_params.append(('docker.imageTag', local_var_params['docker_image_tag']))  # noqa: E501
        if 'docker_layer_id' in local_var_params and local_var_params['docker_layer_id'] is not None:  # noqa: E501
            query_params.append(('docker.layerId', local_var_params['docker_layer_id']))  # noqa: E501
        if 'docker_content_digest' in local_var_params and local_var_params['docker_content_digest'] is not None:  # noqa: E501
            query_params.append(('docker.contentDigest', local_var_params['docker_content_digest']))  # noqa: E501
        if 'maven_group_id' in local_var_params and local_var_params['maven_group_id'] is not None:  # noqa: E501
            query_params.append(('maven.groupId', local_var_params['maven_group_id']))  # noqa: E501
        if 'maven_artifact_id' in local_var_params and local_var_params['maven_artifact_id'] is not None:  # noqa: E501
            query_params.append(('maven.artifactId', local_var_params['maven_artifact_id']))  # noqa: E501
        if 'maven_base_version' in local_var_params and local_var_params['maven_base_version'] is not None:  # noqa: E501
            query_params.append(('maven.baseVersion', local_var_params['maven_base_version']))  # noqa: E501
        if 'maven_extension' in local_var_params and local_var_params['maven_extension'] is not None:  # noqa: E501
            query_params.append(('maven.extension', local_var_params['maven_extension']))  # noqa: E501
        if 'maven_classifier' in local_var_params and local_var_params['maven_classifier'] is not None:  # noqa: E501
            query_params.append(('maven.classifier', local_var_params['maven_classifier']))  # noqa: E501
        if 'npm_scope' in local_var_params and local_var_params['npm_scope'] is not None:  # noqa: E501
            query_params.append(('npm.scope', local_var_params['npm_scope']))  # noqa: E501
        if 'nuget_id' in local_var_params and local_var_params['nuget_id'] is not None:  # noqa: E501
            query_params.append(('nuget.id', local_var_params['nuget_id']))  # noqa: E501
        if 'nuget_tags' in local_var_params and local_var_params['nuget_tags'] is not None:  # noqa: E501
            query_params.append(('nuget.tags', local_var_params['nuget_tags']))  # noqa: E501
        if 'pypi_classifiers' in local_var_params and local_var_params['pypi_classifiers'] is not None:  # noqa: E501
            query_params.append(('pypi.classifiers', local_var_params['pypi_classifiers']))  # noqa: E501
        if 'pypi_description' in local_var_params and local_var_params['pypi_description'] is not None:  # noqa: E501
            query_params.append(('pypi.description', local_var_params['pypi_description']))  # noqa: E501
        if 'pypi_keywords' in local_var_params and local_var_params['pypi_keywords'] is not None:  # noqa: E501
            query_params.append(('pypi.keywords', local_var_params['pypi_keywords']))  # noqa: E501
        if 'pypi_summary' in local_var_params and local_var_params['pypi_summary'] is not None:  # noqa: E501
            query_params.append(('pypi.summary', local_var_params['pypi_summary']))  # noqa: E501
        if 'rubygems_description' in local_var_params and local_var_params['rubygems_description'] is not None:  # noqa: E501
            query_params.append(('rubygems.description', local_var_params['rubygems_description']))  # noqa: E501
        if 'rubygems_platform' in local_var_params and local_var_params['rubygems_platform'] is not None:  # noqa: E501
            query_params.append(('rubygems.platform', local_var_params['rubygems_platform']))  # noqa: E501
        if 'rubygems_summary' in local_var_params and local_var_params['rubygems_summary'] is not None:  # noqa: E501
            query_params.append(('rubygems.summary', local_var_params['rubygems_summary']))  # noqa: E501
        if 'yum_architecture' in local_var_params and local_var_params['yum_architecture'] is not None:  # noqa: E501
            query_params.append(('yum.architecture', local_var_params['yum_architecture']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/search/assets/download', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def search_assets(self, **kwargs):  # noqa: E501
        """Search assets  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_assets(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str continuation_token: A token returned by a prior request. If present, the next page of results are returned
        :param str sort: The field to sort the results against, if left empty, a sort based on match weight will be used.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: PageAssetXO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.search_assets_with_http_info(**kwargs)  # noqa: E501

    def search_assets_with_http_info(self, **kwargs):  # noqa: E501
        """Search assets  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_assets_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str continuation_token: A token returned by a prior request. If present, the next page of results are returned
        :param str sort: The field to sort the results against, if left empty, a sort based on match weight will be used.
        :param str direction: The direction to sort records in, defaults to ascending ('asc') for all sort fields, except version, which defaults to descending ('desc')
        :param int timeout: How long to wait for search results in seconds. If this value is not provided, the system default timeout will be used.
        :param str q: Query by keyword
        :param str repository: Repository name
        :param str format: Query by format
        :param str group: Component group
        :param str name: Component name
        :param str version: Component version
        :param str md5: Specific MD5 hash of component's asset
        :param str sha1: Specific SHA-1 hash of component's asset
        :param str sha256: Specific SHA-256 hash of component's asset
        :param str sha512: Specific SHA-512 hash of component's asset
        :param str prerelease: Prerelease version flag
        :param str docker_image_name: Docker image name
        :param str docker_image_tag: Docker image tag
        :param str docker_layer_id: Docker layer ID
        :param str docker_content_digest: Docker content digest
        :param str maven_group_id: Maven groupId
        :param str maven_artifact_id: Maven artifactId
        :param str maven_base_version: Maven base version
        :param str maven_extension: Maven extension of component's asset
        :param str maven_classifier: Maven classifier of component's asset
        :param str npm_scope: NPM scope
        :param str nuget_id: Nuget id
        :param str nuget_tags: Nuget tags
        :param str pypi_classifiers: PyPi classifiers
        :param str pypi_description: PyPi description
        :param str pypi_keywords: PyPi keywords
        :param str pypi_summary: PyPi summary
        :param str rubygems_description: RubyGems description
        :param str rubygems_platform: RubyGems platform
        :param str rubygems_summary: RubyGems summary
        :param str yum_architecture: Yum architecture
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(PageAssetXO, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['continuation_token', 'sort', 'direction', 'timeout', 'q', 'repository', 'format', 'group', 'name', 'version', 'md5', 'sha1', 'sha256', 'sha512', 'prerelease', 'docker_image_name', 'docker_image_tag', 'docker_layer_id', 'docker_content_digest', 'maven_group_id', 'maven_artifact_id', 'maven_base_version', 'maven_extension', 'maven_classifier', 'npm_scope', 'nuget_id', 'nuget_tags', 'pypi_classifiers', 'pypi_description', 'pypi_keywords', 'pypi_summary', 'rubygems_description', 'rubygems_platform', 'rubygems_summary', 'yum_architecture']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search_assets" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'continuation_token' in local_var_params and local_var_params['continuation_token'] is not None:  # noqa: E501
            query_params.append(('continuationToken', local_var_params['continuation_token']))  # noqa: E501
        if 'sort' in local_var_params and local_var_params['sort'] is not None:  # noqa: E501
            query_params.append(('sort', local_var_params['sort']))  # noqa: E501
        if 'direction' in local_var_params and local_var_params['direction'] is not None:  # noqa: E501
            query_params.append(('direction', local_var_params['direction']))  # noqa: E501
        if 'timeout' in local_var_params and local_var_params['timeout'] is not None:  # noqa: E501
            query_params.append(('timeout', local_var_params['timeout']))  # noqa: E501
        if 'q' in local_var_params and local_var_params['q'] is not None:  # noqa: E501
            query_params.append(('q', local_var_params['q']))  # noqa: E501
        if 'repository' in local_var_params and local_var_params['repository'] is not None:  # noqa: E501
            query_params.append(('repository', local_var_params['repository']))  # noqa: E501
        if 'format' in local_var_params and local_var_params['format'] is not None:  # noqa: E501
            query_params.append(('format', local_var_params['format']))  # noqa: E501
        if 'group' in local_var_params and local_var_params['group'] is not None:  # noqa: E501
            query_params.append(('group', local_var_params['group']))  # noqa: E501
        if 'name' in local_var_params and local_var_params['name'] is not None:  # noqa: E501
            query_params.append(('name', local_var_params['name']))  # noqa: E501
        if 'version' in local_var_params and local_var_params['version'] is not None:  # noqa: E501
            query_params.append(('version', local_var_params['version']))  # noqa: E501
        if 'md5' in local_var_params and local_var_params['md5'] is not None:  # noqa: E501
            query_params.append(('md5', local_var_params['md5']))  # noqa: E501
        if 'sha1' in local_var_params and local_var_params['sha1'] is not None:  # noqa: E501
            query_params.append(('sha1', local_var_params['sha1']))  # noqa: E501
        if 'sha256' in local_var_params and local_var_params['sha256'] is not None:  # noqa: E501
            query_params.append(('sha256', local_var_params['sha256']))  # noqa: E501
        if 'sha512' in local_var_params and local_var_params['sha512'] is not None:  # noqa: E501
            query_params.append(('sha512', local_var_params['sha512']))  # noqa: E501
        if 'prerelease' in local_var_params and local_var_params['prerelease'] is not None:  # noqa: E501
            query_params.append(('prerelease', local_var_params['prerelease']))  # noqa: E501
        if 'docker_image_name' in local_var_params and local_var_params['docker_image_name'] is not None:  # noqa: E501
            query_params.append(('docker.imageName', local_var_params['docker_image_name']))  # noqa: E501
        if 'docker_image_tag' in local_var_params and local_var_params['docker_image_tag'] is not None:  # noqa: E501
            query_params.append(('docker.imageTag', local_var_params['docker_image_tag']))  # noqa: E501
        if 'docker_layer_id' in local_var_params and local_var_params['docker_layer_id'] is not None:  # noqa: E501
            query_params.append(('docker.layerId', local_var_params['docker_layer_id']))  # noqa: E501
        if 'docker_content_digest' in local_var_params and local_var_params['docker_content_digest'] is not None:  # noqa: E501
            query_params.append(('docker.contentDigest', local_var_params['docker_content_digest']))  # noqa: E501
        if 'maven_group_id' in local_var_params and local_var_params['maven_group_id'] is not None:  # noqa: E501
            query_params.append(('maven.groupId', local_var_params['maven_group_id']))  # noqa: E501
        if 'maven_artifact_id' in local_var_params and local_var_params['maven_artifact_id'] is not None:  # noqa: E501
            query_params.append(('maven.artifactId', local_var_params['maven_artifact_id']))  # noqa: E501
        if 'maven_base_version' in local_var_params and local_var_params['maven_base_version'] is not None:  # noqa: E501
            query_params.append(('maven.baseVersion', local_var_params['maven_base_version']))  # noqa: E501
        if 'maven_extension' in local_var_params and local_var_params['maven_extension'] is not None:  # noqa: E501
            query_params.append(('maven.extension', local_var_params['maven_extension']))  # noqa: E501
        if 'maven_classifier' in local_var_params and local_var_params['maven_classifier'] is not None:  # noqa: E501
            query_params.append(('maven.classifier', local_var_params['maven_classifier']))  # noqa: E501
        if 'npm_scope' in local_var_params and local_var_params['npm_scope'] is not None:  # noqa: E501
            query_params.append(('npm.scope', local_var_params['npm_scope']))  # noqa: E501
        if 'nuget_id' in local_var_params and local_var_params['nuget_id'] is not None:  # noqa: E501
            query_params.append(('nuget.id', local_var_params['nuget_id']))  # noqa: E501
        if 'nuget_tags' in local_var_params and local_var_params['nuget_tags'] is not None:  # noqa: E501
            query_params.append(('nuget.tags', local_var_params['nuget_tags']))  # noqa: E501
        if 'pypi_classifiers' in local_var_params and local_var_params['pypi_classifiers'] is not None:  # noqa: E501
            query_params.append(('pypi.classifiers', local_var_params['pypi_classifiers']))  # noqa: E501
        if 'pypi_description' in local_var_params and local_var_params['pypi_description'] is not None:  # noqa: E501
            query_params.append(('pypi.description', local_var_params['pypi_description']))  # noqa: E501
        if 'pypi_keywords' in local_var_params and local_var_params['pypi_keywords'] is not None:  # noqa: E501
            query_params.append(('pypi.keywords', local_var_params['pypi_keywords']))  # noqa: E501
        if 'pypi_summary' in local_var_params and local_var_params['pypi_summary'] is not None:  # noqa: E501
            query_params.append(('pypi.summary', local_var_params['pypi_summary']))  # noqa: E501
        if 'rubygems_description' in local_var_params and local_var_params['rubygems_description'] is not None:  # noqa: E501
            query_params.append(('rubygems.description', local_var_params['rubygems_description']))  # noqa: E501
        if 'rubygems_platform' in local_var_params and local_var_params['rubygems_platform'] is not None:  # noqa: E501
            query_params.append(('rubygems.platform', local_var_params['rubygems_platform']))  # noqa: E501
        if 'rubygems_summary' in local_var_params and local_var_params['rubygems_summary'] is not None:  # noqa: E501
            query_params.append(('rubygems.summary', local_var_params['rubygems_summary']))  # noqa: E501
        if 'yum_architecture' in local_var_params and local_var_params['yum_architecture'] is not None:  # noqa: E501
            query_params.append(('yum.architecture', local_var_params['yum_architecture']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/search/assets', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PageAssetXO',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
