diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 52425407..1c555d20 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 8b5fa338-9106-4734-abf0-e30d67044a90 management: - docChecksum: a22c1e202b7ac1f3305521fb7827a79d + docChecksum: 6433f28e5b70c3c0d7754fc7a88db327 docVersion: 1.1.7 - speakeasyVersion: 1.534.0 - generationVersion: 2.585.0 - releaseVersion: 0.33.0 - configChecksum: d3a6fe7f2ae7f430c8fff9c158af4f46 + speakeasyVersion: 1.535.1 + generationVersion: 2.585.2 + releaseVersion: 0.33.1 + configChecksum: 8b5e7fbd95d040ba09964f3c97c3156a repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git repoSubDirectory: . installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git @@ -46,6 +46,10 @@ generatedFiles: - docs/models/errors/servererror.md - docs/models/operations/canceljobrequest.md - docs/models/operations/canceljobresponse.md + - docs/models/operations/createconnectioncheckdestinationsrequest.md + - docs/models/operations/createconnectioncheckdestinationsresponse.md + - docs/models/operations/createconnectionchecksourcesrequest.md + - docs/models/operations/createconnectionchecksourcesresponse.md - docs/models/operations/createdestinationrequest.md - docs/models/operations/createdestinationresponse.md - docs/models/operations/createsourcerequest.md @@ -60,6 +64,10 @@ generatedFiles: - docs/models/operations/deleteworkflowresponse.md - docs/models/operations/downloadjoboutputrequest.md - docs/models/operations/downloadjoboutputresponse.md + - docs/models/operations/getconnectioncheckdestinationsrequest.md + - docs/models/operations/getconnectioncheckdestinationsresponse.md + - docs/models/operations/getconnectionchecksourcesrequest.md + - docs/models/operations/getconnectionchecksourcesresponse.md - docs/models/operations/getdestinationrequest.md - docs/models/operations/getdestinationresponse.md - docs/models/operations/getjobrequest.md @@ -98,6 +106,7 @@ generatedFiles: - docs/models/shared/config.md - docs/models/shared/confluencesourceconnectorconfig.md - docs/models/shared/confluencesourceconnectorconfiginput.md + - docs/models/shared/connectioncheckstatus.md - docs/models/shared/couchbasedestinationconnectorconfig.md - docs/models/shared/couchbasedestinationconnectorconfiginput.md - docs/models/shared/couchbasesourceconnectorconfig.md @@ -107,6 +116,7 @@ generatedFiles: - docs/models/shared/createsourceconnectorconfig.md - docs/models/shared/createworkflow.md - docs/models/shared/crontabentry.md + - docs/models/shared/dagnodeconnectioncheck.md - docs/models/shared/databricksvdtdestinationconnectorconfig.md - docs/models/shared/databricksvdtdestinationconnectorconfiginput.md - docs/models/shared/databricksvolumesconnectorconfig.md @@ -227,6 +237,8 @@ generatedFiles: - src/unstructured_client/models/errors/servererror.py - src/unstructured_client/models/operations/__init__.py - src/unstructured_client/models/operations/cancel_job.py + - src/unstructured_client/models/operations/create_connection_check_destinations.py + - src/unstructured_client/models/operations/create_connection_check_sources.py - src/unstructured_client/models/operations/create_destination.py - src/unstructured_client/models/operations/create_source.py - src/unstructured_client/models/operations/create_workflow.py @@ -234,6 +246,8 @@ generatedFiles: - src/unstructured_client/models/operations/delete_source.py - src/unstructured_client/models/operations/delete_workflow.py - src/unstructured_client/models/operations/download_job_output.py + - src/unstructured_client/models/operations/get_connection_check_destinations.py + - src/unstructured_client/models/operations/get_connection_check_sources.py - src/unstructured_client/models/operations/get_destination.py - src/unstructured_client/models/operations/get_job.py - src/unstructured_client/models/operations/get_source.py @@ -259,6 +273,7 @@ generatedFiles: - src/unstructured_client/models/shared/boxsourceconnectorconfiginput.py - src/unstructured_client/models/shared/confluencesourceconnectorconfig.py - src/unstructured_client/models/shared/confluencesourceconnectorconfiginput.py + - src/unstructured_client/models/shared/connectioncheckstatus.py - src/unstructured_client/models/shared/couchbasedestinationconnectorconfig.py - src/unstructured_client/models/shared/couchbasedestinationconnectorconfiginput.py - src/unstructured_client/models/shared/couchbasesourceconnectorconfig.py @@ -267,6 +282,7 @@ generatedFiles: - src/unstructured_client/models/shared/createsourceconnector.py - src/unstructured_client/models/shared/createworkflow.py - src/unstructured_client/models/shared/crontabentry.py + - src/unstructured_client/models/shared/dagnodeconnectioncheck.py - src/unstructured_client/models/shared/databricksvdtdestinationconnectorconfig.py - src/unstructured_client/models/shared/databricksvdtdestinationconnectorconfiginput.py - src/unstructured_client/models/shared/databricksvolumesconnectorconfig.py @@ -437,6 +453,7 @@ examples: job_id: "bddbb621-2124-4cc2-9fa7-c6cdc21dac44" query: file_id: "" + node_id: "bddbb621-2124-4cc2-9fa7-c6cdc21dac44" header: {} responses: "200": @@ -630,5 +647,49 @@ examples: application/json: {"created_at": "2025-01-25T05:08:46.547Z", "id": "7cc92d68-dc16-49f9-a119-c651a18a978d", "status": "SCHEDULED"} "422": application/json: {"detail": ""} + create_connection_check_destinations: + speakeasy-default-create-connection-check-destinations: + parameters: + path: + destination_id: "d9795fb7-2135-4e48-a51d-009dd6ca38a1" + header: {} + responses: + "202": + application/json: {"created_at": "2025-10-23T17:00:52.828Z", "id": "2b33c132-612e-425e-9ef0-4c89923fc202", "status": "SCHEDULED"} + "422": + application/json: {"detail": ""} + get_connection_check_destinations: + speakeasy-default-get-connection-check-destinations: + parameters: + path: + destination_id: "eb6a7890-5661-44a2-840b-bc59e9bb3318" + header: {} + responses: + "200": + application/json: {"created_at": "2025-03-13T23:31:02.383Z", "id": "c3274f55-9861-4e4e-8526-4273aa4d2772", "status": "FAILURE"} + "422": + application/json: {"detail": [{"loc": [""], "msg": "", "type": ""}, {"loc": [], "msg": "", "type": ""}, {"loc": [], "msg": "", "type": ""}]} + create_connection_check_sources: + speakeasy-default-create-connection-check-sources: + parameters: + path: + source_id: "e5658517-3282-4845-9c22-88de48549d21" + header: {} + responses: + "202": + application/json: {"created_at": "2023-03-12T05:54:05.025Z", "id": "b5793adb-057f-470c-ae7e-309d786a99eb", "status": "SUCCESS"} + "422": + application/json: {"detail": []} + get_connection_check_sources: + speakeasy-default-get-connection-check-sources: + parameters: + path: + source_id: "b3b6b67d-aca9-4b1c-89c0-5788869c1383" + header: {} + responses: + "200": + application/json: {"created_at": "2023-09-12T00:38:55.692Z", "id": "f7d1d931-a753-4fe9-ae3f-671f188a9b55", "status": "SUCCESS"} + "422": + application/json: {"detail": [{"loc": [""], "msg": "", "type": ""}, {"loc": [], "msg": "", "type": ""}]} examplesVersion: 1.0.1 generatedTests: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index dbb4a0a9..76866fdf 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.535.0 +speakeasyVersion: 1.535.1 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:8682267837b89a2ee79370a4ad952198440742fd4e6da24fd6c8061be3e52c03 - sourceBlobDigest: sha256:1549523a97b9ebd09012362367f313beb08069f42290a5186a65854ceff2ecd1 + sourceRevisionDigest: sha256:6771a944eaf5581cde4835c43e7997635f7d80ce441763c47cad9c305ba4a91e + sourceBlobDigest: sha256:521a1c7be485e2be9f33ff7b82566823e96827cb69f7ca7775e0dd3dcc52d825 tags: - latest - - speakeasy-sdk-regen-1744919342 + - speakeasy-sdk-regen-1745261613 - 1.1.7 targets: unstructured-python: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:8682267837b89a2ee79370a4ad952198440742fd4e6da24fd6c8061be3e52c03 - sourceBlobDigest: sha256:1549523a97b9ebd09012362367f313beb08069f42290a5186a65854ceff2ecd1 + sourceRevisionDigest: sha256:6771a944eaf5581cde4835c43e7997635f7d80ce441763c47cad9c305ba4a91e + sourceBlobDigest: sha256:521a1c7be485e2be9f33ff7b82566823e96827cb69f7ca7775e0dd3dcc52d825 codeSamplesNamespace: my-source-code-samples - codeSamplesRevisionDigest: sha256:42c3a9e6802072bcdb162dd89daa5b4a59b92c4dffd0b852e212812845f6b556 + codeSamplesRevisionDigest: sha256:06bd35ef844f603c2c2357092fc875febff06f5c9eb855e262ff013b8935d8d6 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index c2b0b7f3..4ce8ffd5 100755 --- a/README.md +++ b/README.md @@ -110,38 +110,26 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call: ```python from unstructured_client import UnstructuredClient -from unstructured_client.models import shared from unstructured_client.utils import BackoffStrategy, RetryConfig with UnstructuredClient() as uc_client: - res = uc_client.destinations.create_destination(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }, RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) ``` 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: ```python from unstructured_client import UnstructuredClient -from unstructured_client.models import shared from unstructured_client.utils import BackoffStrategy, RetryConfig @@ -149,24 +137,14 @@ with UnstructuredClient( retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), ) as uc_client: - res = uc_client.destinations.create_destination(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) ``` @@ -186,7 +164,7 @@ By default, an API error will raise a errors.SDKError exception, which has the f | `.raw_response` | *httpx.Response* | The raw HTTP response | | `.body` | *str* | The response content | -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: +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_connection_check_destinations_async` method may raise the following exceptions: | Error Type | Status Code | Content Type | | -------------------------- | ----------- | ---------------- | @@ -197,31 +175,21 @@ When custom error responses are specified for an operation, the SDK may also rai ```python from unstructured_client import UnstructuredClient -from unstructured_client.models import errors, shared +from unstructured_client.models import errors with UnstructuredClient() as uc_client: res = None try: - res = uc_client.destinations.create_destination(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) except errors.HTTPValidationError as e: # handle e.data: errors.HTTPValidationErrorData @@ -332,29 +300,18 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u ```python # Synchronous Example from unstructured_client import UnstructuredClient -from unstructured_client.models import shared with UnstructuredClient() as uc_client: - res = uc_client.destinations.create_destination(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) ```
@@ -364,30 +321,19 @@ The same SDK client can also be used to make asychronous requests by importing a # Asynchronous Example import asyncio from unstructured_client import UnstructuredClient -from unstructured_client.models import shared async def main(): async with UnstructuredClient() as uc_client: - res = await uc_client.destinations.create_destination_async(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = await uc_client.destinations.create_connection_check_destinations_async(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) asyncio.run(main()) ``` diff --git a/RELEASES.md b/RELEASES.md index eb3bdbbc..34900c93 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -967,3 +967,14 @@ Based on: - [python v0.33.0] . ### Releases - [PyPI v0.33.0] https://pypi.org/project/unstructured-client/0.33.0 - . + + +## 2025-04-21 18:53:16 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.535.1 (2.585.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.33.1] . +### Releases +- [PyPI v0.33.1] https://pypi.org/project/unstructured-client/0.33.1 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 27e85212..ce43adb4 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2,29 +2,18 @@ ```python # Synchronous Example from unstructured_client import UnstructuredClient -from unstructured_client.models import shared with UnstructuredClient() as uc_client: - res = uc_client.destinations.create_destination(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) ```
@@ -34,30 +23,19 @@ The same SDK client can also be used to make asychronous requests by importing a # Asynchronous Example import asyncio from unstructured_client import UnstructuredClient -from unstructured_client.models import shared async def main(): async with UnstructuredClient() as uc_client: - res = await uc_client.destinations.create_destination_async(request={ - "create_destination_connector": { - "config": { - "api_endpoint": "", - "batch_size": 20, - "collection_name": "", - "flatten_metadata": False, - "token": "", - }, - "name": "", - "type": shared.DestinationConnectorType.AZURE_AI_SEARCH, - }, + res = await uc_client.destinations.create_connection_check_destinations_async(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", }) - assert res.destination_connector_information is not None + assert res.dag_node_connection_check is not None # Handle response - print(res.destination_connector_information) + print(res.dag_node_connection_check) asyncio.run(main()) ``` diff --git a/codeSamples.yaml b/codeSamples.yaml index 59130d07..7d2a084e 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -37,14 +37,14 @@ actions: update: "x-codeSamples": - "lang": "python" - "label": "get_destination_connection_check_api_v1_destinations__destination_id__connection_check_get" - "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.get_destination_connection_check_api_v1_destinations_destination_id_connection_check_get(request={\n \"destination_id\": \"3c48df35-2b2c-46f2-9aa2-d7eae993797c\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" + "label": "get_connection_check_destinations" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.get_connection_check_destinations(request={\n \"destination_id\": \"eb6a7890-5661-44a2-840b-bc59e9bb3318\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" - target: $["paths"]["/api/v1/destinations/{destination_id}/connection-check"]["post"] update: "x-codeSamples": - "lang": "python" - "label": "check_destination_connection_api_v1_destinations__destination_id__connection_check_post" - "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.check_destination_connection_api_v1_destinations_destination_id_connection_check_post(request={\n \"destination_id\": \"b65169f5-79ba-4464-918f-b0be2c07b962\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" + "label": "create_connection_check_destinations" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.create_connection_check_destinations(request={\n \"destination_id\": \"d9795fb7-2135-4e48-a51d-009dd6ca38a1\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" - target: $["paths"]["/api/v1/jobs/"]["get"] update: "x-codeSamples": @@ -68,7 +68,7 @@ actions: "x-codeSamples": - "lang": "python" "label": "download_job_output" - "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.jobs.download_job_output(request={\n \"job_id\": \"bddbb621-2124-4cc2-9fa7-c6cdc21dac44\",\n \"file_id\": \"\",\n })\n\n assert res.any is not None\n\n # Handle response\n print(res.any)" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.jobs.download_job_output(request={\n \"job_id\": \"bddbb621-2124-4cc2-9fa7-c6cdc21dac44\",\n \"file_id\": \"\",\n \"node_id\": \"a949c7ba-31b1-4a2b-b7df-f144e8cc5768\",\n })\n\n assert res.any is not None\n\n # Handle response\n print(res.any)" - target: $["paths"]["/api/v1/sources/"]["get"] update: "x-codeSamples": @@ -103,14 +103,14 @@ actions: update: "x-codeSamples": - "lang": "python" - "label": "get_connection_check_api_v1_sources__source_id__connection_check_get" - "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.sources.get_connection_check_api_v1_sources_source_id_connection_check_get(request={\n \"source_id\": \"d9c3daec-ddf9-4cef-ae8d-3a989813cc7b\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" + "label": "get_connection_check_sources" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.sources.get_connection_check_sources(request={\n \"source_id\": \"b3b6b67d-aca9-4b1c-89c0-5788869c1383\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" - target: $["paths"]["/api/v1/sources/{source_id}/connection-check"]["post"] update: "x-codeSamples": - "lang": "python" - "label": "check_connection_api_v1_sources__source_id__connection_check_post" - "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.sources.check_connection_api_v1_sources_source_id_connection_check_post(request={\n \"source_id\": \"8cb54f13-5652-423e-889c-1df1f8147126\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" + "label": "create_connection_check_sources" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.sources.create_connection_check_sources(request={\n \"source_id\": \"e5658517-3282-4845-9c22-88de48549d21\",\n })\n\n assert res.dag_node_connection_check is not None\n\n # Handle response\n print(res.dag_node_connection_check)" - target: $["paths"]["/api/v1/workflows/"]["get"] update: "x-codeSamples": diff --git a/docs/models/operations/createconnectioncheckdestinationsrequest.md b/docs/models/operations/createconnectioncheckdestinationsrequest.md new file mode 100644 index 00000000..03297232 --- /dev/null +++ b/docs/models/operations/createconnectioncheckdestinationsrequest.md @@ -0,0 +1,9 @@ +# CreateConnectionCheckDestinationsRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `destination_id` | *str* | :heavy_check_mark: | N/A | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createconnectioncheckdestinationsresponse.md b/docs/models/operations/createconnectioncheckdestinationsresponse.md new file mode 100644 index 00000000..4d29ed43 --- /dev/null +++ b/docs/models/operations/createconnectioncheckdestinationsresponse.md @@ -0,0 +1,11 @@ +# CreateConnectionCheckDestinationsResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `dag_node_connection_check` | [Optional[shared.DagNodeConnectionCheck]](../../models/shared/dagnodeconnectioncheck.md) | :heavy_minus_sign: | Successful Response | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [httpx.Response](https://www.python-httpx.org/api/#response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/createconnectionchecksourcesrequest.md b/docs/models/operations/createconnectionchecksourcesrequest.md new file mode 100644 index 00000000..08994520 --- /dev/null +++ b/docs/models/operations/createconnectionchecksourcesrequest.md @@ -0,0 +1,9 @@ +# CreateConnectionCheckSourcesRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `source_id` | *str* | :heavy_check_mark: | N/A | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createconnectionchecksourcesresponse.md b/docs/models/operations/createconnectionchecksourcesresponse.md new file mode 100644 index 00000000..92da80e6 --- /dev/null +++ b/docs/models/operations/createconnectionchecksourcesresponse.md @@ -0,0 +1,11 @@ +# CreateConnectionCheckSourcesResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `dag_node_connection_check` | [Optional[shared.DagNodeConnectionCheck]](../../models/shared/dagnodeconnectioncheck.md) | :heavy_minus_sign: | Successful Response | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [httpx.Response](https://www.python-httpx.org/api/#response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/downloadjoboutputrequest.md b/docs/models/operations/downloadjoboutputrequest.md index 4a4680d0..26f515a8 100644 --- a/docs/models/operations/downloadjoboutputrequest.md +++ b/docs/models/operations/downloadjoboutputrequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `file_id` | *str* | :heavy_check_mark: | ID of the file to download | -| `job_id` | *str* | :heavy_check_mark: | N/A | -| `node_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Node ID to view per node output of the file | -| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `file_id` | *str* | :heavy_check_mark: | ID of the file to download | +| `job_id` | *str* | :heavy_check_mark: | N/A | +| `node_id` | *str* | :heavy_check_mark: | Node ID to retrieve the corresponding output file | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getconnectioncheckdestinationsrequest.md b/docs/models/operations/getconnectioncheckdestinationsrequest.md new file mode 100644 index 00000000..0cf87f06 --- /dev/null +++ b/docs/models/operations/getconnectioncheckdestinationsrequest.md @@ -0,0 +1,9 @@ +# GetConnectionCheckDestinationsRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `destination_id` | *str* | :heavy_check_mark: | N/A | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getconnectioncheckdestinationsresponse.md b/docs/models/operations/getconnectioncheckdestinationsresponse.md new file mode 100644 index 00000000..5e547344 --- /dev/null +++ b/docs/models/operations/getconnectioncheckdestinationsresponse.md @@ -0,0 +1,11 @@ +# GetConnectionCheckDestinationsResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `dag_node_connection_check` | [Optional[shared.DagNodeConnectionCheck]](../../models/shared/dagnodeconnectioncheck.md) | :heavy_minus_sign: | Successful Response | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [httpx.Response](https://www.python-httpx.org/api/#response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/getconnectionchecksourcesrequest.md b/docs/models/operations/getconnectionchecksourcesrequest.md new file mode 100644 index 00000000..5076aebd --- /dev/null +++ b/docs/models/operations/getconnectionchecksourcesrequest.md @@ -0,0 +1,9 @@ +# GetConnectionCheckSourcesRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `source_id` | *str* | :heavy_check_mark: | N/A | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getconnectionchecksourcesresponse.md b/docs/models/operations/getconnectionchecksourcesresponse.md new file mode 100644 index 00000000..4633b094 --- /dev/null +++ b/docs/models/operations/getconnectionchecksourcesresponse.md @@ -0,0 +1,11 @@ +# GetConnectionCheckSourcesResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `dag_node_connection_check` | [Optional[shared.DagNodeConnectionCheck]](../../models/shared/dagnodeconnectioncheck.md) | :heavy_minus_sign: | Successful Response | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [httpx.Response](https://www.python-httpx.org/api/#response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/shared/connectioncheckstatus.md b/docs/models/shared/connectioncheckstatus.md new file mode 100644 index 00000000..08715d17 --- /dev/null +++ b/docs/models/shared/connectioncheckstatus.md @@ -0,0 +1,10 @@ +# ConnectionCheckStatus + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `SCHEDULED` | SCHEDULED | +| `SUCCESS` | SUCCESS | +| `FAILURE` | FAILURE | \ No newline at end of file diff --git a/docs/models/shared/dagnodeconnectioncheck.md b/docs/models/shared/dagnodeconnectioncheck.md new file mode 100644 index 00000000..23a8fe06 --- /dev/null +++ b/docs/models/shared/dagnodeconnectioncheck.md @@ -0,0 +1,12 @@ +# DagNodeConnectionCheck + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | +| `id` | *str* | :heavy_check_mark: | N/A | +| `reason` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `reported_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | N/A | +| `status` | [shared.ConnectionCheckStatus](../../models/shared/connectioncheckstatus.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/destinations/README.md b/docs/sdks/destinations/README.md index 8a847af8..2782b2c0 100644 --- a/docs/sdks/destinations/README.md +++ b/docs/sdks/destinations/README.md @@ -5,12 +5,56 @@ ### Available Operations +* [create_connection_check_destinations](#create_connection_check_destinations) - Create destination connection check * [create_destination](#create_destination) - Create destination connector * [delete_destination](#delete_destination) - Delete destination connector +* [get_connection_check_destinations](#get_connection_check_destinations) - Get the latest destination connector connection check * [get_destination](#get_destination) - Get destination connector * [list_destinations](#list_destinations) - List destination connectors * [update_destination](#update_destination) - Update destination connector +## create_connection_check_destinations + +Initiate a connection check for the destination connector + +### Example Usage + +```python +from unstructured_client import UnstructuredClient + + +with UnstructuredClient() as uc_client: + + res = uc_client.destinations.create_connection_check_destinations(request={ + "destination_id": "d9795fb7-2135-4e48-a51d-009dd6ca38a1", + }) + + assert res.dag_node_connection_check is not None + + # Handle response + print(res.dag_node_connection_check) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateConnectionCheckDestinationsRequest](../../models/operations/createconnectioncheckdestinationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| `server_url` | *Optional[str]* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**[operations.CreateConnectionCheckDestinationsResponse](../../models/operations/createconnectioncheckdestinationsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + ## create_destination Create a new destination connector using the provided configuration and name. @@ -106,6 +150,48 @@ with UnstructuredClient() as uc_client: | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | +## get_connection_check_destinations + +Retrieves the most recent connection check for the specified destination connector. + +### Example Usage + +```python +from unstructured_client import UnstructuredClient + + +with UnstructuredClient() as uc_client: + + res = uc_client.destinations.get_connection_check_destinations(request={ + "destination_id": "eb6a7890-5661-44a2-840b-bc59e9bb3318", + }) + + assert res.dag_node_connection_check is not None + + # Handle response + print(res.dag_node_connection_check) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetConnectionCheckDestinationsRequest](../../models/operations/getconnectioncheckdestinationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| `server_url` | *Optional[str]* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**[operations.GetConnectionCheckDestinationsResponse](../../models/operations/getconnectioncheckdestinationsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + ## get_destination Retrieve detailed information for a specific destination connector by its ID. diff --git a/docs/sdks/jobs/README.md b/docs/sdks/jobs/README.md index 195fb15d..3fbd36e7 100644 --- a/docs/sdks/jobs/README.md +++ b/docs/sdks/jobs/README.md @@ -54,7 +54,7 @@ with UnstructuredClient() as uc_client: ## download_job_output -Download the output of a job from a local workflow. +Download the output of a job from a workflow where the input file was provided at runtime. ### Example Usage @@ -67,6 +67,7 @@ with UnstructuredClient() as uc_client: res = uc_client.jobs.download_job_output(request={ "file_id": "", "job_id": "bddbb621-2124-4cc2-9fa7-c6cdc21dac44", + "node_id": "bddbb621-2124-4cc2-9fa7-c6cdc21dac44", }) assert res.any is not None diff --git a/docs/sdks/sources/README.md b/docs/sdks/sources/README.md index 54452ead..f4ad28d8 100644 --- a/docs/sdks/sources/README.md +++ b/docs/sdks/sources/README.md @@ -5,12 +5,56 @@ ### Available Operations +* [create_connection_check_sources](#create_connection_check_sources) - Create source connection check * [create_source](#create_source) - Create source connector * [delete_source](#delete_source) - Delete source connector +* [get_connection_check_sources](#get_connection_check_sources) - Get the latest source connector connection check * [get_source](#get_source) - Get source connector * [list_sources](#list_sources) - List available source connectors * [update_source](#update_source) - Update source connector +## create_connection_check_sources + +Initiates a connection check for the specified source connector. + +### Example Usage + +```python +from unstructured_client import UnstructuredClient + + +with UnstructuredClient() as uc_client: + + res = uc_client.sources.create_connection_check_sources(request={ + "source_id": "e5658517-3282-4845-9c22-88de48549d21", + }) + + assert res.dag_node_connection_check is not None + + # Handle response + print(res.dag_node_connection_check) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateConnectionCheckSourcesRequest](../../models/operations/createconnectionchecksourcesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| `server_url` | *Optional[str]* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**[operations.CreateConnectionCheckSourcesResponse](../../models/operations/createconnectionchecksourcesresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + ## create_source Create a new source connector using the provided configuration and name. @@ -108,6 +152,48 @@ with UnstructuredClient() as uc_client: | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | +## get_connection_check_sources + +Retrieves the most recent connection check for the specified source connector. + +### Example Usage + +```python +from unstructured_client import UnstructuredClient + + +with UnstructuredClient() as uc_client: + + res = uc_client.sources.get_connection_check_sources(request={ + "source_id": "b3b6b67d-aca9-4b1c-89c0-5788869c1383", + }) + + assert res.dag_node_connection_check is not None + + # Handle response + print(res.dag_node_connection_check) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetConnectionCheckSourcesRequest](../../models/operations/getconnectionchecksourcesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| `server_url` | *Optional[str]* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**[operations.GetConnectionCheckSourcesResponse](../../models/operations/getconnectionchecksourcesresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + ## get_source Retrieve detailed information for a specific source connector by its ID. diff --git a/gen.yaml b/gen.yaml index bd93d4c5..35688474 100644 --- a/gen.yaml +++ b/gen.yaml @@ -12,7 +12,7 @@ generation: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false python: - version: 0.33.0 + version: 0.33.1 additionalDependencies: dev: deepdiff: '>=6.0' diff --git a/pyproject.toml b/pyproject.toml index 23a1a66a..758c990c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "unstructured-client" -version = "0.33.0" +version = "0.33.1" description = "Python Client SDK for Unstructured API" authors = [{ name = "Unstructured" },] readme = "README-PYPI.md" diff --git a/src/unstructured_client/_version.py b/src/unstructured_client/_version.py index 63db4e6b..5ceb97af 100644 --- a/src/unstructured_client/_version.py +++ b/src/unstructured_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "unstructured-client" -__version__: str = "0.33.0" +__version__: str = "0.33.1" __openapi_doc_version__: str = "1.1.7" -__gen_version__: str = "2.585.0" -__user_agent__: str = "speakeasy-sdk/python 0.33.0 2.585.0 1.1.7 unstructured-client" +__gen_version__: str = "2.585.2" +__user_agent__: str = "speakeasy-sdk/python 0.33.1 2.585.2 1.1.7 unstructured-client" try: if __package__ is not None: diff --git a/src/unstructured_client/destinations.py b/src/unstructured_client/destinations.py index 6eba26da..6b38f480 100644 --- a/src/unstructured_client/destinations.py +++ b/src/unstructured_client/destinations.py @@ -9,6 +9,236 @@ class Destinations(BaseSDK): + def create_connection_check_destinations( + self, + *, + request: Union[ + operations.CreateConnectionCheckDestinationsRequest, + operations.CreateConnectionCheckDestinationsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.CreateConnectionCheckDestinationsResponse: + r"""Create destination connection check + + Initiate a connection check for the destination connector + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.CREATE_CONNECTION_CHECK_DESTINATIONS_SERVERS[ + operations.CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.CreateConnectionCheckDestinationsRequest + ) + request = cast(operations.CreateConnectionCheckDestinationsRequest, request) + + req = self._build_request( + method="POST", + path="/api/v1/destinations/{destination_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = self.do_request( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="create_connection_check_destinations", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return operations.CreateConnectionCheckDestinationsResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_connection_check_destinations_async( + self, + *, + request: Union[ + operations.CreateConnectionCheckDestinationsRequest, + operations.CreateConnectionCheckDestinationsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.CreateConnectionCheckDestinationsResponse: + r"""Create destination connection check + + Initiate a connection check for the destination connector + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.CREATE_CONNECTION_CHECK_DESTINATIONS_SERVERS[ + operations.CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.CreateConnectionCheckDestinationsRequest + ) + request = cast(operations.CreateConnectionCheckDestinationsRequest, request) + + req = self._build_request_async( + method="POST", + path="/api/v1/destinations/{destination_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="create_connection_check_destinations", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return operations.CreateConnectionCheckDestinationsResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + def create_destination( self, *, @@ -471,6 +701,236 @@ async def delete_destination_async( http_res, ) + def get_connection_check_destinations( + self, + *, + request: Union[ + operations.GetConnectionCheckDestinationsRequest, + operations.GetConnectionCheckDestinationsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetConnectionCheckDestinationsResponse: + r"""Get the latest destination connector connection check + + Retrieves the most recent connection check for the specified destination connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.GET_CONNECTION_CHECK_DESTINATIONS_SERVERS[ + operations.GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetConnectionCheckDestinationsRequest + ) + request = cast(operations.GetConnectionCheckDestinationsRequest, request) + + req = self._build_request( + method="GET", + path="/api/v1/destinations/{destination_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = self.do_request( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="get_connection_check_destinations", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetConnectionCheckDestinationsResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_connection_check_destinations_async( + self, + *, + request: Union[ + operations.GetConnectionCheckDestinationsRequest, + operations.GetConnectionCheckDestinationsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetConnectionCheckDestinationsResponse: + r"""Get the latest destination connector connection check + + Retrieves the most recent connection check for the specified destination connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.GET_CONNECTION_CHECK_DESTINATIONS_SERVERS[ + operations.GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetConnectionCheckDestinationsRequest + ) + request = cast(operations.GetConnectionCheckDestinationsRequest, request) + + req = self._build_request_async( + method="GET", + path="/api/v1/destinations/{destination_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="get_connection_check_destinations", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetConnectionCheckDestinationsResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + def get_destination( self, *, diff --git a/src/unstructured_client/jobs.py b/src/unstructured_client/jobs.py index 50eef1b4..3b0cfcc4 100644 --- a/src/unstructured_client/jobs.py +++ b/src/unstructured_client/jobs.py @@ -243,7 +243,7 @@ def download_job_output( ) -> operations.DownloadJobOutputResponse: r"""Download Job output - Download the output of a job from a local workflow. + Download the output of a job from a workflow where the input file was provided at runtime. :param request: The request object to send. :param retries: Override the default retry configuration for this method @@ -354,7 +354,7 @@ async def download_job_output_async( ) -> operations.DownloadJobOutputResponse: r"""Download Job output - Download the output of a job from a local workflow. + Download the output of a job from a workflow where the input file was provided at runtime. :param request: The request object to send. :param retries: Override the default retry configuration for this method diff --git a/src/unstructured_client/models/operations/__init__.py b/src/unstructured_client/models/operations/__init__.py index 7a02a0ac..d23eabdf 100644 --- a/src/unstructured_client/models/operations/__init__.py +++ b/src/unstructured_client/models/operations/__init__.py @@ -8,6 +8,22 @@ CancelJobResponse, CancelJobResponseTypedDict, ) +from .create_connection_check_destinations import ( + CREATE_CONNECTION_CHECK_DESTINATIONS_SERVERS, + CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API, + CreateConnectionCheckDestinationsRequest, + CreateConnectionCheckDestinationsRequestTypedDict, + CreateConnectionCheckDestinationsResponse, + CreateConnectionCheckDestinationsResponseTypedDict, +) +from .create_connection_check_sources import ( + CREATE_CONNECTION_CHECK_SOURCES_SERVERS, + CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API, + CreateConnectionCheckSourcesRequest, + CreateConnectionCheckSourcesRequestTypedDict, + CreateConnectionCheckSourcesResponse, + CreateConnectionCheckSourcesResponseTypedDict, +) from .create_destination import ( CREATE_DESTINATION_SERVERS, CREATE_DESTINATION_SERVER_PLATFORM_API, @@ -64,6 +80,22 @@ DownloadJobOutputResponse, DownloadJobOutputResponseTypedDict, ) +from .get_connection_check_destinations import ( + GET_CONNECTION_CHECK_DESTINATIONS_SERVERS, + GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API, + GetConnectionCheckDestinationsRequest, + GetConnectionCheckDestinationsRequestTypedDict, + GetConnectionCheckDestinationsResponse, + GetConnectionCheckDestinationsResponseTypedDict, +) +from .get_connection_check_sources import ( + GET_CONNECTION_CHECK_SOURCES_SERVERS, + GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API, + GetConnectionCheckSourcesRequest, + GetConnectionCheckSourcesRequestTypedDict, + GetConnectionCheckSourcesResponse, + GetConnectionCheckSourcesResponseTypedDict, +) from .get_destination import ( GET_DESTINATION_SERVERS, GET_DESTINATION_SERVER_PLATFORM_API, @@ -174,6 +206,10 @@ __all__ = [ "CANCEL_JOB_SERVERS", "CANCEL_JOB_SERVER_PLATFORM_API", + "CREATE_CONNECTION_CHECK_DESTINATIONS_SERVERS", + "CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API", + "CREATE_CONNECTION_CHECK_SOURCES_SERVERS", + "CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API", "CREATE_DESTINATION_SERVERS", "CREATE_DESTINATION_SERVER_PLATFORM_API", "CREATE_SOURCE_SERVERS", @@ -184,6 +220,14 @@ "CancelJobRequestTypedDict", "CancelJobResponse", "CancelJobResponseTypedDict", + "CreateConnectionCheckDestinationsRequest", + "CreateConnectionCheckDestinationsRequestTypedDict", + "CreateConnectionCheckDestinationsResponse", + "CreateConnectionCheckDestinationsResponseTypedDict", + "CreateConnectionCheckSourcesRequest", + "CreateConnectionCheckSourcesRequestTypedDict", + "CreateConnectionCheckSourcesResponse", + "CreateConnectionCheckSourcesResponseTypedDict", "CreateDestinationRequest", "CreateDestinationRequestTypedDict", "CreateDestinationResponse", @@ -220,6 +264,10 @@ "DownloadJobOutputRequestTypedDict", "DownloadJobOutputResponse", "DownloadJobOutputResponseTypedDict", + "GET_CONNECTION_CHECK_DESTINATIONS_SERVERS", + "GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API", + "GET_CONNECTION_CHECK_SOURCES_SERVERS", + "GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API", "GET_DESTINATION_SERVERS", "GET_DESTINATION_SERVER_PLATFORM_API", "GET_JOB_SERVERS", @@ -228,6 +276,14 @@ "GET_SOURCE_SERVER_PLATFORM_API", "GET_WORKFLOW_SERVERS", "GET_WORKFLOW_SERVER_PLATFORM_API", + "GetConnectionCheckDestinationsRequest", + "GetConnectionCheckDestinationsRequestTypedDict", + "GetConnectionCheckDestinationsResponse", + "GetConnectionCheckDestinationsResponseTypedDict", + "GetConnectionCheckSourcesRequest", + "GetConnectionCheckSourcesRequestTypedDict", + "GetConnectionCheckSourcesResponse", + "GetConnectionCheckSourcesResponseTypedDict", "GetDestinationRequest", "GetDestinationRequestTypedDict", "GetDestinationResponse", diff --git a/src/unstructured_client/models/operations/create_connection_check_destinations.py b/src/unstructured_client/models/operations/create_connection_check_destinations.py new file mode 100644 index 00000000..e2366bb6 --- /dev/null +++ b/src/unstructured_client/models/operations/create_connection_check_destinations.py @@ -0,0 +1,102 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import httpx +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from unstructured_client.models.shared import ( + dagnodeconnectioncheck as shared_dagnodeconnectioncheck, +) +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from unstructured_client.utils import FieldMetadata, HeaderMetadata, PathParamMetadata + +CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API = "platform-api" +r"""Unstructured Platform API""" + +CREATE_CONNECTION_CHECK_DESTINATIONS_SERVERS = { + CREATE_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API: "https://platform.unstructuredapp.io/", +} + + +class CreateConnectionCheckDestinationsRequestTypedDict(TypedDict): + destination_id: str + unstructured_api_key: NotRequired[Nullable[str]] + + +class CreateConnectionCheckDestinationsRequest(BaseModel): + destination_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + unstructured_api_key: Annotated[ + OptionalNullable[str], + pydantic.Field(alias="unstructured-api-key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["unstructured-api-key"] + nullable_fields = ["unstructured-api-key"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class CreateConnectionCheckDestinationsResponseTypedDict(TypedDict): + content_type: str + r"""HTTP response content type for this operation""" + status_code: int + r"""HTTP response status code for this operation""" + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + dag_node_connection_check: NotRequired[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheckTypedDict + ] + r"""Successful Response""" + + +class CreateConnectionCheckDestinationsResponse(BaseModel): + content_type: str + r"""HTTP response content type for this operation""" + + status_code: int + r"""HTTP response status code for this operation""" + + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + + dag_node_connection_check: Optional[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheck + ] = None + r"""Successful Response""" diff --git a/src/unstructured_client/models/operations/create_connection_check_sources.py b/src/unstructured_client/models/operations/create_connection_check_sources.py new file mode 100644 index 00000000..a7ab4713 --- /dev/null +++ b/src/unstructured_client/models/operations/create_connection_check_sources.py @@ -0,0 +1,102 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import httpx +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from unstructured_client.models.shared import ( + dagnodeconnectioncheck as shared_dagnodeconnectioncheck, +) +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from unstructured_client.utils import FieldMetadata, HeaderMetadata, PathParamMetadata + +CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API = "platform-api" +r"""Unstructured Platform API""" + +CREATE_CONNECTION_CHECK_SOURCES_SERVERS = { + CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API: "https://platform.unstructuredapp.io/", +} + + +class CreateConnectionCheckSourcesRequestTypedDict(TypedDict): + source_id: str + unstructured_api_key: NotRequired[Nullable[str]] + + +class CreateConnectionCheckSourcesRequest(BaseModel): + source_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + unstructured_api_key: Annotated[ + OptionalNullable[str], + pydantic.Field(alias="unstructured-api-key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["unstructured-api-key"] + nullable_fields = ["unstructured-api-key"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class CreateConnectionCheckSourcesResponseTypedDict(TypedDict): + content_type: str + r"""HTTP response content type for this operation""" + status_code: int + r"""HTTP response status code for this operation""" + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + dag_node_connection_check: NotRequired[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheckTypedDict + ] + r"""Successful Response""" + + +class CreateConnectionCheckSourcesResponse(BaseModel): + content_type: str + r"""HTTP response content type for this operation""" + + status_code: int + r"""HTTP response status code for this operation""" + + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + + dag_node_connection_check: Optional[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheck + ] = None + r"""Successful Response""" diff --git a/src/unstructured_client/models/operations/download_job_output.py b/src/unstructured_client/models/operations/download_job_output.py index 4130a2b0..7d7c941b 100644 --- a/src/unstructured_client/models/operations/download_job_output.py +++ b/src/unstructured_client/models/operations/download_job_output.py @@ -32,8 +32,8 @@ class DownloadJobOutputRequestTypedDict(TypedDict): file_id: str r"""ID of the file to download""" job_id: str - node_id: NotRequired[Nullable[str]] - r"""Node ID to view per node output of the file""" + node_id: str + r"""Node ID to retrieve the corresponding output file""" unstructured_api_key: NotRequired[Nullable[str]] @@ -48,10 +48,9 @@ class DownloadJobOutputRequest(BaseModel): ] node_id: Annotated[ - OptionalNullable[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = UNSET - r"""Node ID to view per node output of the file""" + str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True)) + ] + r"""Node ID to retrieve the corresponding output file""" unstructured_api_key: Annotated[ OptionalNullable[str], @@ -61,8 +60,8 @@ class DownloadJobOutputRequest(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["node_id", "unstructured-api-key"] - nullable_fields = ["node_id", "unstructured-api-key"] + optional_fields = ["unstructured-api-key"] + nullable_fields = ["unstructured-api-key"] null_default_fields = [] serialized = handler(self) diff --git a/src/unstructured_client/models/operations/get_connection_check_destinations.py b/src/unstructured_client/models/operations/get_connection_check_destinations.py new file mode 100644 index 00000000..e80a2841 --- /dev/null +++ b/src/unstructured_client/models/operations/get_connection_check_destinations.py @@ -0,0 +1,102 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import httpx +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from unstructured_client.models.shared import ( + dagnodeconnectioncheck as shared_dagnodeconnectioncheck, +) +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from unstructured_client.utils import FieldMetadata, HeaderMetadata, PathParamMetadata + +GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API = "platform-api" +r"""Unstructured Platform API""" + +GET_CONNECTION_CHECK_DESTINATIONS_SERVERS = { + GET_CONNECTION_CHECK_DESTINATIONS_SERVER_PLATFORM_API: "https://platform.unstructuredapp.io/", +} + + +class GetConnectionCheckDestinationsRequestTypedDict(TypedDict): + destination_id: str + unstructured_api_key: NotRequired[Nullable[str]] + + +class GetConnectionCheckDestinationsRequest(BaseModel): + destination_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + unstructured_api_key: Annotated[ + OptionalNullable[str], + pydantic.Field(alias="unstructured-api-key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["unstructured-api-key"] + nullable_fields = ["unstructured-api-key"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class GetConnectionCheckDestinationsResponseTypedDict(TypedDict): + content_type: str + r"""HTTP response content type for this operation""" + status_code: int + r"""HTTP response status code for this operation""" + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + dag_node_connection_check: NotRequired[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheckTypedDict + ] + r"""Successful Response""" + + +class GetConnectionCheckDestinationsResponse(BaseModel): + content_type: str + r"""HTTP response content type for this operation""" + + status_code: int + r"""HTTP response status code for this operation""" + + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + + dag_node_connection_check: Optional[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheck + ] = None + r"""Successful Response""" diff --git a/src/unstructured_client/models/operations/get_connection_check_sources.py b/src/unstructured_client/models/operations/get_connection_check_sources.py new file mode 100644 index 00000000..55b9eb6a --- /dev/null +++ b/src/unstructured_client/models/operations/get_connection_check_sources.py @@ -0,0 +1,102 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +import httpx +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from unstructured_client.models.shared import ( + dagnodeconnectioncheck as shared_dagnodeconnectioncheck, +) +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from unstructured_client.utils import FieldMetadata, HeaderMetadata, PathParamMetadata + +GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API = "platform-api" +r"""Unstructured Platform API""" + +GET_CONNECTION_CHECK_SOURCES_SERVERS = { + GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API: "https://platform.unstructuredapp.io/", +} + + +class GetConnectionCheckSourcesRequestTypedDict(TypedDict): + source_id: str + unstructured_api_key: NotRequired[Nullable[str]] + + +class GetConnectionCheckSourcesRequest(BaseModel): + source_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + + unstructured_api_key: Annotated[ + OptionalNullable[str], + pydantic.Field(alias="unstructured-api-key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["unstructured-api-key"] + nullable_fields = ["unstructured-api-key"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class GetConnectionCheckSourcesResponseTypedDict(TypedDict): + content_type: str + r"""HTTP response content type for this operation""" + status_code: int + r"""HTTP response status code for this operation""" + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + dag_node_connection_check: NotRequired[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheckTypedDict + ] + r"""Successful Response""" + + +class GetConnectionCheckSourcesResponse(BaseModel): + content_type: str + r"""HTTP response content type for this operation""" + + status_code: int + r"""HTTP response status code for this operation""" + + raw_response: httpx.Response + r"""Raw HTTP response; suitable for custom response parsing""" + + dag_node_connection_check: Optional[ + shared_dagnodeconnectioncheck.DagNodeConnectionCheck + ] = None + r"""Successful Response""" diff --git a/src/unstructured_client/models/shared/__init__.py b/src/unstructured_client/models/shared/__init__.py index 25e37417..26e65b5c 100644 --- a/src/unstructured_client/models/shared/__init__.py +++ b/src/unstructured_client/models/shared/__init__.py @@ -46,6 +46,7 @@ ConfluenceSourceConnectorConfigInput, ConfluenceSourceConnectorConfigInputTypedDict, ) +from .connectioncheckstatus import ConnectionCheckStatus from .couchbasedestinationconnectorconfig import ( CouchbaseDestinationConnectorConfig, CouchbaseDestinationConnectorConfigTypedDict, @@ -76,6 +77,10 @@ ) from .createworkflow import CreateWorkflow, CreateWorkflowTypedDict, Schedule from .crontabentry import CronTabEntry, CronTabEntryTypedDict +from .dagnodeconnectioncheck import ( + DagNodeConnectionCheck, + DagNodeConnectionCheckTypedDict, +) from .databricksvdtdestinationconnectorconfig import ( DatabricksVDTDestinationConnectorConfig, DatabricksVDTDestinationConnectorConfigTypedDict, @@ -399,6 +404,7 @@ "ConfluenceSourceConnectorConfigInput", "ConfluenceSourceConnectorConfigInputTypedDict", "ConfluenceSourceConnectorConfigTypedDict", + "ConnectionCheckStatus", "CouchbaseDestinationConnectorConfig", "CouchbaseDestinationConnectorConfigInput", "CouchbaseDestinationConnectorConfigInputTypedDict", @@ -417,6 +423,8 @@ "CreateWorkflowTypedDict", "CronTabEntry", "CronTabEntryTypedDict", + "DagNodeConnectionCheck", + "DagNodeConnectionCheckTypedDict", "DatabricksVDTDestinationConnectorConfig", "DatabricksVDTDestinationConnectorConfigInput", "DatabricksVDTDestinationConnectorConfigInputTypedDict", diff --git a/src/unstructured_client/models/shared/connectioncheckstatus.py b/src/unstructured_client/models/shared/connectioncheckstatus.py new file mode 100644 index 00000000..a2f6477f --- /dev/null +++ b/src/unstructured_client/models/shared/connectioncheckstatus.py @@ -0,0 +1,10 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class ConnectionCheckStatus(str, Enum): + SCHEDULED = "SCHEDULED" + SUCCESS = "SUCCESS" + FAILURE = "FAILURE" diff --git a/src/unstructured_client/models/shared/dagnodeconnectioncheck.py b/src/unstructured_client/models/shared/dagnodeconnectioncheck.py new file mode 100644 index 00000000..fade6b96 --- /dev/null +++ b/src/unstructured_client/models/shared/dagnodeconnectioncheck.py @@ -0,0 +1,64 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .connectioncheckstatus import ConnectionCheckStatus +from datetime import datetime +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) + + +class DagNodeConnectionCheckTypedDict(TypedDict): + created_at: datetime + id: str + status: ConnectionCheckStatus + reason: NotRequired[Nullable[str]] + reported_at: NotRequired[Nullable[datetime]] + + +class DagNodeConnectionCheck(BaseModel): + created_at: datetime + + id: str + + status: ConnectionCheckStatus + + reason: OptionalNullable[str] = UNSET + + reported_at: OptionalNullable[datetime] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["reason", "reported_at"] + nullable_fields = ["reason", "reported_at"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/unstructured_client/sources.py b/src/unstructured_client/sources.py index 20d0d09d..d0a5bef4 100644 --- a/src/unstructured_client/sources.py +++ b/src/unstructured_client/sources.py @@ -9,6 +9,236 @@ class Sources(BaseSDK): + def create_connection_check_sources( + self, + *, + request: Union[ + operations.CreateConnectionCheckSourcesRequest, + operations.CreateConnectionCheckSourcesRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.CreateConnectionCheckSourcesResponse: + r"""Create source connection check + + Initiates a connection check for the specified source connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.CREATE_CONNECTION_CHECK_SOURCES_SERVERS[ + operations.CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.CreateConnectionCheckSourcesRequest + ) + request = cast(operations.CreateConnectionCheckSourcesRequest, request) + + req = self._build_request( + method="POST", + path="/api/v1/sources/{source_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = self.do_request( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="create_connection_check_sources", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return operations.CreateConnectionCheckSourcesResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_connection_check_sources_async( + self, + *, + request: Union[ + operations.CreateConnectionCheckSourcesRequest, + operations.CreateConnectionCheckSourcesRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.CreateConnectionCheckSourcesResponse: + r"""Create source connection check + + Initiates a connection check for the specified source connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.CREATE_CONNECTION_CHECK_SOURCES_SERVERS[ + operations.CREATE_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.CreateConnectionCheckSourcesRequest + ) + request = cast(operations.CreateConnectionCheckSourcesRequest, request) + + req = self._build_request_async( + method="POST", + path="/api/v1/sources/{source_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="create_connection_check_sources", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "202", "application/json"): + return operations.CreateConnectionCheckSourcesResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + def create_source( self, *, @@ -467,6 +697,236 @@ async def delete_source_async( http_res, ) + def get_connection_check_sources( + self, + *, + request: Union[ + operations.GetConnectionCheckSourcesRequest, + operations.GetConnectionCheckSourcesRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetConnectionCheckSourcesResponse: + r"""Get the latest source connector connection check + + Retrieves the most recent connection check for the specified source connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.GET_CONNECTION_CHECK_SOURCES_SERVERS[ + operations.GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetConnectionCheckSourcesRequest + ) + request = cast(operations.GetConnectionCheckSourcesRequest, request) + + req = self._build_request( + method="GET", + path="/api/v1/sources/{source_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = self.do_request( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="get_connection_check_sources", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetConnectionCheckSourcesResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_connection_check_sources_async( + self, + *, + request: Union[ + operations.GetConnectionCheckSourcesRequest, + operations.GetConnectionCheckSourcesRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.GetConnectionCheckSourcesResponse: + r"""Get the latest source connector connection check + + Retrieves the most recent connection check for the specified source connector. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = operations.GET_CONNECTION_CHECK_SOURCES_SERVERS[ + operations.GET_CONNECTION_CHECK_SOURCES_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetConnectionCheckSourcesRequest + ) + request = cast(operations.GetConnectionCheckSourcesRequest, request) + + req = self._build_request_async( + method="GET", + path="/api/v1/sources/{source_id}/connection-check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(3000, 720000, 1.88, 1800000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5xx"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="get_connection_check_sources", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["422", "4XX", "5XX"], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return operations.GetConnectionCheckSourcesResponse( + dag_node_connection_check=utils.unmarshal_json( + http_res.text, Optional[shared.DagNodeConnectionCheck] + ), + status_code=http_res.status_code, + content_type=http_res.headers.get("Content-Type") or "", + raw_response=http_res, + ) + if utils.match_response(http_res, "422", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, errors.HTTPValidationErrorData + ) + raise errors.HTTPValidationError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + def get_source( self, *,