# coding: utf-8

"""
    ThingsBoard REST API

     ThingsBoard open-source IoT platform REST API documentation.  # noqa: E501

    OpenAPI spec version: 3.7.0
    Contact: info@thingsboard.io
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from tb_rest_client.api_client import ApiClient


class ImageControllerApi(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):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def delete_image_using_delete(self, type, key, **kwargs):  # noqa: E501
        """deleteImage  # 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_image_using_delete(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param bool force: force
        :return: TbImageDeleteResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_image_using_delete_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_image_using_delete_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def delete_image_using_delete_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """deleteImage  # 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_image_using_delete_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param bool force: force
        :return: TbImageDeleteResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'force']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        query_params = []
        if 'force' in params:
            query_params.append(('force', params['force']))  # 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'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}{?force}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbImageDeleteResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def download_image_preview_using_get(self, type, key, **kwargs):  # noqa: E501
        """downloadImagePreview  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_image_preview_using_get(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.download_image_preview_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.download_image_preview_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def download_image_preview_using_get_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """downloadImagePreview  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_image_preview_using_get_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'if_none_match']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        query_params = []

        header_params = {}
        if 'if_none_match' in params:
            header_params['If-None-Match'] = params['if_none_match']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['image/png'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}/preview', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def download_image_using_get(self, type, key, **kwargs):  # noqa: E501
        """downloadImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_image_using_get(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.download_image_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.download_image_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def download_image_using_get_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """downloadImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_image_using_get_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'if_none_match']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        query_params = []

        header_params = {}
        if 'if_none_match' in params:
            header_params['If-None-Match'] = params['if_none_match']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['image/*'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def download_public_image_using_get(self, public_resource_key, **kwargs):  # noqa: E501
        """downloadPublicImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_public_image_using_get(public_resource_key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str public_resource_key: publicResourceKey (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.download_public_image_using_get_with_http_info(public_resource_key, **kwargs)  # noqa: E501
        else:
            (data) = self.download_public_image_using_get_with_http_info(public_resource_key, **kwargs)  # noqa: E501
            return data

    def download_public_image_using_get_with_http_info(self, public_resource_key, **kwargs):  # noqa: E501
        """downloadPublicImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_public_image_using_get_with_http_info(public_resource_key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str public_resource_key: publicResourceKey (required)
        :param str if_none_match: If-None-Match
        :return: ByteArrayResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['public_resource_key', 'if_none_match']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'public_resource_key' in params:
            path_params['publicResourceKey'] = params['public_resource_key']  # noqa: E501

        query_params = []

        header_params = {}
        if 'if_none_match' in params:
            header_params['If-None-Match'] = params['if_none_match']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['image/*'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/public/{publicResourceKey}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def export_image_using_get(self, type, key, **kwargs):  # noqa: E501
        """exportImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.export_image_using_get(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :return: ImageExportData
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.export_image_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.export_image_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def export_image_using_get_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """exportImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.export_image_using_get_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :return: ImageExportData
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        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'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}/export', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ImageExportData',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def get_image_info_using_get(self, type, key, **kwargs):  # noqa: E501
        """getImageInfo  # 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_image_info_using_get(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_image_info_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.get_image_info_using_get_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def get_image_info_using_get_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """getImageInfo  # 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_image_info_using_get_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        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'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}/info', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def get_images_using_get(self, page_size, page, **kwargs):  # noqa: E501
        """getImages  # 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_images_using_get(page_size, page, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page_size: Maximum amount of entities in a one page (required)
        :param int page: Sequence number of page starting from 0 (required)
        :param bool include_system_images: Use 'true' to include system images. Disabled by default. Ignored for requests by users with system administrator authority.
        :param str text_search: The case insensitive 'substring' filter based on the resource title.
        :param str sort_property: Property of entity to sort by
        :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
        :return: PageDataTbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_images_using_get_with_http_info(page_size, page, **kwargs)  # noqa: E501
        else:
            (data) = self.get_images_using_get_with_http_info(page_size, page, **kwargs)  # noqa: E501
            return data

    def get_images_using_get_with_http_info(self, page_size, page, **kwargs):  # noqa: E501
        """getImages  # 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_images_using_get_with_http_info(page_size, page, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page_size: Maximum amount of entities in a one page (required)
        :param int page: Sequence number of page starting from 0 (required)
        :param bool include_system_images: Use 'true' to include system images. Disabled by default. Ignored for requests by users with system administrator authority.
        :param str text_search: The case insensitive 'substring' filter based on the resource title.
        :param str sort_property: Property of entity to sort by
        :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING)
        :return: PageDataTbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_size', 'page', 'include_system_images', 'text_search', 'sort_property', 'sort_order']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_images_using_get" % 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_images_using_get`")  # noqa: E501
        # 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_images_using_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'include_system_images' in params:
            query_params.append(('includeSystemImages', params['include_system_images']))  # noqa: E501
        if 'text_search' in params:
            query_params.append(('textSearch', params['text_search']))  # noqa: E501
        if 'sort_property' in params:
            query_params.append(('sortProperty', params['sort_property']))  # noqa: E501
        if 'sort_order' in params:
            query_params.append(('sortOrder', params['sort_order']))  # 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'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images{?includeSystemImages,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='PageDataTbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def import_image_using_put(self, **kwargs):  # noqa: E501
        """importImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.import_image_using_put(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ImageExportData body:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.import_image_using_put_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.import_image_using_put_with_http_info(**kwargs)  # noqa: E501
            return data

    def import_image_using_put_with_http_info(self, **kwargs):  # noqa: E501
        """importImage  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.import_image_using_put_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ImageExportData body:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/image/import', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def update_image_info_using_put(self, type, key, **kwargs):  # noqa: E501
        """updateImageInfo  # 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_image_info_using_put(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param TbResourceInfo body:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_image_info_using_put_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.update_image_info_using_put_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def update_image_info_using_put_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """updateImageInfo  # 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_image_info_using_put_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param TbResourceInfo body:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}/info', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def update_image_public_status_using_put(self, type, key, is_public, **kwargs):  # noqa: E501
        """updateImagePublicStatus  # 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_image_public_status_using_put(type, key, is_public, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param bool is_public: isPublic (required)
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_image_public_status_using_put_with_http_info(type, key, is_public, **kwargs)  # noqa: E501
        else:
            (data) = self.update_image_public_status_using_put_with_http_info(type, key, is_public, **kwargs)  # noqa: E501
            return data

    def update_image_public_status_using_put_with_http_info(self, type, key, is_public, **kwargs):  # noqa: E501
        """updateImagePublicStatus  # 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_image_public_status_using_put_with_http_info(type, key, is_public, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param bool is_public: isPublic (required)
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'is_public']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501
        if 'is_public' in params:
            path_params['isPublic'] = params['is_public']  # noqa: E501

        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'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}/public/{isPublic}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def update_image_using_put(self, type, key, **kwargs):  # noqa: E501
        """updateImage  # 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_image_using_put(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str file:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_image_using_put_with_http_info(type, key, **kwargs)  # noqa: E501
        else:
            (data) = self.update_image_using_put_with_http_info(type, key, **kwargs)  # noqa: E501
            return data

    def update_image_using_put_with_http_info(self, type, key, **kwargs):  # noqa: E501
        """updateImage  # 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_image_using_put_with_http_info(type, key, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str type: Type of the image: tenant or system (required)
        :param str key: Image resource key, for example thermostats_dashboard_background.jpeg (required)
        :param str file:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['type', 'key', 'file']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'type' in params:
            path_params['type'] = params['type']  # noqa: E501
        if 'key' in params:
            path_params['key'] = params['key']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}
        if 'file' in params:
            local_var_files['file'] = params['file']  # noqa: E501

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['multipart/form-data'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/images/{type}/{key}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def upload_image_using_post(self, **kwargs):  # noqa: E501
        """uploadImage  # 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_image_using_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str file:
        :param str title:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.upload_image_using_post_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.upload_image_using_post_with_http_info(**kwargs)  # noqa: E501
            return data

    def upload_image_using_post_with_http_info(self, **kwargs):  # noqa: E501
        """uploadImage  # 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_image_using_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str file:
        :param str title:
        :return: TbResourceInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['file', 'title']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

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

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['multipart/form-data'])  # noqa: E501

        # Authentication setting
        auth_settings = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/image', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TbResourceInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
