Skip to content

Commit b8d02ca

Browse files
authored
[create-pull-request] automated change (#121)
Co-authored-by: yejiyang <[email protected]>
1 parent 0b53319 commit b8d02ca

27 files changed

+3750
-125
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
from http import HTTPStatus
2+
from typing import Any, Optional, Union
3+
from uuid import UUID
4+
5+
import httpx
6+
7+
from ... import errors
8+
from ...client import AuthenticatedClient, Client
9+
from ...models.comment import Comment
10+
from ...models.http_validation_error import HTTPValidationError
11+
from ...types import Response
12+
13+
14+
def _get_kwargs(
15+
project_id: str,
16+
location_id: UUID,
17+
) -> dict[str, Any]:
18+
_kwargs: dict[str, Any] = {
19+
"method": "get",
20+
"url": f"/projects/{project_id}/locations/{location_id}/comments",
21+
}
22+
23+
return _kwargs
24+
25+
26+
def _parse_response(
27+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
28+
) -> Optional[Union[HTTPValidationError, list["Comment"]]]:
29+
if response.status_code == 200:
30+
response_200 = []
31+
_response_200 = response.json()
32+
for response_200_item_data in _response_200:
33+
response_200_item = Comment.from_dict(response_200_item_data)
34+
35+
response_200.append(response_200_item)
36+
37+
return response_200
38+
if response.status_code == 422:
39+
response_422 = HTTPValidationError.from_dict(response.json())
40+
41+
return response_422
42+
if client.raise_on_unexpected_status:
43+
raise errors.UnexpectedStatus(response.status_code, response.content)
44+
else:
45+
return None
46+
47+
48+
def _build_response(
49+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
50+
) -> Response[Union[HTTPValidationError, list["Comment"]]]:
51+
return Response(
52+
status_code=HTTPStatus(response.status_code),
53+
content=response.content,
54+
headers=response.headers,
55+
parsed=_parse_response(client=client, response=response),
56+
)
57+
58+
59+
def sync_detailed(
60+
project_id: str,
61+
location_id: UUID,
62+
*,
63+
client: AuthenticatedClient,
64+
) -> Response[Union[HTTPValidationError, list["Comment"]]]:
65+
"""Get Location Comments
66+
67+
Get all location comments, along with associated likes
68+
69+
Args:
70+
project_id (str):
71+
location_id (UUID):
72+
73+
Raises:
74+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75+
httpx.TimeoutException: If the request takes longer than Client.timeout.
76+
77+
Returns:
78+
Response[Union[HTTPValidationError, list['Comment']]]
79+
"""
80+
81+
kwargs = _get_kwargs(
82+
project_id=project_id,
83+
location_id=location_id,
84+
)
85+
86+
response = client.get_httpx_client().request(
87+
**kwargs,
88+
)
89+
90+
return _build_response(client=client, response=response)
91+
92+
93+
def sync(
94+
project_id: str,
95+
location_id: UUID,
96+
*,
97+
client: AuthenticatedClient,
98+
) -> Optional[Union[HTTPValidationError, list["Comment"]]]:
99+
"""Get Location Comments
100+
101+
Get all location comments, along with associated likes
102+
103+
Args:
104+
project_id (str):
105+
location_id (UUID):
106+
107+
Raises:
108+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109+
httpx.TimeoutException: If the request takes longer than Client.timeout.
110+
111+
Returns:
112+
Union[HTTPValidationError, list['Comment']]
113+
"""
114+
115+
return sync_detailed(
116+
project_id=project_id,
117+
location_id=location_id,
118+
client=client,
119+
).parsed
120+
121+
122+
async def asyncio_detailed(
123+
project_id: str,
124+
location_id: UUID,
125+
*,
126+
client: AuthenticatedClient,
127+
) -> Response[Union[HTTPValidationError, list["Comment"]]]:
128+
"""Get Location Comments
129+
130+
Get all location comments, along with associated likes
131+
132+
Args:
133+
project_id (str):
134+
location_id (UUID):
135+
136+
Raises:
137+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
138+
httpx.TimeoutException: If the request takes longer than Client.timeout.
139+
140+
Returns:
141+
Response[Union[HTTPValidationError, list['Comment']]]
142+
"""
143+
144+
kwargs = _get_kwargs(
145+
project_id=project_id,
146+
location_id=location_id,
147+
)
148+
149+
response = await client.get_async_httpx_client().request(**kwargs)
150+
151+
return _build_response(client=client, response=response)
152+
153+
154+
async def asyncio(
155+
project_id: str,
156+
location_id: UUID,
157+
*,
158+
client: AuthenticatedClient,
159+
) -> Optional[Union[HTTPValidationError, list["Comment"]]]:
160+
"""Get Location Comments
161+
162+
Get all location comments, along with associated likes
163+
164+
Args:
165+
project_id (str):
166+
location_id (UUID):
167+
168+
Raises:
169+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170+
httpx.TimeoutException: If the request takes longer than Client.timeout.
171+
172+
Returns:
173+
Union[HTTPValidationError, list['Comment']]
174+
"""
175+
176+
return (
177+
await asyncio_detailed(
178+
project_id=project_id,
179+
location_id=location_id,
180+
client=client,
181+
)
182+
).parsed

field-manager-python-client/field_manager_python_client/api/comments/get_comments_projects_project_id_locations_location_id_comments_get.py renamed to field-manager-python-client/field_manager_python_client/api/comments/get_method_comments_projects_project_id_locations_location_id_methods_method_id_comments_get.py

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,17 @@
88
from ...client import AuthenticatedClient, Client
99
from ...models.comment import Comment
1010
from ...models.http_validation_error import HTTPValidationError
11-
from ...types import UNSET, Response, Unset
11+
from ...types import Response
1212

1313

1414
def _get_kwargs(
1515
project_id: str,
1616
location_id: UUID,
17-
*,
18-
method_id: Union[None, UUID, Unset] = UNSET,
17+
method_id: UUID,
1918
) -> dict[str, Any]:
20-
params: dict[str, Any] = {}
21-
22-
json_method_id: Union[None, Unset, str]
23-
if isinstance(method_id, Unset):
24-
json_method_id = UNSET
25-
elif isinstance(method_id, UUID):
26-
json_method_id = str(method_id)
27-
else:
28-
json_method_id = method_id
29-
params["method_id"] = json_method_id
30-
31-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
32-
3319
_kwargs: dict[str, Any] = {
3420
"method": "get",
35-
"url": f"/projects/{project_id}/locations/{location_id}/comments",
36-
"params": params,
21+
"url": f"/projects/{project_id}/locations/{location_id}/methods/{method_id}/comments",
3722
}
3823

3924
return _kwargs
@@ -75,18 +60,18 @@ def _build_response(
7560
def sync_detailed(
7661
project_id: str,
7762
location_id: UUID,
63+
method_id: UUID,
7864
*,
7965
client: AuthenticatedClient,
80-
method_id: Union[None, UUID, Unset] = UNSET,
8166
) -> Response[Union[HTTPValidationError, list["Comment"]]]:
82-
"""Get Comments
67+
"""Get Method Comments
8368
84-
Get all non-deleted comments, along with associated likes, on a given method or location
69+
Get all method comments, along with associated likes, on a given method
8570
8671
Args:
8772
project_id (str):
8873
location_id (UUID):
89-
method_id (Union[None, UUID, Unset]):
74+
method_id (UUID):
9075
9176
Raises:
9277
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -112,18 +97,18 @@ def sync_detailed(
11297
def sync(
11398
project_id: str,
11499
location_id: UUID,
100+
method_id: UUID,
115101
*,
116102
client: AuthenticatedClient,
117-
method_id: Union[None, UUID, Unset] = UNSET,
118103
) -> Optional[Union[HTTPValidationError, list["Comment"]]]:
119-
"""Get Comments
104+
"""Get Method Comments
120105
121-
Get all non-deleted comments, along with associated likes, on a given method or location
106+
Get all method comments, along with associated likes, on a given method
122107
123108
Args:
124109
project_id (str):
125110
location_id (UUID):
126-
method_id (Union[None, UUID, Unset]):
111+
method_id (UUID):
127112
128113
Raises:
129114
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -136,26 +121,26 @@ def sync(
136121
return sync_detailed(
137122
project_id=project_id,
138123
location_id=location_id,
139-
client=client,
140124
method_id=method_id,
125+
client=client,
141126
).parsed
142127

143128

144129
async def asyncio_detailed(
145130
project_id: str,
146131
location_id: UUID,
132+
method_id: UUID,
147133
*,
148134
client: AuthenticatedClient,
149-
method_id: Union[None, UUID, Unset] = UNSET,
150135
) -> Response[Union[HTTPValidationError, list["Comment"]]]:
151-
"""Get Comments
136+
"""Get Method Comments
152137
153-
Get all non-deleted comments, along with associated likes, on a given method or location
138+
Get all method comments, along with associated likes, on a given method
154139
155140
Args:
156141
project_id (str):
157142
location_id (UUID):
158-
method_id (Union[None, UUID, Unset]):
143+
method_id (UUID):
159144
160145
Raises:
161146
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -179,18 +164,18 @@ async def asyncio_detailed(
179164
async def asyncio(
180165
project_id: str,
181166
location_id: UUID,
167+
method_id: UUID,
182168
*,
183169
client: AuthenticatedClient,
184-
method_id: Union[None, UUID, Unset] = UNSET,
185170
) -> Optional[Union[HTTPValidationError, list["Comment"]]]:
186-
"""Get Comments
171+
"""Get Method Comments
187172
188-
Get all non-deleted comments, along with associated likes, on a given method or location
173+
Get all method comments, along with associated likes, on a given method
189174
190175
Args:
191176
project_id (str):
192177
location_id (UUID):
193-
method_id (Union[None, UUID, Unset]):
178+
method_id (UUID):
194179
195180
Raises:
196181
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -204,7 +189,7 @@ async def asyncio(
204189
await asyncio_detailed(
205190
project_id=project_id,
206191
location_id=location_id,
207-
client=client,
208192
method_id=method_id,
193+
client=client,
209194
)
210195
).parsed

0 commit comments

Comments
 (0)