# coding: utf-8

"""
    Vidispine API

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

    The version of the OpenAPI document: 5.x
    Contact: info@vidispine.com
    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 vidispine.models import *
from vidispine.api_client import ApiClient
from vidispine.exceptions import (
    ApiTypeError,
    ApiValueError
)


class TransferLogApi(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 get_transfer_log(self, **kwargs):  # noqa: E501
        """List all transfer log entries  # noqa: E501

        Retrieves log entries according to the specified filtering criteria. Note that the transfer log table does not have a lot of indices, so the extraction of data can be slow. Do not use this method other than for troubleshooting.  # 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_transfer_log(async_req=True)
        >>> result = thread.get()

        :key bool async_req: execute request asynchronously
        :key str shape: Site id, only return transfers where source or destination shape matches.  Default is all rows.  Note that not all transfers contains information about shapes.
        :key list[str] method: Comma-separated list Only return transfers where method matches.
        :key str endtime: ISO 8601 time, for upper limit of rows to return.
        :key str storage: Site id, only return transfers where source or destination storage matches.  Default is all rows.  Note that not all transfers contains information about storages.
        :key int first: Number of first row to return.
        :key str uri: URI, only return transfers where source or destination URI matches.  Default is all rows.  A star (`*`) in the URI represents a wildcard.
        :key str file: Site id, only return transfers where source or destination file matches.  Default is all rows.  Note that not all transfers contains information about files.
        :key int rows: Number of rows to return.  Cannot be greater than 1000.
        :key str item: Site id, only return transfers where source or destination item matches.  Default is all rows.  Note that not all transfers contains information about items.
        :key str starttime: ISO 8601 time, for lower limit of rows to return.
        :key list[str] status: Comma-separated list.  Only return transfers where status matches.
        :key bool perform_count: - `true` - Return a total number of rows matching criteria (except first and count).  - `false` (default) - Do not return a total number of rows matching criteria.
        :key str job: Site id, only return transfers where job matches.  Default is all rows.  Note that not all transfers contains information about jobs.
        :key _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :key _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: TransferLogListType.
                 If the method is called asynchronously, returns the request thread.
        :rtype: TransferLogListType or multiprocessing.pool.AsyncResult
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transfer_log_with_http_info(**kwargs)  # noqa: E501

    def get_transfer_log_with_http_info(self, **kwargs):  # noqa: E501
        """List all transfer log entries  # noqa: E501

        Retrieves log entries according to the specified filtering criteria. Note that the transfer log table does not have a lot of indices, so the extraction of data can be slow. Do not use this method other than for troubleshooting.  # 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_transfer_log_with_http_info(async_req=True)
        >>> result = thread.get()

        :key bool async_req: execute request asynchronously
        :key str shape: Site id, only return transfers where source or destination shape matches.  Default is all rows.  Note that not all transfers contains information about shapes.
        :key list[str] method: Comma-separated list Only return transfers where method matches.
        :key str endtime: ISO 8601 time, for upper limit of rows to return.
        :key str storage: Site id, only return transfers where source or destination storage matches.  Default is all rows.  Note that not all transfers contains information about storages.
        :key int first: Number of first row to return.
        :key str uri: URI, only return transfers where source or destination URI matches.  Default is all rows.  A star (`*`) in the URI represents a wildcard.
        :key str file: Site id, only return transfers where source or destination file matches.  Default is all rows.  Note that not all transfers contains information about files.
        :key int rows: Number of rows to return.  Cannot be greater than 1000.
        :key str item: Site id, only return transfers where source or destination item matches.  Default is all rows.  Note that not all transfers contains information about items.
        :key str starttime: ISO 8601 time, for lower limit of rows to return.
        :key list[str] status: Comma-separated list.  Only return transfers where status matches.
        :key bool perform_count: - `true` - Return a total number of rows matching criteria (except first and count).  - `false` (default) - Do not return a total number of rows matching criteria.
        :key str job: Site id, only return transfers where job matches.  Default is all rows.  Note that not all transfers contains information about jobs.
        :key _return_http_data_only: response data without head status code
                                       and headers
        :key _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :key _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(TransferLogListType, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['shape', 'method', 'endtime', 'storage', 'first', 'uri', 'file', 'rows', 'item', 'starttime', 'status', 'perform_count', 'job']  # 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 get_transfer_log" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'shape' in local_var_params:
            query_params.append(('shape', local_var_params['shape']))  # noqa: E501
        if 'method' in local_var_params:
            query_params.append(('method', local_var_params['method']))  # noqa: E501
            collection_formats['method'] = 'csv'  # noqa: E501
        if 'endtime' in local_var_params:
            query_params.append(('endtime', local_var_params['endtime']))  # noqa: E501
        if 'storage' in local_var_params:
            query_params.append(('storage', local_var_params['storage']))  # noqa: E501
        if 'first' in local_var_params:
            query_params.append(('first', local_var_params['first']))  # noqa: E501
        if 'uri' in local_var_params:
            query_params.append(('uri', local_var_params['uri']))  # noqa: E501
        if 'file' in local_var_params:
            query_params.append(('file', local_var_params['file']))  # noqa: E501
        if 'rows' in local_var_params:
            query_params.append(('rows', local_var_params['rows']))  # noqa: E501
        if 'item' in local_var_params:
            query_params.append(('item', local_var_params['item']))  # noqa: E501
        if 'starttime' in local_var_params:
            query_params.append(('starttime', local_var_params['starttime']))  # noqa: E501
        if 'status' in local_var_params:
            query_params.append(('status', local_var_params['status']))  # noqa: E501
            collection_formats['status'] = 'csv'  # noqa: E501
        if 'perform_count' in local_var_params:
            query_params.append(('performCount', local_var_params['perform_count']))  # noqa: E501
        if 'job' in local_var_params:
            query_params.append(('job', local_var_params['job']))  # 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', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basicAuth']  # noqa: E501

        return self.api_client.call_api(
            '/log/transfer-log', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TransferLogListType',  # 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)
