diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a8480c36..c3fe141b 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: 1305a6771cbde39530fd78e1b8acb938 - docVersion: 1.1.17 + docChecksum: 9f5b0f5a65058a58d5eb82235ccf0616 + docVersion: 1.1.23 speakeasyVersion: 1.552.0 generationVersion: 2.610.0 - releaseVersion: 0.36.0 - configChecksum: e1d52979607afacfb892d70fedc250fb + releaseVersion: 0.37.1 + configChecksum: 995e2ded80d15617a1661ac4be288219 repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git repoSubDirectory: . installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git @@ -86,6 +86,8 @@ generatedFiles: - docs/models/operations/listworkflowsresponse.md - docs/models/operations/partitionrequest.md - docs/models/operations/partitionresponse.md + - docs/models/operations/retrieverequest.md + - docs/models/operations/retrieveresponse.md - docs/models/operations/runworkflowrequest.md - docs/models/operations/runworkflowresponse.md - docs/models/operations/updatedestinationrequest.md @@ -164,6 +166,7 @@ generatedFiles: - docs/models/shared/outlooksourceconnectorconfiginput.md - docs/models/shared/outputformat.md - docs/models/shared/partitionparameters.md + - docs/models/shared/pemauthresponse.md - docs/models/shared/pineconedestinationconnectorconfig.md - docs/models/shared/pineconedestinationconnectorconfiginput.md - docs/models/shared/postgresdestinationconnectorconfig.md @@ -215,6 +218,7 @@ generatedFiles: - docs/sdks/destinations/README.md - docs/sdks/general/README.md - docs/sdks/jobs/README.md + - docs/sdks/pemkeyauth/README.md - docs/sdks/sources/README.md - docs/sdks/unstructuredclient/README.md - docs/sdks/workflows/README.md @@ -258,6 +262,7 @@ generatedFiles: - src/unstructured_client/models/operations/list_sources.py - src/unstructured_client/models/operations/list_workflows.py - src/unstructured_client/models/operations/partition.py + - src/unstructured_client/models/operations/retrieve.py - src/unstructured_client/models/operations/run_workflow.py - src/unstructured_client/models/operations/update_destination.py - src/unstructured_client/models/operations/update_source.py @@ -326,6 +331,7 @@ generatedFiles: - src/unstructured_client/models/shared/outlooksourceconnectorconfig.py - src/unstructured_client/models/shared/outlooksourceconnectorconfiginput.py - src/unstructured_client/models/shared/partition_parameters.py + - src/unstructured_client/models/shared/pemauthresponse.py - src/unstructured_client/models/shared/pineconedestinationconnectorconfig.py - src/unstructured_client/models/shared/pineconedestinationconnectorconfiginput.py - src/unstructured_client/models/shared/postgresdestinationconnectorconfig.py @@ -365,6 +371,7 @@ generatedFiles: - src/unstructured_client/models/shared/workflowtype.py - src/unstructured_client/models/shared/zendesksourceconnectorconfig.py - src/unstructured_client/models/shared/zendesksourceconnectorconfiginput.py + - src/unstructured_client/pemkeyauth.py - src/unstructured_client/py.typed - src/unstructured_client/sdk.py - src/unstructured_client/sdkconfiguration.py @@ -633,5 +640,12 @@ examples: application/json: {"detail": ""} 5XX: application/json: {"detail": "An error occurred"} + retrieve: + speakeasy-default-retrieve: + responses: + "200": + application/json: {"pem_key": "", "tenant_id": ""} + "422": + application/json: {"detail": ""} examplesVersion: 1.0.2 generatedTests: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 1ede046b..e6d7ed5f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,20 +2,20 @@ speakeasyVersion: 1.552.0 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:7ceb514059ca48d6851ea7eacc84aa4177b0299d9fc01e71a891f6bc6244b089 - sourceBlobDigest: sha256:20af3cb02fd412795707dc692fcfdb11f412c27d8095ee4197ea318ea31c7bfe + sourceRevisionDigest: sha256:e3bb8b85cdb5e7cf4f9ac2fc93398696108bd299e379c14c338f73ad4ea5a9c7 + sourceBlobDigest: sha256:45fccbe81de2d78b0e015ea92ed40440c6e2b56525706293cc7489f533181254 tags: - latest - - speakeasy-sdk-regen-1748459387 - - 1.1.17 + - speakeasy-sdk-regen-1749082267 + - 1.1.23 targets: unstructured-python: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:7ceb514059ca48d6851ea7eacc84aa4177b0299d9fc01e71a891f6bc6244b089 - sourceBlobDigest: sha256:20af3cb02fd412795707dc692fcfdb11f412c27d8095ee4197ea318ea31c7bfe + sourceRevisionDigest: sha256:e3bb8b85cdb5e7cf4f9ac2fc93398696108bd299e379c14c338f73ad4ea5a9c7 + sourceBlobDigest: sha256:45fccbe81de2d78b0e015ea92ed40440c6e2b56525706293cc7489f533181254 codeSamplesNamespace: my-source-code-samples - codeSamplesRevisionDigest: sha256:8dd8b645e1112de59bfed16856623f891e44b10d8af11e4f48877b08541e246f + codeSamplesRevisionDigest: sha256:e21609fe9dcd7aa32fef1f3ca6fa653f8eb06210eadca7169d0ea8f45eb837b6 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index d1f30248..776fb0c5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1007,4 +1007,14 @@ Based on: ### Generated - [python v0.36.0] . ### Releases -- [PyPI v0.36.0] https://pypi.org/project/unstructured-client/0.36.0 - . \ No newline at end of file +- [PyPI v0.36.0] https://pypi.org/project/unstructured-client/0.36.0 - . + +## 2025-06-14 00:10:29 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.552.0 (2.610.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.37.1] . +### Releases +- [PyPI v0.37.1] https://pypi.org/project/unstructured-client/0.37.1 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index f859f700..ece66902 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -69,6 +69,12 @@ actions: - "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\": \"06d1b7b8-8642-4793-b37e-e45d97d53bc3\",\n \"file_id\": \"\",\n \"node_id\": \"7c8f2aa4-da13-4a04-a98d-0204ea55681e\",\n })\n\n assert res.any is not None\n\n # Handle response\n print(res.any)" + - target: $["paths"]["/api/v1/pemkeyauth/retrieve"]["post"] + update: + "x-codeSamples": + - "lang": "python" + "label": "retrieve" + "source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.pemkeyauth.retrieve(request={})\n\n assert res.pem_auth_response is not None\n\n # Handle response\n print(res.pem_auth_response)" - target: $["paths"]["/api/v1/sources/"]["get"] update: "x-codeSamples": diff --git a/docs/models/operations/retrieverequest.md b/docs/models/operations/retrieverequest.md new file mode 100644 index 00000000..6f1a9c98 --- /dev/null +++ b/docs/models/operations/retrieverequest.md @@ -0,0 +1,8 @@ +# RetrieveRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `unstructured_api_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/retrieveresponse.md b/docs/models/operations/retrieveresponse.md new file mode 100644 index 00000000..df683b89 --- /dev/null +++ b/docs/models/operations/retrieveresponse.md @@ -0,0 +1,11 @@ +# RetrieveResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `pem_auth_response` | [Optional[shared.PemAuthResponse]](../../models/shared/pemauthresponse.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/pemauthresponse.md b/docs/models/shared/pemauthresponse.md new file mode 100644 index 00000000..1a3880ca --- /dev/null +++ b/docs/models/shared/pemauthresponse.md @@ -0,0 +1,12 @@ +# PemAuthResponse + +Response model for PEM key retrieval. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `pem_key` | *str* | :heavy_check_mark: | N/A | +| `tenant_id` | *str* | :heavy_check_mark: | N/A | +| `user_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/sdks/pemkeyauth/README.md b/docs/sdks/pemkeyauth/README.md new file mode 100644 index 00000000..d383912c --- /dev/null +++ b/docs/sdks/pemkeyauth/README.md @@ -0,0 +1,48 @@ +# Pemkeyauth +(*pemkeyauth*) + +## Overview + +### Available Operations + +* [retrieve](#retrieve) - Retrieve PEM Key + +## retrieve + +Given a UNSTRUCTURED_API_KEY in the post-payload, retrieve the associated PEM key + +### Example Usage + +```python +from unstructured_client import UnstructuredClient + + +with UnstructuredClient() as uc_client: + + res = uc_client.pemkeyauth.retrieve(request={}) + + assert res.pem_auth_response is not None + + # Handle response + print(res.pem_auth_response) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `request` | [operations.RetrieveRequest](../../models/operations/retrieverequest.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.RetrieveResponse](../../models/operations/retrieveresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| errors.HTTPValidationError | 422 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index ac36d670..b8358b1e 100644 --- a/gen.yaml +++ b/gen.yaml @@ -3,6 +3,7 @@ generation: sdkClassName: unstructured_client usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor fixes: nameResolutionFeb2025: false parameterOrderingFeb2024: false @@ -13,7 +14,7 @@ generation: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false python: - version: 0.36.0 + version: 0.37.1 additionalDependencies: dev: deepdiff: '>=6.0' @@ -34,6 +35,7 @@ python: requests-toolbelt: '>=1.0.0' authors: - Unstructured + baseErrorName: UnstructuredClientError clientServerStatusCodesAsErrors: true defaultErrorName: SDKError description: Python Client SDK for Unstructured API diff --git a/poetry.lock b/poetry.lock index 2769ae75..feb5b16d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -416,31 +416,31 @@ python-dateutil = ">=2.7" [[package]] name = "h11" -version = "0.14.0" +version = "0.16.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" groups = ["main", "dev"] files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, ] [[package]] name = "httpcore" -version = "1.0.6" +version = "1.0.9" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" groups = ["main", "dev"] files = [ - {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, - {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, + {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, + {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, ] [package.dependencies] certifi = "*" -h11 = ">=0.13,<0.15" +h11 = ">=0.16" [package.extras] asyncio = ["anyio (>=4.0,<5.0)"] diff --git a/pyproject.toml b/pyproject.toml index 2a392b75..55d2172f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "unstructured-client" -version = "0.36.0" +version = "0.37.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 79326603..f685767c 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.36.0" -__openapi_doc_version__: str = "1.1.17" +__version__: str = "0.37.1" +__openapi_doc_version__: str = "1.1.23" __gen_version__: str = "2.610.0" -__user_agent__: str = "speakeasy-sdk/python 0.36.0 2.610.0 1.1.17 unstructured-client" +__user_agent__: str = "speakeasy-sdk/python 0.37.1 2.610.0 1.1.23 unstructured-client" try: if __package__ is not None: diff --git a/src/unstructured_client/models/operations/__init__.py b/src/unstructured_client/models/operations/__init__.py index b91a82ff..bb63b658 100644 --- a/src/unstructured_client/models/operations/__init__.py +++ b/src/unstructured_client/models/operations/__init__.py @@ -173,6 +173,14 @@ PartitionResponse, PartitionResponseTypedDict, ) + from .retrieve import ( + RETRIEVE_SERVERS, + RETRIEVE_SERVER_PLATFORM_API, + RetrieveRequest, + RetrieveRequestTypedDict, + RetrieveResponse, + RetrieveResponseTypedDict, + ) from .run_workflow import ( RUN_WORKFLOW_SERVERS, RUN_WORKFLOW_SERVER_PLATFORM_API, @@ -334,8 +342,14 @@ "PartitionRequestTypedDict", "PartitionResponse", "PartitionResponseTypedDict", + "RETRIEVE_SERVERS", + "RETRIEVE_SERVER_PLATFORM_API", "RUN_WORKFLOW_SERVERS", "RUN_WORKFLOW_SERVER_PLATFORM_API", + "RetrieveRequest", + "RetrieveRequestTypedDict", + "RetrieveResponse", + "RetrieveResponseTypedDict", "RunWorkflowRequest", "RunWorkflowRequestTypedDict", "RunWorkflowResponse", @@ -488,6 +502,12 @@ "PartitionRequestTypedDict": ".partition", "PartitionResponse": ".partition", "PartitionResponseTypedDict": ".partition", + "RETRIEVE_SERVERS": ".retrieve", + "RETRIEVE_SERVER_PLATFORM_API": ".retrieve", + "RetrieveRequest": ".retrieve", + "RetrieveRequestTypedDict": ".retrieve", + "RetrieveResponse": ".retrieve", + "RetrieveResponseTypedDict": ".retrieve", "RUN_WORKFLOW_SERVERS": ".run_workflow", "RUN_WORKFLOW_SERVER_PLATFORM_API": ".run_workflow", "RunWorkflowRequest": ".run_workflow", diff --git a/src/unstructured_client/models/operations/retrieve.py b/src/unstructured_client/models/operations/retrieve.py new file mode 100644 index 00000000..839e2afa --- /dev/null +++ b/src/unstructured_client/models/operations/retrieve.py @@ -0,0 +1,91 @@ +"""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 pemauthresponse as shared_pemauthresponse +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from unstructured_client.utils import FieldMetadata, HeaderMetadata + +RETRIEVE_SERVER_PLATFORM_API = "platform-api" +r"""Unstructured Platform API""" + +RETRIEVE_SERVERS = { + RETRIEVE_SERVER_PLATFORM_API: "https://platform.unstructuredapp.io/", +} + + +class RetrieveRequestTypedDict(TypedDict): + unstructured_api_key: NotRequired[Nullable[str]] + + +class RetrieveRequest(BaseModel): + 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 RetrieveResponseTypedDict(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""" + pem_auth_response: NotRequired[shared_pemauthresponse.PemAuthResponseTypedDict] + r"""Successful Response""" + + +class RetrieveResponse(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""" + + pem_auth_response: Optional[shared_pemauthresponse.PemAuthResponse] = None + r"""Successful Response""" diff --git a/src/unstructured_client/models/shared/__init__.py b/src/unstructured_client/models/shared/__init__.py index 500a6edf..93335958 100644 --- a/src/unstructured_client/models/shared/__init__.py +++ b/src/unstructured_client/models/shared/__init__.py @@ -249,6 +249,7 @@ VLMModel, VLMModelProvider, ) + from .pemauthresponse import PemAuthResponse, PemAuthResponseTypedDict from .pineconedestinationconnectorconfig import ( PineconeDestinationConnectorConfig, PineconeDestinationConnectorConfigTypedDict, @@ -528,6 +529,8 @@ "OutputFormat", "PartitionParameters", "PartitionParametersTypedDict", + "PemAuthResponse", + "PemAuthResponseTypedDict", "PineconeDestinationConnectorConfig", "PineconeDestinationConnectorConfigInput", "PineconeDestinationConnectorConfigInputTypedDict", @@ -754,6 +757,8 @@ "Strategy": ".partition_parameters", "VLMModel": ".partition_parameters", "VLMModelProvider": ".partition_parameters", + "PemAuthResponse": ".pemauthresponse", + "PemAuthResponseTypedDict": ".pemauthresponse", "PineconeDestinationConnectorConfig": ".pineconedestinationconnectorconfig", "PineconeDestinationConnectorConfigTypedDict": ".pineconedestinationconnectorconfig", "PineconeDestinationConnectorConfigInput": ".pineconedestinationconnectorconfiginput", diff --git a/src/unstructured_client/models/shared/pemauthresponse.py b/src/unstructured_client/models/shared/pemauthresponse.py new file mode 100644 index 00000000..d2184f96 --- /dev/null +++ b/src/unstructured_client/models/shared/pemauthresponse.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from pydantic import model_serializer +from typing_extensions import NotRequired, TypedDict +from unstructured_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) + + +class PemAuthResponseTypedDict(TypedDict): + r"""Response model for PEM key retrieval.""" + + pem_key: str + tenant_id: str + user_id: NotRequired[Nullable[str]] + + +class PemAuthResponse(BaseModel): + r"""Response model for PEM key retrieval.""" + + pem_key: str + + tenant_id: str + + user_id: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["user_id"] + nullable_fields = ["user_id"] + 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/pemkeyauth.py b/src/unstructured_client/pemkeyauth.py new file mode 100644 index 00000000..1c6f9ada --- /dev/null +++ b/src/unstructured_client/pemkeyauth.py @@ -0,0 +1,230 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from typing import Any, Mapping, Optional, Union, cast +from unstructured_client import utils +from unstructured_client._hooks import HookContext +from unstructured_client.models import errors, operations, shared +from unstructured_client.types import BaseModel, OptionalNullable, UNSET + + +class Pemkeyauth(BaseSDK): + def retrieve( + self, + *, + request: Union[operations.RetrieveRequest, operations.RetrieveRequestTypedDict], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.RetrieveResponse: + r"""Retrieve PEM Key + + Given a UNSTRUCTURED_API_KEY in the post-payload, retrieve the associated PEM key + + :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.RETRIEVE_SERVERS[ + operations.RETRIEVE_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.RetrieveRequest) + request = cast(operations.RetrieveRequest, request) + + req = self._build_request( + method="POST", + path="/api/v1/pemkeyauth/retrieve", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + 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="retrieve", + 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.RetrieveResponse( + pem_auth_response=utils.unmarshal_json( + http_res.text, Optional[shared.PemAuthResponse] + ), + 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 retrieve_async( + self, + *, + request: Union[operations.RetrieveRequest, operations.RetrieveRequestTypedDict], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> operations.RetrieveResponse: + r"""Retrieve PEM Key + + Given a UNSTRUCTURED_API_KEY in the post-payload, retrieve the associated PEM key + + :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.RETRIEVE_SERVERS[ + operations.RETRIEVE_SERVER_PLATFORM_API + ] + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.RetrieveRequest) + request = cast(operations.RetrieveRequest, request) + + req = self._build_request_async( + method="POST", + path="/api/v1/pemkeyauth/retrieve", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + 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="retrieve", + 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.RetrieveResponse( + pem_auth_response=utils.unmarshal_json( + http_res.text, Optional[shared.PemAuthResponse] + ), + 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, + ) diff --git a/src/unstructured_client/sdk.py b/src/unstructured_client/sdk.py index dc55648e..7960fd63 100644 --- a/src/unstructured_client/sdk.py +++ b/src/unstructured_client/sdk.py @@ -18,6 +18,7 @@ from unstructured_client.destinations import Destinations from unstructured_client.general import General from unstructured_client.jobs import Jobs + from unstructured_client.pemkeyauth import Pemkeyauth from unstructured_client.sources import Sources from unstructured_client.workflows import Workflows @@ -25,12 +26,14 @@ class UnstructuredClient(BaseSDK): destinations: "Destinations" jobs: "Jobs" + pemkeyauth: "Pemkeyauth" sources: "Sources" workflows: "Workflows" general: "General" _sub_sdk_map = { "destinations": ("unstructured_client.destinations", "Destinations"), "jobs": ("unstructured_client.jobs", "Jobs"), + "pemkeyauth": ("unstructured_client.pemkeyauth", "Pemkeyauth"), "sources": ("unstructured_client.sources", "Sources"), "workflows": ("unstructured_client.workflows", "Workflows"), "general": ("unstructured_client.general", "General"),