pingram-python 1.0.30__py3-none-any.whl → 1.0.31__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pingram/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.0.30"
17
+ __version__ = "1.0.31"
18
18
 
19
19
  # Define package exports
20
20
  __all__ = [
@@ -109,8 +109,6 @@ __all__ = [
109
109
  "EmailComponentResponseReferencedByInner",
110
110
  "Environment",
111
111
  "EnvironmentPatchRequest",
112
- "EventsWebhookResponse",
113
- "EventsWebhookUpsertRequest",
114
112
  "FirstAccountRequest",
115
113
  "FirstAccountResponse",
116
114
  "GetAccountMetadataResponse",
@@ -322,6 +320,10 @@ __all__ = [
322
320
  "VoiceBrowserCallResponse",
323
321
  "VoiceCallRequest",
324
322
  "VoiceCallResponse",
323
+ "WebhookEndpoint",
324
+ "WebhookEndpointUpsertRequest",
325
+ "WebhookEndpointsResponse",
326
+ "WebhookEndpointsResponseEndpointsInner",
325
327
  "WebhookEvent",
326
328
  "WebhookResponse",
327
329
  ]
@@ -422,8 +424,6 @@ from pingram.models.email_component_response import EmailComponentResponse as Em
422
424
  from pingram.models.email_component_response_referenced_by_inner import EmailComponentResponseReferencedByInner as EmailComponentResponseReferencedByInner
423
425
  from pingram.models.environment import Environment as Environment
424
426
  from pingram.models.environment_patch_request import EnvironmentPatchRequest as EnvironmentPatchRequest
425
- from pingram.models.events_webhook_response import EventsWebhookResponse as EventsWebhookResponse
426
- from pingram.models.events_webhook_upsert_request import EventsWebhookUpsertRequest as EventsWebhookUpsertRequest
427
427
  from pingram.models.first_account_request import FirstAccountRequest as FirstAccountRequest
428
428
  from pingram.models.first_account_response import FirstAccountResponse as FirstAccountResponse
429
429
  from pingram.models.get_account_metadata_response import GetAccountMetadataResponse as GetAccountMetadataResponse
@@ -635,6 +635,10 @@ from pingram.models.voice_browser_call_request import VoiceBrowserCallRequest as
635
635
  from pingram.models.voice_browser_call_response import VoiceBrowserCallResponse as VoiceBrowserCallResponse
636
636
  from pingram.models.voice_call_request import VoiceCallRequest as VoiceCallRequest
637
637
  from pingram.models.voice_call_response import VoiceCallResponse as VoiceCallResponse
638
+ from pingram.models.webhook_endpoint import WebhookEndpoint as WebhookEndpoint
639
+ from pingram.models.webhook_endpoint_upsert_request import WebhookEndpointUpsertRequest as WebhookEndpointUpsertRequest
640
+ from pingram.models.webhook_endpoints_response import WebhookEndpointsResponse as WebhookEndpointsResponse
641
+ from pingram.models.webhook_endpoints_response_endpoints_inner import WebhookEndpointsResponseEndpointsInner as WebhookEndpointsResponseEndpointsInner
638
642
  from pingram.models.webhook_event import WebhookEvent as WebhookEvent
639
643
  from pingram.models.webhook_response import WebhookResponse as WebhookResponse
640
644
  from pingram.client_wrapper import Pingram, PingramConfig, PingramRegion
@@ -16,8 +16,11 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pingram.models.events_webhook_response import EventsWebhookResponse
20
- from pingram.models.events_webhook_upsert_request import EventsWebhookUpsertRequest
19
+ from pydantic import Field, StrictStr
20
+ from typing_extensions import Annotated
21
+ from pingram.models.webhook_endpoint import WebhookEndpoint
22
+ from pingram.models.webhook_endpoint_upsert_request import WebhookEndpointUpsertRequest
23
+ from pingram.models.webhook_endpoints_response import WebhookEndpointsResponse
21
24
 
22
25
  from pingram.api_client import ApiClient, RequestSerialized
23
26
  from pingram.api_response import ApiResponse
@@ -38,8 +41,298 @@ class WebhooksApi:
38
41
 
39
42
 
40
43
  @validate_call
41
- async def webhooks_delete_events_webhook(
44
+ async def webhooks_create_webhook(
45
+ self,
46
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
47
+ _request_timeout: Union[
48
+ None,
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Tuple[
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Annotated[StrictFloat, Field(gt=0)]
53
+ ]
54
+ ] = None,
55
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
56
+ _content_type: Optional[StrictStr] = None,
57
+ _headers: Optional[Dict[StrictStr, Any]] = None,
58
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
59
+ ) -> WebhookEndpoint:
60
+ """Create a webhook.
61
+
62
+
63
+ :param webhook_endpoint_upsert_request: (required)
64
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
65
+ :param _request_timeout: timeout setting for this request. If one
66
+ number provided, it will be total request
67
+ timeout. It can also be a pair (tuple) of
68
+ (connection, read) timeouts.
69
+ :type _request_timeout: int, tuple(int, int), optional
70
+ :param _request_auth: set to override the auth_settings for an a single
71
+ request; this effectively ignores the
72
+ authentication in the spec for a single request.
73
+ :type _request_auth: dict, optional
74
+ :param _content_type: force content-type for the request.
75
+ :type _content_type: str, Optional
76
+ :param _headers: set to override the headers for a single
77
+ request; this effectively ignores the headers
78
+ in the spec for a single request.
79
+ :type _headers: dict, optional
80
+ :param _host_index: set to override the host_index for a single
81
+ request; this effectively ignores the host_index
82
+ in the spec for a single request.
83
+ :type _host_index: int, optional
84
+ :return: Returns the result object.
85
+ """ # noqa: E501
86
+
87
+ _param = self._webhooks_create_webhook_serialize(
88
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
89
+ _request_auth=_request_auth,
90
+ _content_type=_content_type,
91
+ _headers=_headers,
92
+ _host_index=_host_index
93
+ )
94
+
95
+ _response_types_map: Dict[str, Optional[str]] = {
96
+ '200': "WebhookEndpoint",
97
+ '400': "ApiErrorResponse",
98
+ '401': None,
99
+ '402': "ApiErrorResponse",
100
+ '500': None,
101
+ '502': "ApiErrorResponse",
102
+ }
103
+ response_data = await self.api_client.call_api(
104
+ *_param,
105
+ _request_timeout=_request_timeout
106
+ )
107
+ await response_data.read()
108
+ return self.api_client.response_deserialize(
109
+ response_data=response_data,
110
+ response_types_map=_response_types_map,
111
+ ).data
112
+
113
+
114
+ @validate_call
115
+ async def webhooks_create_webhook_with_http_info(
116
+ self,
117
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
118
+ _request_timeout: Union[
119
+ None,
120
+ Annotated[StrictFloat, Field(gt=0)],
121
+ Tuple[
122
+ Annotated[StrictFloat, Field(gt=0)],
123
+ Annotated[StrictFloat, Field(gt=0)]
124
+ ]
125
+ ] = None,
126
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
127
+ _content_type: Optional[StrictStr] = None,
128
+ _headers: Optional[Dict[StrictStr, Any]] = None,
129
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
130
+ ) -> ApiResponse[WebhookEndpoint]:
131
+ """Create a webhook.
132
+
133
+
134
+ :param webhook_endpoint_upsert_request: (required)
135
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
136
+ :param _request_timeout: timeout setting for this request. If one
137
+ number provided, it will be total request
138
+ timeout. It can also be a pair (tuple) of
139
+ (connection, read) timeouts.
140
+ :type _request_timeout: int, tuple(int, int), optional
141
+ :param _request_auth: set to override the auth_settings for an a single
142
+ request; this effectively ignores the
143
+ authentication in the spec for a single request.
144
+ :type _request_auth: dict, optional
145
+ :param _content_type: force content-type for the request.
146
+ :type _content_type: str, Optional
147
+ :param _headers: set to override the headers for a single
148
+ request; this effectively ignores the headers
149
+ in the spec for a single request.
150
+ :type _headers: dict, optional
151
+ :param _host_index: set to override the host_index for a single
152
+ request; this effectively ignores the host_index
153
+ in the spec for a single request.
154
+ :type _host_index: int, optional
155
+ :return: Returns the result object.
156
+ """ # noqa: E501
157
+
158
+ _param = self._webhooks_create_webhook_serialize(
159
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
160
+ _request_auth=_request_auth,
161
+ _content_type=_content_type,
162
+ _headers=_headers,
163
+ _host_index=_host_index
164
+ )
165
+
166
+ _response_types_map: Dict[str, Optional[str]] = {
167
+ '200': "WebhookEndpoint",
168
+ '400': "ApiErrorResponse",
169
+ '401': None,
170
+ '402': "ApiErrorResponse",
171
+ '500': None,
172
+ '502': "ApiErrorResponse",
173
+ }
174
+ response_data = await self.api_client.call_api(
175
+ *_param,
176
+ _request_timeout=_request_timeout
177
+ )
178
+ await response_data.read()
179
+ return self.api_client.response_deserialize(
180
+ response_data=response_data,
181
+ response_types_map=_response_types_map,
182
+ )
183
+
184
+
185
+ @validate_call
186
+ async def webhooks_create_webhook_without_preload_content(
187
+ self,
188
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
189
+ _request_timeout: Union[
190
+ None,
191
+ Annotated[StrictFloat, Field(gt=0)],
192
+ Tuple[
193
+ Annotated[StrictFloat, Field(gt=0)],
194
+ Annotated[StrictFloat, Field(gt=0)]
195
+ ]
196
+ ] = None,
197
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
198
+ _content_type: Optional[StrictStr] = None,
199
+ _headers: Optional[Dict[StrictStr, Any]] = None,
200
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
201
+ ) -> RESTResponseType:
202
+ """Create a webhook.
203
+
204
+
205
+ :param webhook_endpoint_upsert_request: (required)
206
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
207
+ :param _request_timeout: timeout setting for this request. If one
208
+ number provided, it will be total request
209
+ timeout. It can also be a pair (tuple) of
210
+ (connection, read) timeouts.
211
+ :type _request_timeout: int, tuple(int, int), optional
212
+ :param _request_auth: set to override the auth_settings for an a single
213
+ request; this effectively ignores the
214
+ authentication in the spec for a single request.
215
+ :type _request_auth: dict, optional
216
+ :param _content_type: force content-type for the request.
217
+ :type _content_type: str, Optional
218
+ :param _headers: set to override the headers for a single
219
+ request; this effectively ignores the headers
220
+ in the spec for a single request.
221
+ :type _headers: dict, optional
222
+ :param _host_index: set to override the host_index for a single
223
+ request; this effectively ignores the host_index
224
+ in the spec for a single request.
225
+ :type _host_index: int, optional
226
+ :return: Returns the result object.
227
+ """ # noqa: E501
228
+
229
+ _param = self._webhooks_create_webhook_serialize(
230
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
231
+ _request_auth=_request_auth,
232
+ _content_type=_content_type,
233
+ _headers=_headers,
234
+ _host_index=_host_index
235
+ )
236
+
237
+ _response_types_map: Dict[str, Optional[str]] = {
238
+ '200': "WebhookEndpoint",
239
+ '400': "ApiErrorResponse",
240
+ '401': None,
241
+ '402': "ApiErrorResponse",
242
+ '500': None,
243
+ '502': "ApiErrorResponse",
244
+ }
245
+ response_data = await self.api_client.call_api(
246
+ *_param,
247
+ _request_timeout=_request_timeout
248
+ )
249
+ return response_data.response
250
+
251
+
252
+ def _webhooks_create_webhook_serialize(
253
+ self,
254
+ webhook_endpoint_upsert_request,
255
+ _request_auth,
256
+ _content_type,
257
+ _headers,
258
+ _host_index,
259
+ ) -> RequestSerialized:
260
+
261
+ _host = None
262
+
263
+ _collection_formats: Dict[str, str] = {
264
+ }
265
+
266
+ _path_params: Dict[str, str] = {}
267
+ _query_params: List[Tuple[str, str]] = []
268
+ _header_params: Dict[str, Optional[str]] = _headers or {}
269
+ _form_params: List[Tuple[str, str]] = []
270
+ _files: Dict[
271
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
272
+ ] = {}
273
+ _body_params: Optional[bytes] = None
274
+
275
+ # process the path parameters
276
+ # process the query parameters
277
+ # process the header parameters
278
+ # process the form parameters
279
+ # process the body parameter
280
+ if webhook_endpoint_upsert_request is not None:
281
+ _body_params = webhook_endpoint_upsert_request
282
+
283
+
284
+ # set the HTTP header `Accept`
285
+ if 'Accept' not in _header_params:
286
+ _header_params['Accept'] = self.api_client.select_header_accept(
287
+ [
288
+ 'application/json'
289
+ ]
290
+ )
291
+
292
+ # set the HTTP header `Content-Type`
293
+ if _content_type:
294
+ _header_params['Content-Type'] = _content_type
295
+ else:
296
+ _default_content_type = (
297
+ self.api_client.select_header_content_type(
298
+ [
299
+ 'application/json'
300
+ ]
301
+ )
302
+ )
303
+ if _default_content_type is not None:
304
+ _header_params['Content-Type'] = _default_content_type
305
+
306
+ # authentication setting
307
+ _auth_settings: List[str] = [
308
+ 'endUserHashed',
309
+ 'endUser',
310
+ 'apiKey',
311
+ 'clientCredentials'
312
+ ]
313
+
314
+ return self.api_client.param_serialize(
315
+ method='POST',
316
+ resource_path='/webhooks',
317
+ path_params=_path_params,
318
+ query_params=_query_params,
319
+ header_params=_header_params,
320
+ body=_body_params,
321
+ post_params=_form_params,
322
+ files=_files,
323
+ auth_settings=_auth_settings,
324
+ collection_formats=_collection_formats,
325
+ _host=_host,
326
+ _request_auth=_request_auth
327
+ )
328
+
329
+
330
+
331
+
332
+ @validate_call
333
+ async def webhooks_delete_webhook(
42
334
  self,
335
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
43
336
  _request_timeout: Union[
44
337
  None,
45
338
  Annotated[StrictFloat, Field(gt=0)],
@@ -53,9 +346,11 @@ class WebhooksApi:
53
346
  _headers: Optional[Dict[StrictStr, Any]] = None,
54
347
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
55
348
  ) -> None:
56
- """Delete the events webhook configuration for the current account/environment.
349
+ """Delete a webhook.
57
350
 
58
351
 
352
+ :param endpoint_id: Webhook endpoint id (required)
353
+ :type endpoint_id: str
59
354
  :param _request_timeout: timeout setting for this request. If one
60
355
  number provided, it will be total request
61
356
  timeout. It can also be a pair (tuple) of
@@ -78,7 +373,8 @@ class WebhooksApi:
78
373
  :return: Returns the result object.
79
374
  """ # noqa: E501
80
375
 
81
- _param = self._webhooks_delete_events_webhook_serialize(
376
+ _param = self._webhooks_delete_webhook_serialize(
377
+ endpoint_id=endpoint_id,
82
378
  _request_auth=_request_auth,
83
379
  _content_type=_content_type,
84
380
  _headers=_headers,
@@ -105,8 +401,9 @@ class WebhooksApi:
105
401
 
106
402
 
107
403
  @validate_call
108
- async def webhooks_delete_events_webhook_with_http_info(
404
+ async def webhooks_delete_webhook_with_http_info(
109
405
  self,
406
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
110
407
  _request_timeout: Union[
111
408
  None,
112
409
  Annotated[StrictFloat, Field(gt=0)],
@@ -120,9 +417,11 @@ class WebhooksApi:
120
417
  _headers: Optional[Dict[StrictStr, Any]] = None,
121
418
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
122
419
  ) -> ApiResponse[None]:
123
- """Delete the events webhook configuration for the current account/environment.
420
+ """Delete a webhook.
124
421
 
125
422
 
423
+ :param endpoint_id: Webhook endpoint id (required)
424
+ :type endpoint_id: str
126
425
  :param _request_timeout: timeout setting for this request. If one
127
426
  number provided, it will be total request
128
427
  timeout. It can also be a pair (tuple) of
@@ -145,7 +444,8 @@ class WebhooksApi:
145
444
  :return: Returns the result object.
146
445
  """ # noqa: E501
147
446
 
148
- _param = self._webhooks_delete_events_webhook_serialize(
447
+ _param = self._webhooks_delete_webhook_serialize(
448
+ endpoint_id=endpoint_id,
149
449
  _request_auth=_request_auth,
150
450
  _content_type=_content_type,
151
451
  _headers=_headers,
@@ -172,8 +472,9 @@ class WebhooksApi:
172
472
 
173
473
 
174
474
  @validate_call
175
- async def webhooks_delete_events_webhook_without_preload_content(
475
+ async def webhooks_delete_webhook_without_preload_content(
176
476
  self,
477
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
177
478
  _request_timeout: Union[
178
479
  None,
179
480
  Annotated[StrictFloat, Field(gt=0)],
@@ -187,9 +488,11 @@ class WebhooksApi:
187
488
  _headers: Optional[Dict[StrictStr, Any]] = None,
188
489
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
189
490
  ) -> RESTResponseType:
190
- """Delete the events webhook configuration for the current account/environment.
491
+ """Delete a webhook.
191
492
 
192
493
 
494
+ :param endpoint_id: Webhook endpoint id (required)
495
+ :type endpoint_id: str
193
496
  :param _request_timeout: timeout setting for this request. If one
194
497
  number provided, it will be total request
195
498
  timeout. It can also be a pair (tuple) of
@@ -212,7 +515,8 @@ class WebhooksApi:
212
515
  :return: Returns the result object.
213
516
  """ # noqa: E501
214
517
 
215
- _param = self._webhooks_delete_events_webhook_serialize(
518
+ _param = self._webhooks_delete_webhook_serialize(
519
+ endpoint_id=endpoint_id,
216
520
  _request_auth=_request_auth,
217
521
  _content_type=_content_type,
218
522
  _headers=_headers,
@@ -234,8 +538,9 @@ class WebhooksApi:
234
538
  return response_data.response
235
539
 
236
540
 
237
- def _webhooks_delete_events_webhook_serialize(
541
+ def _webhooks_delete_webhook_serialize(
238
542
  self,
543
+ endpoint_id,
239
544
  _request_auth,
240
545
  _content_type,
241
546
  _headers,
@@ -257,6 +562,8 @@ class WebhooksApi:
257
562
  _body_params: Optional[bytes] = None
258
563
 
259
564
  # process the path parameters
565
+ if endpoint_id is not None:
566
+ _path_params['endpointId'] = endpoint_id
260
567
  # process the query parameters
261
568
  # process the header parameters
262
569
  # process the form parameters
@@ -282,7 +589,7 @@ class WebhooksApi:
282
589
 
283
590
  return self.api_client.param_serialize(
284
591
  method='DELETE',
285
- resource_path='/webhooks/events',
592
+ resource_path='/webhooks/{endpointId}',
286
593
  path_params=_path_params,
287
594
  query_params=_query_params,
288
595
  header_params=_header_params,
@@ -299,7 +606,7 @@ class WebhooksApi:
299
606
 
300
607
 
301
608
  @validate_call
302
- async def webhooks_get_events_webhook(
609
+ async def webhooks_list_webhooks(
303
610
  self,
304
611
  _request_timeout: Union[
305
612
  None,
@@ -313,8 +620,8 @@ class WebhooksApi:
313
620
  _content_type: Optional[StrictStr] = None,
314
621
  _headers: Optional[Dict[StrictStr, Any]] = None,
315
622
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
316
- ) -> EventsWebhookResponse:
317
- """Get the events webhook configuration for the current account/environment.
623
+ ) -> WebhookEndpointsResponse:
624
+ """List webhooks for the current account.
318
625
 
319
626
 
320
627
  :param _request_timeout: timeout setting for this request. If one
@@ -339,7 +646,7 @@ class WebhooksApi:
339
646
  :return: Returns the result object.
340
647
  """ # noqa: E501
341
648
 
342
- _param = self._webhooks_get_events_webhook_serialize(
649
+ _param = self._webhooks_list_webhooks_serialize(
343
650
  _request_auth=_request_auth,
344
651
  _content_type=_content_type,
345
652
  _headers=_headers,
@@ -347,7 +654,7 @@ class WebhooksApi:
347
654
  )
348
655
 
349
656
  _response_types_map: Dict[str, Optional[str]] = {
350
- '200': "EventsWebhookResponse",
657
+ '200': "WebhookEndpointsResponse",
351
658
  '400': "ApiErrorResponse",
352
659
  '401': None,
353
660
  '402': "ApiErrorResponse",
@@ -366,7 +673,7 @@ class WebhooksApi:
366
673
 
367
674
 
368
675
  @validate_call
369
- async def webhooks_get_events_webhook_with_http_info(
676
+ async def webhooks_list_webhooks_with_http_info(
370
677
  self,
371
678
  _request_timeout: Union[
372
679
  None,
@@ -380,8 +687,8 @@ class WebhooksApi:
380
687
  _content_type: Optional[StrictStr] = None,
381
688
  _headers: Optional[Dict[StrictStr, Any]] = None,
382
689
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
383
- ) -> ApiResponse[EventsWebhookResponse]:
384
- """Get the events webhook configuration for the current account/environment.
690
+ ) -> ApiResponse[WebhookEndpointsResponse]:
691
+ """List webhooks for the current account.
385
692
 
386
693
 
387
694
  :param _request_timeout: timeout setting for this request. If one
@@ -406,7 +713,7 @@ class WebhooksApi:
406
713
  :return: Returns the result object.
407
714
  """ # noqa: E501
408
715
 
409
- _param = self._webhooks_get_events_webhook_serialize(
716
+ _param = self._webhooks_list_webhooks_serialize(
410
717
  _request_auth=_request_auth,
411
718
  _content_type=_content_type,
412
719
  _headers=_headers,
@@ -414,7 +721,7 @@ class WebhooksApi:
414
721
  )
415
722
 
416
723
  _response_types_map: Dict[str, Optional[str]] = {
417
- '200': "EventsWebhookResponse",
724
+ '200': "WebhookEndpointsResponse",
418
725
  '400': "ApiErrorResponse",
419
726
  '401': None,
420
727
  '402': "ApiErrorResponse",
@@ -433,7 +740,7 @@ class WebhooksApi:
433
740
 
434
741
 
435
742
  @validate_call
436
- async def webhooks_get_events_webhook_without_preload_content(
743
+ async def webhooks_list_webhooks_without_preload_content(
437
744
  self,
438
745
  _request_timeout: Union[
439
746
  None,
@@ -448,7 +755,7 @@ class WebhooksApi:
448
755
  _headers: Optional[Dict[StrictStr, Any]] = None,
449
756
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
450
757
  ) -> RESTResponseType:
451
- """Get the events webhook configuration for the current account/environment.
758
+ """List webhooks for the current account.
452
759
 
453
760
 
454
761
  :param _request_timeout: timeout setting for this request. If one
@@ -473,7 +780,7 @@ class WebhooksApi:
473
780
  :return: Returns the result object.
474
781
  """ # noqa: E501
475
782
 
476
- _param = self._webhooks_get_events_webhook_serialize(
783
+ _param = self._webhooks_list_webhooks_serialize(
477
784
  _request_auth=_request_auth,
478
785
  _content_type=_content_type,
479
786
  _headers=_headers,
@@ -481,7 +788,7 @@ class WebhooksApi:
481
788
  )
482
789
 
483
790
  _response_types_map: Dict[str, Optional[str]] = {
484
- '200': "EventsWebhookResponse",
791
+ '200': "WebhookEndpointsResponse",
485
792
  '400': "ApiErrorResponse",
486
793
  '401': None,
487
794
  '402': "ApiErrorResponse",
@@ -495,7 +802,7 @@ class WebhooksApi:
495
802
  return response_data.response
496
803
 
497
804
 
498
- def _webhooks_get_events_webhook_serialize(
805
+ def _webhooks_list_webhooks_serialize(
499
806
  self,
500
807
  _request_auth,
501
808
  _content_type,
@@ -543,7 +850,7 @@ class WebhooksApi:
543
850
 
544
851
  return self.api_client.param_serialize(
545
852
  method='GET',
546
- resource_path='/webhooks/events',
853
+ resource_path='/webhooks',
547
854
  path_params=_path_params,
548
855
  query_params=_query_params,
549
856
  header_params=_header_params,
@@ -560,9 +867,10 @@ class WebhooksApi:
560
867
 
561
868
 
562
869
  @validate_call
563
- async def webhooks_upsert_events_webhook(
870
+ async def webhooks_update_webhook(
564
871
  self,
565
- events_webhook_upsert_request: EventsWebhookUpsertRequest,
872
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
873
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
566
874
  _request_timeout: Union[
567
875
  None,
568
876
  Annotated[StrictFloat, Field(gt=0)],
@@ -575,12 +883,14 @@ class WebhooksApi:
575
883
  _content_type: Optional[StrictStr] = None,
576
884
  _headers: Optional[Dict[StrictStr, Any]] = None,
577
885
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
578
- ) -> EventsWebhookResponse:
579
- """Create or update the events webhook configuration for the current account/environment.
886
+ ) -> WebhookEndpoint:
887
+ """Update a webhook. The signing secret is preserved.
580
888
 
581
889
 
582
- :param events_webhook_upsert_request: (required)
583
- :type events_webhook_upsert_request: EventsWebhookUpsertRequest
890
+ :param endpoint_id: Webhook endpoint id (required)
891
+ :type endpoint_id: str
892
+ :param webhook_endpoint_upsert_request: (required)
893
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
584
894
  :param _request_timeout: timeout setting for this request. If one
585
895
  number provided, it will be total request
586
896
  timeout. It can also be a pair (tuple) of
@@ -603,8 +913,9 @@ class WebhooksApi:
603
913
  :return: Returns the result object.
604
914
  """ # noqa: E501
605
915
 
606
- _param = self._webhooks_upsert_events_webhook_serialize(
607
- events_webhook_upsert_request=events_webhook_upsert_request,
916
+ _param = self._webhooks_update_webhook_serialize(
917
+ endpoint_id=endpoint_id,
918
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
608
919
  _request_auth=_request_auth,
609
920
  _content_type=_content_type,
610
921
  _headers=_headers,
@@ -612,7 +923,7 @@ class WebhooksApi:
612
923
  )
613
924
 
614
925
  _response_types_map: Dict[str, Optional[str]] = {
615
- '200': "EventsWebhookResponse",
926
+ '200': "WebhookEndpoint",
616
927
  '400': "ApiErrorResponse",
617
928
  '401': None,
618
929
  '402': "ApiErrorResponse",
@@ -631,9 +942,10 @@ class WebhooksApi:
631
942
 
632
943
 
633
944
  @validate_call
634
- async def webhooks_upsert_events_webhook_with_http_info(
945
+ async def webhooks_update_webhook_with_http_info(
635
946
  self,
636
- events_webhook_upsert_request: EventsWebhookUpsertRequest,
947
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
948
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
637
949
  _request_timeout: Union[
638
950
  None,
639
951
  Annotated[StrictFloat, Field(gt=0)],
@@ -646,12 +958,14 @@ class WebhooksApi:
646
958
  _content_type: Optional[StrictStr] = None,
647
959
  _headers: Optional[Dict[StrictStr, Any]] = None,
648
960
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
649
- ) -> ApiResponse[EventsWebhookResponse]:
650
- """Create or update the events webhook configuration for the current account/environment.
961
+ ) -> ApiResponse[WebhookEndpoint]:
962
+ """Update a webhook. The signing secret is preserved.
651
963
 
652
964
 
653
- :param events_webhook_upsert_request: (required)
654
- :type events_webhook_upsert_request: EventsWebhookUpsertRequest
965
+ :param endpoint_id: Webhook endpoint id (required)
966
+ :type endpoint_id: str
967
+ :param webhook_endpoint_upsert_request: (required)
968
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
655
969
  :param _request_timeout: timeout setting for this request. If one
656
970
  number provided, it will be total request
657
971
  timeout. It can also be a pair (tuple) of
@@ -674,8 +988,9 @@ class WebhooksApi:
674
988
  :return: Returns the result object.
675
989
  """ # noqa: E501
676
990
 
677
- _param = self._webhooks_upsert_events_webhook_serialize(
678
- events_webhook_upsert_request=events_webhook_upsert_request,
991
+ _param = self._webhooks_update_webhook_serialize(
992
+ endpoint_id=endpoint_id,
993
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
679
994
  _request_auth=_request_auth,
680
995
  _content_type=_content_type,
681
996
  _headers=_headers,
@@ -683,7 +998,7 @@ class WebhooksApi:
683
998
  )
684
999
 
685
1000
  _response_types_map: Dict[str, Optional[str]] = {
686
- '200': "EventsWebhookResponse",
1001
+ '200': "WebhookEndpoint",
687
1002
  '400': "ApiErrorResponse",
688
1003
  '401': None,
689
1004
  '402': "ApiErrorResponse",
@@ -702,9 +1017,10 @@ class WebhooksApi:
702
1017
 
703
1018
 
704
1019
  @validate_call
705
- async def webhooks_upsert_events_webhook_without_preload_content(
1020
+ async def webhooks_update_webhook_without_preload_content(
706
1021
  self,
707
- events_webhook_upsert_request: EventsWebhookUpsertRequest,
1022
+ endpoint_id: Annotated[StrictStr, Field(description="Webhook endpoint id")],
1023
+ webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest,
708
1024
  _request_timeout: Union[
709
1025
  None,
710
1026
  Annotated[StrictFloat, Field(gt=0)],
@@ -718,11 +1034,13 @@ class WebhooksApi:
718
1034
  _headers: Optional[Dict[StrictStr, Any]] = None,
719
1035
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
720
1036
  ) -> RESTResponseType:
721
- """Create or update the events webhook configuration for the current account/environment.
1037
+ """Update a webhook. The signing secret is preserved.
722
1038
 
723
1039
 
724
- :param events_webhook_upsert_request: (required)
725
- :type events_webhook_upsert_request: EventsWebhookUpsertRequest
1040
+ :param endpoint_id: Webhook endpoint id (required)
1041
+ :type endpoint_id: str
1042
+ :param webhook_endpoint_upsert_request: (required)
1043
+ :type webhook_endpoint_upsert_request: WebhookEndpointUpsertRequest
726
1044
  :param _request_timeout: timeout setting for this request. If one
727
1045
  number provided, it will be total request
728
1046
  timeout. It can also be a pair (tuple) of
@@ -745,8 +1063,9 @@ class WebhooksApi:
745
1063
  :return: Returns the result object.
746
1064
  """ # noqa: E501
747
1065
 
748
- _param = self._webhooks_upsert_events_webhook_serialize(
749
- events_webhook_upsert_request=events_webhook_upsert_request,
1066
+ _param = self._webhooks_update_webhook_serialize(
1067
+ endpoint_id=endpoint_id,
1068
+ webhook_endpoint_upsert_request=webhook_endpoint_upsert_request,
750
1069
  _request_auth=_request_auth,
751
1070
  _content_type=_content_type,
752
1071
  _headers=_headers,
@@ -754,7 +1073,7 @@ class WebhooksApi:
754
1073
  )
755
1074
 
756
1075
  _response_types_map: Dict[str, Optional[str]] = {
757
- '200': "EventsWebhookResponse",
1076
+ '200': "WebhookEndpoint",
758
1077
  '400': "ApiErrorResponse",
759
1078
  '401': None,
760
1079
  '402': "ApiErrorResponse",
@@ -768,9 +1087,10 @@ class WebhooksApi:
768
1087
  return response_data.response
769
1088
 
770
1089
 
771
- def _webhooks_upsert_events_webhook_serialize(
1090
+ def _webhooks_update_webhook_serialize(
772
1091
  self,
773
- events_webhook_upsert_request,
1092
+ endpoint_id,
1093
+ webhook_endpoint_upsert_request,
774
1094
  _request_auth,
775
1095
  _content_type,
776
1096
  _headers,
@@ -792,12 +1112,14 @@ class WebhooksApi:
792
1112
  _body_params: Optional[bytes] = None
793
1113
 
794
1114
  # process the path parameters
1115
+ if endpoint_id is not None:
1116
+ _path_params['endpointId'] = endpoint_id
795
1117
  # process the query parameters
796
1118
  # process the header parameters
797
1119
  # process the form parameters
798
1120
  # process the body parameter
799
- if events_webhook_upsert_request is not None:
800
- _body_params = events_webhook_upsert_request
1121
+ if webhook_endpoint_upsert_request is not None:
1122
+ _body_params = webhook_endpoint_upsert_request
801
1123
 
802
1124
 
803
1125
  # set the HTTP header `Accept`
@@ -832,7 +1154,7 @@ class WebhooksApi:
832
1154
 
833
1155
  return self.api_client.param_serialize(
834
1156
  method='PUT',
835
- resource_path='/webhooks/events',
1157
+ resource_path='/webhooks/{endpointId}',
836
1158
  path_params=_path_params,
837
1159
  query_params=_query_params,
838
1160
  header_params=_header_params,
pingram/api_client.py CHANGED
@@ -91,7 +91,7 @@ class ApiClient:
91
91
  self.default_headers[header_name] = header_value
92
92
  self.cookie = cookie
93
93
  # Set default User-Agent.
94
- self.user_agent = 'pingram-python/1.0.30'
94
+ self.user_agent = 'pingram-python/1.0.31'
95
95
  self.client_side_validation = configuration.client_side_validation
96
96
 
97
97
  async def __aenter__(self):
pingram/configuration.py CHANGED
@@ -551,7 +551,7 @@ conf = pingram.Configuration(
551
551
  "OS: {env}\n"\
552
552
  "Python Version: {pyversion}\n"\
553
553
  "Version of the API: 1.0.0\n"\
554
- "SDK Package Version: 1.0.30".\
554
+ "SDK Package Version: 1.0.31".\
555
555
  format(env=sys.platform, pyversion=sys.version)
556
556
 
557
557
  def get_host_settings(self) -> List[HostSetting]:
@@ -70,8 +70,6 @@ from pingram.models.email_component_response import EmailComponentResponse
70
70
  from pingram.models.email_component_response_referenced_by_inner import EmailComponentResponseReferencedByInner
71
71
  from pingram.models.environment import Environment
72
72
  from pingram.models.environment_patch_request import EnvironmentPatchRequest
73
- from pingram.models.events_webhook_response import EventsWebhookResponse
74
- from pingram.models.events_webhook_upsert_request import EventsWebhookUpsertRequest
75
73
  from pingram.models.first_account_request import FirstAccountRequest
76
74
  from pingram.models.first_account_response import FirstAccountResponse
77
75
  from pingram.models.get_account_metadata_response import GetAccountMetadataResponse
@@ -283,6 +281,10 @@ from pingram.models.voice_browser_call_request import VoiceBrowserCallRequest
283
281
  from pingram.models.voice_browser_call_response import VoiceBrowserCallResponse
284
282
  from pingram.models.voice_call_request import VoiceCallRequest
285
283
  from pingram.models.voice_call_response import VoiceCallResponse
284
+ from pingram.models.webhook_endpoint import WebhookEndpoint
285
+ from pingram.models.webhook_endpoint_upsert_request import WebhookEndpointUpsertRequest
286
+ from pingram.models.webhook_endpoints_response import WebhookEndpointsResponse
287
+ from pingram.models.webhook_endpoints_response_endpoints_inner import WebhookEndpointsResponseEndpointsInner
286
288
  from pingram.models.webhook_event import WebhookEvent
287
289
  from pingram.models.webhook_response import WebhookResponse
288
290
 
@@ -22,15 +22,15 @@ from typing import Any, ClassVar, Dict, List
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
- class EventsWebhookResponse(BaseModel):
25
+ class WebhookEndpoint(BaseModel):
26
26
  """
27
- Events webhook configuration returned by the API.
27
+ Destination URL that receives signed event payloads for a set of subscribed events.
28
28
  """ # noqa: E501
29
- webhook_id: StrictStr = Field(description="Storage key in the format accountId:envId (currently accountId:accountId for account-scoped usage).", alias="webhookId")
29
+ id: StrictStr = Field(description="Unique identifier for this endpoint within the account.")
30
30
  webhook: StrictStr = Field(description="Destination URL that receives webhook event payloads.")
31
- events: List[StrictStr] = Field(description="List of subscribed event types for this webhook configuration.")
31
+ events: List[StrictStr] = Field(description="List of subscribed event types for this endpoint.")
32
32
  secret: StrictStr = Field(description="HMAC secret for verifying webhook signatures. Use this with your X-Pingram-Signature verification.")
33
- __properties: ClassVar[List[str]] = ["webhookId", "webhook", "events", "secret"]
33
+ __properties: ClassVar[List[str]] = ["id", "webhook", "events", "secret"]
34
34
 
35
35
  @field_validator('events')
36
36
  def events_validate_enum(cls, value):
@@ -58,7 +58,7 @@ class EventsWebhookResponse(BaseModel):
58
58
 
59
59
  @classmethod
60
60
  def from_json(cls, json_str: str) -> Optional[Self]:
61
- """Create an instance of EventsWebhookResponse from a JSON string"""
61
+ """Create an instance of WebhookEndpoint from a JSON string"""
62
62
  return cls.from_dict(json.loads(json_str))
63
63
 
64
64
  def to_dict(self) -> Dict[str, Any]:
@@ -83,7 +83,7 @@ class EventsWebhookResponse(BaseModel):
83
83
 
84
84
  @classmethod
85
85
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
- """Create an instance of EventsWebhookResponse from a dict"""
86
+ """Create an instance of WebhookEndpoint from a dict"""
87
87
  if obj is None:
88
88
  return None
89
89
 
@@ -91,7 +91,7 @@ class EventsWebhookResponse(BaseModel):
91
91
  return cls.model_validate(obj)
92
92
 
93
93
  _obj = cls.model_validate({
94
- "webhookId": obj.get("webhookId"),
94
+ "id": obj.get("id"),
95
95
  "webhook": obj.get("webhook"),
96
96
  "events": obj.get("events"),
97
97
  "secret": obj.get("secret")
@@ -22,9 +22,9 @@ from typing import Any, ClassVar, Dict, List
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
- class EventsWebhookUpsertRequest(BaseModel):
25
+ class WebhookEndpointUpsertRequest(BaseModel):
26
26
  """
27
- Request body for creating or updating the events webhook configuration.
27
+ Request body for creating or updating an events webhook endpoint.
28
28
  """ # noqa: E501
29
29
  webhook: StrictStr = Field(description="Destination URL that receives webhook event payloads. Must be a valid http(s) URL.")
30
30
  events: List[StrictStr] = Field(description="List of event types that should be forwarded to the webhook URL.")
@@ -56,7 +56,7 @@ class EventsWebhookUpsertRequest(BaseModel):
56
56
 
57
57
  @classmethod
58
58
  def from_json(cls, json_str: str) -> Optional[Self]:
59
- """Create an instance of EventsWebhookUpsertRequest from a JSON string"""
59
+ """Create an instance of WebhookEndpointUpsertRequest from a JSON string"""
60
60
  return cls.from_dict(json.loads(json_str))
61
61
 
62
62
  def to_dict(self) -> Dict[str, Any]:
@@ -81,7 +81,7 @@ class EventsWebhookUpsertRequest(BaseModel):
81
81
 
82
82
  @classmethod
83
83
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
- """Create an instance of EventsWebhookUpsertRequest from a dict"""
84
+ """Create an instance of WebhookEndpointUpsertRequest from a dict"""
85
85
  if obj is None:
86
86
  return None
87
87
 
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pingram
5
+
6
+ Internal API for notification delivery and management
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List
22
+ from pingram.models.webhook_endpoints_response_endpoints_inner import WebhookEndpointsResponseEndpointsInner
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class WebhookEndpointsResponse(BaseModel):
27
+ """
28
+ Events webhook endpoints configured for the current account.
29
+ """ # noqa: E501
30
+ endpoints: List[WebhookEndpointsResponseEndpointsInner] = Field(description="Configured webhook endpoints. Empty when none exist.")
31
+ __properties: ClassVar[List[str]] = ["endpoints"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of WebhookEndpointsResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in endpoints (list)
73
+ _items = []
74
+ if self.endpoints:
75
+ for _item_endpoints in self.endpoints:
76
+ if _item_endpoints:
77
+ _items.append(_item_endpoints.to_dict())
78
+ _dict['endpoints'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of WebhookEndpointsResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "endpoints": [WebhookEndpointsResponseEndpointsInner.from_dict(_item) for _item in obj["endpoints"]] if obj.get("endpoints") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pingram
5
+
6
+ Internal API for notification delivery and management
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class WebhookEndpointsResponseEndpointsInner(BaseModel):
26
+ """
27
+ Destination URL that receives signed event payloads for a set of subscribed events.
28
+ """ # noqa: E501
29
+ id: StrictStr = Field(description="Unique identifier for this endpoint within the account.")
30
+ webhook: StrictStr = Field(description="Destination URL that receives webhook event payloads.")
31
+ events: List[StrictStr] = Field(description="List of subscribed event types for this endpoint.")
32
+ secret: StrictStr = Field(description="HMAC secret for verifying webhook signatures. Use this with your X-Pingram-Signature verification.")
33
+ __properties: ClassVar[List[str]] = ["id", "webhook", "events", "secret"]
34
+
35
+ @field_validator('events')
36
+ def events_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ for i in value:
39
+ if i not in set(['EMAIL_OPEN', 'EMAIL_CLICK', 'EMAIL_FAILED', 'EMAIL_DELIVERED', 'EMAIL_UNSUBSCRIBE', 'EMAIL_INBOUND', 'INAPP_WEB_FAILED', 'INAPP_WEB_UNSUBSCRIBE', 'SMS_DELIVERED', 'SMS_FAILED', 'SMS_UNSUBSCRIBE', 'SMS_SUBSCRIBE', 'SMS_INBOUND', 'PUSH_FAILED', 'PUSH_UNSUBSCRIBE', 'CALL_FAILED', 'CALL_UNSUBSCRIBE', 'WEB_PUSH_FAILED', 'WEB_PUSH_UNSUBSCRIBE', 'SLACK_FAILED', 'SLACK_UNSUBSCRIBE']):
40
+ raise ValueError("each list item must be one of ('EMAIL_OPEN', 'EMAIL_CLICK', 'EMAIL_FAILED', 'EMAIL_DELIVERED', 'EMAIL_UNSUBSCRIBE', 'EMAIL_INBOUND', 'INAPP_WEB_FAILED', 'INAPP_WEB_UNSUBSCRIBE', 'SMS_DELIVERED', 'SMS_FAILED', 'SMS_UNSUBSCRIBE', 'SMS_SUBSCRIBE', 'SMS_INBOUND', 'PUSH_FAILED', 'PUSH_UNSUBSCRIBE', 'CALL_FAILED', 'CALL_UNSUBSCRIBE', 'WEB_PUSH_FAILED', 'WEB_PUSH_UNSUBSCRIBE', 'SLACK_FAILED', 'SLACK_UNSUBSCRIBE')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of WebhookEndpointsResponseEndpointsInner from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of WebhookEndpointsResponseEndpointsInner from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "id": obj.get("id"),
95
+ "webhook": obj.get("webhook"),
96
+ "events": obj.get("events"),
97
+ "secret": obj.get("secret")
98
+ })
99
+ return _obj
100
+
101
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pingram-python
3
- Version: 1.0.30
3
+ Version: 1.0.31
4
4
  Summary: Official Python SDK for Pingram - Send notifications via Email, SMS, Push, In-App, and more
5
5
  Author: Pingram
6
6
  License: MIT
@@ -1,8 +1,8 @@
1
- pingram/__init__.py,sha256=3dEOf7S5Q1A4XZ6of0SGHwGoJGsK1NCtZbEb7hIiIMw,45145
2
- pingram/api_client.py,sha256=Taq208K6ZVtNBg1P139Qog_VpTYEI20z3Sy1RfIGMKo,27792
1
+ pingram/__init__.py,sha256=Q9YbxKBJt1_tsP-pMYhBSIeeA1ZGghpRa6kvHPL46G4,45464
2
+ pingram/api_client.py,sha256=DL3V99MbV549wDuE0eU4L4E_VllqkQvpfEkRR0bEW-Q,27792
3
3
  pingram/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
4
4
  pingram/client_wrapper.py,sha256=OthUT3ImXw7O_tax9yU-IZZdqSx-R4vVxCuKOX2ojk8,13992
5
- pingram/configuration.py,sha256=0yMQA1U6nc9lmFsylxJKg_Nn2kYOfO6Dg-RDtlYz0yw,19466
5
+ pingram/configuration.py,sha256=T67oixyJY6aH_kMQbf3-PEz12Xf4SC8IufHu3TC94yY,19466
6
6
  pingram/exceptions.py,sha256=0l6B9dlFRwmPx-sfytj3wC9rdGgVPJY3AQ39qHx3GS4,8483
7
7
  pingram/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pingram/rest.py,sha256=soB0_p6OMFlXrz5pDmdf2nIZchqPua9hgtuj8A5Yea4,6426
@@ -32,8 +32,8 @@ pingram/api/types_api.py,sha256=AL7Hj6hLe-pWYiXRUGYnevVDfZeVJDi2V8x70uYgqfg,5639
32
32
  pingram/api/user_api.py,sha256=lgPwwZzo9_nrouwmUa6gzUOLe30r8W_RnT-vccTIF5Y,79230
33
33
  pingram/api/users_api.py,sha256=AERWQ8wGRve3TovcVBp9CamZOUV8lpjJb_P9HnsxV4g,37532
34
34
  pingram/api/voice_api.py,sha256=ML4Xbnn64f47nkM7_Bn2kwvcvng_T4Nv1uLg6Jhd3-Y,125242
35
- pingram/api/webhooks_api.py,sha256=RycvnhNbTEdXRnyjGpzoKNdFq2gXbL8T4QKbb62HiZ0,32758
36
- pingram/models/__init__.py,sha256=gc9MkRa0WARpk7FQ-Kti7IqvNPZoltOEYpUFtLS6EAg,24065
35
+ pingram/api/webhooks_api.py,sha256=yMzgXx8tSps1Wg04ghSh5IMnEqkte5d6k2pMFcCLA2E,45241
36
+ pingram/models/__init__.py,sha256=u6YLZ9N7QUlbsr2gRCh1VzbFrNM2NUnWRZovGLa0fPk,24244
37
37
  pingram/models/accept_invite_request.py,sha256=ZXIkBQFXWjD0g0Akfuz6CuWTWZ8AWpWXHfY8EMgo4XE,2443
38
38
  pingram/models/accept_invite_response.py,sha256=R-fqCEzKwX1XxJscgtPSU7MUCeKGmuBkzh8fha-9KEM,2869
39
39
  pingram/models/account_addresses_response.py,sha256=0nev-caxYCmHQHHTXSvpmrz6yYPx92UcB8Umzkt2RK8,3068
@@ -91,8 +91,6 @@ pingram/models/email_component_response.py,sha256=uquZWKFjmXLY3HsLmQEf3Pd-J5IC0B
91
91
  pingram/models/email_component_response_referenced_by_inner.py,sha256=uygSXD6cpSLi_VLyy1hbWdTzOKDiRYSaaZTpeM9fwH0,2851
92
92
  pingram/models/environment.py,sha256=4dUsbrJD9xMXZucKGg75QbP7KyTa8B3avSo9FJ3_u34,2986
93
93
  pingram/models/environment_patch_request.py,sha256=Vd4OaOdbJwMnBVB_xNd12FJ77rFxA8p1RJMH8VC9qMw,3021
94
- pingram/models/events_webhook_response.py,sha256=4CaeAIXyNCvgO5qnKXfJcE4OpUqDpY2GFrT3t71oOoU,4184
95
- pingram/models/events_webhook_upsert_request.py,sha256=gNAwjGs3kjDmlJ_T3KX8w4nF9Cbu9Cc9uutByicgi50,3829
96
94
  pingram/models/first_account_request.py,sha256=YfIz1xAOAayq70AvIc1VCd_cRKQ9VVH7tXVrQ_S-00s,2612
97
95
  pingram/models/first_account_response.py,sha256=wbJd0vq1VDGAoxGiENbPLgWTui745tQNQf9UU37tbG8,2588
98
96
  pingram/models/get_account_metadata_response.py,sha256=lD-8X19FqgZgiZv-XifYvM3wU2RgULfPv1QkwdjipO4,3051
@@ -304,10 +302,14 @@ pingram/models/voice_browser_call_request.py,sha256=hMwyUbtSBMeIfpBwrwNnnVxg4Uey
304
302
  pingram/models/voice_browser_call_response.py,sha256=Hi-6mtkCv1Rb6ILB6-hVbYhzG--WNiOErH5pBA3_-KE,2673
305
303
  pingram/models/voice_call_request.py,sha256=nO7Ci5yB_jqJrVkMBt5p59gLsYsVDT5fsZl0stuHCn8,3287
306
304
  pingram/models/voice_call_response.py,sha256=wxVY-uyUvw8uvGPRbQBLmCOE5RYOQl8c_zS6RPtFIQE,2788
305
+ pingram/models/webhook_endpoint.py,sha256=aH5edYss5iejbqpCZxpwXGUgX0JfSXjzY7chK2uyTpc,4095
306
+ pingram/models/webhook_endpoint_upsert_request.py,sha256=prg0iKGXeR3T09zAHtJ9xjGcobpeXaxCM9VLv7ppfqc,3829
307
+ pingram/models/webhook_endpoints_response.py,sha256=ukoMTHiFVi1h2lUsZKCzxhOcwZqZI8YxUSS5jJDxjM0,3187
308
+ pingram/models/webhook_endpoints_response_endpoints_inner.py,sha256=DJn-BfmHcxyJSxZxiOwUKZOBTzuKdJ-WG3TB8HmMuVs,4164
307
309
  pingram/models/webhook_event.py,sha256=T_f1G9eLhOjMlCDwHru3J6KDCKBxgiZBmata_pvBlU8,4879
308
310
  pingram/models/webhook_response.py,sha256=rwCh3OTCE3TK6tVEKOKVlq9w0b1fZ-fKKEoe9Tz0tIc,3233
309
- pingram_python-1.0.30.dist-info/licenses/LICENSE,sha256=jFcP99OXuZ-3f_86j4Q4OjmvvHNm7SG94ytcAhqvldk,1059
310
- pingram_python-1.0.30.dist-info/METADATA,sha256=L4LjJbAgPTYaNzXAlOQk5K5YE3W6uAKLEXZuH7Y5Vvk,2268
311
- pingram_python-1.0.30.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
312
- pingram_python-1.0.30.dist-info/top_level.txt,sha256=6BmMatn4_wswGo1u11HkRU892yP2gG5dddsmmRhSjD8,8
313
- pingram_python-1.0.30.dist-info/RECORD,,
311
+ pingram_python-1.0.31.dist-info/licenses/LICENSE,sha256=jFcP99OXuZ-3f_86j4Q4OjmvvHNm7SG94ytcAhqvldk,1059
312
+ pingram_python-1.0.31.dist-info/METADATA,sha256=EP7oXZEvejH0z-vBcAcXsjcr6YaBP27UYSB07H0svs0,2268
313
+ pingram_python-1.0.31.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
314
+ pingram_python-1.0.31.dist-info/top_level.txt,sha256=6BmMatn4_wswGo1u11HkRU892yP2gG5dddsmmRhSjD8,8
315
+ pingram_python-1.0.31.dist-info/RECORD,,