# coding: utf-8

"""
    BombBomb

    We make it easy to build relationships using simple videos.

    OpenAPI spec version: 2.0.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class FilesApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def doc_host_delete(self, doc_id, **kwargs):
        """
        Delete file
        Deletes a users file

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_delete(doc_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str doc_id: Id of document (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.doc_host_delete_with_http_info(doc_id, **kwargs)
        else:
            (data) = self.doc_host_delete_with_http_info(doc_id, **kwargs)
            return data

    def doc_host_delete_with_http_info(self, doc_id, **kwargs):
        """
        Delete file
        Deletes a users file

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_delete_with_http_info(doc_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str doc_id: Id of document (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['doc_id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method doc_host_delete" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'doc_id' is set
        if ('doc_id' not in params) or (params['doc_id'] is None):
            raise ValueError("Missing the required parameter `doc_id` when calling `doc_host_delete`")

        resource_path = '/files/{docId}'.replace('{format}', 'json')
        path_params = {}
        if 'doc_id' in params:
            path_params['docId'] = params['doc_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'DELETE',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def doc_host_get(self, doc_id, **kwargs):
        """
        Get file
        Get a single file by id

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_get(doc_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str doc_id: Id of document (required)
        :return: HostedDoc
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.doc_host_get_with_http_info(doc_id, **kwargs)
        else:
            (data) = self.doc_host_get_with_http_info(doc_id, **kwargs)
            return data

    def doc_host_get_with_http_info(self, doc_id, **kwargs):
        """
        Get file
        Get a single file by id

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_get_with_http_info(doc_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str doc_id: Id of document (required)
        :return: HostedDoc
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['doc_id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method doc_host_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'doc_id' is set
        if ('doc_id' not in params) or (params['doc_id'] is None):
            raise ValueError("Missing the required parameter `doc_id` when calling `doc_host_get`")

        resource_path = '/files/{docId}'.replace('{format}', 'json')
        path_params = {}
        if 'doc_id' in params:
            path_params['docId'] = params['doc_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='HostedDoc',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def doc_host_list(self, **kwargs):
        """
        List all files
        List all uploaded user files

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_list(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[HostedDoc]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.doc_host_list_with_http_info(**kwargs)
        else:
            (data) = self.doc_host_list_with_http_info(**kwargs)
            return data

    def doc_host_list_with_http_info(self, **kwargs):
        """
        List all files
        List all uploaded user files

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_list_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[HostedDoc]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method doc_host_list" % key
                )
            params[key] = val
        del params['kwargs']

        resource_path = '/files'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[HostedDoc]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def doc_host_upload_v2(self, file, **kwargs):
        """
        Upload a file
        Upload a new file

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_upload_v2(file, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str file: The file being uploaded (required)
        :return: list[HostedDoc]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.doc_host_upload_v2_with_http_info(file, **kwargs)
        else:
            (data) = self.doc_host_upload_v2_with_http_info(file, **kwargs)
            return data

    def doc_host_upload_v2_with_http_info(self, file, **kwargs):
        """
        Upload a file
        Upload a new file

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.doc_host_upload_v2_with_http_info(file, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str file: The file being uploaded (required)
        :return: list[HostedDoc]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['file']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method doc_host_upload_v2" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'file' is set
        if ('file' not in params) or (params['file'] is None):
            raise ValueError("Missing the required parameter `file` when calling `doc_host_upload_v2`")

        resource_path = '/files'.replace('{format}', 'json')
        path_params = {}

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}
        if 'file' in params:
            form_params.append(('file', params['file']))

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='list[HostedDoc]',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_hosted_images_paged(self, page_size, page, **kwargs):
        """
        Get paged hosted images
        Get a specific page of uploaded images available to the user.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_hosted_images_paged(page_size, page, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str page_size: The number of items to retrieve in a single db query. (required)
        :param str page: Zero-based index of the page of data to retrieve from the db. (required)
        :param str search: Filter results with names that match the search term.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_hosted_images_paged_with_http_info(page_size, page, **kwargs)
        else:
            (data) = self.get_hosted_images_paged_with_http_info(page_size, page, **kwargs)
            return data

    def get_hosted_images_paged_with_http_info(self, page_size, page, **kwargs):
        """
        Get paged hosted images
        Get a specific page of uploaded images available to the user.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_hosted_images_paged_with_http_info(page_size, page, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str page_size: The number of items to retrieve in a single db query. (required)
        :param str page: Zero-based index of the page of data to retrieve from the db. (required)
        :param str search: Filter results with names that match the search term.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_size', 'page', 'search']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_hosted_images_paged" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'page_size' is set
        if ('page_size' not in params) or (params['page_size'] is None):
            raise ValueError("Missing the required parameter `page_size` when calling `get_hosted_images_paged`")
        # verify the required parameter 'page' is set
        if ('page' not in params) or (params['page'] is None):
            raise ValueError("Missing the required parameter `page` when calling `get_hosted_images_paged`")

        resource_path = '/files/images/paged'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'page_size' in params:
            query_params['pageSize'] = params['page_size']
        if 'page' in params:
            query_params['page'] = params['page']
        if 'search' in params:
            query_params['search'] = params['search']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = ['BBOAuth2']

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))
