|
5 | 5 | from glean.api_client._hooks import HookContext |
6 | 6 | from glean.api_client.types import OptionalNullable, UNSET |
7 | 7 | from glean.api_client.utils import get_security_from_env |
| 8 | +from glean.api_client.utils.unmarshal_json_response import unmarshal_json_response |
8 | 9 | from typing import List, Mapping, Optional, Union |
9 | 10 |
|
10 | 11 |
|
@@ -85,7 +86,7 @@ def create( |
85 | 86 | ) |
86 | 87 |
|
87 | 88 | if utils.match_response(http_res, "200", "application/json"): |
88 | | - return utils.unmarshal_json_response(models.Answer, http_res) |
| 89 | + return unmarshal_json_response(models.Answer, http_res) |
89 | 90 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
90 | 91 | http_res_text = utils.stream_to_text(http_res) |
91 | 92 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -171,7 +172,7 @@ async def create_async( |
171 | 172 | ) |
172 | 173 |
|
173 | 174 | if utils.match_response(http_res, "200", "application/json"): |
174 | | - return utils.unmarshal_json_response(models.Answer, http_res) |
| 175 | + return unmarshal_json_response(models.Answer, http_res) |
175 | 176 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
176 | 177 | http_res_text = await utils.stream_to_text_async(http_res) |
177 | 178 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -513,7 +514,7 @@ def update( |
513 | 514 | ) |
514 | 515 |
|
515 | 516 | if utils.match_response(http_res, "200", "application/json"): |
516 | | - return utils.unmarshal_json_response(models.Answer, http_res) |
| 517 | + return unmarshal_json_response(models.Answer, http_res) |
517 | 518 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
518 | 519 | http_res_text = utils.stream_to_text(http_res) |
519 | 520 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -677,7 +678,7 @@ async def update_async( |
677 | 678 | ) |
678 | 679 |
|
679 | 680 | if utils.match_response(http_res, "200", "application/json"): |
680 | | - return utils.unmarshal_json_response(models.Answer, http_res) |
| 681 | + return unmarshal_json_response(models.Answer, http_res) |
681 | 682 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
682 | 683 | http_res_text = await utils.stream_to_text_async(http_res) |
683 | 684 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -766,7 +767,7 @@ def retrieve( |
766 | 767 | ) |
767 | 768 |
|
768 | 769 | if utils.match_response(http_res, "200", "application/json"): |
769 | | - return utils.unmarshal_json_response(models.GetAnswerResponse, http_res) |
| 770 | + return unmarshal_json_response(models.GetAnswerResponse, http_res) |
770 | 771 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
771 | 772 | http_res_text = utils.stream_to_text(http_res) |
772 | 773 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -855,7 +856,7 @@ async def retrieve_async( |
855 | 856 | ) |
856 | 857 |
|
857 | 858 | if utils.match_response(http_res, "200", "application/json"): |
858 | | - return utils.unmarshal_json_response(models.GetAnswerResponse, http_res) |
| 859 | + return unmarshal_json_response(models.GetAnswerResponse, http_res) |
859 | 860 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
860 | 861 | http_res_text = await utils.stream_to_text_async(http_res) |
861 | 862 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -941,7 +942,7 @@ def list( |
941 | 942 | ) |
942 | 943 |
|
943 | 944 | if utils.match_response(http_res, "200", "application/json"): |
944 | | - return utils.unmarshal_json_response(models.ListAnswersResponse, http_res) |
| 945 | + return unmarshal_json_response(models.ListAnswersResponse, http_res) |
945 | 946 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
946 | 947 | http_res_text = utils.stream_to_text(http_res) |
947 | 948 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
@@ -1027,7 +1028,7 @@ async def list_async( |
1027 | 1028 | ) |
1028 | 1029 |
|
1029 | 1030 | if utils.match_response(http_res, "200", "application/json"): |
1030 | | - return utils.unmarshal_json_response(models.ListAnswersResponse, http_res) |
| 1031 | + return unmarshal_json_response(models.ListAnswersResponse, http_res) |
1031 | 1032 | if utils.match_response(http_res, ["400", "401", "429", "4XX"], "*"): |
1032 | 1033 | http_res_text = await utils.stream_to_text_async(http_res) |
1033 | 1034 | raise errors.GleanError("API error occurred", http_res, http_res_text) |
|
0 commit comments