You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -123,8 +129,8 @@ The Conversation domain API access remains `sinch_client.conversation`; message
123
129
|`send()` with `SendConversationMessageRequest`| Use convenience methods: `send_text_message()`, `send_card_message()`, `send_carousel_message()`, `send_choice_message()`, `send_contact_info_message()`, `send_list_message()`, `send_location_message()`, `send_media_message()`, `send_template_message()`<br>Or `send()` with `app_id`, `message` (dict or `SendMessageRequestBodyDict`), and either `contact_id` or `recipient_identities`|
124
130
|`get()` with `GetConversationMessageRequest`|`get()` with `message_id: str` parameter |
125
131
|`delete()` with `DeleteConversationMessageRequest`|`delete()` with `message_id: str` parameter |
126
-
|`list()` with `ListConversationMessagesRequest`|In Progress|
127
-
| — |**New in V2:**`update()` with `message_id`, `metadata`, and optional `messages_source`|
132
+
|`list()` with `ListConversationMessagesRequest`|`list()` with the same fields as keyword arguments (see models table above). V2 adds optional `channel_identity`, `start_time`, `end_time`, `channel`, `direction`. Returns **`Paginator[ConversationMessageResponse]`**: use `.content()` for messages on the current page, `.next_page()` to load the next page, or `.iterator()` to walk every message across all pages.|
133
+
| — |**New in V2:**`update()` with `message_id`, `metadata`, and optional `messages_source`|
The Conversation HTTP API still expects the JSON field **`callback_url`**. In V2, use the Python parameter / model field `event_destination_target`; it is serialized as `callback_url` on the wire (same pattern as other domains, e.g. SMS).
@@ -200,6 +206,7 @@ The Conversation HTTP API still expects the JSON field **`callback_url`**. In V2
200
206
#### Replacement APIs
201
207
202
208
The SMS domain API access remains the same: `sinch.sms.batches` and `sinch.sms.delivery_reports`. However, the underlying models and method signatures have changed.
209
+
203
210
Note that `sinch.sms.groups` and `sinch.sms.inbounds` are not supported yet and will be available in future minor versions.
204
211
205
212
##### Batches API
@@ -213,17 +220,17 @@ Note that `sinch.sms.groups` and `sinch.sms.inbounds` are not supported yet and
213
220
|`update()` with `UpdateBatchRequest`| Use convenience methods: `update_sms()`, `update_binary()`, `update_mms()`<br>Or `update()` with `UpdateBatchMessageRequest` (Union of `UpdateTextRequestWithBatchId`, `UpdateBinaryRequestWithBatchId`, `UpdateMediaRequestWithBatchId`) |
214
221
|`replace()` with `ReplaceBatchRequest`| Use convenience methods: `replace_sms()`, `replace_binary()`, `replace_mms()`<br>Or `replace()` with `ReplaceBatchRequest` (Union of `ReplaceTextRequest`, `ReplaceBinaryRequest`, `ReplaceMediaRequest`) |
215
222
216
-
<br>
223
+
---
217
224
218
225
##### Delivery Reports API
219
226
220
227
| Old method | New method in `sms.delivery_reports`|
|`list()` with `ListSMSDeliveryReportsRequest`|`list()` the parameters `start_date` and `end_date` now accepts both `str` and `datetime`|
229
+
|`list()` with `ListSMSDeliveryReportsRequest`|`list()` the parameters `start_date` and `end_date` now accepts both `str` and `datetime`|
223
230
|`get_for_batch()` with `GetSMSDeliveryReportForBatchRequest`|`get()` with `batch_id: str` and optional parameters: `report_type`, `status`, `code`, `client_reference`|
224
231
|`get_for_number()` with `GetSMSDeliveryReportForNumberRequest`|`get_for_number()` with `batch_id: str` and `recipient: str` parameters |
To obtain a Numbers Sinch Events handler: `sinch_client.numbers.sinch_events(callback_secret)` returns a `SinchEvents` instance; `handler.parse_event(request_body)` returns a `NumberSinchEvent`.
273
280
274
-
275
281
```python
276
282
# New
277
283
from sinch.domains.numbers.sinch_events.v1.events import NumberSinchEvent
@@ -286,7 +292,6 @@ event = handler.parse_event(request_body) # event is a NumberSinchEvent
286
292
|**Methods that accept the parameter**| Only `numbers.available.rent_any(..., callback_url=...)`|`numbers.rent(...)`, `numbers.rent_any(...)`, and `numbers.update(...)` accept `event_destination_target`|
Copy file name to clipboardExpand all lines: README.md
+17-21Lines changed: 17 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ For more information on the Sinch APIs on which this SDK is based, refer to the
22
22
-[Prerequisites](#prerequisites)
23
23
-[Installation](#installation)
24
24
-[Getting started](#getting-started)
25
-
-[Logging]()
25
+
-[Logging](#logging)
26
26
27
27
## Prerequisites
28
28
@@ -79,41 +79,37 @@ sinch_client = SinchClient(
79
79
)
80
80
```
81
81
82
+
### SMS and Conversation regions (V2)
83
+
84
+
You must set `sms_region` before using the SMS API and `conversation_region` before using the Conversation API—either in the `SinchClient(...)` constructor or on `sinch_client.configuration` before the first call to that product. See [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md) for examples.
85
+
82
86
## Logging
83
87
84
88
Logging configuration for this SDK utilizes following hierarchy:
85
89
1. If no configuration was provided via `logger_name` or `logger` configurable, SDK will inherit configuration from the root logger with the `Sinch` prefix.
86
90
2. If `logger_name` configurable was provided, SDK will use logger related to that name. For example: `myapp.sinch` will inherit configuration from the `myapp` logger.
87
91
3. If `logger` (logger instance) configurable was provided, SDK will use that particular logger for all its logging operations.
88
92
89
-
If all logging returned by this SDK needs to be disabled, usage of `NullHanlder` provided by the standard `logging` module is advised.
93
+
If all logging returned by this SDK needs to be disabled, usage of `NullHandler` provided by the standard `logging` module is advised.
90
94
91
95
92
96
93
97
## Sample apps
94
98
95
-
Usage example of the `numbers` domain:
99
+
Usage example of the Numbers API via [`VirtualNumbers`](sinch/domains/numbers/virtual_numbers.py) on the client (`sinch_client.numbers`)—`list()` returns your project’s active virtual numbers:
Returned values are [Pydantic](https://docs.pydantic.dev/) model instances (for example [`ActiveNumber`](sinch/domains/numbers/models/v1/response/active_number.py)), including fields such as `phone_number`, `region_code`, `type`, and `capabilities`.
111
+
112
+
More examples live under [examples/snippets](examples/snippets) on the `main` branch.
117
113
118
114
### Handling exceptions
119
115
@@ -125,9 +121,9 @@ Example for Numbers API:
125
121
from sinch.domains.numbers.api.v1.exceptions import NumbersException
126
122
127
123
try:
128
-
nums= sinch_client.numbers.available.list(
124
+
paginator= sinch_client.numbers.list(
129
125
region_code="US",
130
-
number_type="LOCAL"
126
+
number_type="LOCAL",
131
127
)
132
128
except NumbersException as err:
133
129
pass
@@ -163,4 +159,4 @@ The transport must be a synchronous implementation.
163
159
164
160
## License
165
161
166
-
This project is licensed under the Apache License. See the [LICENSE](license.md) filefor the license text.
162
+
This project is licensed under the Apache License. See the [LICENSE](LICENSE) file for the license text.
0 commit comments