"""
    Agilicus API

    Agilicus is API-first. Modern software is controlled by other software, is open, is available for you to use the way you want, securely, simply.  A rendered, online viewable and usable version of this specification is available at [api](https://www.agilicus.com/api). You may try the API inline directly in the web page. To do so, first obtain an Authentication Token (the simplest way is to install the Python SDK, and then run `agilicus-cli --issuer https://MYISSUER get-token`). You will need an org-id for most calls (and can obtain from `agilicus-cli --issuer https://MYISSUER list-orgs`). The `MYISSUER` will typically be `auth.MYDOMAIN`, and you will see it as you sign-in to the administrative UI.  This API releases on Bearer-Token authentication. To obtain a valid bearer token you will need to Authenticate to an Issuer with OpenID Connect (a superset of OAUTH2).  Your \"issuer\" will look like https://auth.MYDOMAIN. For example, when you signed-up, if you said \"use my own domain name\" and assigned a CNAME of cloud.example.com, then your issuer would be https://auth.cloud.example.com.  If you selected \"use an Agilicus supplied domain name\", your issuer would look like https://auth.myorg.agilicus.cloud.  For test purposes you can use our [Python SDK](https://pypi.org/project/agilicus/) and run `agilicus-cli --issuer https://auth.MYDOMAIN get-token`.  This API may be used in any language runtime that supports OpenAPI 3.0, or, you may use our [Python SDK](https://pypi.org/project/agilicus/), our [Typescript SDK](https://www.npmjs.com/package/@agilicus/angular), or our [Golang SDK](https://git.agilicus.com/pub/sdk-go).  100% of the activities in our system our API-driven, from our web-admin, through our progressive web applications, to all internals: there is nothing that is not accessible.  For more information, see [developer resources](https://www.agilicus.com/developer).   # noqa: E501

    The version of the OpenAPI document: 2021.06.29
    Contact: dev@agilicus.com
    Generated by: https://openapi-generator.tech
"""


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

from agilicus_api.api_client import ApiClient, Endpoint as _Endpoint
from agilicus_api.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from agilicus_api.model.file import File
from agilicus_api.model.file_name import FileName
from agilicus_api.model.file_summary import FileSummary
from agilicus_api.model.file_visibility import FileVisibility
from agilicus_api.model.list_files_response import ListFilesResponse
from agilicus_api.model.storage_region import StorageRegion


