@@ -110,41 +110,63 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
110
110
To change the default retry strategy for a single API call, simply provide a ` RetryConfig ` object to the call:
111
111
``` python
112
112
from unstructured_client import UnstructuredClient
113
+ from unstructured_client.models import shared
113
114
from unstructured_client.utils import BackoffStrategy, RetryConfig
114
115
115
116
116
117
with UnstructuredClient() as uc_client:
117
118
118
- res = uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post(request = {
119
- " destination_id" : " b65169f5-79ba-4464-918f-b0be2c07b962" ,
119
+ res = uc_client.destinations.create_destination(request = {
120
+ " create_destination_connector" : {
121
+ " config" : {
122
+ " api_endpoint" : " <value>" ,
123
+ " batch_size" : 20 ,
124
+ " collection_name" : " <value>" ,
125
+ " flatten_metadata" : False ,
126
+ " token" : " <value>" ,
127
+ },
128
+ " name" : " <value>" ,
129
+ " type" : shared.DestinationConnectorType.AZURE_AI_SEARCH ,
130
+ },
120
131
},
121
132
RetryConfig(" backoff" , BackoffStrategy(1 , 50 , 1.1 , 100 ), False ))
122
133
123
- assert res.dag_node_connection_check is not None
134
+ assert res.destination_connector_information is not None
124
135
125
136
# Handle response
126
- print (res.dag_node_connection_check )
137
+ print (res.destination_connector_information )
127
138
128
139
```
129
140
130
141
If you'd like to override the default retry strategy for all operations that support retries, you can use the ` retry_config ` optional parameter when initializing the SDK:
131
142
``` python
132
143
from unstructured_client import UnstructuredClient
144
+ from unstructured_client.models import shared
133
145
from unstructured_client.utils import BackoffStrategy, RetryConfig
134
146
135
147
136
148
with UnstructuredClient(
137
149
retry_config = RetryConfig(" backoff" , BackoffStrategy(1 , 50 , 1.1 , 100 ), False ),
138
150
) as uc_client:
139
151
140
- res = uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post(request = {
141
- " destination_id" : " b65169f5-79ba-4464-918f-b0be2c07b962" ,
152
+ res = uc_client.destinations.create_destination(request = {
153
+ " create_destination_connector" : {
154
+ " config" : {
155
+ " api_endpoint" : " <value>" ,
156
+ " batch_size" : 20 ,
157
+ " collection_name" : " <value>" ,
158
+ " flatten_metadata" : False ,
159
+ " token" : " <value>" ,
160
+ },
161
+ " name" : " <value>" ,
162
+ " type" : shared.DestinationConnectorType.AZURE_AI_SEARCH ,
163
+ },
142
164
})
143
165
144
- assert res.dag_node_connection_check is not None
166
+ assert res.destination_connector_information is not None
145
167
146
168
# Handle response
147
- print (res.dag_node_connection_check )
169
+ print (res.destination_connector_information )
148
170
149
171
```
150
172
<!-- End Retries [retries] -->
@@ -164,7 +186,7 @@ By default, an API error will raise a errors.SDKError exception, which has the f
164
186
| ` .raw_response ` | * httpx.Response* | The raw HTTP response |
165
187
| ` .body ` | * str* | The response content |
166
188
167
- When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective * Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the ` check_destination_connection_api_v1_destinations_destination_id_connection_check_post_async ` method may raise the following exceptions:
189
+ When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective * Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the ` create_destination_async ` method may raise the following exceptions:
168
190
169
191
| Error Type | Status Code | Content Type |
170
192
| -------------------------- | ----------- | ---------------- |
@@ -175,21 +197,31 @@ When custom error responses are specified for an operation, the SDK may also rai
175
197
176
198
``` python
177
199
from unstructured_client import UnstructuredClient
178
- from unstructured_client.models import errors
200
+ from unstructured_client.models import errors, shared
179
201
180
202
181
203
with UnstructuredClient() as uc_client:
182
204
res = None
183
205
try :
184
206
185
- res = uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post(request = {
186
- " destination_id" : " b65169f5-79ba-4464-918f-b0be2c07b962" ,
207
+ res = uc_client.destinations.create_destination(request = {
208
+ " create_destination_connector" : {
209
+ " config" : {
210
+ " api_endpoint" : " <value>" ,
211
+ " batch_size" : 20 ,
212
+ " collection_name" : " <value>" ,
213
+ " flatten_metadata" : False ,
214
+ " token" : " <value>" ,
215
+ },
216
+ " name" : " <value>" ,
217
+ " type" : shared.DestinationConnectorType.AZURE_AI_SEARCH ,
218
+ },
187
219
})
188
220
189
- assert res.dag_node_connection_check is not None
221
+ assert res.destination_connector_information is not None
190
222
191
223
# Handle response
192
- print (res.dag_node_connection_check )
224
+ print (res.destination_connector_information )
193
225
194
226
except errors.HTTPValidationError as e:
195
227
# handle e.data: errors.HTTPValidationErrorData
@@ -300,18 +332,29 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
300
332
``` python
301
333
# Synchronous Example
302
334
from unstructured_client import UnstructuredClient
335
+ from unstructured_client.models import shared
303
336
304
337
305
338
with UnstructuredClient() as uc_client:
306
339
307
- res = uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post(request = {
308
- " destination_id" : " b65169f5-79ba-4464-918f-b0be2c07b962" ,
340
+ res = uc_client.destinations.create_destination(request = {
341
+ " create_destination_connector" : {
342
+ " config" : {
343
+ " api_endpoint" : " <value>" ,
344
+ " batch_size" : 20 ,
345
+ " collection_name" : " <value>" ,
346
+ " flatten_metadata" : False ,
347
+ " token" : " <value>" ,
348
+ },
349
+ " name" : " <value>" ,
350
+ " type" : shared.DestinationConnectorType.AZURE_AI_SEARCH ,
351
+ },
309
352
})
310
353
311
- assert res.dag_node_connection_check is not None
354
+ assert res.destination_connector_information is not None
312
355
313
356
# Handle response
314
- print (res.dag_node_connection_check )
357
+ print (res.destination_connector_information )
315
358
```
316
359
317
360
</br >
@@ -321,19 +364,30 @@ The same SDK client can also be used to make asychronous requests by importing a
321
364
# Asynchronous Example
322
365
import asyncio
323
366
from unstructured_client import UnstructuredClient
367
+ from unstructured_client.models import shared
324
368
325
369
async def main ():
326
370
327
371
async with UnstructuredClient() as uc_client:
328
372
329
- res = await uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post_async(request = {
330
- " destination_id" : " b65169f5-79ba-4464-918f-b0be2c07b962" ,
373
+ res = await uc_client.destinations.create_destination_async(request = {
374
+ " create_destination_connector" : {
375
+ " config" : {
376
+ " api_endpoint" : " <value>" ,
377
+ " batch_size" : 20 ,
378
+ " collection_name" : " <value>" ,
379
+ " flatten_metadata" : False ,
380
+ " token" : " <value>" ,
381
+ },
382
+ " name" : " <value>" ,
383
+ " type" : shared.DestinationConnectorType.AZURE_AI_SEARCH ,
384
+ },
331
385
})
332
386
333
- assert res.dag_node_connection_check is not None
387
+ assert res.destination_connector_information is not None
334
388
335
389
# Handle response
336
- print (res.dag_node_connection_check )
390
+ print (res.destination_connector_information )
337
391
338
392
asyncio.run(main())
339
393
```
0 commit comments