"""
    Universal Binary Archiver Service

    Universal Binary Archiver Service  # noqa: E501

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


import re  # noqa: F401
import sys  # noqa: F401

from ubai_client.api_client import ApiClient, Endpoint as _Endpoint
from ubai_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from ubai_client.model.artifact_input import ArtifactInput
from ubai_client.model.artifact_storage import ArtifactStorage
from ubai_client.model.http_validation_error import HTTPValidationError
from ubai_client.model.num_updated_artifacts import NumUpdatedArtifacts


class ArtifactApi(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 __delete_artifact(
            self,
            artifact_id,
            **kwargs
        ):
            """delete_artifact  # noqa: E501

            Delete an artifact by its ID  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.delete_artifact(artifact_id, async_req=True)
            >>> result = thread.get()

            Args:
                artifact_id (str): An artifact ID

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                None
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['artifact_id'] = \
                artifact_id
            return self.call_with_http_info(**kwargs)

        self.delete_artifact = _Endpoint(
            settings={
                'response_type': None,
                'auth': [],
                'endpoint_path': '/api/v1/artifacts/{artifact_id}',
                'operation_id': 'delete_artifact',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'artifact_id',
                ],
                'required': [
                    'artifact_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'artifact_id':
                        (str,),
                },
                'attribute_map': {
                    'artifact_id': 'artifact_id',
                },
                'location_map': {
                    'artifact_id': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [],
                'content_type': [],
            },
            api_client=api_client,
            callable=__delete_artifact
        )

        def __get_artifact(
            self,
            artifact_id,
            **kwargs
        ):
            """get_artifact  # noqa: E501

            Get an artifact by its ID  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.get_artifact(artifact_id, async_req=True)
            >>> result = thread.get()

            Args:
                artifact_id (str): An artifact ID

            Keyword Args:
                x_fields (str): An optional fields mask. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                ArtifactStorage
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['artifact_id'] = \
                artifact_id
            return self.call_with_http_info(**kwargs)

        self.get_artifact = _Endpoint(
            settings={
                'response_type': (ArtifactStorage,),
                'auth': [],
                'endpoint_path': '/api/v1/artifacts/{artifact_id}',
                'operation_id': 'get_artifact',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'artifact_id',
                    'x_fields',
                ],
                'required': [
                    'artifact_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'artifact_id':
                        (str,),
                    'x_fields':
                        (str,),
                },
                'attribute_map': {
                    'artifact_id': 'artifact_id',
                    'x_fields': 'X-Fields',
                },
                'location_map': {
                    'artifact_id': 'path',
                    'x_fields': 'header',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__get_artifact
        )

        def __update_artifact(
            self,
            artifact_id,
            artifact_storage,
            **kwargs
        ):
            """Update Artifact  # noqa: E501

            Updates retention for an existing artifact  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.update_artifact(artifact_id, artifact_storage, async_req=True)
            >>> result = thread.get()

            Args:
                artifact_id (str):
                artifact_storage (ArtifactStorage):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                bool, date, datetime, dict, float, int, list, str, none_type
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['artifact_id'] = \
                artifact_id
            kwargs['artifact_storage'] = \
                artifact_storage
            return self.call_with_http_info(**kwargs)

        self.update_artifact = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [],
                'endpoint_path': '/api/v1/artifacts/{artifact_id}',
                'operation_id': 'update_artifact',
                'http_method': 'PATCH',
                'servers': None,
            },
            params_map={
                'all': [
                    'artifact_id',
                    'artifact_storage',
                ],
                'required': [
                    'artifact_id',
                    'artifact_storage',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'artifact_id':
                        (str,),
                    'artifact_storage':
                        (ArtifactStorage,),
                },
                'attribute_map': {
                    'artifact_id': 'artifact_id',
                },
                'location_map': {
                    'artifact_id': 'path',
                    'artifact_storage': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__update_artifact
        )

        def __update_artifacts(
            self,
            artifact_storage,
            **kwargs
        ):
            """Update Artifacts  # noqa: E501

            Updates retention on artifacts matching the query specification  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.update_artifacts(artifact_storage, async_req=True)
            >>> result = thread.get()

            Args:
                artifact_storage (ArtifactStorage):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                NumUpdatedArtifacts
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['artifact_storage'] = \
                artifact_storage
            return self.call_with_http_info(**kwargs)

        self.update_artifacts = _Endpoint(
            settings={
                'response_type': (NumUpdatedArtifacts,),
                'auth': [],
                'endpoint_path': '/api/v1/artifacts',
                'operation_id': 'update_artifacts',
                'http_method': 'PATCH',
                'servers': None,
            },
            params_map={
                'all': [
                    'artifact_storage',
                ],
                'required': [
                    'artifact_storage',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'artifact_storage':
                        (ArtifactStorage,),
                },
                'attribute_map': {
                },
                'location_map': {
                    'artifact_storage': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__update_artifacts
        )

        def __upload_artifact(
            self,
            payload,
            **kwargs
        ):
            """upload_artifact  # noqa: E501

            Upload an artifact to be stored  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.upload_artifact(payload, async_req=True)
            >>> result = thread.get()

            Args:
                payload (ArtifactInput):

            Keyword Args:
                x_fields (str): An optional fields mask. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                ArtifactStorage
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['payload'] = \
                payload
            return self.call_with_http_info(**kwargs)

        self.upload_artifact = _Endpoint(
            settings={
                'response_type': (ArtifactStorage,),
                'auth': [],
                'endpoint_path': '/api/v1/artifacts',
                'operation_id': 'upload_artifact',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'payload',
                    'x_fields',
                ],
                'required': [
                    'payload',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'payload':
                        (ArtifactInput,),
                    'x_fields':
                        (str,),
                },
                'attribute_map': {
                    'x_fields': 'X-Fields',
                },
                'location_map': {
                    'payload': 'body',
                    'x_fields': 'header',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__upload_artifact
        )
