<commit_before># coding: utf-8

"""
TranslatedtextApi.py
Copyright 2016 SmartBear Software

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

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

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

from __future__ import absolute_import

import sys
import os

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

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


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

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

    def get_translated_text(self, uuid, **kwargs):
        """
        
        Get translated text

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

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str uuid: Uuid (required)
        :param str oauth_consumer_key: access token value
        :return: TranslatedText
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['uuid', 'oauth_consumer_key']
        all_params.append('callback')

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

        # verify the required parameter 'uuid' is set
        if ('uuid' not in params) or (params['uuid'] is None):
            raise ValueError("Missing the required parameter `uuid` when calling `get_translated_text`")

        resource_path = '/translatedtext/{uuid}'.replace('{format}', 'json')
        method = 'GET'

        path_params = {}
        if 'uuid' in params:
            path_params['uuid'] = params['uuid']

        query_params = {}
        if 'oauth_consumer_key' in params:
            query_params['oauth_consumer_key'] = params['oauth_consumer_key']

        header_params = {}

        form_params = {}
        files = {}

        body_params = None

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = []

        response = self.api_client.call_api(resource_path, method,
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=files,
                                            response_type='TranslatedText',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        return response

    def update_translated_text(self, uuid, translated_text_update_payload, **kwargs):
        """
        
        Updates the translated_text

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

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str uuid: Uuid (required)
        :param TranslatedTextUpdatePayload translated_text_update_payload: Metadata (required)
        :return: TranslatedText
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['uuid', 'translated_text_update_payload']
        all_params.append('callback')

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

        # verify the required parameter 'uuid' is set
        if ('uuid' not in params) or (params['uuid'] is None):
            raise ValueError("Missing the required parameter `uuid` when calling `update_translated_text`")
        # verify the required parameter 'translated_text_update_payload' is set
        if ('translated_text_update_payload' not in params) or (params['translated_text_update_payload'] is None):
            raise ValueError("Missing the required parameter `translated_text_update_payload` when calling `update_translated_text`")

        resource_path = '/translatedtext/{uuid}'.replace('{format}', 'json')
        method = 'POST'

        path_params = {}
        if 'uuid' in params:
            path_params['uuid'] = params['uuid']

        query_params = {}

        header_params = {}

        form_params = {}
        files = {}

        body_params = None
        if 'translated_text_update_payload' in params:<commit_msg>Accepting the oauth_consumer_key as a query param<commit_after># coding: utf-8

"""
TranslatedtextApi.py
Copyright 2016 SmartBear Software

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

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

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

from __future__ import absolute_import

import sys
import os

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

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


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

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

    def get_translated_text(self, uuid, **kwargs):
        """
        
        Get translated text

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

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str uuid: Uuid (required)
        :param str oauth_consumer_key: access token value
        :return: TranslatedText
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        # verify the required parameter 'uuid' is set
        if ('uuid' not in params) or (params['uuid'] is None):
            raise ValueError("Missing the required parameter `uuid` when calling `get_translated_text`")

        resource_path = '/translatedtext/{uuid}'.replace('{format}', 'json')
        method = 'GET'

        path_params = {}
        if 'uuid' in params:
            path_params['uuid'] = params['uuid']

        query_params = {}
        if 'oauth_consumer_key' in params:
            query_params['oauth_consumer_key'] = params['oauth_consumer_key']

        header_params = {}

        form_params = {}
        files = {}

        body_params = None

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = []

        response = self.api_client.call_api(resource_path, method,
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=files,
                                            response_type='TranslatedText',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        return response

    def update_translated_text(self, uuid, translated_text_update_payload, **kwargs):
        """
        
        Updates the translated_text

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

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str uuid: Uuid (required)
        :param TranslatedTextUpdatePayload translated_text_update_payload: Metadata (required)
        :return: TranslatedText
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['uuid', 'translated_text_update_payload', 'oauth_consumer_key']
        all_params.append('callback')

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

        # verify the required parameter 'uuid' is set
        if ('uuid' not in params) or (params['uuid'] is None):
            raise ValueError("Missing the required parameter `uuid` when calling `update_translated_text`")
        # verify the required parameter 'translated_text_update_payload' is set
        if ('translated_text_update_payload' not in params) or (params['translated_text_update_payload'] is None):
            raise ValueError("Missing the required parameter `translated_text_update_payload` when calling `update_translated_text`")

        resource_path = '/translatedtext/{uuid}'.replace('{format}', 'json')
        method = 'POST'

        path_params = {}
        if 'uuid' in params:
            path_params['uuid'] = params['uuid']

        query_params = {}
        if 'oauth_consumer_key' in params:
            query_params['oauth_consumer_key'] = params['oauth_consumer_key']

        header_params = {}

        form_params = {}
        files = {}

        body_params = None
        if 'translated_text_update_payload' in params:
{'fraction_non_alphanumeric': 0.07962854635858438, 'fraction_numerical': 0.0016086575021936238, 'mean_word_length': 2.043391188251001, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '500232', 'n_tokens_mistral': 3348, 'n_tokens_neox': 3203, 'n_words': 1048}