File tree Expand file tree Collapse file tree 4 files changed +56
-2
lines changed Expand file tree Collapse file tree 4 files changed +56
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
3
3
4
4
## [ 0.4.2] - TBA
5
5
6
+ ### Added
7
+ - New method ` delete_event ` in customer-api v3.6.
8
+
6
9
### Changed
7
10
- Improved websocket response collection + extended logging in the websocket client.
8
11
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def __init__(
20
20
if isinstance (organization_id , str ):
21
21
self .ws = WebsocketClient (
22
22
url =
23
- f'wss://{ base_url } /v3.5 /customer/rtm/ws?organization_id={ organization_id } ' ,
23
+ f'wss://{ base_url } /v3.4 /customer/rtm/ws?organization_id={ organization_id } ' ,
24
24
header = header )
25
25
else :
26
26
raise ValueError (
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def __init__(
20
20
if isinstance (organization_id , str ):
21
21
self .ws = WebsocketClient (
22
22
url =
23
- f'wss://{ base_url } /v3.5 /customer/rtm/ws?organization_id={ organization_id } ' ,
23
+ f'wss://{ base_url } /v3.6 /customer/rtm/ws?organization_id={ organization_id } ' ,
24
24
header = header )
25
25
else :
26
26
raise ValueError (
@@ -214,6 +214,28 @@ def send_event(self,
214
214
payload = prepare_payload (locals ())
215
215
return self .ws .send ({'action' : 'send_event' , 'payload' : payload })
216
216
217
+ def delete_event (self ,
218
+ chat_id : str = None ,
219
+ thread_id : str = None ,
220
+ event_id : str = None ,
221
+ payload : dict = None ) -> RtmResponse :
222
+ ''' Deletes an event.
223
+
224
+ Args:
225
+ chat_id (str): ID of the chat from which to delete the event.
226
+ thread_id (str): ID of the thread from which to delete the event.
227
+ event_id (str): ID of the event to be deleted.
228
+ payload (dict): Custom payload to be used as request's data.
229
+ It overrides all other parameters provided for the method.
230
+
231
+ Returns:
232
+ RtmResponse: RTM response structure (`request_id`, `action`,
233
+ `type`, `success` and `payload` properties)
234
+ '''
235
+ if payload is None :
236
+ payload = prepare_payload (locals ())
237
+ return self .ws .send ({'action' : 'delete_event' , 'payload' : payload })
238
+
217
239
def send_rich_message_postback (self ,
218
240
chat_id : str = None ,
219
241
thread_id : str = None ,
Original file line number Diff line number Diff line change @@ -312,6 +312,35 @@ def send_event(self,
312
312
json = payload ,
313
313
headers = headers )
314
314
315
+ def delete_event (self ,
316
+ chat_id : str = None ,
317
+ thread_id : str = None ,
318
+ event_id : str = None ,
319
+ payload : dict = None ,
320
+ headers : dict = None ) -> httpx .Response :
321
+ ''' Deletes an event.
322
+
323
+ Args:
324
+ chat_id (str): ID of the chat from which to delete the event.
325
+ thread_id (str): ID of the thread from which to delete the event.
326
+ event_id (str): ID of the event to be deleted.
327
+
328
+ payload (dict): Custom payload to be used as request's data.
329
+ It overrides all other parameters provided for the method.
330
+ headers (dict): Custom headers to be used with session headers.
331
+ They will be merged with session-level values that are set,
332
+ however, these method-level parameters will not be persisted across requests.
333
+
334
+ Returns:
335
+ httpx.Response: The Response object from `httpx` library,
336
+ which contains a server’s response to an HTTP request. '''
337
+ if payload is None :
338
+ payload = prepare_payload (locals ())
339
+ return self .session .post (
340
+ f'{ self .api_url } /delete_event{ self .query_string } ' ,
341
+ json = payload ,
342
+ headers = headers )
343
+
315
344
def upload_file (self ,
316
345
file : typing .BinaryIO = None ,
317
346
headers : dict = None ) -> httpx .Response :
You can’t perform that action at this time.
0 commit comments