diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 802a481b..fe295d93 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 3e3290ca-0ee8-4981-b1bc-14536048fa63 management: docChecksum: bb65a174a6b697994f7bde3845843d9d docVersion: 0.9.0 - speakeasyVersion: 1.576.1 - generationVersion: 2.651.2 - releaseVersion: 0.7.0 - configChecksum: 1fdd57721d8451c79856369d08e3d61d + speakeasyVersion: 1.580.2 + generationVersion: 2.656.5 + releaseVersion: 0.7.1 + configChecksum: f7304ede6fe6f15382ffd279d0680654 repoURL: https://github.com/gleanwork/api-client-python.git installationURL: https://github.com/gleanwork/api-client-python.git published: true @@ -22,7 +22,7 @@ features: devContainers: 3.0.0 enumUnions: 0.1.0 envVarSecurityUsage: 0.3.2 - examples: 3.0.1 + examples: 3.0.2 flatRequests: 1.0.1 flattening: 3.1.1 globalSecurity: 3.0.3 @@ -45,7 +45,6 @@ generatedFiles: - .devcontainer/devcontainer.json - .devcontainer/setup.sh - .gitattributes - - .python-version - .vscode/settings.json - USAGE.md - docs/errors/collectionerror.md @@ -1141,6 +1140,7 @@ generatedFiles: - src/glean/api_client/utils/retries.py - src/glean/api_client/utils/security.py - src/glean/api_client/utils/serializers.py + - src/glean/api_client/utils/unmarshal_json_response.py - src/glean/api_client/utils/url.py - src/glean/api_client/utils/values.py - src/glean/api_client/visibilityoverrides.py diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 560dc1d8..788dd0d5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -26,7 +26,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true python: - version: 0.7.0 + version: 0.7.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 1bb9da22..74ca0dfa 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.576.1 +speakeasyVersion: 1.580.2 sources: Glean API: sourceNamespace: glean-api-specs @@ -6,7 +6,7 @@ sources: sourceBlobDigest: sha256:01cf4577ff2f15ba160b16bba410571a8ba0c5fefa7e6dd7101edef7ef7c68dc tags: - latest - - speakeasy-sdk-regen-1750453704 + - speakeasy-sdk-regen-1751974088 Glean Client API: sourceNamespace: glean-client-api sourceRevisionDigest: sha256:4edc63ad559e4f2c9fb9ebf5edaaaaa9269f1874d271cfd84b441d6dacac43d2 @@ -20,7 +20,7 @@ targets: sourceRevisionDigest: sha256:57fc6af98e6e9e98c92547985293be8fafd52d2a1d1ef88d4b24636743b9f119 sourceBlobDigest: sha256:01cf4577ff2f15ba160b16bba410571a8ba0c5fefa7e6dd7101edef7ef7c68dc codeSamplesNamespace: glean-api-specs-python-code-samples - codeSamplesRevisionDigest: sha256:a3e4747f03210d3a8c89a108ea025873dc27315afa1bc443db740a904074c96e + codeSamplesRevisionDigest: sha256:4fcbe6c58b860aa6d5380328a5e28104c0b1f1724dca9bd974696bde707c1531 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index 65fccb8e..cc00da44 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -178,4 +178,14 @@ Based on: ### Generated - [python v0.7.0] . ### Releases -- [PyPI v0.7.0] https://pypi.org/project/glean/0.7.0 - . \ No newline at end of file +- [PyPI v0.7.0] https://pypi.org/project/glean/0.7.0 - . + +## 2025-07-11 01:47:46 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.580.2 (2.656.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.7.1] . +### Releases +- [PyPI v0.7.1] https://pypi.org/project/glean/0.7.1 - . \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c906a50c..d4b5a75c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "glean-api-client" -version = "0.7.0" +version = "0.7.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Glean Technologies, Inc." }] license = "MIT" diff --git a/src/glean/api_client/_version.py b/src/glean/api_client/_version.py index 73611f72..57036246 100644 --- a/src/glean/api_client/_version.py +++ b/src/glean/api_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "glean" -__version__: str = "0.7.0" +__version__: str = "0.7.1" __openapi_doc_version__: str = "0.9.0" -__gen_version__: str = "2.651.2" -__user_agent__: str = "speakeasy-sdk/python 0.7.0 2.651.2 0.9.0 glean" +__gen_version__: str = "2.656.5" +__user_agent__: str = "speakeasy-sdk/python 0.7.1 2.656.5 0.9.0 glean" try: if __package__ is not None: diff --git a/src/glean/api_client/agents.py b/src/glean/api_client/agents.py index c861e754..82d9f432 100644 --- a/src/glean/api_client/agents.py +++ b/src/glean/api_client/agents.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -85,7 +86,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Agent, http_res) + return unmarshal_json_response(models.Agent, http_res) if utils.match_response(http_res, ["400", "403", "404", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -171,7 +172,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Agent, http_res) + return unmarshal_json_response(models.Agent, http_res) if utils.match_response(http_res, ["400", "403", "404", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -257,7 +258,7 @@ def retrieve_schemas( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AgentSchemas, http_res) + return unmarshal_json_response(models.AgentSchemas, http_res) if utils.match_response(http_res, ["400", "403", "404", "422", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -343,7 +344,7 @@ async def retrieve_schemas_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AgentSchemas, http_res) + return unmarshal_json_response(models.AgentSchemas, http_res) if utils.match_response(http_res, ["400", "403", "404", "422", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -429,7 +430,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchAgentsResponse, http_res) + return unmarshal_json_response(models.SearchAgentsResponse, http_res) if utils.match_response(http_res, ["400", "403", "404", "422", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -515,7 +516,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchAgentsResponse, http_res) + return unmarshal_json_response(models.SearchAgentsResponse, http_res) if utils.match_response(http_res, ["400", "403", "404", "422", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -810,7 +811,7 @@ def run( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AgentRunWaitResponse, http_res) + return unmarshal_json_response(models.AgentRunWaitResponse, http_res) if utils.match_response( http_res, ["400", "403", "404", "409", "422", "4XX"], "*" ): @@ -909,7 +910,7 @@ async def run_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AgentRunWaitResponse, http_res) + return unmarshal_json_response(models.AgentRunWaitResponse, http_res) if utils.match_response( http_res, ["400", "403", "404", "409", "422", "4XX"], "*" ): diff --git a/src/glean/api_client/announcements.py b/src/glean/api_client/announcements.py index 6df6a779..4604e169 100644 --- a/src/glean/api_client/announcements.py +++ b/src/glean/api_client/announcements.py @@ -6,6 +6,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -131,7 +132,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Announcement, http_res) + return unmarshal_json_response(models.Announcement, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -262,7 +263,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Announcement, http_res) + return unmarshal_json_response(models.Announcement, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -568,7 +569,7 @@ def update( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Announcement, http_res) + return unmarshal_json_response(models.Announcement, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -702,7 +703,7 @@ async def update_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Announcement, http_res) + return unmarshal_json_response(models.Announcement, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/answers.py b/src/glean/api_client/answers.py index 01377c69..8766b254 100644 --- a/src/glean/api_client/answers.py +++ b/src/glean/api_client/answers.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -85,7 +86,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Answer, http_res) + return unmarshal_json_response(models.Answer, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -171,7 +172,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Answer, http_res) + return unmarshal_json_response(models.Answer, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -513,7 +514,7 @@ def update( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Answer, http_res) + return unmarshal_json_response(models.Answer, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -677,7 +678,7 @@ async def update_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Answer, http_res) + return unmarshal_json_response(models.Answer, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -766,7 +767,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetAnswerResponse, http_res) + return unmarshal_json_response(models.GetAnswerResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -855,7 +856,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetAnswerResponse, http_res) + return unmarshal_json_response(models.GetAnswerResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -941,7 +942,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListAnswersResponse, http_res) + return unmarshal_json_response(models.ListAnswersResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1027,7 +1028,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListAnswersResponse, http_res) + return unmarshal_json_response(models.ListAnswersResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/client_authentication.py b/src/glean/api_client/client_authentication.py index 971e9237..fac10b86 100644 --- a/src/glean/api_client/client_authentication.py +++ b/src/glean/api_client/client_authentication.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional @@ -80,9 +81,7 @@ def create_token( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateAuthTokenResponse, http_res - ) + return unmarshal_json_response(models.CreateAuthTokenResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -163,9 +162,7 @@ async def create_token_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateAuthTokenResponse, http_res - ) + return unmarshal_json_response(models.CreateAuthTokenResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/client_chat.py b/src/glean/api_client/client_chat.py index 96ff6eee..21d7bfba 100644 --- a/src/glean/api_client/client_chat.py +++ b/src/glean/api_client/client_chat.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -136,7 +137,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ChatResponse, http_res) + return unmarshal_json_response(models.ChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -273,7 +274,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ChatResponse, http_res) + return unmarshal_json_response(models.ChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -720,7 +721,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetChatResponse, http_res) + return unmarshal_json_response(models.GetChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -811,7 +812,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetChatResponse, http_res) + return unmarshal_json_response(models.GetChatResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -894,7 +895,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListChatsResponse, http_res) + return unmarshal_json_response(models.ListChatsResponse, http_res) if utils.match_response(http_res, ["401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -977,7 +978,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListChatsResponse, http_res) + return unmarshal_json_response(models.ListChatsResponse, http_res) if utils.match_response(http_res, ["401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1072,9 +1073,7 @@ def retrieve_application( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetChatApplicationResponse, http_res - ) + return unmarshal_json_response(models.GetChatApplicationResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1169,9 +1168,7 @@ async def retrieve_application_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetChatApplicationResponse, http_res - ) + return unmarshal_json_response(models.GetChatApplicationResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1266,9 +1263,7 @@ def upload_files( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.UploadChatFilesResponse, http_res - ) + return unmarshal_json_response(models.UploadChatFilesResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1363,9 +1358,7 @@ async def upload_files_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.UploadChatFilesResponse, http_res - ) + return unmarshal_json_response(models.UploadChatFilesResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1460,7 +1453,7 @@ def retrieve_files( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetChatFilesResponse, http_res) + return unmarshal_json_response(models.GetChatFilesResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1555,7 +1548,7 @@ async def retrieve_files_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetChatFilesResponse, http_res) + return unmarshal_json_response(models.GetChatFilesResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/client_documents.py b/src/glean/api_client/client_documents.py index 5fac224d..ccd4e853 100644 --- a/src/glean/api_client/client_documents.py +++ b/src/glean/api_client/client_documents.py @@ -6,6 +6,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union, cast @@ -86,9 +87,7 @@ def retrieve_permissions( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocPermissionsResponse, http_res - ) + return unmarshal_json_response(models.GetDocPermissionsResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -174,9 +173,7 @@ async def retrieve_permissions_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocPermissionsResponse, http_res - ) + return unmarshal_json_response(models.GetDocPermissionsResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -264,7 +261,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetDocumentsResponse, http_res) + return unmarshal_json_response(models.GetDocumentsResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -352,7 +349,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetDocumentsResponse, http_res) + return unmarshal_json_response(models.GetDocumentsResponse, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -449,7 +446,7 @@ def retrieve_by_facets( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.GetDocumentsByFacetsResponse, http_res ) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): @@ -548,7 +545,7 @@ async def retrieve_by_facets_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.GetDocumentsByFacetsResponse, http_res ) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): @@ -652,7 +649,7 @@ def summarize( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SummarizeResponse, http_res) + return unmarshal_json_response(models.SummarizeResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -754,7 +751,7 @@ async def summarize_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SummarizeResponse, http_res) + return unmarshal_json_response(models.SummarizeResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/client_shortcuts.py b/src/glean/api_client/client_shortcuts.py index 0fe8f0d1..698bde6b 100644 --- a/src/glean/api_client/client_shortcuts.py +++ b/src/glean/api_client/client_shortcuts.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union, cast @@ -87,9 +88,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateShortcutResponse, http_res - ) + return unmarshal_json_response(models.CreateShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -177,9 +176,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateShortcutResponse, http_res - ) + return unmarshal_json_response(models.CreateShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -439,7 +436,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetShortcutResponse, http_res) + return unmarshal_json_response(models.GetShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -527,7 +524,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetShortcutResponse, http_res) + return unmarshal_json_response(models.GetShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -634,7 +631,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.ListShortcutsPaginatedResponse, http_res ) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): @@ -743,7 +740,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.ListShortcutsPaginatedResponse, http_res ) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): @@ -869,9 +866,7 @@ def update( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.UpdateShortcutResponse, http_res - ) + return unmarshal_json_response(models.UpdateShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -995,9 +990,7 @@ async def update_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.UpdateShortcutResponse, http_res - ) + return unmarshal_json_response(models.UpdateShortcutResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/client_verification.py b/src/glean/api_client/client_verification.py index 2fe108d5..adae9c6f 100644 --- a/src/glean/api_client/client_verification.py +++ b/src/glean/api_client/client_verification.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional @@ -94,7 +95,7 @@ def add_reminder( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Verification, http_res) + return unmarshal_json_response(models.Verification, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -189,7 +190,7 @@ async def add_reminder_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Verification, http_res) + return unmarshal_json_response(models.Verification, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -272,7 +273,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.VerificationFeed, http_res) + return unmarshal_json_response(models.VerificationFeed, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -355,7 +356,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.VerificationFeed, http_res) + return unmarshal_json_response(models.VerificationFeed, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -444,7 +445,7 @@ def verify( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Verification, http_res) + return unmarshal_json_response(models.Verification, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -533,7 +534,7 @@ async def verify_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.Verification, http_res) + return unmarshal_json_response(models.Verification, http_res) if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/collections.py b/src/glean/api_client/collections.py index d57ed50b..0dcf3044 100644 --- a/src/glean/api_client/collections.py +++ b/src/glean/api_client/collections.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, List, Mapping, Optional, Union @@ -96,9 +97,7 @@ def add_items( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.AddCollectionItemsResponse, http_res - ) + return unmarshal_json_response(models.AddCollectionItemsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -195,9 +194,7 @@ async def add_items_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.AddCollectionItemsResponse, http_res - ) + return unmarshal_json_response(models.AddCollectionItemsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -332,11 +329,9 @@ def create( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateCollectionResponse, http_res - ) + return unmarshal_json_response(models.CreateCollectionResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -474,11 +469,9 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CreateCollectionResponse, http_res - ) + return unmarshal_json_response(models.CreateCollectionResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -573,7 +566,7 @@ def delete( if utils.match_response(http_res, "200", "*"): return if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -668,7 +661,7 @@ async def delete_async( if utils.match_response(http_res, "200", "*"): return if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -763,7 +756,7 @@ def delete_item( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.DeleteCollectionItemResponse, http_res ) if utils.match_response(http_res, ["400", "401", "422", "429", "4XX"], "*"): @@ -857,7 +850,7 @@ async def delete_item_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.DeleteCollectionItemResponse, http_res ) if utils.match_response(http_res, ["400", "401", "422", "429", "4XX"], "*"): @@ -994,11 +987,9 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.EditCollectionResponse, http_res - ) + return unmarshal_json_response(models.EditCollectionResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -1136,11 +1127,9 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.EditCollectionResponse, http_res - ) + return unmarshal_json_response(models.EditCollectionResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json_response( + response_data = unmarshal_json_response( errors.CollectionErrorData, http_res ) raise errors.CollectionError(response_data, http_res) @@ -1241,9 +1230,7 @@ def update_item( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.EditCollectionItemResponse, http_res - ) + return unmarshal_json_response(models.EditCollectionItemResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1341,9 +1328,7 @@ async def update_item_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.EditCollectionItemResponse, http_res - ) + return unmarshal_json_response(models.EditCollectionItemResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1438,7 +1423,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetCollectionResponse, http_res) + return unmarshal_json_response(models.GetCollectionResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1533,7 +1518,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetCollectionResponse, http_res) + return unmarshal_json_response(models.GetCollectionResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1625,9 +1610,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.ListCollectionsResponse, http_res - ) + return unmarshal_json_response(models.ListCollectionsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1719,9 +1702,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.ListCollectionsResponse, http_res - ) + return unmarshal_json_response(models.ListCollectionsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/datasources.py b/src/glean/api_client/datasources.py index af982973..4d4e0d8f 100644 --- a/src/glean/api_client/datasources.py +++ b/src/glean/api_client/datasources.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -463,9 +464,7 @@ def retrieve_config( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CustomDatasourceConfig, http_res - ) + return unmarshal_json_response(models.CustomDatasourceConfig, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -551,9 +550,7 @@ async def retrieve_config_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CustomDatasourceConfig, http_res - ) + return unmarshal_json_response(models.CustomDatasourceConfig, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/entities.py b/src/glean/api_client/entities.py index 0097ec2f..bfceb6b7 100644 --- a/src/glean/api_client/entities.py +++ b/src/glean/api_client/entities.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -120,7 +121,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListEntitiesResponse, http_res) + return unmarshal_json_response(models.ListEntitiesResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -241,7 +242,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListEntitiesResponse, http_res) + return unmarshal_json_response(models.ListEntitiesResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -342,7 +343,7 @@ def read_people( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PeopleResponse, http_res) + return unmarshal_json_response(models.PeopleResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -443,7 +444,7 @@ async def read_people_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PeopleResponse, http_res) + return unmarshal_json_response(models.PeopleResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/indexing_authentication.py b/src/glean/api_client/indexing_authentication.py index cfa3b750..171b8950 100644 --- a/src/glean/api_client/indexing_authentication.py +++ b/src/glean/api_client/indexing_authentication.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional @@ -75,7 +76,7 @@ def rotate_token( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.RotateTokenResponse, http_res) + return unmarshal_json_response(models.RotateTokenResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -151,7 +152,7 @@ async def rotate_token_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.RotateTokenResponse, http_res) + return unmarshal_json_response(models.RotateTokenResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/indexing_datasource.py b/src/glean/api_client/indexing_datasource.py index f246a049..5124459e 100644 --- a/src/glean/api_client/indexing_datasource.py +++ b/src/glean/api_client/indexing_datasource.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional @@ -85,7 +86,7 @@ def status( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.DebugDatasourceStatusResponse, http_res ) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): @@ -173,7 +174,7 @@ async def status_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.DebugDatasourceStatusResponse, http_res ) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): diff --git a/src/glean/api_client/indexing_documents.py b/src/glean/api_client/indexing_documents.py index b08b42f7..697397b9 100644 --- a/src/glean/api_client/indexing_documents.py +++ b/src/glean/api_client/indexing_documents.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union, cast from typing_extensions import deprecated @@ -1093,7 +1094,7 @@ def debug( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.DebugDocumentResponse, http_res) + return unmarshal_json_response(models.DebugDocumentResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1194,7 +1195,7 @@ async def debug_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.DebugDocumentResponse, http_res) + return unmarshal_json_response(models.DebugDocumentResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1297,9 +1298,7 @@ def debug_many( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.DebugDocumentsResponse, http_res - ) + return unmarshal_json_response(models.DebugDocumentsResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1402,9 +1401,7 @@ async def debug_many_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.DebugDocumentsResponse, http_res - ) + return unmarshal_json_response(models.DebugDocumentsResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1502,9 +1499,7 @@ def check_access( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CheckDocumentAccessResponse, http_res - ) + return unmarshal_json_response(models.CheckDocumentAccessResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1602,9 +1597,7 @@ async def check_access_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.CheckDocumentAccessResponse, http_res - ) + return unmarshal_json_response(models.CheckDocumentAccessResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1702,9 +1695,7 @@ def status( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocumentStatusResponse, http_res - ) + return unmarshal_json_response(models.GetDocumentStatusResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1802,9 +1793,7 @@ async def status_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocumentStatusResponse, http_res - ) + return unmarshal_json_response(models.GetDocumentStatusResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1896,9 +1885,7 @@ def count( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocumentCountResponse, http_res - ) + return unmarshal_json_response(models.GetDocumentCountResponse, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -1990,9 +1977,7 @@ async def count_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.GetDocumentCountResponse, http_res - ) + return unmarshal_json_response(models.GetDocumentCountResponse, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/insights.py b/src/glean/api_client/insights.py index 5ade3df6..7c92ed33 100644 --- a/src/glean/api_client/insights.py +++ b/src/glean/api_client/insights.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -117,7 +118,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.InsightsResponse, http_res) + return unmarshal_json_response(models.InsightsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -235,7 +236,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.InsightsResponse, http_res) + return unmarshal_json_response(models.InsightsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/messages.py b/src/glean/api_client/messages.py index c21250c2..6c083016 100644 --- a/src/glean/api_client/messages.py +++ b/src/glean/api_client/messages.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional @@ -106,7 +107,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.MessagesResponse, http_res) + return unmarshal_json_response(models.MessagesResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -213,7 +214,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.MessagesResponse, http_res) + return unmarshal_json_response(models.MessagesResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/people.py b/src/glean/api_client/people.py index 523b146f..1a5faccc 100644 --- a/src/glean/api_client/people.py +++ b/src/glean/api_client/people.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union from typing_extensions import deprecated @@ -98,7 +99,7 @@ def debug( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.DebugUserResponse, http_res) + return unmarshal_json_response(models.DebugUserResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -196,7 +197,7 @@ async def debug_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.DebugUserResponse, http_res) + return unmarshal_json_response(models.DebugUserResponse, http_res) if utils.match_response(http_res, ["400", "401", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -288,7 +289,7 @@ def count( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetUserCountResponse, http_res) + return unmarshal_json_response(models.GetUserCountResponse, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -380,7 +381,7 @@ async def count_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetUserCountResponse, http_res) + return unmarshal_json_response(models.GetUserCountResponse, http_res) if utils.match_response(http_res, ["400", "401", "409", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/pins.py b/src/glean/api_client/pins.py index 42d36d07..9c1bdeb9 100644 --- a/src/glean/api_client/pins.py +++ b/src/glean/api_client/pins.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import BaseModel, OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union, cast @@ -95,7 +96,7 @@ def update( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PinDocument, http_res) + return unmarshal_json_response(models.PinDocument, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -191,7 +192,7 @@ async def update_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PinDocument, http_res) + return unmarshal_json_response(models.PinDocument, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -277,7 +278,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetPinResponse, http_res) + return unmarshal_json_response(models.GetPinResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -363,7 +364,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetPinResponse, http_res) + return unmarshal_json_response(models.GetPinResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -449,7 +450,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListPinsResponse, http_res) + return unmarshal_json_response(models.ListPinsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -535,7 +536,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ListPinsResponse, http_res) + return unmarshal_json_response(models.ListPinsResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -631,7 +632,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PinDocument, http_res) + return unmarshal_json_response(models.PinDocument, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -727,7 +728,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.PinDocument, http_res) + return unmarshal_json_response(models.PinDocument, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/policies.py b/src/glean/api_client/policies.py index 67f36448..a2eff6d2 100644 --- a/src/glean/api_client/policies.py +++ b/src/glean/api_client/policies.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional, Union @@ -85,7 +86,7 @@ def retrieve( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetDlpReportResponse, http_res) + return unmarshal_json_response(models.GetDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -171,7 +172,7 @@ async def retrieve_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.GetDlpReportResponse, http_res) + return unmarshal_json_response(models.GetDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -278,9 +279,7 @@ def update( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.UpdateDlpReportResponse, http_res - ) + return unmarshal_json_response(models.UpdateDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -387,9 +386,7 @@ async def update_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.UpdateDlpReportResponse, http_res - ) + return unmarshal_json_response(models.UpdateDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -475,9 +472,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.ListDlpReportsResponse, http_res - ) + return unmarshal_json_response(models.ListDlpReportsResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -563,9 +558,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response( - models.ListDlpReportsResponse, http_res - ) + return unmarshal_json_response(models.ListDlpReportsResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -660,9 +653,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.CreateDlpReportResponse, http_res - ) + return unmarshal_json_response(models.CreateDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -757,9 +748,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.CreateDlpReportResponse, http_res - ) + return unmarshal_json_response(models.CreateDlpReportResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/reports.py b/src/glean/api_client/reports.py index 04a572ef..2aab6253 100644 --- a/src/glean/api_client/reports.py +++ b/src/glean/api_client/reports.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional, Union @@ -88,9 +89,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.UpdateDlpConfigResponse, http_res - ) + return unmarshal_json_response(models.UpdateDlpConfigResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -179,9 +178,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( - models.UpdateDlpConfigResponse, http_res - ) + return unmarshal_json_response(models.UpdateDlpConfigResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -430,7 +427,7 @@ def status( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.ReportStatusResponse, http_res) + return unmarshal_json_response(models.ReportStatusResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -513,7 +510,7 @@ async def status_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response(models.ReportStatusResponse, http_res) + return unmarshal_json_response(models.ReportStatusResponse, http_res) if utils.match_response(http_res, ["403", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/search.py b/src/glean/api_client/search.py index fbca144e..d42c2f6c 100644 --- a/src/glean/api_client/search.py +++ b/src/glean/api_client/search.py @@ -6,6 +6,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, List, Mapping, Optional, Union @@ -147,11 +148,9 @@ def query_as_admin( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchResponse, http_res) + return unmarshal_json_response(models.SearchResponse, http_res) if utils.match_response(http_res, ["403", "422"], "application/json"): - response_data = utils.unmarshal_json_response( - errors.GleanDataErrorData, http_res - ) + response_data = unmarshal_json_response(errors.GleanDataErrorData, http_res) raise errors.GleanDataError(response_data, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) @@ -299,11 +298,9 @@ async def query_as_admin_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchResponse, http_res) + return unmarshal_json_response(models.SearchResponse, http_res) if utils.match_response(http_res, ["403", "422"], "application/json"): - response_data = utils.unmarshal_json_response( - errors.GleanDataErrorData, http_res - ) + response_data = unmarshal_json_response(errors.GleanDataErrorData, http_res) raise errors.GleanDataError(response_data, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -419,7 +416,7 @@ def autocomplete( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AutocompleteResponse, http_res) + return unmarshal_json_response(models.AutocompleteResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -534,7 +531,7 @@ async def autocomplete_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.AutocompleteResponse, http_res) + return unmarshal_json_response(models.AutocompleteResponse, http_res) if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -637,7 +634,7 @@ def retrieve_feed( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.FeedResponse, http_res) + return unmarshal_json_response(models.FeedResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -740,7 +737,7 @@ async def retrieve_feed_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.FeedResponse, http_res) + return unmarshal_json_response(models.FeedResponse, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -866,7 +863,7 @@ def recommendations( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ResultsResponse, http_res) + return unmarshal_json_response(models.ResultsResponse, http_res) if utils.match_response(http_res, ["202", "204"], "*"): return None if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): @@ -994,7 +991,7 @@ async def recommendations_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ResultsResponse, http_res) + return unmarshal_json_response(models.ResultsResponse, http_res) if utils.match_response(http_res, ["202", "204"], "*"): return None if utils.match_response(http_res, ["400", "401", "403", "429", "4XX"], "*"): @@ -1143,11 +1140,9 @@ def query( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchResponse, http_res) + return unmarshal_json_response(models.SearchResponse, http_res) if utils.match_response(http_res, ["403", "422"], "application/json"): - response_data = utils.unmarshal_json_response( - errors.GleanDataErrorData, http_res - ) + response_data = unmarshal_json_response(errors.GleanDataErrorData, http_res) raise errors.GleanDataError(response_data, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) @@ -1295,11 +1290,9 @@ async def query_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.SearchResponse, http_res) + return unmarshal_json_response(models.SearchResponse, http_res) if utils.match_response(http_res, ["403", "422"], "application/json"): - response_data = utils.unmarshal_json_response( - errors.GleanDataErrorData, http_res - ) + response_data = unmarshal_json_response(errors.GleanDataErrorData, http_res) raise errors.GleanDataError(response_data, http_res) if utils.match_response(http_res, ["400", "401", "408", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) diff --git a/src/glean/api_client/tools.py b/src/glean/api_client/tools.py index f7573aab..f6645f29 100644 --- a/src/glean/api_client/tools.py +++ b/src/glean/api_client/tools.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import Dict, List, Mapping, Optional, Union @@ -82,7 +83,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ToolsListResponse, http_res) + return unmarshal_json_response(models.ToolsListResponse, http_res) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -165,7 +166,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ToolsListResponse, http_res) + return unmarshal_json_response(models.ToolsListResponse, http_res) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -259,7 +260,7 @@ def run( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ToolsCallResponse, http_res) + return unmarshal_json_response(models.ToolsCallResponse, http_res) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) @@ -353,7 +354,7 @@ async def run_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json_response(models.ToolsCallResponse, http_res) + return unmarshal_json_response(models.ToolsCallResponse, http_res) if utils.match_response(http_res, ["400", "401", "404", "429", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.GleanError("API error occurred", http_res, http_res_text) diff --git a/src/glean/api_client/utils/__init__.py b/src/glean/api_client/utils/__init__.py index 19b0dfd6..3d078198 100644 --- a/src/glean/api_client/utils/__init__.py +++ b/src/glean/api_client/utils/__init__.py @@ -29,7 +29,6 @@ marshal_json, unmarshal, unmarshal_json, - unmarshal_json_response, serialize_decimal, serialize_float, serialize_int, @@ -99,7 +98,6 @@ "template_url", "unmarshal", "unmarshal_json", - "unmarshal_json_response", "validate_decimal", "validate_const", "validate_float", @@ -154,7 +152,6 @@ "template_url": ".url", "unmarshal": ".serializers", "unmarshal_json": ".serializers", - "unmarshal_json_response": ".serializers", "validate_decimal": ".serializers", "validate_const": ".serializers", "validate_float": ".serializers", diff --git a/src/glean/api_client/utils/serializers.py b/src/glean/api_client/utils/serializers.py index bc29ef86..378a14c0 100644 --- a/src/glean/api_client/utils/serializers.py +++ b/src/glean/api_client/utils/serializers.py @@ -4,7 +4,7 @@ import functools import json import typing -from typing import Any, Dict, List, Optional, Tuple, Union, get_args +from typing import Any, Dict, List, Tuple, Union, get_args import typing_extensions from typing_extensions import get_origin @@ -13,7 +13,6 @@ from pydantic_core import from_json from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset -from glean.api_client import errors def serialize_decimal(as_str: bool): @@ -141,22 +140,6 @@ def unmarshal_json(raw, typ: Any) -> Any: return unmarshal(from_json(raw), typ) -def unmarshal_json_response( - typ: Any, http_res: httpx.Response, body: Optional[str] = None -) -> Any: - if body is None: - body = http_res.text - try: - return unmarshal_json(body, typ) - except Exception as e: - raise errors.ResponseValidationError( - "Response validation failed", - http_res, - e, - body, - ) from e - - def unmarshal(val, typ: Any) -> Any: unmarshaller = create_model( "Unmarshaller", diff --git a/src/glean/api_client/utils/unmarshal_json_response.py b/src/glean/api_client/utils/unmarshal_json_response.py new file mode 100644 index 00000000..3f631b83 --- /dev/null +++ b/src/glean/api_client/utils/unmarshal_json_response.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import Any, Optional + +import httpx + +from .serializers import unmarshal_json +from glean.api_client import errors + + +def unmarshal_json_response( + typ: Any, http_res: httpx.Response, body: Optional[str] = None +) -> Any: + if body is None: + body = http_res.text + try: + return unmarshal_json(body, typ) + except Exception as e: + raise errors.ResponseValidationError( + "Response validation failed", + http_res, + e, + body, + ) from e diff --git a/src/glean/api_client/visibilityoverrides.py b/src/glean/api_client/visibilityoverrides.py index f06486d2..dd4e6a62 100644 --- a/src/glean/api_client/visibilityoverrides.py +++ b/src/glean/api_client/visibilityoverrides.py @@ -5,6 +5,7 @@ from glean.api_client._hooks import HookContext from glean.api_client.types import OptionalNullable, UNSET from glean.api_client.utils import get_security_from_env +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response from typing import List, Mapping, Optional, Union @@ -82,7 +83,7 @@ def list( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.GetDocumentVisibilityOverridesResponse, http_res ) if utils.match_response(http_res, ["403", "4XX"], "*"): @@ -167,7 +168,7 @@ async def list_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.GetDocumentVisibilityOverridesResponse, http_res ) if utils.match_response(http_res, ["403", "4XX"], "*"): @@ -266,7 +267,7 @@ def create( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.UpdateDocumentVisibilityOverridesResponse, http_res ) if utils.match_response(http_res, ["403", "4XX"], "*"): @@ -365,7 +366,7 @@ async def create_async( ) if utils.match_response(http_res, "200", "application/json; charset=UTF-8"): - return utils.unmarshal_json_response( + return unmarshal_json_response( models.UpdateDocumentVisibilityOverridesResponse, http_res ) if utils.match_response(http_res, ["403", "4XX"], "*"): diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1addcollectionitems.go b/tests/mockserver/internal/handler/pathpostrestapiv1addcollectionitems.go index dab5c26e..e62da16d 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1addcollectionitems.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1addcollectionitems.go @@ -200,9 +200,17 @@ func testAddcollectionitemsAddcollectionitems0(w http.ResponseWriter, req *http. Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 489899, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 168446, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1deletecollectionitem.go b/tests/mockserver/internal/handler/pathpostrestapiv1deletecollectionitem.go index d97e781c..759b4f17 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1deletecollectionitem.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1deletecollectionitem.go @@ -251,10 +251,18 @@ func testDeletecollectionitemDeletecollectionitem0(w http.ResponseWriter, req *h Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 835281, }, }, LastReminder: &components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 239964, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1editcollectionitem.go b/tests/mockserver/internal/handler/pathpostrestapiv1editcollectionitem.go index 186281db..e8267aff 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1editcollectionitem.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1editcollectionitem.go @@ -231,9 +231,17 @@ func testEditcollectionitemEditcollectionitem0(w http.ResponseWriter, req *http. Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 841463, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 402252, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1editpin.go b/tests/mockserver/internal/handler/pathpostrestapiv1editpin.go index e08ef257..e82599c5 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1editpin.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1editpin.go @@ -264,9 +264,17 @@ func testEditpinEditpin0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 448916, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 494003, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getanswer.go b/tests/mockserver/internal/handler/pathpostrestapiv1getanswer.go index a7e0758e..530876b0 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getanswer.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getanswer.go @@ -264,9 +264,17 @@ func testGetanswerGetanswer0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 656841, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 570980, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go index 6e47d93c..e93faedf 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go @@ -1058,10 +1058,16 @@ func testGetchatGetchat0(w http.ResponseWriter, req *http.Request) { Description: types.String("however generally ew ha sonar usually slow guacamole"), Unlisted: types.Bool(false), URLTemplate: types.String(""), - CreatedBy: &components.Person{}, - CreateTime: types.MustNewTimeFromString("2000-01-23T04:56:07.000Z"), - UpdatedBy: &components.Person{}, - UpdateTime: types.MustNewTimeFromString("2000-01-23T04:56:07.000Z"), + CreatedBy: &components.Person{ + Name: "", + ObfuscatedID: "", + }, + CreateTime: types.MustNewTimeFromString("2000-01-23T04:56:07.000Z"), + UpdatedBy: &components.Person{ + Name: "", + ObfuscatedID: "", + }, + UpdateTime: types.MustNewTimeFromString("2000-01-23T04:56:07.000Z"), }, QuerySuggestions: &components.QuerySuggestionList{ Suggestions: []components.QuerySuggestion{}, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getcollection.go b/tests/mockserver/internal/handler/pathpostrestapiv1getcollection.go index d0aa8100..cbf1b0e6 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getcollection.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getcollection.go @@ -233,9 +233,17 @@ func testGetcollectionGetcollection0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 149108, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 741131, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getpin.go b/tests/mockserver/internal/handler/pathpostrestapiv1getpin.go index d99e95ec..00d01237 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getpin.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getpin.go @@ -273,9 +273,17 @@ func testGetpinGetpin0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 845806, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 350813, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1insights.go b/tests/mockserver/internal/handler/pathpostrestapiv1insights.go index 6f0e3cea..db802511 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1insights.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1insights.go @@ -315,9 +315,17 @@ func testInsightsInsights0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 856562, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 328633, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listanswers.go b/tests/mockserver/internal/handler/pathpostrestapiv1listanswers.go index 6380017d..86c16485 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listanswers.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listanswers.go @@ -243,10 +243,18 @@ func testListanswersListanswers0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 810770, }, }, LastReminder: &components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 956959, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listchats.go b/tests/mockserver/internal/handler/pathpostrestapiv1listchats.go index 2b3865dc..12675a76 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listchats.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listchats.go @@ -303,9 +303,17 @@ func testListchatsListchats0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 505778, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 948614, }, components.Reminder{ diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listcollections.go b/tests/mockserver/internal/handler/pathpostrestapiv1listcollections.go index 04b48fcf..3bb946af 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listcollections.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listcollections.go @@ -213,9 +213,17 @@ func testListcollectionsListcollections0(w http.ResponseWriter, req *http.Reques Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 777245, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 141764, }, components.Reminder{ diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listentities.go b/tests/mockserver/internal/handler/pathpostrestapiv1listentities.go index 37ad6f80..327753f0 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listentities.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listentities.go @@ -267,9 +267,17 @@ func testListentitiesListentities0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 406555, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 29267, }, components.Reminder{ diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listpins.go b/tests/mockserver/internal/handler/pathpostrestapiv1listpins.go index 7bb86559..04de1ad7 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listpins.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listpins.go @@ -278,9 +278,17 @@ func testListpinsListpins0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 838038, }, components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 517221, }, }, diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1listshortcuts.go b/tests/mockserver/internal/handler/pathpostrestapiv1listshortcuts.go index 29fd4d6a..6591d82a 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1listshortcuts.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1listshortcuts.go @@ -56,17 +56,26 @@ func testListshortcutsListshortcuts0(w http.ResponseWriter, req *http.Request) { components.Shortcut{ InputAlias: "", DestinationURL: types.String("https://remorseful-concentration.biz"), - CreatedBy: &components.Person{}, + CreatedBy: &components.Person{ + Name: "", + ObfuscatedID: "", + }, }, components.Shortcut{ InputAlias: "", DestinationURL: types.String("https://primary-paintwork.com/"), - CreatedBy: &components.Person{}, + CreatedBy: &components.Person{ + Name: "", + ObfuscatedID: "", + }, }, components.Shortcut{ InputAlias: "", DestinationURL: types.String("https://breakable-bathrobe.net"), - CreatedBy: &components.Person{}, + CreatedBy: &components.Person{ + Name: "", + ObfuscatedID: "", + }, }, }, FacetResults: []components.FacetResult{ diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1pin.go b/tests/mockserver/internal/handler/pathpostrestapiv1pin.go index 6d279e1e..89fd54cc 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1pin.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1pin.go @@ -293,10 +293,18 @@ func testPinPin0(w http.ResponseWriter, req *http.Request) { Metadata: &components.VerificationMetadata{ Reminders: []components.Reminder{ components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 982866, }, }, LastReminder: &components.Reminder{ + Assignee: components.Person{ + Name: "George Clooney", + ObfuscatedID: "abc123", + }, RemindAt: 482357, }, },