Skip to content

Commit da9af67

Browse files
author
Jordi Sanchez
committed
Makes parameter schema errors be reported.
Removes a nonexisting parameter from update_parameters_with_data's docstring. Adds an end-to-end test for parameters passed by reference.
1 parent 1fa552a commit da9af67

File tree

15 files changed

+1034
-3
lines changed

15 files changed

+1034
-3
lines changed

end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from typing import Type
44

5+
from .buildings import BuildingsEndpoints
56
from .default import DefaultEndpoints
7+
from .jamf_connect import JamfConnectEndpoints
68
from .location import LocationEndpoints
79
from .parameters import ParametersEndpoints
810
from .responses import ResponsesEndpoints
@@ -39,3 +41,11 @@ def location(cls) -> Type[LocationEndpoints]:
3941
@classmethod
4042
def true_(cls) -> Type[True_Endpoints]:
4143
return True_Endpoints
44+
45+
@classmethod
46+
def buildings(cls) -> Type[BuildingsEndpoints]:
47+
return BuildingsEndpoints
48+
49+
@classmethod
50+
def jamf_connect(cls) -> Type[JamfConnectEndpoints]:
51+
return JamfConnectEndpoints
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
""" Contains methods for accessing the API Endpoints """
2+
3+
import types
4+
5+
from . import get_v1_buildings
6+
7+
8+
class BuildingsEndpoints:
9+
@classmethod
10+
def get_v1_buildings(cls) -> types.ModuleType:
11+
"""
12+
Search for sorted and paged buildings
13+
"""
14+
return get_v1_buildings
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
""" Contains methods for accessing the API Endpoints """
2+
3+
import types
4+
5+
from . import get_v1_jamf_connect_history
6+
7+
8+
class JamfConnectEndpoints:
9+
@classmethod
10+
def get_v1_jamf_connect_history(cls) -> types.ModuleType:
11+
"""
12+
Get Jamf Connect history
13+
14+
"""
15+
return get_v1_jamf_connect_history

end_to_end_tests/golden-record/my_test_api_client/api/buildings/__init__.py

