Skip to content

Commit 03f3be4

Browse files
committed
api_client: regenerate
Regenerate the cloud API client. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 9d259f7 commit 03f3be4

5 files changed

Lines changed: 456 additions & 0 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
from http import HTTPStatus
2+
from typing import Any, Optional, Union, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.uplink_route import UplinkRoute
9+
from ...types import Response
10+
11+
12+
def _get_kwargs(
13+
device_id: str,
14+
) -> dict[str, Any]:
15+
_kwargs: dict[str, Any] = {
16+
"method": "get",
17+
"url": f"/device/deviceId/{device_id}/lastRoute",
18+
}
19+
20+
return _kwargs
21+
22+
23+
def _parse_response(
24+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
25+
) -> Optional[Union[Any, UplinkRoute]]:
26+
if response.status_code == 200:
27+
response_200 = UplinkRoute.from_dict(response.json())
28+
29+
return response_200
30+
if response.status_code == 404:
31+
response_404 = cast(Any, None)
32+
return response_404
33+
if client.raise_on_unexpected_status:
34+
raise errors.UnexpectedStatus(response.status_code, response.content)
35+
else:
36+
return None
37+
38+
39+
def _build_response(
40+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
41+
) -> Response[Union[Any, UplinkRoute]]:
42+
return Response(
43+
status_code=HTTPStatus(response.status_code),
44+
content=response.content,
45+
headers=response.headers,
46+
parsed=_parse_response(client=client, response=response),
47+
)
48+
49+
50+
def sync_detailed(
51+
device_id: str,
52+
*,
53+
client: Union[AuthenticatedClient, Client],
54+
) -> Response[Union[Any, UplinkRoute]]:
55+
"""Get last route by DeviceID
56+
57+
Args:
58+
device_id (str):
59+
60+
Raises:
61+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
62+
httpx.TimeoutException: If the request takes longer than Client.timeout.
63+
64+
Returns:
65+
Response[Union[Any, UplinkRoute]]
66+
"""
67+
68+
kwargs = _get_kwargs(
69+
device_id=device_id,
70+
)
71+
72+
response = client.get_httpx_client().request(
73+
**kwargs,
74+
)
75+
76+
return _build_response(client=client, response=response)
77+
78+
79+
def sync(
80+
device_id: str,
81+
*,
82+
client: Union[AuthenticatedClient, Client],
83+
) -> Optional[Union[Any, UplinkRoute]]:
84+
"""Get last route by DeviceID
85+
86+
Args:
87+
device_id (str):
88+
89+
Raises:
90+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
91+
httpx.TimeoutException: If the request takes longer than Client.timeout.
92+
93+
Returns:
94+
Union[Any, UplinkRoute]
95+
"""
96+
97+
return sync_detailed(
98+
device_id=device_id,
99+
client=client,
100+
).parsed
101+
102+
103+
async def asyncio_detailed(
104+
device_id: str,
105+
*,
106+
client: Union[AuthenticatedClient, Client],
107+
) -> Response[Union[Any, UplinkRoute]]:
108+
"""Get last route by DeviceID
109+
110+
Args:
111+
device_id (str):
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[Union[Any, UplinkRoute]]
119+
"""
120+
121+
kwargs = _get_kwargs(
122+
device_id=device_id,
123+
)
124+
125+
response = await client.get_async_httpx_client().request(**kwargs)
126+
127+
return _build_response(client=client, response=response)
128+
129+
130+
async def asyncio(
131+
device_id: str,
132+
*,
133+
client: Union[AuthenticatedClient, Client],
134+
) -> Optional[Union[Any, UplinkRoute]]:
135+
"""Get last route by DeviceID
136+
137+
Args:
138+
device_id (str):
139+
140+
Raises:
141+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142+
httpx.TimeoutException: If the request takes longer than Client.timeout.
143+
144+
Returns:
145+
Union[Any, UplinkRoute]
146+
"""
147+
148+
return (
149+
await asyncio_detailed(
150+
device_id=device_id,
151+
client=client,
152+
)
153+
).parsed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
from http import HTTPStatus
2+
from typing import Any, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.get_last_routes_for_devices_body import GetLastRoutesForDevicesBody
9+
from ...models.uplink_route_and_device_id import UplinkRouteAndDeviceId
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
*,
15+
body: GetLastRoutesForDevicesBody,
16+
) -> dict[str, Any]:
17+
headers: dict[str, Any] = {}
18+
19+
_kwargs: dict[str, Any] = {
20+
"method": "post",
21+
"url": "/device/lastRoute",
22+
}
23+
24+
_body = body.to_dict()
25+
26+
_kwargs["json"] = _body
27+
headers["Content-Type"] = "application/json"
28+
29+
_kwargs["headers"] = headers
30+
return _kwargs
31+
32+
33+
def _parse_response(
34+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
35+
) -> Optional[list["UplinkRouteAndDeviceId"]]:
36+
if response.status_code == 200:
37+
response_200 = []
38+
_response_200 = response.json()
39+
for response_200_item_data in _response_200:
40+
response_200_item = UplinkRouteAndDeviceId.from_dict(response_200_item_data)
41+
42+
response_200.append(response_200_item)
43+
44+
return response_200
45+
if client.raise_on_unexpected_status:
46+
raise errors.UnexpectedStatus(response.status_code, response.content)
47+
else:
48+
return None
49+
50+
51+
def _build_response(
52+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
53+
) -> Response[list["UplinkRouteAndDeviceId"]]:
54+
return Response(
55+
status_code=HTTPStatus(response.status_code),
56+
content=response.content,
57+
headers=response.headers,
58+
parsed=_parse_response(client=client, response=response),
59+
)
60+
61+
62+
def sync_detailed(
63+
*,
64+
client: Union[AuthenticatedClient, Client],
65+
body: GetLastRoutesForDevicesBody,
66+
) -> Response[list["UplinkRouteAndDeviceId"]]:
67+
"""Get last routes for a group of devices
68+
69+
Args:
70+
body (GetLastRoutesForDevicesBody): Body for getting last routes for devices
71+
72+
Raises:
73+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74+
httpx.TimeoutException: If the request takes longer than Client.timeout.
75+
76+
Returns:
77+
Response[list['UplinkRouteAndDeviceId']]
78+
"""
79+
80+
kwargs = _get_kwargs(
81+
body=body,
82+
)
83+
84+
response = client.get_httpx_client().request(
85+
**kwargs,
86+
)
87+
88+
return _build_response(client=client, response=response)
89+
90+
91+
def sync(
92+
*,
93+
client: Union[AuthenticatedClient, Client],
94+
body: GetLastRoutesForDevicesBody,
95+
) -> Optional[list["UplinkRouteAndDeviceId"]]:
96+
"""Get last routes for a group of devices
97+
98+
Args:
99+
body (GetLastRoutesForDevicesBody): Body for getting last routes for devices
100+
101+
Raises:
102+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103+
httpx.TimeoutException: If the request takes longer than Client.timeout.
104+
105+
Returns:
106+
list['UplinkRouteAndDeviceId']
107+
"""
108+
109+
return sync_detailed(
110+
client=client,
111+
body=body,
112+
).parsed
113+
114+
115+
async def asyncio_detailed(
116+
*,
117+
client: Union[AuthenticatedClient, Client],
118+
body: GetLastRoutesForDevicesBody,
119+
) -> Response[list["UplinkRouteAndDeviceId"]]:
120+
"""Get last routes for a group of devices
121+
122+
Args:
123+
body (GetLastRoutesForDevicesBody): Body for getting last routes for devices
124+
125+
Raises:
126+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127+
httpx.TimeoutException: If the request takes longer than Client.timeout.
128+
129+
Returns:
130+
Response[list['UplinkRouteAndDeviceId']]
131+
"""
132+
133+
kwargs = _get_kwargs(
134+
body=body,
135+
)
136+
137+
response = await client.get_async_httpx_client().request(**kwargs)
138+
139+
return _build_response(client=client, response=response)
140+
141+
142+
async def asyncio(
143+
*,
144+
client: Union[AuthenticatedClient, Client],
145+
body: GetLastRoutesForDevicesBody,
146+
) -> Optional[list["UplinkRouteAndDeviceId"]]:
147+
"""Get last routes for a group of devices
148+
149+
Args:
150+
body (GetLastRoutesForDevicesBody): Body for getting last routes for devices
151+
152+
Raises:
153+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
154+
httpx.TimeoutException: If the request takes longer than Client.timeout.
155+
156+
Returns:
157+
list['UplinkRouteAndDeviceId']
158+
"""
159+
160+
return (
161+
await asyncio_detailed(
162+
client=client,
163+
body=body,
164+
)
165+
).parsed

