Skip to content

Commit bbe4618

Browse files
committed
Merged branch feature/standard-qs-for-journals into develop
1 parent 3da745c commit bbe4618

137 files changed

Lines changed: 11024 additions & 63 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
from http import HTTPStatus
2+
from typing import Any, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.error_response import ErrorResponse
9+
from ...models.journal_question_archive_args import JournalQuestionArchiveArgs
10+
from ...types import UNSET, Response, Unset
11+
12+
13+
def _get_kwargs(
14+
*,
15+
body: JournalQuestionArchiveArgs | Unset = UNSET,
16+
) -> dict[str, Any]:
17+
headers: dict[str, Any] = {}
18+
19+
_kwargs: dict[str, Any] = {
20+
"method": "post",
21+
"url": "/journal-question-archive",
22+
}
23+
24+
if not isinstance(body, Unset):
25+
_kwargs["json"] = body.to_dict()
26+
27+
headers["Content-Type"] = "application/json"
28+
29+
_kwargs["headers"] = headers
30+
return _kwargs
31+
32+
33+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | ErrorResponse | None:
34+
if response.status_code == 200:
35+
response_200 = cast(Any, None)
36+
return response_200
37+
38+
if response.status_code == 400:
39+
response_400 = ErrorResponse.from_dict(response.json())
40+
41+
return response_400
42+
43+
if response.status_code == 401:
44+
response_401 = ErrorResponse.from_dict(response.json())
45+
46+
return response_401
47+
48+
if response.status_code == 404:
49+
response_404 = ErrorResponse.from_dict(response.json())
50+
51+
return response_404
52+
53+
if response.status_code == 406:
54+
response_406 = ErrorResponse.from_dict(response.json())
55+
56+
return response_406
57+
58+
if response.status_code == 409:
59+
response_409 = ErrorResponse.from_dict(response.json())
60+
61+
return response_409
62+
63+
if response.status_code == 410:
64+
response_410 = ErrorResponse.from_dict(response.json())
65+
66+
return response_410
67+
68+
if response.status_code == 422:
69+
response_422 = ErrorResponse.from_dict(response.json())
70+
71+
return response_422
72+
73+
if response.status_code == 426:
74+
response_426 = ErrorResponse.from_dict(response.json())
75+
76+
return response_426
77+
78+
if response.status_code == 429:
79+
response_429 = ErrorResponse.from_dict(response.json())
80+
81+
return response_429
82+
83+
if response.status_code == 502:
84+
response_502 = ErrorResponse.from_dict(response.json())
85+
86+
return response_502
87+
88+
if client.raise_on_unexpected_status:
89+
raise errors.UnexpectedStatus(response.status_code, response.content)
90+
else:
91+
return None
92+
93+
94+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | ErrorResponse]:
95+
return Response(
96+
status_code=HTTPStatus(response.status_code),
97+
content=response.content,
98+
headers=response.headers,
99+
parsed=_parse_response(client=client, response=response),
100+
)
101+
102+
103+
def sync_detailed(
104+
*,
105+
client: AuthenticatedClient,
106+
body: JournalQuestionArchiveArgs | Unset = UNSET,
107+
) -> Response[Any | ErrorResponse]:
108+
"""Use case for archiving a journal question.
109+
110+
Args:
111+
body (JournalQuestionArchiveArgs | Unset): JournalQuestionArchive args.
112+
113+
Raises:
114+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115+
httpx.TimeoutException: If the request takes longer than Client.timeout.
116+
117+
Returns:
118+
Response[Any | ErrorResponse]
119+
"""
120+
121+
kwargs = _get_kwargs(
122+
body=body,
123+
)
124+
125+
response = client.get_httpx_client().request(
126+
**kwargs,
127+
)
128+
129+
return _build_response(client=client, response=response)
130+
131+
132+
def sync(
133+
*,
134+
client: AuthenticatedClient,
135+
body: JournalQuestionArchiveArgs | Unset = UNSET,
136+
) -> Any | ErrorResponse | None:
137+
"""Use case for archiving a journal question.
138+
139+
Args:
140+
body (JournalQuestionArchiveArgs | Unset): JournalQuestionArchive args.
141+
142+
Raises:
143+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144+
httpx.TimeoutException: If the request takes longer than Client.timeout.
145+
146+
Returns:
147+
Any | ErrorResponse
148+
"""
149+
150+
return sync_detailed(
151+
client=client,
152+
body=body,
153+
).parsed
154+
155+
156+
async def asyncio_detailed(
157+
*,
158+
client: AuthenticatedClient,
159+
body: JournalQuestionArchiveArgs | Unset = UNSET,
160+
) -> Response[Any | ErrorResponse]:
161+
"""Use case for archiving a journal question.
162+
163+
Args:
164+
body (JournalQuestionArchiveArgs | Unset): JournalQuestionArchive args.
165+
166+
Raises:
167+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
168+
httpx.TimeoutException: If the request takes longer than Client.timeout.
169+
170+
Returns:
171+
Response[Any | ErrorResponse]
172+
"""
173+
174+
kwargs = _get_kwargs(
175+
body=body,
176+
)
177+
178+
response = await client.get_async_httpx_client().request(**kwargs)
179+
180+
return _build_response(client=client, response=response)
181+
182+
183+
async def asyncio(
184+
*,
185+
client: AuthenticatedClient,
186+
body: JournalQuestionArchiveArgs | Unset = UNSET,
187+
) -> Any | ErrorResponse | None:
188+
"""Use case for archiving a journal question.
189+
190+
Args:
191+
body (JournalQuestionArchiveArgs | Unset): JournalQuestionArchive args.
192+
193+
Raises:
194+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
195+
httpx.TimeoutException: If the request takes longer than Client.timeout.
196+
197+
Returns:
198+
Any | ErrorResponse
199+
"""
200+
201+
return (
202+
await asyncio_detailed(
203+
client=client,
204+
body=body,
205+
)
206+
).parsed

0 commit comments

Comments
 (0)