Whitespace-only changes.
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
from typing import Any, Dict, List, Optional, Union
2+
3+
import httpx
4+
5+
from ...client import Client
6+
from ...models.building_search_results import BuildingSearchResults
7+
from ...types import UNSET, Response, Unset
8+
9+
10+
def _get_kwargs(
11+
*,
12+
client: Client,
13+
page: int = 0,
14+
page_size: int = 100,
15+
sort: Union[Unset, None, List[str]] = UNSET,
16+
filter_: Union[Unset, None, str] = "",
17+
) -> Dict[str, Any]:
18+
url = "{}/v1/buildings".format(client.base_url)
19+
20+
headers: Dict[str, str] = client.get_headers()
21+
cookies: Dict[str, Any] = client.get_cookies()
22+
23+
params: Dict[str, Any] = {}
24+
params["page"] = page
25+
26+
params["page-size"] = page_size
27+
28+
json_sort: Union[Unset, None, List[str]] = UNSET
29+
if not isinstance(sort, Unset):
30+
if sort is None:
31+
json_sort = None
32+
else:
33+
json_sort = sort
34+
35+
params["sort"] = json_sort
36+
37+
params["filter"] = filter_
38+
39+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
40+
41+
return {
42+
"method": "get",
43+
"url": url,
44+
"headers": headers,
45+
"cookies": cookies,
46+
"timeout": client.get_timeout(),
47+
"params": params,
48+
}
49+
50+
51+
def _parse_response(*, response: httpx.Response) -> Optional[BuildingSearchResults]:
52+
if response.status_code == 200:
53+
response_200 = BuildingSearchResults.from_dict(response.json())
54+
55+
return response_200
56+
return None
57+
58+
59+
def _build_response(*, response: httpx.Response) -> Response[BuildingSearchResults]:
60+
return Response(
61+
status_code=response.status_code,
62+
content=response.content,
63+
headers=response.headers,
64+
parsed=_parse_response(response=response),
65+
)
66+
67+
68+
def sync_detailed(
69+
*,
70+
client: Client,
71+
page: int = 0,
72+
page_size: int = 100,
73+
sort: Union[Unset, None, List[str]] = UNSET,
74+
filter_: Union[Unset, None, str] = "",
75+
) -> Response[BuildingSearchResults]:
76+
"""Search for sorted and paged Buildings
77+
78+
Search for sorted and paged buildings
79+
80+
Args:
81+
page (int):
82+
page_size (int): Default: 100.
83+
sort (Union[Unset, None, List[str]]):
84+
filter_ (Union[Unset, None, str]): Default: ''.
85+
86+
Returns:
87+
Response[BuildingSearchResults]
88+
"""
89+
90+
kwargs = _get_kwargs(
91+
client=client,
92+
page=page,
93+
page_size=page_size,
94+
sort=sort,
95+
filter_=filter_,
96+
)
97+
98+
response = httpx.request(
99+
verify=client.verify_ssl,
100+
**kwargs,
101+
)
102+
103+
return _build_response(response=response)
104+
105+
106+
def sync(
107+
*,
108+
client: Client,
109+
page: int = 0,
110+
page_size: int = 100,
111+
sort: Union[Unset, None, List[str]] = UNSET,
112+
filter_: Union[Unset, None, str] = "",
113+
) -> Optional[BuildingSearchResults]:
114+
"""Search for sorted and paged Buildings
115+
116+
Search for sorted and paged buildings
117+
118+
Args:
119+
page (int):
120+
page_size (int): Default: 100.
121+
sort (Union[Unset, None, List[str]]):
122+
filter_ (Union[Unset, None, str]): Default: ''.
123+
124+
Returns:
125+
Response[BuildingSearchResults]
126+
"""
127+
128+
return sync_detailed(
129+
client=client,
130+
page=page,
131+
page_size=page_size,
132+
sort=sort,
133+
filter_=filter_,
134+
).parsed
135+
136+
137+
async def asyncio_detailed(
138+
*,
139+
client: Client,
140+
page: int = 0,
141+
page_size: int = 100,
142+
sort: Union[Unset, None, List[str]] = UNSET,
143+
filter_: Union[Unset, None, str] = "",
144+
) -> Response[BuildingSearchResults]:
145+
"""Search for sorted and paged Buildings
146+
147+
Search for sorted and paged buildings
148+
149+
Args:
150+
page (int):
151+
page_size (int): Default: 100.
152+
sort (Union[Unset, None, List[str]]):
153+
filter_ (Union[Unset, None, str]): Default: ''.
154+
155+
Returns:
156+
Response[BuildingSearchResults]
157+
"""
158+
159+
kwargs = _get_kwargs(
160+
client=client,
161+
page=page,
162+
page_size=page_size,
163+
sort=sort,
164+
filter_=filter_,
165+
)
166+
167+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
168+
response = await _client.request(**kwargs)
169+
170+
return _build_response(response=response)
171+
172+
173+
async def asyncio(
174+
*,
175+
client: Client,
176+
page: int = 0,
177+
page_size: int = 100,
178+
sort: Union[Unset, None, List[str]] = UNSET,
179+
filter_: Union[Unset, None, str] = "",
180+
) -> Optional[BuildingSearchResults]:
181+
"""Search for sorted and paged Buildings
182+
183+
Search for sorted and paged buildings
184+
185+
Args:
186+
page (int):
187+
page_size (int): Default: 100.
188+
sort (Union[Unset, None, List[str]]):
189+
filter_ (Union[Unset, None, str]): Default: ''.
190+
191+
Returns:
192+
Response[BuildingSearchResults]
193+
"""
194+
195+
return (
196+
await asyncio_detailed(
197+
client=client,
198+
page=page,
199+
page_size=page_size,
200+
sort=sort,
201+
filter_=filter_,
202+
)
203+
).parsed

end_to_end_tests/golden-record/my_test_api_client/api/jamf_connect/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)