src/infuse_iot/api_client/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from .error import Error
5353
from .forwarded_downlink_route import ForwardedDownlinkRoute
5454
from .forwarded_uplink_route import ForwardedUplinkRoute
55+
from .get_last_routes_for_devices_body import GetLastRoutesForDevicesBody
5556
from .health_check import HealthCheck
5657
from .interface_data import InterfaceData
5758
from .key import Key
@@ -74,6 +75,7 @@
7475
from .udp_downlink_route import UdpDownlinkRoute
7576
from .udp_uplink_route import UdpUplinkRoute
7677
from .uplink_route import UplinkRoute
78+
from .uplink_route_and_device_id import UplinkRouteAndDeviceId
7779

7880
__all__ = (
7981
"Algorithm",
@@ -128,6 +130,7 @@
128130
"Error",
129131
"ForwardedDownlinkRoute",
130132
"ForwardedUplinkRoute",
133+
"GetLastRoutesForDevicesBody",
131134
"HealthCheck",
132135
"InterfaceData",
133136
"Key",
@@ -150,4 +153,5 @@
150153
"UdpDownlinkRoute",
151154
"UdpUplinkRoute",
152155
"UplinkRoute",
156+
"UplinkRouteAndDeviceId",
153157
)

0 commit comments

Comments
 (0)