# coding: utf-8

"""
    EDIS public shipping API

    <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This API allows 3rd party developers in the Greater-China area to process package shipping details.  # noqa: E501

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


class BundleApi(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 cancel_bundle(self, bundle_id, **kwargs):  # noqa: E501
        """cancel_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to cancel a bundle.<br><br>The <b>bundleId</b> value of the bundle to be canceled must be input as a path parameter in the request. <br><br><span class=\"tablenote\"><b>Note:</b> Bundles cannot be canceled if they are currently being processed.</span>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.cancel_bundle(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle being canceled.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.cancel_bundle_with_http_info(bundle_id, **kwargs)  # noqa: E501
        else:
            (data) = self.cancel_bundle_with_http_info(bundle_id, **kwargs)  # noqa: E501
            return data

    def cancel_bundle_with_http_info(self, bundle_id, **kwargs):  # noqa: E501
        """cancel_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to cancel a bundle.<br><br>The <b>bundleId</b> value of the bundle to be canceled must be input as a path parameter in the request. <br><br><span class=\"tablenote\"><b>Note:</b> Bundles cannot be canceled if they are currently being processed.</span>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.cancel_bundle_with_http_info(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle being canceled.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['api_auth']  # noqa: E501

        return self.api_client.call_api(
            '/bundle/{bundle_id}/cancel', 'POST',
            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=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 create_bundle(self, **kwargs):  # noqa: E501
        """create_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to create a bundle for multiple packages in an order.<br><br>To create a bundle, the consign address to be associated with the bundle and the tracking numbers of the packages to be used in the bundle must be specified in the request. <br><br>If the call is successful, the <b>bundleId</b> for the newly created bundle will be returned.<br><br><span class=\"tablenote\"><b>Note:</b> Sellers should keep track of the returned <b>bundleId</b>, as there is no programmatic way to retrieve this value at this time.</span>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_bundle(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateBundleRequest body:
        :return: CreateBundleResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_bundle_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.create_bundle_with_http_info(**kwargs)  # noqa: E501
            return data

    def create_bundle_with_http_info(self, **kwargs):  # noqa: E501
        """create_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to create a bundle for multiple packages in an order.<br><br>To create a bundle, the consign address to be associated with the bundle and the tracking numbers of the packages to be used in the bundle must be specified in the request. <br><br>If the call is successful, the <b>bundleId</b> for the newly created bundle will be returned.<br><br><span class=\"tablenote\"><b>Note:</b> Sellers should keep track of the returned <b>bundleId</b>, as there is no programmatic way to retrieve this value at this time.</span>  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_bundle_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateBundleRequest body:
        :return: CreateBundleResponse
                 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 create_bundle" % 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 = ['api_auth']  # noqa: E501

        return self.api_client.call_api(
            '/bundle', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CreateBundleResponse',  # 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_bundle(self, bundle_id, **kwargs):  # noqa: E501
        """get_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to retrieved information about a specific bundle based on the provided bundle ID value.<br><br>The <b>bundle_id</b> value of the bundle to be retrieved must be input as a path parameter in the request. If the call is successful, information about the bundle is returned, such as its associated consign preference ID and the tracking numbers of each package in the bundle.  # 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_bundle(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle being retrieved.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: BundleDetailResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_bundle_with_http_info(bundle_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_bundle_with_http_info(bundle_id, **kwargs)  # noqa: E501
            return data

    def get_bundle_with_http_info(self, bundle_id, **kwargs):  # noqa: E501
        """get_bundle  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method is used to retrieved information about a specific bundle based on the provided bundle ID value.<br><br>The <b>bundle_id</b> value of the bundle to be retrieved must be input as a path parameter in the request. If the call is successful, information about the bundle is returned, such as its associated consign preference ID and the tracking numbers of each package in the bundle.  # 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_bundle_with_http_info(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle being retrieved.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: BundleDetailResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'bundle_id' in params:
            path_params['bundle_id'] = params['bundle_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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/bundle/{bundle_id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='BundleDetailResponse',  # 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_bundle_label(self, bundle_id, **kwargs):  # noqa: E501
        """get_bundle_label  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method can be used to retrieve the bundle label for a bundle of packages.<br><br>The bundle for which to retrieve a bundle label is specified through the <b>bundleId</b> path parameter.<br><br>Bundle labels will be returned as base64 string values which can be converted to PDF files.  # 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_bundle_label(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle for which to retrieve a label.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: BundleLabelResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        if '_return_http_data_only' not in kwargs:  # ebay_rest patch
            kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_bundle_label_with_http_info(bundle_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_bundle_label_with_http_info(bundle_id, **kwargs)  # noqa: E501
            return data

    def get_bundle_label_with_http_info(self, bundle_id, **kwargs):  # noqa: E501
        """get_bundle_label  # noqa: E501

        <div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"&lt;b&gt;&lt;span style=&quot;color: #dd1e31;&quot; class=&quot;mcFormatColor&quot;&gt;Important! &lt;/span&gt;&lt;/b&gt;\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\" class=\"mcFormatColor\">Important!</span></b></span></span> This method is only available for Greater-China based sellers with an active eDIS account.</p></div><br>This method can be used to retrieve the bundle label for a bundle of packages.<br><br>The bundle for which to retrieve a bundle label is specified through the <b>bundleId</b> path parameter.<br><br>Bundle labels will be returned as base64 string values which can be converted to PDF files.  # 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_bundle_label_with_http_info(bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str bundle_id: This path parameter specifies the unique identifier of the bundle for which to retrieve a label.<br><br>This ID value is returned when creating a bundle through the <a href=\"/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle\" target=\"_blank\">createBundle</a> method. (required)
        :return: BundleLabelResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'bundle_id' in params:
            path_params['bundle_id'] = params['bundle_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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/bundle/{bundle_id}/label', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='BundleLabelResponse',  # 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)
