From 6dc9398327ae0f25dae0695fb407cbafde52a844 Mon Sep 17 00:00:00 2001 From: ArtemFo Date: Fri, 28 Jul 2023 22:01:18 +0300 Subject: [PATCH 1/2] feat: Regenerate API #9137 --- docs/MessageGroup.md | 2 +- liveagent_api/models/message_group.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/MessageGroup.md b/docs/MessageGroup.md index 23b2e42..ebf2f34 100644 --- a/docs/MessageGroup.md +++ b/docs/MessageGroup.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **parent_id** | **str** | | [optional] **userid** | **str** | | [optional] **user_full_name** | **str** | | [optional] -**type** | **str** | M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE | [optional] +**type** | **str** | M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE 6 - TYPE_WHATSAPP 7 - TYPE_RECEIVED_ANSWER | [optional] **status** | **str** | D - DELETED P - PROMOTED V - VISIBLE S - SPLITTED M - MERGED I - INITIALIZING R - CONNECTING C - CALLING | [optional] **datecreated** | **datetime** | | [optional] **datefinished** | **datetime** | | [optional] diff --git a/liveagent_api/models/message_group.py b/liveagent_api/models/message_group.py index e4d4204..fac6a4e 100644 --- a/liveagent_api/models/message_group.py +++ b/liveagent_api/models/message_group.py @@ -190,7 +190,7 @@ def user_full_name(self, user_full_name): def type(self): """Gets the type of this MessageGroup. # noqa: E501 - M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE # noqa: E501 + M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE 6 - TYPE_WHATSAPP 7 - TYPE_RECEIVED_ANSWER # noqa: E501 :return: The type of this MessageGroup. # noqa: E501 :rtype: str @@ -201,12 +201,12 @@ def type(self): def type(self, type): """Sets the type of this MessageGroup. - M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE # noqa: E501 + M - OFFLINE_LEGACY C - CHAT P - CALL V - OUTGOING_CALL 1 - INTERNAL_CALL I - INTERNAL U - INTERNAL_OFFLINE Z - INTERNAL_COLLAPSED S - STARTINFO T - TRANSFER R - RESOLVE J - POSTPONE X - DELETE B - SPAM G - TAG F - FACEBOOK W - TWITTER Y - RETWEET A - KNOWLEDGEBASE_START K - KNOWLEDGEBASE O - FORWARD Q - FORWARD_REPLY L - SPLITTED 2 - MERGED 3 - INCOMING_EMAIL 4 - OUTGOING_EMAIL 5 - OFFLINE 6 - TYPE_WHATSAPP 7 - TYPE_RECEIVED_ANSWER # noqa: E501 :param type: The type of this MessageGroup. # noqa: E501 :type: str """ - allowed_values = ["M", "C", "P", "V", "1", "I", "U", "Z", "S", "T", "R", "J", "X", "B", "G", "F", "W", "H", "E", "D", "N", "Y", "A", "K", "O", "Q", "L", "2", "3", "4", "5"] # noqa: E501 + allowed_values = ["M", "C", "P", "V", "1", "I", "U", "Z", "S", "T", "R", "J", "X", "B", "G", "F", "W", "H", "E", "D", "N", "Y", "A", "K", "O", "Q", "L", "2", "3", "4", "5", "6", "7"] # noqa: E501 if type not in allowed_values: raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 From c5d2970978cd19551556a541e0182a8eb940c955 Mon Sep 17 00:00:00 2001 From: ArtemFo Date: Fri, 28 Jul 2023 22:02:32 +0300 Subject: [PATCH 2/2] feat: Add request_callback endpoint #9137 --- README.md | 2 + docs/CallsApi.md | 56 ++++++++++++++ docs/PhonesApi.md | 58 +++++++++++++++ liveagent_api/api/calls_api.py | 97 +++++++++++++++++++++++++ liveagent_api/api/phones_api.py | 105 +++++++++++++++++++++++++++ liveagent_api/models/phone_device.py | 6 ++ test/test_calls_api.py | 7 ++ test/test_phones_api.py | 7 ++ 8 files changed, 338 insertions(+) diff --git a/README.md b/README.md index 0b25bc8..7f18b17 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ Class | Method | HTTP request | Description *CallsApi* | [**hold_channel**](docs/CallsApi.md#hold_channel) | **POST** /calls/{callId}/channels/{channelId}/_hold | Hold channel *CallsApi* | [**merge**](docs/CallsApi.md#merge) | **POST** /calls/{callId}/_merge | Merge two calls *CallsApi* | [**mute_channel**](docs/CallsApi.md#mute_channel) | **POST** /calls/{callId}/channels/{channelId}/_mute | Mute channel +*CallsApi* | [**request_callback**](docs/CallsApi.md#request_callback) | **POST** /calls/{callId}/_request_callback | Requests callback on the call *CallsApi* | [**stop_ring**](docs/CallsApi.md#stop_ring) | **POST** /calls/{callId}/_stopRing | Stop ringing of call *CallsApi* | [**unhold_channel**](docs/CallsApi.md#unhold_channel) | **POST** /calls/{callId}/channels/{channelId}/_unhold | Unhold channel *CallsApi* | [**unmute_channel**](docs/CallsApi.md#unmute_channel) | **POST** /calls/{callId}/channels/{channelId}/_unmute | Unmute channel @@ -249,6 +250,7 @@ Class | Method | HTTP request | Description *PhonesApi* | [**remove_phone**](docs/PhonesApi.md#remove_phone) | **DELETE** /phones/{phoneId} | Remove phone *PhonesApi* | [**update_phone**](docs/PhonesApi.md#update_phone) | **PUT** /phones/{phoneId} | Update phone *PhonesApi* | [**update_phone_params**](docs/PhonesApi.md#update_phone_params) | **PUT** /phones/{phoneId}/_updateParams | Update phone params +*PhonesApi* | [**update_reg_status**](docs/PhonesApi.md#update_reg_status) | **PUT** /phones/{phoneId}/_updateRegStatus | Update registration status *PingApi* | [**ping**](docs/PingApi.md#ping) | **GET** /ping | Check that API is responding *PredefinedAnswersApi* | [**create_predefined_answer**](docs/PredefinedAnswersApi.md#create_predefined_answer) | **POST** /predefined_answers | Create predefined answer *PredefinedAnswersApi* | [**delete_predefined_answer**](docs/PredefinedAnswersApi.md#delete_predefined_answer) | **DELETE** /predefined_answers/{predefinedAnswerId} | Predefined answer diff --git a/docs/CallsApi.md b/docs/CallsApi.md index d7f8457..2cdd448 100644 --- a/docs/CallsApi.md +++ b/docs/CallsApi.md @@ -30,6 +30,7 @@ Method | HTTP request | Description [**hold_channel**](CallsApi.md#hold_channel) | **POST** /calls/{callId}/channels/{channelId}/_hold | Hold channel [**merge**](CallsApi.md#merge) | **POST** /calls/{callId}/_merge | Merge two calls [**mute_channel**](CallsApi.md#mute_channel) | **POST** /calls/{callId}/channels/{channelId}/_mute | Mute channel +[**request_callback**](CallsApi.md#request_callback) | **POST** /calls/{callId}/_request_callback | Requests callback on the call [**stop_ring**](CallsApi.md#stop_ring) | **POST** /calls/{callId}/_stopRing | Stop ringing of call [**unhold_channel**](CallsApi.md#unhold_channel) | **POST** /calls/{callId}/channels/{channelId}/_unhold | Unhold channel [**unmute_channel**](CallsApi.md#unmute_channel) | **POST** /calls/{callId}/channels/{channelId}/_unmute | Unmute channel @@ -1559,6 +1560,61 @@ 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) +# **request_callback** +> OkResponse request_callback(call_id) + +Requests callback on the call + +### Example +```python +from __future__ import print_function +import time +import liveagent_api +from liveagent_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: apikey +configuration = liveagent_api.Configuration() +configuration.api_key['apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apikey'] = 'Bearer' +# Configure OAuth2 access token for authorization: privileges +configuration = liveagent_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = liveagent_api.CallsApi(liveagent_api.ApiClient(configuration)) +call_id = 'call_id_example' # str | + +try: + # Requests callback on the call + api_response = api_instance.request_callback(call_id) + pprint(api_response) +except ApiException as e: + print("Exception when calling CallsApi->request_callback: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **call_id** | **str**| | + +### Return type + +[**OkResponse**](OkResponse.md) + +### Authorization + +[apikey](../README.md#apikey), [privileges](../README.md#privileges) + +### 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) + # **stop_ring** > OkResponse stop_ring(call_id) diff --git a/docs/PhonesApi.md b/docs/PhonesApi.md index 3c9697b..eca9539 100644 --- a/docs/PhonesApi.md +++ b/docs/PhonesApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**remove_phone**](PhonesApi.md#remove_phone) | **DELETE** /phones/{phoneId} | Remove phone [**update_phone**](PhonesApi.md#update_phone) | **PUT** /phones/{phoneId} | Update phone [**update_phone_params**](PhonesApi.md#update_phone_params) | **PUT** /phones/{phoneId}/_updateParams | Update phone params +[**update_reg_status**](PhonesApi.md#update_reg_status) | **PUT** /phones/{phoneId}/_updateRegStatus | Update registration status # **create_phone** @@ -374,3 +375,60 @@ 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) +# **update_reg_status** +> OkResponse update_reg_status(phone_id, reg_status) + +Update registration status + +### Example +```python +from __future__ import print_function +import time +import liveagent_api +from liveagent_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: apikey +configuration = liveagent_api.Configuration() +configuration.api_key['apikey'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['apikey'] = 'Bearer' +# Configure OAuth2 access token for authorization: privileges +configuration = liveagent_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = liveagent_api.PhonesApi(liveagent_api.ApiClient(configuration)) +phone_id = 'phone_id_example' # str | +reg_status = 'reg_status_example' # str | F - Phone is not registered (offline). N - Phone is registered (online). + +try: + # Update registration status + api_response = api_instance.update_reg_status(phone_id, reg_status) + pprint(api_response) +except ApiException as e: + print("Exception when calling PhonesApi->update_reg_status: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone_id** | **str**| | + **reg_status** | **str**| F - Phone is not registered (offline). N - Phone is registered (online). | + +### Return type + +[**OkResponse**](OkResponse.md) + +### Authorization + +[apikey](../README.md#apikey), [privileges](../README.md#privileges) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + diff --git a/liveagent_api/api/calls_api.py b/liveagent_api/api/calls_api.py index 4e0104d..4463fa9 100644 --- a/liveagent_api/api/calls_api.py +++ b/liveagent_api/api/calls_api.py @@ -2783,6 +2783,103 @@ def mute_channel_with_http_info(self, call_id, channel_id, **kwargs): # noqa: E _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def request_callback(self, call_id, **kwargs): # noqa: E501 + """Requests callback on the call # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_callback(call_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str call_id: (required) + :return: OkResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_callback_with_http_info(call_id, **kwargs) # noqa: E501 + else: + (data) = self.request_callback_with_http_info(call_id, **kwargs) # noqa: E501 + return data + + def request_callback_with_http_info(self, call_id, **kwargs): # noqa: E501 + """Requests callback on the call # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_callback_with_http_info(call_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str call_id: (required) + :return: OkResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['call_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 request_callback" % 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 `request_callback`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'call_id' in params: + path_params['callId'] = params['call_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 + + # 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 = ['apikey', 'privileges'] # noqa: E501 + + return self.api_client.call_api( + '/calls/{callId}/_request_callback', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OkResponse', # 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 stop_ring(self, call_id, **kwargs): # noqa: E501 """Stop ringing of call # noqa: E501 diff --git a/liveagent_api/api/phones_api.py b/liveagent_api/api/phones_api.py index b49afd5..8b3f246 100644 --- a/liveagent_api/api/phones_api.py +++ b/liveagent_api/api/phones_api.py @@ -678,3 +678,108 @@ def update_phone_params_with_http_info(self, phone_id, params, **kwargs): # noq _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def update_reg_status(self, phone_id, reg_status, **kwargs): # noqa: E501 + """Update registration status # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_reg_status(phone_id, reg_status, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str phone_id: (required) + :param str reg_status: F - Phone is not registered (offline). N - Phone is registered (online). (required) + :return: OkResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_reg_status_with_http_info(phone_id, reg_status, **kwargs) # noqa: E501 + else: + (data) = self.update_reg_status_with_http_info(phone_id, reg_status, **kwargs) # noqa: E501 + return data + + def update_reg_status_with_http_info(self, phone_id, reg_status, **kwargs): # noqa: E501 + """Update registration status # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_reg_status_with_http_info(phone_id, reg_status, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str phone_id: (required) + :param str reg_status: F - Phone is not registered (offline). N - Phone is registered (online). (required) + :return: OkResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['phone_id', 'reg_status'] # 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 update_reg_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'phone_id' is set + if ('phone_id' not in params or + params['phone_id'] is None): + raise ValueError("Missing the required parameter `phone_id` when calling `update_reg_status`") # noqa: E501 + # verify the required parameter 'reg_status' is set + if ('reg_status' not in params or + params['reg_status'] is None): + raise ValueError("Missing the required parameter `reg_status` when calling `update_reg_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'phone_id' in params: + path_params['phoneId'] = params['phone_id'] # noqa: E501 + + query_params = [] + if 'reg_status' in params: + query_params.append(('reg_status', params['reg_status'])) # 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']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 + + # Authentication setting + auth_settings = ['apikey', 'privileges'] # noqa: E501 + + return self.api_client.call_api( + '/phones/{phoneId}/_updateRegStatus', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OkResponse', # 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) diff --git a/liveagent_api/models/phone_device.py b/liveagent_api/models/phone_device.py index 76371b4..e74961e 100644 --- a/liveagent_api/models/phone_device.py +++ b/liveagent_api/models/phone_device.py @@ -224,6 +224,12 @@ def reg_status(self, reg_status): :param reg_status: The reg_status of this PhoneDevice. # noqa: E501 :type: str """ + allowed_values = ["F", "N"] # noqa: E501 + if reg_status not in allowed_values: + raise ValueError( + "Invalid value for `reg_status` ({0}), must be one of {1}" # noqa: E501 + .format(reg_status, allowed_values) + ) self._reg_status = reg_status diff --git a/test/test_calls_api.py b/test/test_calls_api.py index c349c05..274b066 100644 --- a/test/test_calls_api.py +++ b/test/test_calls_api.py @@ -211,6 +211,13 @@ def test_mute_channel(self): """ pass + def test_request_callback(self): + """Test case for request_callback + + Requests callback on the call # noqa: E501 + """ + pass + def test_stop_ring(self): """Test case for stop_ring diff --git a/test/test_phones_api.py b/test/test_phones_api.py index f7bc905..22a5e32 100644 --- a/test/test_phones_api.py +++ b/test/test_phones_api.py @@ -71,6 +71,13 @@ def test_update_phone_params(self): """ pass + def test_update_reg_status(self): + """Test case for update_reg_status + + Update registration status # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main()