# coding: utf-8

"""
    Onshape REST API

    The Onshape REST API consumed by all clients.  # noqa: E501

    OpenAPI spec version: 1.97
    Contact: api-support@onshape.zendesk.com
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from onshape_client.api_client import ApiClient


class DrawingsApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def get_translator_formats2(self, did, wid, eid, **kwargs):  # noqa: E501
        """get_translator_formats2  # 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_translator_formats2(did, wid, eid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str did: (required)
        :param str wid: (required)
        :param str eid: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_translator_formats2_with_http_info(did, wid, eid, **kwargs)  # noqa: E501
        else:
            (data) = self.get_translator_formats2_with_http_info(did, wid, eid, **kwargs)  # noqa: E501
            return data

    def get_translator_formats2_with_http_info(self, did, wid, eid, **kwargs):  # noqa: E501
        """get_translator_formats2  # 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_translator_formats2_with_http_info(did, wid, eid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str did: (required)
        :param str wid: (required)
        :param str eid: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['did', 'wid', 'eid']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'did' in local_var_params:
            path_params['did'] = local_var_params['did']  # noqa: E501
        if 'wid' in local_var_params:
            path_params['wid'] = local_var_params['wid']  # noqa: E501
        if 'eid' in local_var_params:
            path_params['eid'] = local_var_params['eid']  # 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/vnd.onshape.v1+json;charset=UTF-8; qs=0.1', 'application/json;charset=UTF-8; qs=0.9'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/drawings/d/{did}/w/{wid}/e/{eid}/translationformats', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def translate_format4(self, did, wv, wvid, eid, bt_translate_format_params, **kwargs):  # noqa: E501
        """Create Drawing translation  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.translate_format4(did, wv, wvid, eid, bt_translate_format_params, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str did: (required)
        :param str wv: (required)
        :param str wvid: (required)
        :param str eid: (required)
        :param BTTranslateFormatParams bt_translate_format_params: (required)
        :return: BTTranslationRequestInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.translate_format4_with_http_info(did, wv, wvid, eid, bt_translate_format_params, **kwargs)  # noqa: E501
        else:
            (data) = self.translate_format4_with_http_info(did, wv, wvid, eid, bt_translate_format_params, **kwargs)  # noqa: E501
            return data

    def translate_format4_with_http_info(self, did, wv, wvid, eid, bt_translate_format_params, **kwargs):  # noqa: E501
        """Create Drawing translation  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.translate_format4_with_http_info(did, wv, wvid, eid, bt_translate_format_params, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str did: (required)
        :param str wv: (required)
        :param str wvid: (required)
        :param str eid: (required)
        :param BTTranslateFormatParams bt_translate_format_params: (required)
        :return: BTTranslationRequestInfo
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['did', 'wv', 'wvid', 'eid', 'bt_translate_format_params']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}
        if 'did' in local_var_params:
            path_params['did'] = local_var_params['did']  # noqa: E501
        if 'wv' in local_var_params:
            path_params['wv'] = local_var_params['wv']  # noqa: E501
        if 'wvid' in local_var_params:
            path_params['wvid'] = local_var_params['wvid']  # noqa: E501
        if 'eid' in local_var_params:
            path_params['eid'] = local_var_params['eid']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'bt_translate_format_params' in local_var_params:
            body_params = local_var_params['bt_translate_format_params']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/vnd.onshape.v1+json;charset=UTF-8; qs=0.1', 'application/json;charset=UTF-8; qs=0.9'])  # noqa: E501

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

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

        return self.api_client.call_api(
            '/api/drawings/d/{did}/{wv}/{wvid}/e/{eid}/translations', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='BTTranslationRequestInfo',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
