# coding: utf-8

"""
    Pulp 3 API

    Fetch, Upload, Organize, and Distribute Software Packages

    The version of the OpenAPI document: v3
    Contact: pulp-list@redhat.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator
from typing import List, Optional
from typing_extensions import Annotated
from pulpcore.client.pulp_ansible.models.collection_version_search_list import CollectionVersionSearchList
from pulpcore.client.pulp_ansible.models.collection_version_search_list_response import CollectionVersionSearchListResponse
from pulpcore.client.pulp_ansible.models.paginated_collection_version_search_list_response_list import PaginatedCollectionVersionSearchListResponseList

from pulpcore.client.pulp_ansible.api_client import ApiClient, RequestSerialized
from pulpcore.client.pulp_ansible.api_response import ApiResponse
from pulpcore.client.pulp_ansible.rest import RESTResponseType


class ApiPluginAnsibleSearchCollectionVersionsApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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


    @validate_call
    def list(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        dependency: Optional[StrictStr] = None,
        deprecated: Optional[StrictBool] = None,
        distribution: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these distrubtion ids.")] = None,
        distribution_base_path: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these base paths.")] = None,
        highest: Optional[StrictBool] = None,
        is_deprecated: Optional[StrictBool] = None,
        is_highest: Optional[StrictBool] = None,
        is_signed: Optional[StrictBool] = None,
        keywords: Optional[StrictStr] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None,
        name: Optional[StrictStr] = None,
        namespace: Optional[StrictStr] = None,
        offset: Annotated[Optional[StrictInt], Field(description="The initial index from which to return the results.")] = None,
        order_by: Annotated[Optional[List[StrictStr]], Field(description="Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)")] = None,
        q: Optional[StrictStr] = None,
        repository: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repository ids.")] = None,
        repository_label: Annotated[Optional[StrictStr], Field(description="Filter labels by search string")] = None,
        repository_name: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repositories.")] = None,
        repository_version: Optional[StrictStr] = None,
        signed: Optional[StrictBool] = None,
        tags: Annotated[Optional[StrictStr], Field(description="Filter by comma separate list of tags that must all be matched")] = None,
        version: Optional[StrictStr] = None,
        version_range: Optional[StrictStr] = None,
        fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to include in the response.")] = None,
        exclude_fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to exclude from the response.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PaginatedCollectionVersionSearchListResponseList:
        """List cross repository collection version indexs

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param dependency:
        :type dependency: str
        :param deprecated:
        :type deprecated: bool
        :param distribution: Filter collectionversions that are in these distrubtion ids.
        :type distribution: List[str]
        :param distribution_base_path: Filter collectionversions that are in these base paths.
        :type distribution_base_path: List[str]
        :param highest:
        :type highest: bool
        :param is_deprecated:
        :type is_deprecated: bool
        :param is_highest:
        :type is_highest: bool
        :param is_signed:
        :type is_signed: bool
        :param keywords:
        :type keywords: str
        :param limit: Number of results to return per page.
        :type limit: int
        :param name:
        :type name: str
        :param namespace:
        :type namespace: str
        :param offset: The initial index from which to return the results.
        :type offset: int
        :param order_by: Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)
        :type order_by: List[str]
        :param q:
        :type q: str
        :param repository: Filter collectionversions that are in these repository ids.
        :type repository: List[str]
        :param repository_label: Filter labels by search string
        :type repository_label: str
        :param repository_name: Filter collectionversions that are in these repositories.
        :type repository_name: List[str]
        :param repository_version:
        :type repository_version: str
        :param signed:
        :type signed: bool
        :param tags: Filter by comma separate list of tags that must all be matched
        :type tags: str
        :param version:
        :type version: str
        :param version_range:
        :type version_range: str
        :param fields: A list of fields to include in the response.
        :type fields: List[str]
        :param exclude_fields: A list of fields to exclude from the response.
        :type exclude_fields: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            x_task_diagnostics=x_task_diagnostics,
            dependency=dependency,
            deprecated=deprecated,
            distribution=distribution,
            distribution_base_path=distribution_base_path,
            highest=highest,
            is_deprecated=is_deprecated,
            is_highest=is_highest,
            is_signed=is_signed,
            keywords=keywords,
            limit=limit,
            name=name,
            namespace=namespace,
            offset=offset,
            order_by=order_by,
            q=q,
            repository=repository,
            repository_label=repository_label,
            repository_name=repository_name,
            repository_version=repository_version,
            signed=signed,
            tags=tags,
            version=version,
            version_range=version_range,
            fields=fields,
            exclude_fields=exclude_fields,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginatedCollectionVersionSearchListResponseList",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_with_http_info(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        dependency: Optional[StrictStr] = None,
        deprecated: Optional[StrictBool] = None,
        distribution: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these distrubtion ids.")] = None,
        distribution_base_path: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these base paths.")] = None,
        highest: Optional[StrictBool] = None,
        is_deprecated: Optional[StrictBool] = None,
        is_highest: Optional[StrictBool] = None,
        is_signed: Optional[StrictBool] = None,
        keywords: Optional[StrictStr] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None,
        name: Optional[StrictStr] = None,
        namespace: Optional[StrictStr] = None,
        offset: Annotated[Optional[StrictInt], Field(description="The initial index from which to return the results.")] = None,
        order_by: Annotated[Optional[List[StrictStr]], Field(description="Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)")] = None,
        q: Optional[StrictStr] = None,
        repository: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repository ids.")] = None,
        repository_label: Annotated[Optional[StrictStr], Field(description="Filter labels by search string")] = None,
        repository_name: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repositories.")] = None,
        repository_version: Optional[StrictStr] = None,
        signed: Optional[StrictBool] = None,
        tags: Annotated[Optional[StrictStr], Field(description="Filter by comma separate list of tags that must all be matched")] = None,
        version: Optional[StrictStr] = None,
        version_range: Optional[StrictStr] = None,
        fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to include in the response.")] = None,
        exclude_fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to exclude from the response.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PaginatedCollectionVersionSearchListResponseList]:
        """List cross repository collection version indexs

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param dependency:
        :type dependency: str
        :param deprecated:
        :type deprecated: bool
        :param distribution: Filter collectionversions that are in these distrubtion ids.
        :type distribution: List[str]
        :param distribution_base_path: Filter collectionversions that are in these base paths.
        :type distribution_base_path: List[str]
        :param highest:
        :type highest: bool
        :param is_deprecated:
        :type is_deprecated: bool
        :param is_highest:
        :type is_highest: bool
        :param is_signed:
        :type is_signed: bool
        :param keywords:
        :type keywords: str
        :param limit: Number of results to return per page.
        :type limit: int
        :param name:
        :type name: str
        :param namespace:
        :type namespace: str
        :param offset: The initial index from which to return the results.
        :type offset: int
        :param order_by: Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)
        :type order_by: List[str]
        :param q:
        :type q: str
        :param repository: Filter collectionversions that are in these repository ids.
        :type repository: List[str]
        :param repository_label: Filter labels by search string
        :type repository_label: str
        :param repository_name: Filter collectionversions that are in these repositories.
        :type repository_name: List[str]
        :param repository_version:
        :type repository_version: str
        :param signed:
        :type signed: bool
        :param tags: Filter by comma separate list of tags that must all be matched
        :type tags: str
        :param version:
        :type version: str
        :param version_range:
        :type version_range: str
        :param fields: A list of fields to include in the response.
        :type fields: List[str]
        :param exclude_fields: A list of fields to exclude from the response.
        :type exclude_fields: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            x_task_diagnostics=x_task_diagnostics,
            dependency=dependency,
            deprecated=deprecated,
            distribution=distribution,
            distribution_base_path=distribution_base_path,
            highest=highest,
            is_deprecated=is_deprecated,
            is_highest=is_highest,
            is_signed=is_signed,
            keywords=keywords,
            limit=limit,
            name=name,
            namespace=namespace,
            offset=offset,
            order_by=order_by,
            q=q,
            repository=repository,
            repository_label=repository_label,
            repository_name=repository_name,
            repository_version=repository_version,
            signed=signed,
            tags=tags,
            version=version,
            version_range=version_range,
            fields=fields,
            exclude_fields=exclude_fields,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    @validate_call
    def list_without_preload_content(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        dependency: Optional[StrictStr] = None,
        deprecated: Optional[StrictBool] = None,
        distribution: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these distrubtion ids.")] = None,
        distribution_base_path: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these base paths.")] = None,
        highest: Optional[StrictBool] = None,
        is_deprecated: Optional[StrictBool] = None,
        is_highest: Optional[StrictBool] = None,
        is_signed: Optional[StrictBool] = None,
        keywords: Optional[StrictStr] = None,
        limit: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None,
        name: Optional[StrictStr] = None,
        namespace: Optional[StrictStr] = None,
        offset: Annotated[Optional[StrictInt], Field(description="The initial index from which to return the results.")] = None,
        order_by: Annotated[Optional[List[StrictStr]], Field(description="Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)")] = None,
        q: Optional[StrictStr] = None,
        repository: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repository ids.")] = None,
        repository_label: Annotated[Optional[StrictStr], Field(description="Filter labels by search string")] = None,
        repository_name: Annotated[Optional[List[StrictStr]], Field(description="Filter collectionversions that are in these repositories.")] = None,
        repository_version: Optional[StrictStr] = None,
        signed: Optional[StrictBool] = None,
        tags: Annotated[Optional[StrictStr], Field(description="Filter by comma separate list of tags that must all be matched")] = None,
        version: Optional[StrictStr] = None,
        version_range: Optional[StrictStr] = None,
        fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to include in the response.")] = None,
        exclude_fields: Annotated[Optional[List[StrictStr]], Field(description="A list of fields to exclude from the response.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """List cross repository collection version indexs

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param dependency:
        :type dependency: str
        :param deprecated:
        :type deprecated: bool
        :param distribution: Filter collectionversions that are in these distrubtion ids.
        :type distribution: List[str]
        :param distribution_base_path: Filter collectionversions that are in these base paths.
        :type distribution_base_path: List[str]
        :param highest:
        :type highest: bool
        :param is_deprecated:
        :type is_deprecated: bool
        :param is_highest:
        :type is_highest: bool
        :param is_signed:
        :type is_signed: bool
        :param keywords:
        :type keywords: str
        :param limit: Number of results to return per page.
        :type limit: int
        :param name:
        :type name: str
        :param namespace:
        :type namespace: str
        :param offset: The initial index from which to return the results.
        :type offset: int
        :param order_by: Ordering  * `pulp_created` - by CV created * `-pulp_created` - by CV created (descending) * `namespace` - by CV namespace * `-namespace` - by CV namespace (descending) * `name` - by CV name * `-name` - by CV name (descending) * `version` - by CV version * `-version` - by CV version (descending)
        :type order_by: List[str]
        :param q:
        :type q: str
        :param repository: Filter collectionversions that are in these repository ids.
        :type repository: List[str]
        :param repository_label: Filter labels by search string
        :type repository_label: str
        :param repository_name: Filter collectionversions that are in these repositories.
        :type repository_name: List[str]
        :param repository_version:
        :type repository_version: str
        :param signed:
        :type signed: bool
        :param tags: Filter by comma separate list of tags that must all be matched
        :type tags: str
        :param version:
        :type version: str
        :param version_range:
        :type version_range: str
        :param fields: A list of fields to include in the response.
        :type fields: List[str]
        :param exclude_fields: A list of fields to exclude from the response.
        :type exclude_fields: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            x_task_diagnostics=x_task_diagnostics,
            dependency=dependency,
            deprecated=deprecated,
            distribution=distribution,
            distribution_base_path=distribution_base_path,
            highest=highest,
            is_deprecated=is_deprecated,
            is_highest=is_highest,
            is_signed=is_signed,
            keywords=keywords,
            limit=limit,
            name=name,
            namespace=namespace,
            offset=offset,
            order_by=order_by,
            q=q,
            repository=repository,
            repository_label=repository_label,
            repository_name=repository_name,
            repository_version=repository_version,
            signed=signed,
            tags=tags,
            version=version,
            version_range=version_range,
            fields=fields,
            exclude_fields=exclude_fields,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _list_serialize(
        self,
        ansible_cross_repository_collection_version_index_href,
        x_task_diagnostics,
        dependency,
        deprecated,
        distribution,
        distribution_base_path,
        highest,
        is_deprecated,
        is_highest,
        is_signed,
        keywords,
        limit,
        name,
        namespace,
        offset,
        order_by,
        q,
        repository,
        repository_label,
        repository_name,
        repository_version,
        signed,
        tags,
        version,
        version_range,
        fields,
        exclude_fields,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'X-Task-Diagnostics': 'csv',
            'distribution': 'multi',
            'distribution_base_path': 'multi',
            'order_by': 'csv',
            'repository': 'multi',
            'repository_name': 'multi',
            'fields': 'multi',
            'exclude_fields': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if ansible_cross_repository_collection_version_index_href is not None:
            _path_params['ansible_cross_repository_collection_version_index_href'] = ansible_cross_repository_collection_version_index_href
        # process the query parameters
        if dependency is not None:
            
            _query_params.append(('dependency', dependency))
            
        if deprecated is not None:
            
            _query_params.append(('deprecated', deprecated))
            
        if distribution is not None:
            
            _query_params.append(('distribution', distribution))
            
        if distribution_base_path is not None:
            
            _query_params.append(('distribution_base_path', distribution_base_path))
            
        if highest is not None:
            
            _query_params.append(('highest', highest))
            
        if is_deprecated is not None:
            
            _query_params.append(('is_deprecated', is_deprecated))
            
        if is_highest is not None:
            
            _query_params.append(('is_highest', is_highest))
            
        if is_signed is not None:
            
            _query_params.append(('is_signed', is_signed))
            
        if keywords is not None:
            
            _query_params.append(('keywords', keywords))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if name is not None:
            
            _query_params.append(('name', name))
            
        if namespace is not None:
            
            _query_params.append(('namespace', namespace))
            
        if offset is not None:
            
            _query_params.append(('offset', offset))
            
        if order_by is not None:
            
            _query_params.append(('order_by', order_by))
            
        if q is not None:
            
            _query_params.append(('q', q))
            
        if repository is not None:
            
            _query_params.append(('repository', repository))
            
        if repository_label is not None:
            
            _query_params.append(('repository_label', repository_label))
            
        if repository_name is not None:
            
            _query_params.append(('repository_name', repository_name))
            
        if repository_version is not None:
            
            _query_params.append(('repository_version', repository_version))
            
        if signed is not None:
            
            _query_params.append(('signed', signed))
            
        if tags is not None:
            
            _query_params.append(('tags', tags))
            
        if version is not None:
            
            _query_params.append(('version', version))
            
        if version_range is not None:
            
            _query_params.append(('version_range', version_range))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if exclude_fields is not None:
            
            _query_params.append(('exclude_fields', exclude_fields))
            
        # process the header parameters
        if x_task_diagnostics is not None:
            _header_params['X-Task-Diagnostics'] = x_task_diagnostics
        # process the form parameters
        # process the body parameter


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


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'cookieAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='{ansible_cross_repository_collection_version_index_href}api/v3/plugin/ansible/search/collection-versions/',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def rebuild(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        collection_version_search_list: CollectionVersionSearchList,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> CollectionVersionSearchListResponse:
        """rebuild

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param collection_version_search_list: (required)
        :type collection_version_search_list: CollectionVersionSearchList
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._rebuild_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            collection_version_search_list=collection_version_search_list,
            x_task_diagnostics=x_task_diagnostics,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "CollectionVersionSearchListResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def rebuild_with_http_info(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        collection_version_search_list: CollectionVersionSearchList,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[CollectionVersionSearchListResponse]:
        """rebuild

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param collection_version_search_list: (required)
        :type collection_version_search_list: CollectionVersionSearchList
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._rebuild_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            collection_version_search_list=collection_version_search_list,
            x_task_diagnostics=x_task_diagnostics,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '201': "CollectionVersionSearchListResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def rebuild_without_preload_content(
        self,
        ansible_cross_repository_collection_version_index_href: StrictStr,
        collection_version_search_list: CollectionVersionSearchList,
        x_task_diagnostics: Annotated[Optional[List[StrictStr]], Field(description="List of profilers to use on tasks.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """rebuild

        A viewset for cross-repo searches.

        :param ansible_cross_repository_collection_version_index_href: (required)
        :type ansible_cross_repository_collection_version_index_href: str
        :param collection_version_search_list: (required)
        :type collection_version_search_list: CollectionVersionSearchList
        :param x_task_diagnostics: List of profilers to use on tasks.
        :type x_task_diagnostics: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._rebuild_serialize(
            ansible_cross_repository_collection_version_index_href=ansible_cross_repository_collection_version_index_href,
            collection_version_search_list=collection_version_search_list,
            x_task_diagnostics=x_task_diagnostics,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

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


    def _rebuild_serialize(
        self,
        ansible_cross_repository_collection_version_index_href,
        collection_version_search_list,
        x_task_diagnostics,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'X-Task-Diagnostics': 'csv',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if ansible_cross_repository_collection_version_index_href is not None:
            _path_params['ansible_cross_repository_collection_version_index_href'] = ansible_cross_repository_collection_version_index_href
        # process the query parameters
        # process the header parameters
        if x_task_diagnostics is not None:
            _header_params['X-Task-Diagnostics'] = x_task_diagnostics
        # process the form parameters
        # process the body parameter
        if collection_version_search_list is not None:
            _body_params = collection_version_search_list


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

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json', 
                        'application/x-www-form-urlencoded', 
                        'multipart/form-data'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'cookieAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='{ansible_cross_repository_collection_version_index_href}api/v3/plugin/ansible/search/collection-versions/',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


