# coding: utf-8

"""
    Welcome to the Atera API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: v3
    
    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 atera_client.api_client import ApiClient


class RatesApi(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 rates_delete_expense(self, expense_id, **kwargs):  # noqa: E501
        """Delete specified expense  # noqa: E501

        Deletes a specified expense. Requires the expense ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_delete_expense(expense_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System Expense ID (required)
        :return: Object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_delete_expense_with_http_info(expense_id, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_delete_expense_with_http_info(expense_id, **kwargs)  # noqa: E501
            return data

    def rates_delete_expense_with_http_info(self, expense_id, **kwargs):  # noqa: E501
        """Delete specified expense  # noqa: E501

        Deletes a specified expense. Requires the expense ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_delete_expense_with_http_info(expense_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System Expense ID (required)
        :return: Object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["expense_id"]  # 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 rates_delete_expense" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'expense_id' is set
        if self.api_client.client_side_validation and (
            "expense_id" not in params or params["expense_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `expense_id` when calling `rates_delete_expense`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "expense_id" in params:
            path_params["expenseId"] = params["expense_id"]  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/expenses/{expenseId}",
            "DELETE",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Object",  # 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 rates_delete_product(self, product_id, **kwargs):  # noqa: E501
        """Delete specified product  # noqa: E501

        Deletes a specified product. Requires the product ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_delete_product(product_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System Product ID (required)
        :return: Object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_delete_product_with_http_info(product_id, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_delete_product_with_http_info(product_id, **kwargs)  # noqa: E501
            return data

    def rates_delete_product_with_http_info(self, product_id, **kwargs):  # noqa: E501
        """Delete specified product  # noqa: E501

        Deletes a specified product. Requires the product ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_delete_product_with_http_info(product_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System Product ID (required)
        :return: Object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["product_id"]  # 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 rates_delete_product" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'product_id' is set
        if self.api_client.client_side_validation and (
            "product_id" not in params or params["product_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `product_id` when calling `rates_delete_product`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "product_id" in params:
            path_params["productId"] = params["product_id"]  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/products/{productId}",
            "DELETE",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Object",  # 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 rates_expense_query_dto(self, expense_id, **kwargs):  # noqa: E501
        """Find specified expense  # noqa: E501

        Returns a specified expense. Requires the expense ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_expense_query_dto(expense_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System expense ID (required)
        :return: RateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_expense_query_dto_with_http_info(expense_id, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_expense_query_dto_with_http_info(expense_id, **kwargs)  # noqa: E501
            return data

    def rates_expense_query_dto_with_http_info(self, expense_id, **kwargs):  # noqa: E501
        """Find specified expense  # noqa: E501

        Returns a specified expense. Requires the expense ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_expense_query_dto_with_http_info(expense_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System expense ID (required)
        :return: RateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["expense_id"]  # 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 rates_expense_query_dto" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'expense_id' is set
        if self.api_client.client_side_validation and (
            "expense_id" not in params or params["expense_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `expense_id` when calling `rates_expense_query_dto`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "expense_id" in params:
            path_params["expenseId"] = params["expense_id"]  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/expenses/{expenseId}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="RateQueryDTO",  # 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 rates_get_expenses(self, **kwargs):  # noqa: E501
        """Find expenses  # noqa: E501

        Returns a list of expenses.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_get_expenses(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: Optional - Page index, based on items per page (default is 1)
        :param int items_in_page: Optional - Number of items per page (default is 20, max is 50)
        :return: APIResultWrapperRateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_get_expenses_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.rates_get_expenses_with_http_info(**kwargs)  # noqa: E501
            return data

    def rates_get_expenses_with_http_info(self, **kwargs):  # noqa: E501
        """Find expenses  # noqa: E501

        Returns a list of expenses.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_get_expenses_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: Optional - Page index, based on items per page (default is 1)
        :param int items_in_page: Optional - Number of items per page (default is 20, max is 50)
        :return: APIResultWrapperRateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["page", "items_in_page"]  # 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 rates_get_expenses" % key)
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "page" in params:
            query_params.append(("page", params["page"]))  # noqa: E501
        if "items_in_page" in params:
            query_params.append(("itemsInPage", params["items_in_page"]))  # 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", "text/json"])  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/expenses",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="APIResultWrapperRateQueryDTO",  # 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 rates_get_products(self, **kwargs):  # noqa: E501
        """Find products  # noqa: E501

        Returns a list of products.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_get_products(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: Optional - Page index, based on items per page (default is 1)
        :param int items_in_page: Optional - Number of items per page (default is 20, max is 50)
        :return: APIResultWrapperRateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_get_products_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.rates_get_products_with_http_info(**kwargs)  # noqa: E501
            return data

    def rates_get_products_with_http_info(self, **kwargs):  # noqa: E501
        """Find products  # noqa: E501

        Returns a list of products.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_get_products_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: Optional - Page index, based on items per page (default is 1)
        :param int items_in_page: Optional - Number of items per page (default is 20, max is 50)
        :return: APIResultWrapperRateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["page", "items_in_page"]  # 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 rates_get_products" % key)
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "page" in params:
            query_params.append(("page", params["page"]))  # noqa: E501
        if "items_in_page" in params:
            query_params.append(("itemsInPage", params["items_in_page"]))  # 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", "text/json"])  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/products",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="APIResultWrapperRateQueryDTO",  # 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 rates_post_expense(self, expense, **kwargs):  # noqa: E501
        """Create expense  # noqa: E501

        Creates a new expense. Requires an expense description.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_post_expense(expense, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateProductExpenseRateDTO expense: Required - System Expense object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_post_expense_with_http_info(expense, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_post_expense_with_http_info(expense, **kwargs)  # noqa: E501
            return data

    def rates_post_expense_with_http_info(self, expense, **kwargs):  # noqa: E501
        """Create expense  # noqa: E501

        Creates a new expense. Requires an expense description.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_post_expense_with_http_info(expense, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateProductExpenseRateDTO expense: Required - System Expense object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["expense"]  # 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 rates_post_expense" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'expense' is set
        if self.api_client.client_side_validation and (
            "expense" not in params or params["expense"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `expense` when calling `rates_post_expense`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/expenses",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Result",  # 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 rates_post_product(self, product, **kwargs):  # noqa: E501
        """Create product  # noqa: E501

        Creates a new product. Requires a product description.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_post_product(product, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateProductExpenseRateDTO product: Required - System Product object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_post_product_with_http_info(product, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_post_product_with_http_info(product, **kwargs)  # noqa: E501
            return data

    def rates_post_product_with_http_info(self, product, **kwargs):  # noqa: E501
        """Create product  # noqa: E501

        Creates a new product. Requires a product description.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_post_product_with_http_info(product, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateProductExpenseRateDTO product: Required - System Product object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["product"]  # 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 rates_post_product" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'product' is set
        if self.api_client.client_side_validation and (
            "product" not in params or params["product"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `product` when calling `rates_post_product`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/products",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Result",  # 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 rates_product_query_dto(self, product_id, **kwargs):  # noqa: E501
        """Find specified product  # noqa: E501

        Returns a specified product. Requires the product ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_product_query_dto(product_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System product ID (required)
        :return: RateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_product_query_dto_with_http_info(product_id, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_product_query_dto_with_http_info(product_id, **kwargs)  # noqa: E501
            return data

    def rates_product_query_dto_with_http_info(self, product_id, **kwargs):  # noqa: E501
        """Find specified product  # noqa: E501

        Returns a specified product. Requires the product ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_product_query_dto_with_http_info(product_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System product ID (required)
        :return: RateQueryDTO
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["product_id"]  # 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 rates_product_query_dto" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'product_id' is set
        if self.api_client.client_side_validation and (
            "product_id" not in params or params["product_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `product_id` when calling `rates_product_query_dto`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "product_id" in params:
            path_params["productId"] = params["product_id"]  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/products/{productId}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="RateQueryDTO",  # 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 rates_put_expense(self, expense_id, expense, **kwargs):  # noqa: E501
        """Update specified expense  # noqa: E501

        Updates a specified expense. Requires the expense ID.              <br /><br />               The following fields are editable:              <br /><br />               Description              <br />              Category              <br />               Amount              <br />              SKU              <br />              Archived  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_put_expense(expense_id, expense, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System Expense ID (required)
        :param UpdateProductExpenseRateDTO expense: Required - System Expense object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_put_expense_with_http_info(expense_id, expense, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_put_expense_with_http_info(expense_id, expense, **kwargs)  # noqa: E501
            return data

    def rates_put_expense_with_http_info(self, expense_id, expense, **kwargs):  # noqa: E501
        """Update specified expense  # noqa: E501

        Updates a specified expense. Requires the expense ID.              <br /><br />               The following fields are editable:              <br /><br />               Description              <br />              Category              <br />               Amount              <br />              SKU              <br />              Archived  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_put_expense_with_http_info(expense_id, expense, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int expense_id: Required - System Expense ID (required)
        :param UpdateProductExpenseRateDTO expense: Required - System Expense object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["expense_id", "expense"]  # 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 rates_put_expense" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'expense_id' is set
        if self.api_client.client_side_validation and (
            "expense_id" not in params or params["expense_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `expense_id` when calling `rates_put_expense`"
            )  # noqa: E501
        # verify the required parameter 'expense' is set
        if self.api_client.client_side_validation and (
            "expense" not in params or params["expense"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `expense` when calling `rates_put_expense`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "expense_id" in params:
            path_params["expenseId"] = params["expense_id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/expenses/{expenseId}",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Result",  # 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 rates_put_product(self, product_id, product, **kwargs):  # noqa: E501
        """Update specified product  # noqa: E501

        Updates a specified product. Requires the product ID.              <br /><br />               The following fields are editable:              <br /><br />               Description              <br />              Category              <br />               Amount              <br />              SKU              <br />              Archived  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_put_product(product_id, product, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System Product ID (required)
        :param UpdateProductExpenseRateDTO product: Required - System Product object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.rates_put_product_with_http_info(product_id, product, **kwargs)  # noqa: E501
        else:
            (data) = self.rates_put_product_with_http_info(product_id, product, **kwargs)  # noqa: E501
            return data

    def rates_put_product_with_http_info(self, product_id, product, **kwargs):  # noqa: E501
        """Update specified product  # noqa: E501

        Updates a specified product. Requires the product ID.              <br /><br />               The following fields are editable:              <br /><br />               Description              <br />              Category              <br />               Amount              <br />              SKU              <br />              Archived  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.rates_put_product_with_http_info(product_id, product, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int product_id: Required - System Product ID (required)
        :param UpdateProductExpenseRateDTO product: Required - System Product object (required)
        :return: Result
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["product_id", "product"]  # 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 rates_put_product" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'product_id' is set
        if self.api_client.client_side_validation and (
            "product_id" not in params or params["product_id"] is None
        ):  # noqa: E501
            raise ValueError(
                "Missing the required parameter `product_id` when calling `rates_put_product`"
            )  # noqa: E501
        # verify the required parameter 'product' is set
        if self.api_client.client_side_validation and (
            "product" not in params or params["product"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `product` when calling `rates_put_product`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "product_id" in params:
            path_params["productId"] = params["product_id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["api-key"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v3/rates/products/{productId}",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="Result",  # 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,
        )
