diff --git a/README.md b/README.md index 2be4c91..e5faa95 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 3.0.0 - Package version: 1.0.0 -- Build date: 2017-11-29T13:18:25.520+01:00 +- Build date: 2017-12-01T10:49:16.519+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -111,6 +111,7 @@ Class | Method | HTTP request | Description *CallsApi* | [**call_start**](docs/CallsApi.md#call_start) | **POST** /call/_start | Starts new outcoming / internal call *CallsApi* | [**call_start_failed**](docs/CallsApi.md#call_start_failed) | **POST** /call/_startFailed | Callback that starting call failed *CallsApi* | [**call_stop**](docs/CallsApi.md#call_stop) | **POST** /calls/{callId}/_stop | Stops the call +*CallsApi* | [**call_transfer**](docs/CallsApi.md#call_transfer) | **POST** /calls/{callId}/_transfer | Transfers call to different department / agent *CallsApi* | [**confirm_ring**](docs/CallsApi.md#confirm_ring) | **POST** /calls/{callId}/_confirmRing | Confirm that call is ringing *CallsApi* | [**get_calls_list**](docs/CallsApi.md#get_calls_list) | **GET** /calls | Gets list of calls *CallsApi* | [**merge**](docs/CallsApi.md#merge) | **POST** /calls/{callId}/_merge | Merge two calls @@ -221,6 +222,7 @@ Class | Method | HTTP request | Description - [CallListItem](docs/CallListItem.md) - [CallMessage](docs/CallMessage.md) - [CallStatus](docs/CallStatus.md) + - [CallTransferResult](docs/CallTransferResult.md) - [CannedMessage](docs/CannedMessage.md) - [Company](docs/Company.md) - [CompanyListItem](docs/CompanyListItem.md) diff --git a/docs/CallTransferResult.md b/docs/CallTransferResult.md new file mode 100644 index 0000000..e5a6860 --- /dev/null +++ b/docs/CallTransferResult.md @@ -0,0 +1,10 @@ +# CallTransferResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**callee_status** | **str** | O - online, F - offline | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CallsApi.md b/docs/CallsApi.md index 69f7849..473e1b7 100644 --- a/docs/CallsApi.md +++ b/docs/CallsApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**call_start**](CallsApi.md#call_start) | **POST** /call/_start | Starts new outcoming / internal call [**call_start_failed**](CallsApi.md#call_start_failed) | **POST** /call/_startFailed | Callback that starting call failed [**call_stop**](CallsApi.md#call_stop) | **POST** /calls/{callId}/_stop | Stops the call +[**call_transfer**](CallsApi.md#call_transfer) | **POST** /calls/{callId}/_transfer | Transfers call to different department / agent [**confirm_ring**](CallsApi.md#confirm_ring) | **POST** /calls/{callId}/_confirmRing | Confirm that call is ringing [**get_calls_list**](CallsApi.md#get_calls_list) | **GET** /calls | Gets list of calls [**merge**](CallsApi.md#merge) | **POST** /calls/{callId}/_merge | Merge two calls @@ -730,6 +731,62 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **call_transfer** +> CallTransferResult call_transfer(call_id, to=to) + +Transfers call to different department / agent + +Transfer can be called on incoming calls before they start ringing to agents + +### Example +```python +import time +import liveagent_api +from liveagent_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: privileges +liveagent_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' +# Configure API key authorization: apikey +liveagent_api.configuration.api_key['apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# liveagent_api.configuration.api_key_prefix['apikey'] = 'BEARER' + +# create an instance of the API class +api_instance = liveagent_api.CallsApi() +call_id = 'call_id_example' # str | +to = 'to_example' # str | Department ID or extension (optional) + +try: + # Transfers call to different department / agent + api_response = api_instance.call_transfer(call_id, to=to) + pprint(api_response) +except ApiException as e: + print "Exception when calling CallsApi->call_transfer: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **call_id** | **str**| | + **to** | **str**| Department ID or extension | [optional] + +### Return type + +[**CallTransferResult**](CallTransferResult.md) + +### Authorization + +[privileges](../README.md#privileges), [apikey](../README.md#apikey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **confirm_ring** > OkResponse confirm_ring(call_id, to_number=to_number, channel_id=channel_id) diff --git a/docs/IvrStep.md b/docs/IvrStep.md index 19b8491..b0e9cf8 100644 --- a/docs/IvrStep.md +++ b/docs/IvrStep.md @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **str** | P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (message URL in params, choices) G - goto (IVR name in params) | +**type** | **str** | P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (choices), G - goto (IVR name in params), T - transfer (optional ivr settings in params {\"O\":\"online\",\"F\":\"offline\",\"Q\":\"queue\"}) | **params** | **str** | | [optional] **choices** | [**list[IvrChoice]**](IvrChoice.md) | | [optional] diff --git a/liveagent_api/__init__.py b/liveagent_api/__init__.py index 35d9f71..b5381e4 100644 --- a/liveagent_api/__init__.py +++ b/liveagent_api/__init__.py @@ -19,6 +19,7 @@ from .models.call_list_item import CallListItem from .models.call_message import CallMessage from .models.call_status import CallStatus +from .models.call_transfer_result import CallTransferResult from .models.canned_message import CannedMessage from .models.company import Company from .models.company_list_item import CompanyListItem diff --git a/liveagent_api/apis/calls_api.py b/liveagent_api/apis/calls_api.py index 8e0aeda..0f1a5be 100644 --- a/liveagent_api/apis/calls_api.py +++ b/liveagent_api/apis/calls_api.py @@ -1136,6 +1136,86 @@ def call_stop(self, call_id, **kwargs): callback=params.get('callback')) return response + def call_transfer(self, call_id, **kwargs): + """ + Transfers call to different department / agent + Transfer can be called on incoming calls before they start ringing to agents + + 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.call_transfer(call_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str call_id: (required) + :param str to: Department ID or extension + :return: CallTransferResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['call_id', 'to'] + 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 call_transfer" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'call_id' is set + if ('call_id' not in params) or (params['call_id'] is None): + raise ValueError("Missing the required parameter `call_id` when calling `call_transfer`") + + resource_path = '/calls/{callId}/_transfer'.replace('{format}', 'json') + path_params = {} + if 'call_id' in params: + path_params['callId'] = params['call_id'] + + query_params = {} + if 'to' in params: + query_params['to'] = params['to'] + + header_params = {} + + form_params = [] + local_var_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(['application/json']) + + # Authentication setting + auth_settings = ['privileges', 'apikey'] + + response = self.api_client.call_api(resource_path, 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CallTransferResult', + auth_settings=auth_settings, + callback=params.get('callback')) + return response + def confirm_ring(self, call_id, **kwargs): """ Confirm that call is ringing diff --git a/liveagent_api/models/__init__.py b/liveagent_api/models/__init__.py index 0beeb0d..9518f41 100644 --- a/liveagent_api/models/__init__.py +++ b/liveagent_api/models/__init__.py @@ -19,6 +19,7 @@ from .call_list_item import CallListItem from .call_message import CallMessage from .call_status import CallStatus +from .call_transfer_result import CallTransferResult from .canned_message import CannedMessage from .company import Company from .company_list_item import CompanyListItem diff --git a/liveagent_api/models/call_transfer_result.py b/liveagent_api/models/call_transfer_result.py new file mode 100644 index 0000000..67ade9c --- /dev/null +++ b/liveagent_api/models/call_transfer_result.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" +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. + + Ref: https://github.com/swagger-api/swagger-codegen +""" + +from pprint import pformat +from six import iteritems + + +class CallTransferResult(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + CallTransferResult - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'callee_status': 'str' + } + + self.attribute_map = { + 'callee_status': 'callee_status' + } + + self._callee_status = None + + @property + def callee_status(self): + """ + Gets the callee_status of this CallTransferResult. + O - online, F - offline + + :return: The callee_status of this CallTransferResult. + :rtype: str + """ + return self._callee_status + + @callee_status.setter + def callee_status(self, callee_status): + """ + Sets the callee_status of this CallTransferResult. + O - online, F - offline + + :param callee_status: The callee_status of this CallTransferResult. + :type: str + """ + allowed_values = ["O", "F"] + if callee_status not in allowed_values: + raise ValueError( + "Invalid value for `callee_status`, must be one of {0}" + .format(allowed_values) + ) + self._callee_status = callee_status + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other + diff --git a/liveagent_api/models/ivr_step.py b/liveagent_api/models/ivr_step.py index 696b041..45c43ee 100644 --- a/liveagent_api/models/ivr_step.py +++ b/liveagent_api/models/ivr_step.py @@ -56,7 +56,7 @@ def __init__(self): def type(self): """ Gets the type of this IvrStep. - P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (message URL in params, choices) G - goto (IVR name in params) + P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (choices), G - goto (IVR name in params), T - transfer (optional ivr settings in params {\"O\":\"online\",\"F\":\"offline\",\"Q\":\"queue\"}) :return: The type of this IvrStep. :rtype: str @@ -67,12 +67,12 @@ def type(self): def type(self, type): """ Sets the type of this IvrStep. - P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (message URL in params, choices) G - goto (IVR name in params) + P - play message (URL in params), R - ring to agent (optional departmentId in params), V - redirect to voicemail, D - choice (choices), G - goto (IVR name in params), T - transfer (optional ivr settings in params {\"O\":\"online\",\"F\":\"offline\",\"Q\":\"queue\"}) :param type: The type of this IvrStep. :type: str """ - allowed_values = ["P", "R", "V", "D", "G"] + allowed_values = ["P", "R", "V", "D", "G", "T"] if type not in allowed_values: raise ValueError( "Invalid value for `type`, must be one of {0}"