class FilesApi(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 __add_file(
            self,
            name,
            file_zip,
            **kwargs
        ):
            """upload a file  # noqa: E501

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

            >>> thread = api.add_file(name, file_zip, async_req=True)
            >>> result = thread.get()

            Args:
                name (FileName):
                file_zip (file_type): The contents of the file in binary format

            Keyword Args:
                org_id (str): Unique identifier. [optional]
                tag (str): A file tag. [optional]
                label (str): A file label. [optional]
                region (StorageRegion): [optional]
                visibility (FileVisibility): [optional]
                md5_hash (str): MD5 Hash of file in base64. [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:
                FileSummary
                    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['name'] = \
                name
            kwargs['file_zip'] = \
                file_zip
            return self.call_with_http_info(**kwargs)

        if self.add_file is None:
            self.add_file = _Endpoint(
                settings={
                    'response_type': (FileSummary,),
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files',
                    'operation_id': 'add_file',
                    'http_method': 'POST',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'name',
                        'file_zip',
                        'org_id',
                        'tag',
                        'label',
                        'region',
                        'visibility',
                        'md5_hash',
                    ],
                    'required': [
                        'name',
                        'file_zip',
                    ],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                    ]
                },
                root_map={
                    'validations': {
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'name':
                            (FileName,),
                        'file_zip':
                            (file_type,),
                        'org_id':
                            (str,),
                        'tag':
                            (str,),
                        'label':
                            (str,),
                        'region':
                            (StorageRegion,),
                        'visibility':
                            (FileVisibility,),
                        'md5_hash':
                            (str,),
                    },
                    'attribute_map': {
                        'name': 'name',
                        'file_zip': 'file_zip',
                        'org_id': 'org_id',
                        'tag': 'tag',
                        'label': 'label',
                        'region': 'region',
                        'visibility': 'visibility',
                        'md5_hash': 'md5_hash',
                    },
                    'location_map': {
                        'name': 'form',
                        'file_zip': 'form',
                        'org_id': 'form',
                        'tag': 'form',
                        'label': 'form',
                        'region': 'form',
                        'visibility': 'form',
                        'md5_hash': 'form',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [
                        'application/json'
                    ],
                    'content_type': [
                        'multipart/form-data'
                    ]
                },
                api_client=api_client,
                callable=__add_file
            )

        def __delete_file(
            self,
            file_id,
            **kwargs
        ):
            """Delete a File  # noqa: E501

            Delete a File  # 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_file(file_id, async_req=True)
            >>> result = thread.get()

            Args:
                file_id (str): file_id path

            Keyword Args:
                org_id (str): Organisation Unique identifier. [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:
                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['file_id'] = \
                file_id
            return self.call_with_http_info(**kwargs)

        if self.delete_file is None:
            self.delete_file = _Endpoint(
                settings={
                    'response_type': None,
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files/{file_id}',
                    'operation_id': 'delete_file',
                    'http_method': 'DELETE',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'file_id',
                        'org_id',
                    ],
                    'required': [
                        'file_id',
                    ],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                    ]
                },
                root_map={
                    'validations': {
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'file_id':
                            (str,),
                        'org_id':
                            (str,),
                    },
                    'attribute_map': {
                        'file_id': 'file_id',
                        'org_id': 'org_id',
                    },
                    'location_map': {
                        'file_id': 'path',
                        'org_id': 'query',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [],
                    'content_type': [],
                },
                api_client=api_client,
                callable=__delete_file
            )

        def __get_download(
            self,
            file_id,
            **kwargs
        ):
            """Download File  # noqa: E501

            Download File  # 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_download(file_id, async_req=True)
            >>> result = thread.get()

            Args:
                file_id (str): file_id path

            Keyword Args:
                org_id (str): Organisation Unique identifier. [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:
                file_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['file_id'] = \
                file_id
            return self.call_with_http_info(**kwargs)

        if self.get_download is None:
            self.get_download = _Endpoint(
                settings={
                    'response_type': (file_type,),
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files_download/{file_id}',
                    'operation_id': 'get_download',
                    'http_method': 'GET',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'file_id',
                        'org_id',
                    ],
                    'required': [
                        'file_id',
                    ],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                    ]
                },
                root_map={
                    'validations': {
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'file_id':
                            (str,),
                        'org_id':
                            (str,),
                    },
                    'attribute_map': {
                        'file_id': 'file_id',
                        'org_id': 'org_id',
                    },
                    'location_map': {
                        'file_id': 'path',
                        'org_id': 'query',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [
                        'application/octet-stream'
                    ],
                    'content_type': [],
                },
                api_client=api_client,
                callable=__get_download
            )

        def __get_file(
            self,
            file_id,
            **kwargs
        ):
            """Get File metadata  # noqa: E501

            Get File metadata  # 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_file(file_id, async_req=True)
            >>> result = thread.get()

            Args:
                file_id (str): file_id path

            Keyword Args:
                org_id (str): Organisation Unique identifier. [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:
                FileSummary
                    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['file_id'] = \
                file_id
            return self.call_with_http_info(**kwargs)

        if self.get_file is None:
            self.get_file = _Endpoint(
                settings={
                    'response_type': (FileSummary,),
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files/{file_id}',
                    'operation_id': 'get_file',
                    'http_method': 'GET',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'file_id',
                        'org_id',
                    ],
                    'required': [
                        'file_id',
                    ],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                    ]
                },
                root_map={
                    'validations': {
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'file_id':
                            (str,),
                        'org_id':
                            (str,),
                    },
                    'attribute_map': {
                        'file_id': 'file_id',
                        'org_id': 'org_id',
                    },
                    'location_map': {
                        'file_id': 'path',
                        'org_id': 'query',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [
                        'application/json'
                    ],
                    'content_type': [],
                },
                api_client=api_client,
                callable=__get_file
            )

        def __list_files(
            self,
            **kwargs
        ):
            """Query Files  # noqa: E501

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

            >>> thread = api.list_files(async_req=True)
            >>> result = thread.get()


            Keyword Args:
                limit (int): limit the number of rows in the response. [optional] if omitted the server will use the default value of 500
                org_id (str): Organisation Unique identifier. [optional]
                user_id (str): Query based on user id. [optional]
                tag (str): Search files based on tag. [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:
                ListFilesResponse
                    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')
            return self.call_with_http_info(**kwargs)

        if self.list_files is None:
            self.list_files = _Endpoint(
                settings={
                    'response_type': (ListFilesResponse,),
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files',
                    'operation_id': 'list_files',
                    'http_method': 'GET',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'limit',
                        'org_id',
                        'user_id',
                        'tag',
                    ],
                    'required': [],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                        'limit',
                    ]
                },
                root_map={
                    'validations': {
                        ('limit',): {

                            'inclusive_maximum': 500,
                            'inclusive_minimum': 1,
                        },
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'limit':
                            (int,),
                        'org_id':
                            (str,),
                        'user_id':
                            (str,),
                        'tag':
                            (str,),
                    },
                    'attribute_map': {
                        'limit': 'limit',
                        'org_id': 'org_id',
                        'user_id': 'user_id',
                        'tag': 'tag',
                    },
                    'location_map': {
                        'limit': 'query',
                        'org_id': 'query',
                        'user_id': 'query',
                        'tag': 'query',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [
                        'application/json'
                    ],
                    'content_type': [],
                },
                api_client=api_client,
                callable=__list_files
            )

        def __replace_file(
            self,
            file_id,
            file,
            **kwargs
        ):
            """Update a file  # noqa: E501

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

            >>> thread = api.replace_file(file_id, file, async_req=True)
            >>> result = thread.get()

            Args:
                file_id (str): file_id path
                file (File): Upload file request

            Keyword Args:
                org_id (str): Organisation Unique identifier. [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:
                FileSummary
                    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['file_id'] = \
                file_id
            kwargs['file'] = \
                file
            return self.call_with_http_info(**kwargs)

        if self.replace_file is None:
            self.replace_file = _Endpoint(
                settings={
                    'response_type': (FileSummary,),
                    'auth': [
                        'token-valid'
                    ],
                    'endpoint_path': '/v1/files/{file_id}',
                    'operation_id': 'replace_file',
                    'http_method': 'PUT',
                    'servers': None,
                },
                params_map={
                    'all': [
                        'file_id',
                        'file',
                        'org_id',
                    ],
                    'required': [
                        'file_id',
                        'file',
                    ],
                    'nullable': [
                    ],
                    'enum': [
                    ],
                    'validation': [
                    ]
                },
                root_map={
                    'validations': {
                    },
                    'allowed_values': {
                    },
                    'openapi_types': {
                        'file_id':
                            (str,),
                        'file':
                            (File,),
                        'org_id':
                            (str,),
                    },
                    'attribute_map': {
                        'file_id': 'file_id',
                        'org_id': 'org_id',
                    },
                    'location_map': {
                        'file_id': 'path',
                        'file': 'body',
                        'org_id': 'query',
                    },
                    'collection_format_map': {
                    }
                },
                headers_map={
                    'accept': [
                        'application/json'
                    ],
                    'content_type': [
                        'application/json'
                    ]
                },
                api_client=api_client,
                callable=__replace_file
            )

    add_file = None 
    delete_file = None 
    get_download = None 
    get_file = None 
    list_files = None 
    replace_file = None 
