diff --git a/src/infuse_iot/api_client/api/admin/generate_api_key.py b/src/infuse_iot/api_client/api/admin/generate_api_key.py index 4e3d8000..2db9eaf3 100644 --- a/src/infuse_iot/api_client/api/admin/generate_api_key.py +++ b/src/infuse_iot/api_client/api/admin/generate_api_key.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/admin/apiKey", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,14 +37,17 @@ def _parse_response( response_200 = GeneratedAPIKey.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, GeneratedAPIKey]] + Response[Error | GeneratedAPIKey] """ kwargs = _get_kwargs( @@ -107,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, GeneratedAPIKey] + Error | GeneratedAPIKey """ return sync_detailed( @@ -131,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, GeneratedAPIKey]] + Response[Error | GeneratedAPIKey] """ kwargs = _get_kwargs( @@ -158,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, GeneratedAPIKey] + Error | GeneratedAPIKey """ return ( diff --git a/src/infuse_iot/api_client/api/board/create_board.py b/src/infuse_iot/api_client/api/board/create_board.py index fee19cc9..d7e2e659 100644 --- a/src/infuse_iot/api_client/api/board/create_board.py +++ b/src/infuse_iot/api_client/api/board/create_board.py @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/board", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -35,12 +34,15 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_201 = Board.from_dict(response.json()) return response_201 + if response.status_code == 409: response_409 = cast(Any, None) return response_409 + if response.status_code == 422: response_422 = cast(Any, None) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -71,7 +73,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Board]] + Response[Any | Board] """ kwargs = _get_kwargs( @@ -100,7 +102,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Board] + Any | Board """ return sync_detailed( @@ -124,7 +126,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Board]] + Response[Any | Board] """ kwargs = _get_kwargs( @@ -151,7 +153,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Board] + Any | Board """ return ( diff --git a/src/infuse_iot/api_client/api/board/get_board_by_id.py b/src/infuse_iot/api_client/api/board/get_board_by_id.py index dd79470d..d1fe9186 100644 --- a/src/infuse_iot/api_client/api/board/get_board_by_id.py +++ b/src/infuse_iot/api_client/api/board/get_board_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/board/id/{id}", + "url": "/board/id/{id}".format( + id=quote(str(id), safe=""), + ), } return _kwargs @@ -26,9 +29,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Board.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,7 +64,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Board]] + Response[Any | Board] """ kwargs = _get_kwargs( @@ -88,7 +93,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Board] + Any | Board """ return sync_detailed( @@ -112,7 +117,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Board]] + Response[Any | Board] """ kwargs = _get_kwargs( @@ -139,7 +144,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Board] + Any | Board """ return ( diff --git a/src/infuse_iot/api_client/api/board/get_boards.py b/src/infuse_iot/api_client/api/board/get_boards.py index 437554b8..8a615f98 100644 --- a/src/infuse_iot/api_client/api/board/get_boards.py +++ b/src/infuse_iot/api_client/api/board/get_boards.py @@ -30,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list["Board"] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[Board] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -40,13 +40,14 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list["Board"]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[Board]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +60,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, -) -> Response[list["Board"]]: +) -> Response[list[Board]]: """Get all boards in an organisation Args: @@ -70,7 +71,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['Board']] + Response[list[Board]] """ kwargs = _get_kwargs( @@ -88,7 +89,7 @@ def sync( *, client: AuthenticatedClient | Client, organisation_id: UUID, -) -> list["Board"] | None: +) -> list[Board] | None: """Get all boards in an organisation Args: @@ -99,7 +100,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['Board'] + list[Board] """ return sync_detailed( @@ -112,7 +113,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, -) -> Response[list["Board"]]: +) -> Response[list[Board]]: """Get all boards in an organisation Args: @@ -123,7 +124,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['Board']] + Response[list[Board]] """ kwargs = _get_kwargs( @@ -139,7 +140,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, organisation_id: UUID, -) -> list["Board"] | None: +) -> list[Board] | None: """Get all boards in an organisation Args: @@ -150,7 +151,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['Board'] + list[Board] """ return ( diff --git a/src/infuse_iot/api_client/api/board/get_devices_by_board_id.py b/src/infuse_iot/api_client/api/board/get_devices_by_board_id.py index 968f133b..1885f541 100644 --- a/src/infuse_iot/api_client/api/board/get_devices_by_board_id.py +++ b/src/infuse_iot/api_client/api/board/get_devices_by_board_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -13,8 +14,8 @@ def _get_kwargs( id: UUID, *, - metadata_name: Unset | str = UNSET, - metadata_value: Unset | str = UNSET, + metadata_name: str | Unset = UNSET, + metadata_value: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -26,14 +27,16 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/board/id/{id}/devices", + "url": "/board/id/{id}/devices".format( + id=quote(str(id), safe=""), + ), "params": params, } return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | list["Device"] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | list[Device] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -43,18 +46,18 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200.append(response_200_item) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | list["Device"]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | list[Device]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,22 +70,22 @@ def sync_detailed( id: UUID, *, client: AuthenticatedClient | Client, - metadata_name: Unset | str = UNSET, - metadata_value: Unset | str = UNSET, -) -> Response[Any | list["Device"]]: + metadata_name: str | Unset = UNSET, + metadata_value: str | Unset = UNSET, +) -> Response[Any | list[Device]]: """Get devices by board id and optional metadata field Args: id (UUID): - metadata_name (Union[Unset, str]): - metadata_value (Union[Unset, str]): + metadata_name (str | Unset): + metadata_value (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, list['Device']]] + Response[Any | list[Device]] """ kwargs = _get_kwargs( @@ -102,22 +105,22 @@ def sync( id: UUID, *, client: AuthenticatedClient | Client, - metadata_name: Unset | str = UNSET, - metadata_value: Unset | str = UNSET, -) -> Any | list["Device"] | None: + metadata_name: str | Unset = UNSET, + metadata_value: str | Unset = UNSET, +) -> Any | list[Device] | None: """Get devices by board id and optional metadata field Args: id (UUID): - metadata_name (Union[Unset, str]): - metadata_value (Union[Unset, str]): + metadata_name (str | Unset): + metadata_value (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, list['Device']] + Any | list[Device] """ return sync_detailed( @@ -132,22 +135,22 @@ async def asyncio_detailed( id: UUID, *, client: AuthenticatedClient | Client, - metadata_name: Unset | str = UNSET, - metadata_value: Unset | str = UNSET, -) -> Response[Any | list["Device"]]: + metadata_name: str | Unset = UNSET, + metadata_value: str | Unset = UNSET, +) -> Response[Any | list[Device]]: """Get devices by board id and optional metadata field Args: id (UUID): - metadata_name (Union[Unset, str]): - metadata_value (Union[Unset, str]): + metadata_name (str | Unset): + metadata_value (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, list['Device']]] + Response[Any | list[Device]] """ kwargs = _get_kwargs( @@ -165,22 +168,22 @@ async def asyncio( id: UUID, *, client: AuthenticatedClient | Client, - metadata_name: Unset | str = UNSET, - metadata_value: Unset | str = UNSET, -) -> Any | list["Device"] | None: + metadata_name: str | Unset = UNSET, + metadata_value: str | Unset = UNSET, +) -> Any | list[Device] | None: """Get devices by board id and optional metadata field Args: id (UUID): - metadata_name (Union[Unset, str]): - metadata_value (Union[Unset, str]): + metadata_name (str | Unset): + metadata_value (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, list['Device']] + Any | list[Device] """ return ( diff --git a/src/infuse_iot/api_client/api/coap/get_coap_file_stats.py b/src/infuse_iot/api_client/api/coap/get_coap_file_stats.py index 7a708b04..e0926d73 100644 --- a/src/infuse_iot/api_client/api/coap/get_coap_file_stats.py +++ b/src/infuse_iot/api_client/api/coap/get_coap_file_stats.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/coap/file/{filename}/stats", + "url": "/coap/file/{filename}/stats".format( + filename=quote(str(filename), safe=""), + ), } return _kwargs @@ -26,14 +29,17 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = COAPFileStats.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -66,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[COAPFileStats, Error]] + Response[COAPFileStats | Error] """ kwargs = _get_kwargs( @@ -95,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[COAPFileStats, Error] + COAPFileStats | Error """ return sync_detailed( @@ -119,7 +125,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[COAPFileStats, Error]] + Response[COAPFileStats | Error] """ kwargs = _get_kwargs( @@ -146,7 +152,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[COAPFileStats, Error] + COAPFileStats | Error """ return ( diff --git a/src/infuse_iot/api_client/api/coap/get_coap_files.py b/src/infuse_iot/api_client/api/coap/get_coap_files.py index 7fa7f6cd..bd40ab40 100644 --- a/src/infuse_iot/api_client/api/coap/get_coap_files.py +++ b/src/infuse_iot/api_client/api/coap/get_coap_files.py @@ -12,7 +12,7 @@ def _get_kwargs( *, - regex: Unset | str = UNSET, + regex: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -34,14 +34,17 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = COAPFilesList.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,19 +65,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - regex: Unset | str = UNSET, + regex: str | Unset = UNSET, ) -> Response[COAPFilesList | Error]: """Get a list of files on the COAP server Args: - regex (Union[Unset, str]): + regex (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[COAPFilesList, Error]] + Response[COAPFilesList | Error] """ kwargs = _get_kwargs( @@ -91,19 +94,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - regex: Unset | str = UNSET, + regex: str | Unset = UNSET, ) -> COAPFilesList | Error | None: """Get a list of files on the COAP server Args: - regex (Union[Unset, str]): + regex (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[COAPFilesList, Error] + COAPFilesList | Error """ return sync_detailed( @@ -115,19 +118,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - regex: Unset | str = UNSET, + regex: str | Unset = UNSET, ) -> Response[COAPFilesList | Error]: """Get a list of files on the COAP server Args: - regex (Union[Unset, str]): + regex (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[COAPFilesList, Error]] + Response[COAPFilesList | Error] """ kwargs = _get_kwargs( @@ -142,19 +145,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - regex: Unset | str = UNSET, + regex: str | Unset = UNSET, ) -> COAPFilesList | Error | None: """Get a list of files on the COAP server Args: - regex (Union[Unset, str]): + regex (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[COAPFilesList, Error] + COAPFilesList | Error """ return ( diff --git a/src/infuse_iot/api_client/api/default/get_health.py b/src/infuse_iot/api_client/api/default/get_health.py index d53c3ca2..b4064231 100644 --- a/src/infuse_iot/api_client/api/default/get_health.py +++ b/src/infuse_iot/api_client/api/default/get_health.py @@ -23,6 +23,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = HealthCheck.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: diff --git a/src/infuse_iot/api_client/api/defs/add_kv_definitions.py b/src/infuse_iot/api_client/api/defs/add_kv_definitions.py index 00c53444..f007cf1b 100644 --- a/src/infuse_iot/api_client/api/defs/add_kv_definitions.py +++ b/src/infuse_iot/api_client/api/defs/add_kv_definitions.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/defs/kv", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,14 +37,17 @@ def _parse_response( response_201 = DefinitionsKVResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs( @@ -107,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return sync_detailed( @@ -131,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs( @@ -158,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/add_rpc_definitions.py b/src/infuse_iot/api_client/api/defs/add_rpc_definitions.py index 5c0d5a43..78d53529 100644 --- a/src/infuse_iot/api_client/api/defs/add_rpc_definitions.py +++ b/src/infuse_iot/api_client/api/defs/add_rpc_definitions.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/defs/rpc", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,14 +37,17 @@ def _parse_response( response_201 = DefinitionsRPCResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs( @@ -107,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return sync_detailed( @@ -131,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs( @@ -158,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/add_tdf_definitions.py b/src/infuse_iot/api_client/api/defs/add_tdf_definitions.py index 542c7c99..b78d16ac 100644 --- a/src/infuse_iot/api_client/api/defs/add_tdf_definitions.py +++ b/src/infuse_iot/api_client/api/defs/add_tdf_definitions.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/defs/tdf", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,14 +37,17 @@ def _parse_response( response_201 = DefinitionsTDFResponse.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs( @@ -107,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return sync_detailed( @@ -131,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs( @@ -158,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_kv_definitions_by_version.py b/src/infuse_iot/api_client/api/defs/get_kv_definitions_by_version.py index baf0d75a..a8dbddd2 100644 --- a/src/infuse_iot/api_client/api/defs/get_kv_definitions_by_version.py +++ b/src/infuse_iot/api_client/api/defs/get_kv_definitions_by_version.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/defs/kv/{version}", + "url": "/defs/kv/{version}".format( + version=quote(str(version), safe=""), + ), } return _kwargs @@ -28,14 +31,17 @@ def _parse_response( response_200 = DefinitionsKVResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs( @@ -97,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return sync_detailed( @@ -121,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs( @@ -148,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_latest_kv_definitions.py b/src/infuse_iot/api_client/api/defs/get_latest_kv_definitions.py index a24f0a7c..e8aa9b02 100644 --- a/src/infuse_iot/api_client/api/defs/get_latest_kv_definitions.py +++ b/src/infuse_iot/api_client/api/defs/get_latest_kv_definitions.py @@ -26,14 +26,17 @@ def _parse_response( response_200 = DefinitionsKVResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,7 +65,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs() @@ -85,7 +88,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return sync_detailed( @@ -104,7 +107,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsKVResponse, Error]] + Response[DefinitionsKVResponse | Error] """ kwargs = _get_kwargs() @@ -125,7 +128,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsKVResponse, Error] + DefinitionsKVResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_latest_rpc_definitions.py b/src/infuse_iot/api_client/api/defs/get_latest_rpc_definitions.py index 7a2bd10b..57433eec 100644 --- a/src/infuse_iot/api_client/api/defs/get_latest_rpc_definitions.py +++ b/src/infuse_iot/api_client/api/defs/get_latest_rpc_definitions.py @@ -26,14 +26,17 @@ def _parse_response( response_200 = DefinitionsRPCResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,7 +65,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs() @@ -85,7 +88,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return sync_detailed( @@ -104,7 +107,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs() @@ -125,7 +128,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_latest_tdf_definitions.py b/src/infuse_iot/api_client/api/defs/get_latest_tdf_definitions.py index ddad953a..e759a545 100644 --- a/src/infuse_iot/api_client/api/defs/get_latest_tdf_definitions.py +++ b/src/infuse_iot/api_client/api/defs/get_latest_tdf_definitions.py @@ -26,14 +26,17 @@ def _parse_response( response_200 = DefinitionsTDFResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,7 +65,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs() @@ -85,7 +88,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return sync_detailed( @@ -104,7 +107,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs() @@ -125,7 +128,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_rpc_definitions_by_version.py b/src/infuse_iot/api_client/api/defs/get_rpc_definitions_by_version.py index b540ffd6..060a240e 100644 --- a/src/infuse_iot/api_client/api/defs/get_rpc_definitions_by_version.py +++ b/src/infuse_iot/api_client/api/defs/get_rpc_definitions_by_version.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/defs/rpc/{version}", + "url": "/defs/rpc/{version}".format( + version=quote(str(version), safe=""), + ), } return _kwargs @@ -28,14 +31,17 @@ def _parse_response( response_200 = DefinitionsRPCResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs( @@ -97,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return sync_detailed( @@ -121,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsRPCResponse, Error]] + Response[DefinitionsRPCResponse | Error] """ kwargs = _get_kwargs( @@ -148,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsRPCResponse, Error] + DefinitionsRPCResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/defs/get_tdf_definitions_by_version.py b/src/infuse_iot/api_client/api/defs/get_tdf_definitions_by_version.py index a73ec7ff..a6aad750 100644 --- a/src/infuse_iot/api_client/api/defs/get_tdf_definitions_by_version.py +++ b/src/infuse_iot/api_client/api/defs/get_tdf_definitions_by_version.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/defs/tdf/{version}", + "url": "/defs/tdf/{version}".format( + version=quote(str(version), safe=""), + ), } return _kwargs @@ -28,14 +31,17 @@ def _parse_response( response_200 = DefinitionsTDFResponse.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs( @@ -97,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return sync_detailed( @@ -121,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[DefinitionsTDFResponse, Error]] + Response[DefinitionsTDFResponse | Error] """ kwargs = _get_kwargs( @@ -148,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[DefinitionsTDFResponse, Error] + DefinitionsTDFResponse | Error """ return ( diff --git a/src/infuse_iot/api_client/api/device/cancel_pending_device_kv_entry_updates_by_device_id_and_key_id.py b/src/infuse_iot/api_client/api/device/cancel_pending_device_kv_entry_updates_by_device_id_and_key_id.py index a9710086..2c918489 100644 --- a/src/infuse_iot/api_client/api/device/cancel_pending_device_kv_entry_updates_by_device_id_and_key_id.py +++ b/src/infuse_iot/api_client/api/device/cancel_pending_device_kv_entry_updates_by_device_id_and_key_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,10 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "delete", - "url": f"/device/deviceId/{device_id}/kv/entries/{key_id}/updates", + "url": "/device/deviceId/{device_id}/kv/entries/{key_id}/updates".format( + device_id=quote(str(device_id), safe=""), + key_id=quote(str(key_id), safe=""), + ), } return _kwargs @@ -28,9 +32,11 @@ def _parse_response( response_200 = DeviceKVEntryUpdate.from_dict(response.json()) return response_200 + if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,7 +71,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntryUpdate]] + Response[Any | DeviceKVEntryUpdate] """ kwargs = _get_kwargs( @@ -97,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntryUpdate] + Any | DeviceKVEntryUpdate """ return sync_detailed( @@ -124,7 +130,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntryUpdate]] + Response[Any | DeviceKVEntryUpdate] """ kwargs = _get_kwargs( @@ -154,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntryUpdate] + Any | DeviceKVEntryUpdate """ return ( diff --git a/src/infuse_iot/api_client/api/device/create_device.py b/src/infuse_iot/api_client/api/device/create_device.py index e2ca71a8..d0fa26b6 100644 --- a/src/infuse_iot/api_client/api/device/create_device.py +++ b/src/infuse_iot/api_client/api/device/create_device.py @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/device", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -35,12 +34,15 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_201 = Device.from_dict(response.json()) return response_201 + if response.status_code == 409: response_409 = cast(Any, None) return response_409 + if response.status_code == 422: response_422 = cast(Any, None) return response_422 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -71,7 +73,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -100,7 +102,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return sync_detailed( @@ -124,7 +126,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -151,7 +153,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return ( diff --git a/src/infuse_iot/api_client/api/device/create_device_kv_entry_update_by_device_id_and_key_id.py b/src/infuse_iot/api_client/api/device/create_device_kv_entry_update_by_device_id_and_key_id.py index 461943fa..9e961089 100644 --- a/src/infuse_iot/api_client/api/device/create_device_kv_entry_update_by_device_id_and_key_id.py +++ b/src/infuse_iot/api_client/api/device/create_device_kv_entry_update_by_device_id_and_key_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -21,12 +22,14 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/device/deviceId/{device_id}/kv/entries/{key_id}/updates", + "url": "/device/deviceId/{device_id}/kv/entries/{key_id}/updates".format( + device_id=quote(str(device_id), safe=""), + key_id=quote(str(key_id), safe=""), + ), } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -40,22 +43,28 @@ def _parse_response( response_200 = DeviceKVEntry.from_dict(response.json()) return response_200 + if response.status_code == 201: response_201 = DeviceKVEntryUpdate.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = cast(Any, None) return response_400 + if response.status_code == 403: response_403 = cast(Any, None) return response_403 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if response.status_code == 409: response_409 = cast(Any, None) return response_409 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -92,7 +101,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntry, DeviceKVEntryUpdate]] + Response[Any | DeviceKVEntry | DeviceKVEntryUpdate] """ kwargs = _get_kwargs( @@ -127,7 +136,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntry, DeviceKVEntryUpdate] + Any | DeviceKVEntry | DeviceKVEntryUpdate """ return sync_detailed( @@ -157,7 +166,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntry, DeviceKVEntryUpdate]] + Response[Any | DeviceKVEntry | DeviceKVEntryUpdate] """ kwargs = _get_kwargs( @@ -190,7 +199,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntry, DeviceKVEntryUpdate] + Any | DeviceKVEntry | DeviceKVEntryUpdate """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_by_device_id.py b/src/infuse_iot/api_client/api/device/get_device_by_device_id.py index f0b08e58..8f16968e 100644 --- a/src/infuse_iot/api_client/api/device/get_device_by_device_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_by_device_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -14,7 +15,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}", + "url": "/device/deviceId/{device_id}".format( + device_id=quote(str(device_id), safe=""), + ), } return _kwargs @@ -25,9 +28,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Device.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,7 +63,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -87,7 +92,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return sync_detailed( @@ -111,7 +116,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -138,7 +143,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_by_id.py b/src/infuse_iot/api_client/api/device/get_device_by_id.py index b1f02466..fe933120 100644 --- a/src/infuse_iot/api_client/api/device/get_device_by_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/id/{id}", + "url": "/device/id/{id}".format( + id=quote(str(id), safe=""), + ), } return _kwargs @@ -26,9 +29,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Device.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,7 +64,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -88,7 +93,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return sync_detailed( @@ -112,7 +117,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -139,7 +144,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_by_soc_and_mcu_id.py b/src/infuse_iot/api_client/api/device/get_device_by_soc_and_mcu_id.py index a0ab2b17..0955b911 100644 --- a/src/infuse_iot/api_client/api/device/get_device_by_soc_and_mcu_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_by_soc_and_mcu_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,10 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/soc/{soc}/mcuId/{mcu_id}", + "url": "/device/soc/{soc}/mcuId/{mcu_id}".format( + soc=quote(str(soc), safe=""), + mcu_id=quote(str(mcu_id), safe=""), + ), } return _kwargs @@ -26,9 +30,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Device.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -61,7 +67,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -93,7 +99,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return sync_detailed( @@ -120,7 +126,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -150,7 +156,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_kv_entries_by_device_id.py b/src/infuse_iot/api_client/api/device/get_device_kv_entries_by_device_id.py index 70e69ffe..ee23ea07 100644 --- a/src/infuse_iot/api_client/api/device/get_device_kv_entries_by_device_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_kv_entries_by_device_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -14,7 +15,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/kv/entries", + "url": "/device/deviceId/{device_id}/kv/entries".format( + device_id=quote(str(device_id), safe=""), + ), } return _kwargs @@ -22,7 +25,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | list["DeviceKVEntry"] | None: +) -> Any | list[DeviceKVEntry] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -32,9 +35,11 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -43,7 +48,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | list["DeviceKVEntry"]]: +) -> Response[Any | list[DeviceKVEntry]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -56,7 +61,7 @@ def sync_detailed( device_id: str, *, client: AuthenticatedClient | Client, -) -> Response[Any | list["DeviceKVEntry"]]: +) -> Response[Any | list[DeviceKVEntry]]: """Get KV entries by DeviceID Args: @@ -67,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, list['DeviceKVEntry']]] + Response[Any | list[DeviceKVEntry]] """ kwargs = _get_kwargs( @@ -85,7 +90,7 @@ def sync( device_id: str, *, client: AuthenticatedClient | Client, -) -> Any | list["DeviceKVEntry"] | None: +) -> Any | list[DeviceKVEntry] | None: """Get KV entries by DeviceID Args: @@ -96,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, list['DeviceKVEntry']] + Any | list[DeviceKVEntry] """ return sync_detailed( @@ -109,7 +114,7 @@ async def asyncio_detailed( device_id: str, *, client: AuthenticatedClient | Client, -) -> Response[Any | list["DeviceKVEntry"]]: +) -> Response[Any | list[DeviceKVEntry]]: """Get KV entries by DeviceID Args: @@ -120,7 +125,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, list['DeviceKVEntry']]] + Response[Any | list[DeviceKVEntry]] """ kwargs = _get_kwargs( @@ -136,7 +141,7 @@ async def asyncio( device_id: str, *, client: AuthenticatedClient | Client, -) -> Any | list["DeviceKVEntry"] | None: +) -> Any | list[DeviceKVEntry] | None: """Get KV entries by DeviceID Args: @@ -147,7 +152,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, list['DeviceKVEntry']] + Any | list[DeviceKVEntry] """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_kv_entry_by_device_id_and_key_id.py b/src/infuse_iot/api_client/api/device/get_device_kv_entry_by_device_id_and_key_id.py index acef74b4..151c1b2c 100644 --- a/src/infuse_iot/api_client/api/device/get_device_kv_entry_by_device_id_and_key_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_kv_entry_by_device_id_and_key_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,10 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/kv/entries/{key_id}", + "url": "/device/deviceId/{device_id}/kv/entries/{key_id}".format( + device_id=quote(str(device_id), safe=""), + key_id=quote(str(key_id), safe=""), + ), } return _kwargs @@ -26,9 +30,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = DeviceKVEntry.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -61,7 +67,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntry]] + Response[Any | DeviceKVEntry] """ kwargs = _get_kwargs( @@ -93,7 +99,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntry] + Any | DeviceKVEntry """ return sync_detailed( @@ -120,7 +126,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceKVEntry]] + Response[Any | DeviceKVEntry] """ kwargs = _get_kwargs( @@ -150,7 +156,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceKVEntry] + Any | DeviceKVEntry """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_kv_entry_updates_by_device_id_and_key_id.py b/src/infuse_iot/api_client/api/device/get_device_kv_entry_updates_by_device_id_and_key_id.py index c7682dfe..0ff9612e 100644 --- a/src/infuse_iot/api_client/api/device/get_device_kv_entry_updates_by_device_id_and_key_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_kv_entry_updates_by_device_id_and_key_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote import httpx @@ -14,13 +15,13 @@ def _get_kwargs( device_id: str, key_id: int, *, - status: Unset | DeviceEntryUpdateStatus = UNSET, - limit: Unset | int = 100, - offset: Unset | int = 0, + status: DeviceEntryUpdateStatus | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, ) -> dict[str, Any]: params: dict[str, Any] = {} - json_status: Unset | str = UNSET + json_status: str | Unset = UNSET if not isinstance(status, Unset): json_status = status.value @@ -34,7 +35,10 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/kv/entries/{key_id}/updates", + "url": "/device/deviceId/{device_id}/kv/entries/{key_id}/updates".format( + device_id=quote(str(device_id), safe=""), + key_id=quote(str(key_id), safe=""), + ), "params": params, } @@ -43,7 +47,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> list["DeviceKVEntryUpdate"] | None: +) -> list[DeviceKVEntryUpdate] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -53,6 +57,7 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -61,7 +66,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[list["DeviceKVEntryUpdate"]]: +) -> Response[list[DeviceKVEntryUpdate]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,25 +80,25 @@ def sync_detailed( key_id: int, *, client: AuthenticatedClient | Client, - status: Unset | DeviceEntryUpdateStatus = UNSET, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["DeviceKVEntryUpdate"]]: + status: DeviceEntryUpdateStatus | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[DeviceKVEntryUpdate]]: """Get KV entry updates by DeviceID and Key ID Args: device_id (str): key_id (int): - status (Union[Unset, DeviceEntryUpdateStatus]): Status of device KV entry update - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + status (DeviceEntryUpdateStatus | Unset): Status of device KV entry update + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['DeviceKVEntryUpdate']] + Response[list[DeviceKVEntryUpdate]] """ kwargs = _get_kwargs( @@ -116,25 +121,25 @@ def sync( key_id: int, *, client: AuthenticatedClient | Client, - status: Unset | DeviceEntryUpdateStatus = UNSET, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["DeviceKVEntryUpdate"] | None: + status: DeviceEntryUpdateStatus | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[DeviceKVEntryUpdate] | None: """Get KV entry updates by DeviceID and Key ID Args: device_id (str): key_id (int): - status (Union[Unset, DeviceEntryUpdateStatus]): Status of device KV entry update - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + status (DeviceEntryUpdateStatus | Unset): Status of device KV entry update + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['DeviceKVEntryUpdate'] + list[DeviceKVEntryUpdate] """ return sync_detailed( @@ -152,25 +157,25 @@ async def asyncio_detailed( key_id: int, *, client: AuthenticatedClient | Client, - status: Unset | DeviceEntryUpdateStatus = UNSET, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["DeviceKVEntryUpdate"]]: + status: DeviceEntryUpdateStatus | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[DeviceKVEntryUpdate]]: """Get KV entry updates by DeviceID and Key ID Args: device_id (str): key_id (int): - status (Union[Unset, DeviceEntryUpdateStatus]): Status of device KV entry update - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + status (DeviceEntryUpdateStatus | Unset): Status of device KV entry update + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['DeviceKVEntryUpdate']] + Response[list[DeviceKVEntryUpdate]] """ kwargs = _get_kwargs( @@ -191,25 +196,25 @@ async def asyncio( key_id: int, *, client: AuthenticatedClient | Client, - status: Unset | DeviceEntryUpdateStatus = UNSET, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["DeviceKVEntryUpdate"] | None: + status: DeviceEntryUpdateStatus | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[DeviceKVEntryUpdate] | None: """Get KV entry updates by DeviceID and Key ID Args: device_id (str): key_id (int): - status (Union[Unset, DeviceEntryUpdateStatus]): Status of device KV entry update - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + status (DeviceEntryUpdateStatus | Unset): Status of device KV entry update + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['DeviceKVEntryUpdate'] + list[DeviceKVEntryUpdate] """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_last_route_by_device_id.py b/src/infuse_iot/api_client/api/device/get_device_last_route_by_device_id.py index de2c8ee7..b211ec86 100644 --- a/src/infuse_iot/api_client/api/device/get_device_last_route_by_device_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_last_route_by_device_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -14,7 +15,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/lastRoute", + "url": "/device/deviceId/{device_id}/lastRoute".format( + device_id=quote(str(device_id), safe=""), + ), } return _kwargs @@ -25,9 +28,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = UplinkRoute.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,7 +63,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, UplinkRoute]] + Response[Any | UplinkRoute] """ kwargs = _get_kwargs( @@ -87,7 +92,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, UplinkRoute] + Any | UplinkRoute """ return sync_detailed( @@ -111,7 +116,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, UplinkRoute]] + Response[Any | UplinkRoute] """ kwargs = _get_kwargs( @@ -138,7 +143,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, UplinkRoute] + Any | UplinkRoute """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_logger_state_by_device_id_and_index.py b/src/infuse_iot/api_client/api/device/get_device_logger_state_by_device_id_and_index.py index 01b0b299..294003c8 100644 --- a/src/infuse_iot/api_client/api/device/get_device_logger_state_by_device_id_and_index.py +++ b/src/infuse_iot/api_client/api/device/get_device_logger_state_by_device_id_and_index.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -15,7 +16,10 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/loggerState/{index}", + "url": "/device/deviceId/{device_id}/loggerState/{index}".format( + device_id=quote(str(device_id), safe=""), + index=quote(str(index), safe=""), + ), } return _kwargs @@ -28,9 +32,11 @@ def _parse_response( response_200 = DeviceLoggerState.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,7 +71,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceLoggerState]] + Response[Any | DeviceLoggerState] """ kwargs = _get_kwargs( @@ -97,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceLoggerState] + Any | DeviceLoggerState """ return sync_detailed( @@ -124,7 +130,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceLoggerState]] + Response[Any | DeviceLoggerState] """ kwargs = _get_kwargs( @@ -154,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceLoggerState] + Any | DeviceLoggerState """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_logger_states_by_device_id.py b/src/infuse_iot/api_client/api/device/get_device_logger_states_by_device_id.py new file mode 100644 index 00000000..6a8c2ce8 --- /dev/null +++ b/src/infuse_iot/api_client/api/device/get_device_logger_states_by_device_id.py @@ -0,0 +1,163 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.device_logger_state_with_index import DeviceLoggerStateWithIndex +from ...types import Response + + +def _get_kwargs( + device_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/device/deviceId/{device_id}/loggerStates".format( + device_id=quote(str(device_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | list[DeviceLoggerStateWithIndex] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = DeviceLoggerStateWithIndex.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | list[DeviceLoggerStateWithIndex]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + device_id: str, + *, + client: AuthenticatedClient | Client, +) -> Response[Any | list[DeviceLoggerStateWithIndex]]: + """Get all logger states by DeviceID + + Args: + device_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | list[DeviceLoggerStateWithIndex]] + """ + + kwargs = _get_kwargs( + device_id=device_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + device_id: str, + *, + client: AuthenticatedClient | Client, +) -> Any | list[DeviceLoggerStateWithIndex] | None: + """Get all logger states by DeviceID + + Args: + device_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | list[DeviceLoggerStateWithIndex] + """ + + return sync_detailed( + device_id=device_id, + client=client, + ).parsed + + +async def asyncio_detailed( + device_id: str, + *, + client: AuthenticatedClient | Client, +) -> Response[Any | list[DeviceLoggerStateWithIndex]]: + """Get all logger states by DeviceID + + Args: + device_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | list[DeviceLoggerStateWithIndex]] + """ + + kwargs = _get_kwargs( + device_id=device_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + device_id: str, + *, + client: AuthenticatedClient | Client, +) -> Any | list[DeviceLoggerStateWithIndex] | None: + """Get all logger states by DeviceID + + Args: + device_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | list[DeviceLoggerStateWithIndex] + """ + + return ( + await asyncio_detailed( + device_id=device_id, + client=client, + ) + ).parsed diff --git a/src/infuse_iot/api_client/api/device/get_device_state_by_device_id.py b/src/infuse_iot/api_client/api/device/get_device_state_by_device_id.py index f7a71878..f4178a03 100644 --- a/src/infuse_iot/api_client/api/device/get_device_state_by_device_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_state_by_device_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -14,7 +15,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/deviceId/{device_id}/state", + "url": "/device/deviceId/{device_id}/state".format( + device_id=quote(str(device_id), safe=""), + ), } return _kwargs @@ -25,9 +28,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = DeviceState.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,7 +63,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -87,7 +92,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return sync_detailed( @@ -111,7 +116,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -138,7 +143,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_device_state_by_id.py b/src/infuse_iot/api_client/api/device/get_device_state_by_id.py index 6bd521d2..b79bd54e 100644 --- a/src/infuse_iot/api_client/api/device/get_device_state_by_id.py +++ b/src/infuse_iot/api_client/api/device/get_device_state_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/device/id/{id}/state", + "url": "/device/id/{id}/state".format( + id=quote(str(id), safe=""), + ), } return _kwargs @@ -26,9 +29,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = DeviceState.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,7 +64,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -88,7 +93,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return sync_detailed( @@ -112,7 +117,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -139,7 +144,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_devices.py b/src/infuse_iot/api_client/api/device/get_devices.py index 2f4b0da9..190f2c2c 100644 --- a/src/infuse_iot/api_client/api/device/get_devices.py +++ b/src/infuse_iot/api_client/api/device/get_devices.py @@ -13,8 +13,8 @@ def _get_kwargs( *, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, + limit: int | Unset = 100, + offset: int | Unset = 0, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -36,7 +36,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list["Device"] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[Device] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -46,13 +46,14 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list["Device"]]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[Device]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,22 +66,22 @@ def sync_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["Device"]]: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[Device]]: """Get all devices in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['Device']] + Response[list[Device]] """ kwargs = _get_kwargs( @@ -100,22 +101,22 @@ def sync( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["Device"] | None: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[Device] | None: """Get all devices in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['Device'] + list[Device] """ return sync_detailed( @@ -130,22 +131,22 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["Device"]]: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[Device]]: """Get all devices in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['Device']] + Response[list[Device]] """ kwargs = _get_kwargs( @@ -163,22 +164,22 @@ async def asyncio( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["Device"] | None: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[Device] | None: """Get all devices in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['Device'] + list[Device] """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_devices_and_states.py b/src/infuse_iot/api_client/api/device/get_devices_and_states.py index 7d66e4cd..37c7b20c 100644 --- a/src/infuse_iot/api_client/api/device/get_devices_and_states.py +++ b/src/infuse_iot/api_client/api/device/get_devices_and_states.py @@ -13,8 +13,8 @@ def _get_kwargs( *, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, + limit: int | Unset = 100, + offset: int | Unset = 0, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -36,7 +36,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list["DeviceAndState"] | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[DeviceAndState] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -46,6 +46,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -54,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[list["DeviceAndState"]]: +) -> Response[list[DeviceAndState]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,22 +68,22 @@ def sync_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["DeviceAndState"]]: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[DeviceAndState]]: """Get all devices and their states in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['DeviceAndState']] + Response[list[DeviceAndState]] """ kwargs = _get_kwargs( @@ -102,22 +103,22 @@ def sync( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["DeviceAndState"] | None: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[DeviceAndState] | None: """Get all devices and their states in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['DeviceAndState'] + list[DeviceAndState] """ return sync_detailed( @@ -132,22 +133,22 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> Response[list["DeviceAndState"]]: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[list[DeviceAndState]]: """Get all devices and their states in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['DeviceAndState']] + Response[list[DeviceAndState]] """ kwargs = _get_kwargs( @@ -165,22 +166,22 @@ async def asyncio( *, client: AuthenticatedClient | Client, organisation_id: UUID, - limit: Unset | int = 100, - offset: Unset | int = 0, -) -> list["DeviceAndState"] | None: + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> list[DeviceAndState] | None: """Get all devices and their states in an organisation Args: organisation_id (UUID): - limit (Union[Unset, int]): Default: 100. - offset (Union[Unset, int]): Default: 0. + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['DeviceAndState'] + list[DeviceAndState] """ return ( diff --git a/src/infuse_iot/api_client/api/device/get_last_routes_for_devices.py b/src/infuse_iot/api_client/api/device/get_last_routes_for_devices.py index 2b51399e..efa3aaf3 100644 --- a/src/infuse_iot/api_client/api/device/get_last_routes_for_devices.py +++ b/src/infuse_iot/api_client/api/device/get_last_routes_for_devices.py @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/device/lastRoute", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -32,7 +31,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> list["UplinkRouteAndDeviceId"] | None: +) -> list[UplinkRouteAndDeviceId] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -42,6 +41,7 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -50,7 +50,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[list["UplinkRouteAndDeviceId"]]: +) -> Response[list[UplinkRouteAndDeviceId]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +63,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, body: GetLastRoutesForDevicesBody, -) -> Response[list["UplinkRouteAndDeviceId"]]: +) -> Response[list[UplinkRouteAndDeviceId]]: """Get last routes for a group of devices Args: @@ -74,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['UplinkRouteAndDeviceId']] + Response[list[UplinkRouteAndDeviceId]] """ kwargs = _get_kwargs( @@ -92,7 +92,7 @@ def sync( *, client: AuthenticatedClient | Client, body: GetLastRoutesForDevicesBody, -) -> list["UplinkRouteAndDeviceId"] | None: +) -> list[UplinkRouteAndDeviceId] | None: """Get last routes for a group of devices Args: @@ -103,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['UplinkRouteAndDeviceId'] + list[UplinkRouteAndDeviceId] """ return sync_detailed( @@ -116,7 +116,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, body: GetLastRoutesForDevicesBody, -) -> Response[list["UplinkRouteAndDeviceId"]]: +) -> Response[list[UplinkRouteAndDeviceId]]: """Get last routes for a group of devices Args: @@ -127,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[list['UplinkRouteAndDeviceId']] + Response[list[UplinkRouteAndDeviceId]] """ kwargs = _get_kwargs( @@ -143,7 +143,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, body: GetLastRoutesForDevicesBody, -) -> list["UplinkRouteAndDeviceId"] | None: +) -> list[UplinkRouteAndDeviceId] | None: """Get last routes for a group of devices Args: @@ -154,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - list['UplinkRouteAndDeviceId'] + list[UplinkRouteAndDeviceId] """ return ( diff --git a/src/infuse_iot/api_client/api/device/update_device_by_id.py b/src/infuse_iot/api_client/api/device/update_device_by_id.py index 2c5bc785..3328ae27 100644 --- a/src/infuse_iot/api_client/api/device/update_device_by_id.py +++ b/src/infuse_iot/api_client/api/device/update_device_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -20,12 +21,13 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "put", - "url": f"/device/id/{id}", + "url": "/device/id/{id}".format( + id=quote(str(id), safe=""), + ), } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -37,9 +39,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Device.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -72,7 +76,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -104,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return sync_detailed( @@ -131,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Device]] + Response[Any | Device] """ kwargs = _get_kwargs( @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Device] + Any | Device """ return ( diff --git a/src/infuse_iot/api_client/api/device/update_device_logger_state_by_device_id_and_index.py b/src/infuse_iot/api_client/api/device/update_device_logger_state_by_device_id_and_index.py new file mode 100644 index 00000000..c9eb9a48 --- /dev/null +++ b/src/infuse_iot/api_client/api/device/update_device_logger_state_by_device_id_and_index.py @@ -0,0 +1,194 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.device_logger_state import DeviceLoggerState +from ...models.device_logger_state_update import DeviceLoggerStateUpdate +from ...types import Response + + +def _get_kwargs( + device_id: str, + index: int, + *, + body: DeviceLoggerStateUpdate, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/device/deviceId/{device_id}/loggerState/{index}".format( + device_id=quote(str(device_id), safe=""), + index=quote(str(index), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | DeviceLoggerState | None: + if response.status_code == 200: + response_200 = DeviceLoggerState.from_dict(response.json()) + + return response_200 + + if response.status_code == 404: + response_404 = cast(Any, None) + return response_404 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | DeviceLoggerState]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + device_id: str, + index: int, + *, + client: AuthenticatedClient | Client, + body: DeviceLoggerStateUpdate, +) -> Response[Any | DeviceLoggerState]: + """Update logger state by DeviceID and index + + Args: + device_id (str): + index (int): + body (DeviceLoggerStateUpdate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | DeviceLoggerState] + """ + + kwargs = _get_kwargs( + device_id=device_id, + index=index, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + device_id: str, + index: int, + *, + client: AuthenticatedClient | Client, + body: DeviceLoggerStateUpdate, +) -> Any | DeviceLoggerState | None: + """Update logger state by DeviceID and index + + Args: + device_id (str): + index (int): + body (DeviceLoggerStateUpdate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | DeviceLoggerState + """ + + return sync_detailed( + device_id=device_id, + index=index, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + device_id: str, + index: int, + *, + client: AuthenticatedClient | Client, + body: DeviceLoggerStateUpdate, +) -> Response[Any | DeviceLoggerState]: + """Update logger state by DeviceID and index + + Args: + device_id (str): + index (int): + body (DeviceLoggerStateUpdate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | DeviceLoggerState] + """ + + kwargs = _get_kwargs( + device_id=device_id, + index=index, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + device_id: str, + index: int, + *, + client: AuthenticatedClient | Client, + body: DeviceLoggerStateUpdate, +) -> Any | DeviceLoggerState | None: + """Update logger state by DeviceID and index + + Args: + device_id (str): + index (int): + body (DeviceLoggerStateUpdate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | DeviceLoggerState + """ + + return ( + await asyncio_detailed( + device_id=device_id, + index=index, + client=client, + body=body, + ) + ).parsed diff --git a/src/infuse_iot/api_client/api/device/update_device_state_by_id.py b/src/infuse_iot/api_client/api/device/update_device_state_by_id.py index fe366d14..295a2b6d 100644 --- a/src/infuse_iot/api_client/api/device/update_device_state_by_id.py +++ b/src/infuse_iot/api_client/api/device/update_device_state_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -20,12 +21,13 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "put", - "url": f"/device/id/{id}/state", + "url": "/device/id/{id}/state".format( + id=quote(str(id), safe=""), + ), } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -37,9 +39,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = DeviceState.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -72,7 +76,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -104,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return sync_detailed( @@ -131,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, DeviceState]] + Response[Any | DeviceState] """ kwargs = _get_kwargs( @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, DeviceState] + Any | DeviceState """ return ( diff --git a/src/infuse_iot/api_client/api/key/derive_device_key.py b/src/infuse_iot/api_client/api/key/derive_device_key.py index f5d00778..67927169 100644 --- a/src/infuse_iot/api_client/api/key/derive_device_key.py +++ b/src/infuse_iot/api_client/api/key/derive_device_key.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/key/derived/device", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -36,10 +35,12 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Key.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -73,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Key]] + Response[Error | Key] """ kwargs = _get_kwargs( @@ -105,7 +106,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Key] + Error | Key """ return sync_detailed( @@ -132,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Key]] + Response[Error | Key] """ kwargs = _get_kwargs( @@ -162,7 +163,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Key] + Error | Key """ return ( diff --git a/src/infuse_iot/api_client/api/key/get_public_key.py b/src/infuse_iot/api_client/api/key/get_public_key.py index d3c6221a..9d357560 100644 --- a/src/infuse_iot/api_client/api/key/get_public_key.py +++ b/src/infuse_iot/api_client/api/key/get_public_key.py @@ -23,6 +23,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Key.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: diff --git a/src/infuse_iot/api_client/api/key/get_shared_secret.py b/src/infuse_iot/api_client/api/key/get_shared_secret.py index 3f4b07ad..4a4b562b 100644 --- a/src/infuse_iot/api_client/api/key/get_shared_secret.py +++ b/src/infuse_iot/api_client/api/key/get_shared_secret.py @@ -20,9 +20,8 @@ def _get_kwargs( "url": "/key/sharedSecret", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -34,6 +33,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Key.from_dict(response.json()) return response_200 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: diff --git a/src/infuse_iot/api_client/api/mqtt/generate_mqtt_token.py b/src/infuse_iot/api_client/api/mqtt/generate_mqtt_token.py index 81afd5f3..a2a85e1d 100644 --- a/src/infuse_iot/api_client/api/mqtt/generate_mqtt_token.py +++ b/src/infuse_iot/api_client/api/mqtt/generate_mqtt_token.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/mqtt/token", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,14 +37,17 @@ def _parse_response( response_200 = GeneratedMQTTToken.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, GeneratedMQTTToken]] + Response[Error | GeneratedMQTTToken] """ kwargs = _get_kwargs( @@ -107,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, GeneratedMQTTToken] + Error | GeneratedMQTTToken """ return sync_detailed( @@ -131,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, GeneratedMQTTToken]] + Response[Error | GeneratedMQTTToken] """ kwargs = _get_kwargs( @@ -158,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, GeneratedMQTTToken] + Error | GeneratedMQTTToken """ return ( diff --git a/src/infuse_iot/api_client/api/network/__init__.py b/src/infuse_iot/api_client/api/network/__init__.py new file mode 100644 index 00000000..2d7c0b23 --- /dev/null +++ b/src/infuse_iot/api_client/api/network/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/src/infuse_iot/api_client/api/network/create_network.py b/src/infuse_iot/api_client/api/network/create_network.py new file mode 100644 index 00000000..93d38e0e --- /dev/null +++ b/src/infuse_iot/api_client/api/network/create_network.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.network import Network +from ...models.new_network import NewNetwork +from ...types import Response + + +def _get_kwargs( + *, + body: NewNetwork, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/network", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Network | None: + if response.status_code == 201: + response_201 = Network.from_dict(response.json()) + + return response_201 + + if response.status_code == 409: + response_409 = cast(Any, None) + return response_409 + + if response.status_code == 422: + response_422 = cast(Any, None) + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Network]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: NewNetwork, +) -> Response[Any | Network]: + """Create a new network + + Args: + body (NewNetwork): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | Network] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: NewNetwork, +) -> Any | Network | None: + """Create a new network + + Args: + body (NewNetwork): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Network + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: NewNetwork, +) -> Response[Any | Network]: + """Create a new network + + Args: + body (NewNetwork): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | Network] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: NewNetwork, +) -> Any | Network | None: + """Create a new network + + Args: + body (NewNetwork): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | Network + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/src/infuse_iot/api_client/api/network/get_networks.py b/src/infuse_iot/api_client/api/network/get_networks.py new file mode 100644 index 00000000..f16432a7 --- /dev/null +++ b/src/infuse_iot/api_client/api/network/get_networks.py @@ -0,0 +1,185 @@ +from http import HTTPStatus +from typing import Any +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.network import Network +from ...types import UNSET, Response + + +def _get_kwargs( + *, + organisation_id: UUID, + include_public: bool = False, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + json_organisation_id = str(organisation_id) + params["organisationId"] = json_organisation_id + + params["includePublic"] = include_public + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/network", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[Network] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Network.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[Network]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + organisation_id: UUID, + include_public: bool = False, +) -> Response[list[Network]]: + """Get networks + + Get all networks in an organisation + + Args: + organisation_id (UUID): + include_public (bool): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list[Network]] + """ + + kwargs = _get_kwargs( + organisation_id=organisation_id, + include_public=include_public, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + organisation_id: UUID, + include_public: bool = False, +) -> list[Network] | None: + """Get networks + + Get all networks in an organisation + + Args: + organisation_id (UUID): + include_public (bool): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list[Network] + """ + + return sync_detailed( + client=client, + organisation_id=organisation_id, + include_public=include_public, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + organisation_id: UUID, + include_public: bool = False, +) -> Response[list[Network]]: + """Get networks + + Get all networks in an organisation + + Args: + organisation_id (UUID): + include_public (bool): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list[Network]] + """ + + kwargs = _get_kwargs( + organisation_id=organisation_id, + include_public=include_public, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + organisation_id: UUID, + include_public: bool = False, +) -> list[Network] | None: + """Get networks + + Get all networks in an organisation + + Args: + organisation_id (UUID): + include_public (bool): Default: False. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list[Network] + """ + + return ( + await asyncio_detailed( + client=client, + organisation_id=organisation_id, + include_public=include_public, + ) + ).parsed diff --git a/src/infuse_iot/api_client/api/organisation/create_organisation.py b/src/infuse_iot/api_client/api/organisation/create_organisation.py index 261c6204..77ae18bc 100644 --- a/src/infuse_iot/api_client/api/organisation/create_organisation.py +++ b/src/infuse_iot/api_client/api/organisation/create_organisation.py @@ -21,9 +21,8 @@ def _get_kwargs( "url": "/organisation", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -35,9 +34,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_201 = Organisation.from_dict(response.json()) return response_201 + if response.status_code == 409: response_409 = cast(Any, None) return response_409 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,7 +69,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -97,7 +98,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return sync_detailed( @@ -121,7 +122,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -148,7 +149,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return ( diff --git a/src/infuse_iot/api_client/api/organisation/get_all_organisations.py b/src/infuse_iot/api_client/api/organisation/get_all_organisations.py index a789a8c7..27500104 100644 --- a/src/infuse_iot/api_client/api/organisation/get_all_organisations.py +++ b/src/infuse_iot/api_client/api/organisation/get_all_organisations.py @@ -21,7 +21,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list["Organisation"] | None: +) -> Error | list[Organisation] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -31,10 +31,12 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -43,7 +45,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list["Organisation"]]: +) -> Response[Error | list[Organisation]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -55,7 +57,7 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, -) -> Response[Error | list["Organisation"]]: +) -> Response[Error | list[Organisation]]: """Get all organisations that user has access to Raises: @@ -63,7 +65,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['Organisation']]] + Response[Error | list[Organisation]] """ kwargs = _get_kwargs() @@ -78,7 +80,7 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, -) -> Error | list["Organisation"] | None: +) -> Error | list[Organisation] | None: """Get all organisations that user has access to Raises: @@ -86,7 +88,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['Organisation']] + Error | list[Organisation] """ return sync_detailed( @@ -97,7 +99,7 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, -) -> Response[Error | list["Organisation"]]: +) -> Response[Error | list[Organisation]]: """Get all organisations that user has access to Raises: @@ -105,7 +107,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['Organisation']]] + Response[Error | list[Organisation]] """ kwargs = _get_kwargs() @@ -118,7 +120,7 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, -) -> Error | list["Organisation"] | None: +) -> Error | list[Organisation] | None: """Get all organisations that user has access to Raises: @@ -126,7 +128,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['Organisation']] + Error | list[Organisation] """ return ( diff --git a/src/infuse_iot/api_client/api/organisation/get_organisation_by_id.py b/src/infuse_iot/api_client/api/organisation/get_organisation_by_id.py index 854be227..a3dcb3f6 100644 --- a/src/infuse_iot/api_client/api/organisation/get_organisation_by_id.py +++ b/src/infuse_iot/api_client/api/organisation/get_organisation_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote from uuid import UUID import httpx @@ -15,7 +16,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/organisation/id/{id}", + "url": "/organisation/id/{id}".format( + id=quote(str(id), safe=""), + ), } return _kwargs @@ -26,9 +29,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Organisation.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,7 +64,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -88,7 +93,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return sync_detailed( @@ -112,7 +117,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -139,7 +144,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return ( diff --git a/src/infuse_iot/api_client/api/organisation/get_organisation_by_name.py b/src/infuse_iot/api_client/api/organisation/get_organisation_by_name.py index 2bca963b..f4445636 100644 --- a/src/infuse_iot/api_client/api/organisation/get_organisation_by_name.py +++ b/src/infuse_iot/api_client/api/organisation/get_organisation_by_name.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any, cast +from urllib.parse import quote import httpx @@ -14,7 +15,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/organisation/name/{name}", + "url": "/organisation/name/{name}".format( + name=quote(str(name), safe=""), + ), } return _kwargs @@ -25,9 +28,11 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = Organisation.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = cast(Any, None) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,7 +63,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -87,7 +92,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return sync_detailed( @@ -111,7 +116,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Organisation]] + Response[Any | Organisation] """ kwargs = _get_kwargs( @@ -138,7 +143,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Organisation] + Any | Organisation """ return ( diff --git a/src/infuse_iot/api_client/api/rpc/get_rp_cs.py b/src/infuse_iot/api_client/api/rpc/get_rp_cs.py index e708d8de..d8efd737 100644 --- a/src/infuse_iot/api_client/api/rpc/get_rp_cs.py +++ b/src/infuse_iot/api_client/api/rpc/get_rp_cs.py @@ -15,36 +15,36 @@ def _get_kwargs( *, - organisation_id: Unset | UUID = UNSET, - device_id: Unset | str = UNSET, - status: Unset | DownlinkMessageStatus = UNSET, - start_time: Unset | datetime.datetime = UNSET, - end_time: Unset | datetime.datetime = UNSET, - limit: Unset | int = 10, - rpc_command_id: Unset | int = UNSET, - show_expired: Unset | bool = True, + organisation_id: UUID | Unset = UNSET, + device_id: str | Unset = UNSET, + status: DownlinkMessageStatus | Unset = UNSET, + start_time: datetime.datetime | Unset = UNSET, + end_time: datetime.datetime | Unset = UNSET, + limit: int | Unset = 10, + rpc_command_id: int | Unset = UNSET, + show_expired: bool | Unset = True, ) -> dict[str, Any]: params: dict[str, Any] = {} - json_organisation_id: Unset | str = UNSET + json_organisation_id: str | Unset = UNSET if not isinstance(organisation_id, Unset): json_organisation_id = str(organisation_id) params["organisationId"] = json_organisation_id params["deviceId"] = device_id - json_status: Unset | str = UNSET + json_status: str | Unset = UNSET if not isinstance(status, Unset): json_status = status.value params["status"] = json_status - json_start_time: Unset | str = UNSET + json_start_time: str | Unset = UNSET if not isinstance(start_time, Unset): json_start_time = start_time.isoformat() params["startTime"] = json_start_time - json_end_time: Unset | str = UNSET + json_end_time: str | Unset = UNSET if not isinstance(end_time, Unset): json_end_time = end_time.isoformat() params["endTime"] = json_end_time @@ -68,7 +68,7 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list["RpcMessage"] | None: +) -> Error | list[RpcMessage] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -78,10 +78,12 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -90,7 +92,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list["RpcMessage"]]: +) -> Response[Error | list[RpcMessage]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -102,36 +104,36 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - organisation_id: Unset | UUID = UNSET, - device_id: Unset | str = UNSET, - status: Unset | DownlinkMessageStatus = UNSET, - start_time: Unset | datetime.datetime = UNSET, - end_time: Unset | datetime.datetime = UNSET, - limit: Unset | int = 10, - rpc_command_id: Unset | int = UNSET, - show_expired: Unset | bool = True, -) -> Response[Error | list["RpcMessage"]]: + organisation_id: UUID | Unset = UNSET, + device_id: str | Unset = UNSET, + status: DownlinkMessageStatus | Unset = UNSET, + start_time: datetime.datetime | Unset = UNSET, + end_time: datetime.datetime | Unset = UNSET, + limit: int | Unset = 10, + rpc_command_id: int | Unset = UNSET, + show_expired: bool | Unset = True, +) -> Response[Error | list[RpcMessage]]: """Get RPC messages Args: - organisation_id (Union[Unset, UUID]): ID of organisation - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be - auto-generated) Example: d291d4d66bf0a955. - status (Union[Unset, DownlinkMessageStatus]): Status of downlink message - start_time (Union[Unset, datetime.datetime]): The start time of the query (only return - items on or after this time) - end_time (Union[Unset, datetime.datetime]): The end time of the query (only return items - on or before this time) - limit (Union[Unset, int]): Maximum number of items to return Default: 10. - rpc_command_id (Union[Unset, int]): ID of RPC command - show_expired (Union[Unset, bool]): Whether to show expired RPC messages Default: True. + organisation_id (UUID | Unset): ID of organisation + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto- + generated) Example: d291d4d66bf0a955. + status (DownlinkMessageStatus | Unset): Status of downlink message + start_time (datetime.datetime | Unset): The start time of the query (only return items on + or after this time) + end_time (datetime.datetime | Unset): The end time of the query (only return items on or + before this time) + limit (int | Unset): Maximum number of items to return Default: 10. + rpc_command_id (int | Unset): ID of RPC command + show_expired (bool | Unset): Whether to show expired RPC messages Default: True. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['RpcMessage']]] + Response[Error | list[RpcMessage]] """ kwargs = _get_kwargs( @@ -155,36 +157,36 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - organisation_id: Unset | UUID = UNSET, - device_id: Unset | str = UNSET, - status: Unset | DownlinkMessageStatus = UNSET, - start_time: Unset | datetime.datetime = UNSET, - end_time: Unset | datetime.datetime = UNSET, - limit: Unset | int = 10, - rpc_command_id: Unset | int = UNSET, - show_expired: Unset | bool = True, -) -> Error | list["RpcMessage"] | None: + organisation_id: UUID | Unset = UNSET, + device_id: str | Unset = UNSET, + status: DownlinkMessageStatus | Unset = UNSET, + start_time: datetime.datetime | Unset = UNSET, + end_time: datetime.datetime | Unset = UNSET, + limit: int | Unset = 10, + rpc_command_id: int | Unset = UNSET, + show_expired: bool | Unset = True, +) -> Error | list[RpcMessage] | None: """Get RPC messages Args: - organisation_id (Union[Unset, UUID]): ID of organisation - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be - auto-generated) Example: d291d4d66bf0a955. - status (Union[Unset, DownlinkMessageStatus]): Status of downlink message - start_time (Union[Unset, datetime.datetime]): The start time of the query (only return - items on or after this time) - end_time (Union[Unset, datetime.datetime]): The end time of the query (only return items - on or before this time) - limit (Union[Unset, int]): Maximum number of items to return Default: 10. - rpc_command_id (Union[Unset, int]): ID of RPC command - show_expired (Union[Unset, bool]): Whether to show expired RPC messages Default: True. + organisation_id (UUID | Unset): ID of organisation + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto- + generated) Example: d291d4d66bf0a955. + status (DownlinkMessageStatus | Unset): Status of downlink message + start_time (datetime.datetime | Unset): The start time of the query (only return items on + or after this time) + end_time (datetime.datetime | Unset): The end time of the query (only return items on or + before this time) + limit (int | Unset): Maximum number of items to return Default: 10. + rpc_command_id (int | Unset): ID of RPC command + show_expired (bool | Unset): Whether to show expired RPC messages Default: True. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['RpcMessage']] + Error | list[RpcMessage] """ return sync_detailed( @@ -203,36 +205,36 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - organisation_id: Unset | UUID = UNSET, - device_id: Unset | str = UNSET, - status: Unset | DownlinkMessageStatus = UNSET, - start_time: Unset | datetime.datetime = UNSET, - end_time: Unset | datetime.datetime = UNSET, - limit: Unset | int = 10, - rpc_command_id: Unset | int = UNSET, - show_expired: Unset | bool = True, -) -> Response[Error | list["RpcMessage"]]: + organisation_id: UUID | Unset = UNSET, + device_id: str | Unset = UNSET, + status: DownlinkMessageStatus | Unset = UNSET, + start_time: datetime.datetime | Unset = UNSET, + end_time: datetime.datetime | Unset = UNSET, + limit: int | Unset = 10, + rpc_command_id: int | Unset = UNSET, + show_expired: bool | Unset = True, +) -> Response[Error | list[RpcMessage]]: """Get RPC messages Args: - organisation_id (Union[Unset, UUID]): ID of organisation - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be - auto-generated) Example: d291d4d66bf0a955. - status (Union[Unset, DownlinkMessageStatus]): Status of downlink message - start_time (Union[Unset, datetime.datetime]): The start time of the query (only return - items on or after this time) - end_time (Union[Unset, datetime.datetime]): The end time of the query (only return items - on or before this time) - limit (Union[Unset, int]): Maximum number of items to return Default: 10. - rpc_command_id (Union[Unset, int]): ID of RPC command - show_expired (Union[Unset, bool]): Whether to show expired RPC messages Default: True. + organisation_id (UUID | Unset): ID of organisation + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto- + generated) Example: d291d4d66bf0a955. + status (DownlinkMessageStatus | Unset): Status of downlink message + start_time (datetime.datetime | Unset): The start time of the query (only return items on + or after this time) + end_time (datetime.datetime | Unset): The end time of the query (only return items on or + before this time) + limit (int | Unset): Maximum number of items to return Default: 10. + rpc_command_id (int | Unset): ID of RPC command + show_expired (bool | Unset): Whether to show expired RPC messages Default: True. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['RpcMessage']]] + Response[Error | list[RpcMessage]] """ kwargs = _get_kwargs( @@ -254,36 +256,36 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - organisation_id: Unset | UUID = UNSET, - device_id: Unset | str = UNSET, - status: Unset | DownlinkMessageStatus = UNSET, - start_time: Unset | datetime.datetime = UNSET, - end_time: Unset | datetime.datetime = UNSET, - limit: Unset | int = 10, - rpc_command_id: Unset | int = UNSET, - show_expired: Unset | bool = True, -) -> Error | list["RpcMessage"] | None: + organisation_id: UUID | Unset = UNSET, + device_id: str | Unset = UNSET, + status: DownlinkMessageStatus | Unset = UNSET, + start_time: datetime.datetime | Unset = UNSET, + end_time: datetime.datetime | Unset = UNSET, + limit: int | Unset = 10, + rpc_command_id: int | Unset = UNSET, + show_expired: bool | Unset = True, +) -> Error | list[RpcMessage] | None: """Get RPC messages Args: - organisation_id (Union[Unset, UUID]): ID of organisation - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be - auto-generated) Example: d291d4d66bf0a955. - status (Union[Unset, DownlinkMessageStatus]): Status of downlink message - start_time (Union[Unset, datetime.datetime]): The start time of the query (only return - items on or after this time) - end_time (Union[Unset, datetime.datetime]): The end time of the query (only return items - on or before this time) - limit (Union[Unset, int]): Maximum number of items to return Default: 10. - rpc_command_id (Union[Unset, int]): ID of RPC command - show_expired (Union[Unset, bool]): Whether to show expired RPC messages Default: True. + organisation_id (UUID | Unset): ID of organisation + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto- + generated) Example: d291d4d66bf0a955. + status (DownlinkMessageStatus | Unset): Status of downlink message + start_time (datetime.datetime | Unset): The start time of the query (only return items on + or after this time) + end_time (datetime.datetime | Unset): The end time of the query (only return items on or + before this time) + limit (int | Unset): Maximum number of items to return Default: 10. + rpc_command_id (int | Unset): ID of RPC command + show_expired (bool | Unset): Whether to show expired RPC messages Default: True. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['RpcMessage']] + Error | list[RpcMessage] """ return ( diff --git a/src/infuse_iot/api_client/api/rpc/get_rpc_by_id.py b/src/infuse_iot/api_client/api/rpc/get_rpc_by_id.py index 7a812d51..0f0294fc 100644 --- a/src/infuse_iot/api_client/api/rpc/get_rpc_by_id.py +++ b/src/infuse_iot/api_client/api/rpc/get_rpc_by_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus from typing import Any +from urllib.parse import quote from uuid import UUID import httpx @@ -16,7 +17,9 @@ def _get_kwargs( ) -> dict[str, Any]: _kwargs: dict[str, Any] = { "method": "get", - "url": f"/rpc/{id}", + "url": "/rpc/{id}".format( + id=quote(str(id), safe=""), + ), } return _kwargs @@ -27,14 +30,17 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res response_200 = RpcMessage.from_dict(response.json()) return response_200 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,7 +71,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RpcMessage]] + Response[Error | RpcMessage] """ kwargs = _get_kwargs( @@ -94,7 +100,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RpcMessage] + Error | RpcMessage """ return sync_detailed( @@ -118,7 +124,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, RpcMessage]] + Response[Error | RpcMessage] """ kwargs = _get_kwargs( @@ -145,7 +151,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, RpcMessage] + Error | RpcMessage """ return ( diff --git a/src/infuse_iot/api_client/api/rpc/send_rpc.py b/src/infuse_iot/api_client/api/rpc/send_rpc.py index 9cfea59a..d418989d 100644 --- a/src/infuse_iot/api_client/api/rpc/send_rpc.py +++ b/src/infuse_iot/api_client/api/rpc/send_rpc.py @@ -22,9 +22,8 @@ def _get_kwargs( "url": "/rpc", } - _body = body.to_dict() + _kwargs["json"] = body.to_dict() - _kwargs["json"] = _body headers["Content-Type"] = "application/json" _kwargs["headers"] = headers @@ -38,18 +37,22 @@ def _parse_response( response_201 = CreatedRpcMessage.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 403: response_403 = Error.from_dict(response.json()) return response_403 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -82,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreatedRpcMessage, Error]] + Response[CreatedRpcMessage | Error] """ kwargs = _get_kwargs( @@ -111,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreatedRpcMessage, Error] + CreatedRpcMessage | Error """ return sync_detailed( @@ -135,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreatedRpcMessage, Error]] + Response[CreatedRpcMessage | Error] """ kwargs = _get_kwargs( @@ -162,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreatedRpcMessage, Error] + CreatedRpcMessage | Error """ return ( diff --git a/src/infuse_iot/api_client/client.py b/src/infuse_iot/api_client/client.py index 3f312fb1..1b7055ab 100644 --- a/src/infuse_iot/api_client/client.py +++ b/src/infuse_iot/api_client/client.py @@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/src/infuse_iot/api_client/models/__init__.py b/src/infuse_iot/api_client/models/__init__.py index 497db472..c9fe1817 100644 --- a/src/infuse_iot/api_client/models/__init__.py +++ b/src/infuse_iot/api_client/models/__init__.py @@ -48,6 +48,8 @@ from .device_kv_entry_decoded import DeviceKVEntryDecoded from .device_kv_entry_update import DeviceKVEntryUpdate from .device_logger_state import DeviceLoggerState +from .device_logger_state_update import DeviceLoggerStateUpdate +from .device_logger_state_with_index import DeviceLoggerStateWithIndex from .device_metadata import DeviceMetadata from .device_metadata_update import DeviceMetadataUpdate from .device_metadata_update_operation import DeviceMetadataUpdateOperation @@ -70,11 +72,13 @@ from .key import Key from .key_interface import KeyInterface from .metadata_field import MetadataField +from .network import Network from .new_board import NewBoard from .new_device import NewDevice from .new_device_kv_entry_update import NewDeviceKVEntryUpdate from .new_device_kv_entry_update_decoded import NewDeviceKVEntryUpdateDecoded from .new_device_state import NewDeviceState +from .new_network import NewNetwork from .new_organisation import NewOrganisation from .new_rpc_message import NewRPCMessage from .new_rpc_req import NewRPCReq @@ -140,6 +144,8 @@ "DeviceKVEntryDecoded", "DeviceKVEntryUpdate", "DeviceLoggerState", + "DeviceLoggerStateUpdate", + "DeviceLoggerStateWithIndex", "DeviceMetadata", "DeviceMetadataUpdate", "DeviceMetadataUpdateOperation", @@ -162,11 +168,13 @@ "Key", "KeyInterface", "MetadataField", + "Network", "NewBoard", "NewDevice", "NewDeviceKVEntryUpdate", "NewDeviceKVEntryUpdateDecoded", "NewDeviceState", + "NewNetwork", "NewOrganisation", "NewRPCMessage", "NewRPCReq", diff --git a/src/infuse_iot/api_client/models/algorithm.py b/src/infuse_iot/api_client/models/algorithm.py index fd48f4aa..5444cdd0 100644 --- a/src/infuse_iot/api_client/models/algorithm.py +++ b/src/infuse_iot/api_client/models/algorithm.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/application_version.py b/src/infuse_iot/api_client/models/application_version.py index 52215c1d..c64b3a32 100644 --- a/src/infuse_iot/api_client/models/application_version.py +++ b/src/infuse_iot/api_client/models/application_version.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/board.py b/src/infuse_iot/api_client/models/board.py index 2f014f0b..c74fa6ac 100644 --- a/src/infuse_iot/api_client/models/board.py +++ b/src/infuse_iot/api_client/models/board.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -7,8 +9,6 @@ from attrs import field as _attrs_field from dateutil.parser import isoparse -from ..types import UNSET, Unset - if TYPE_CHECKING: from ..models.metadata_field import MetadataField @@ -27,8 +27,8 @@ class Board: description (str): Description of board Example: Extended description of board. soc (str): System on Chip (SoC) of board Example: nRF9151. organisation_id (UUID): ID of organisation for board to exist in - metadata_fields (Union[Unset, list['MetadataField']]): Metadata fields for board Example: [{'name': 'Field - Name', 'required': True, 'unique': False}]. + metadata_fields (list[MetadataField]): Metadata fields for board Example: [{'name': 'Field Name', 'required': + True, 'unique': False}]. """ id: UUID @@ -38,7 +38,7 @@ class Board: description: str soc: str organisation_id: UUID - metadata_fields: Unset | list["MetadataField"] = UNSET + metadata_fields: list[MetadataField] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -56,14 +56,10 @@ def to_dict(self) -> dict[str, Any]: organisation_id = str(self.organisation_id) - metadata_fields: Unset | list[dict[str, Any]] = UNSET - if not isinstance(self.metadata_fields, Unset): - metadata_fields = [] - for componentsschemas_board_metadata_fields_item_data in self.metadata_fields: - componentsschemas_board_metadata_fields_item = ( - componentsschemas_board_metadata_fields_item_data.to_dict() - ) - metadata_fields.append(componentsschemas_board_metadata_fields_item) + metadata_fields = [] + for componentsschemas_board_metadata_fields_item_data in self.metadata_fields: + componentsschemas_board_metadata_fields_item = componentsschemas_board_metadata_fields_item_data.to_dict() + metadata_fields.append(componentsschemas_board_metadata_fields_item) field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) @@ -76,10 +72,9 @@ def to_dict(self) -> dict[str, Any]: "description": description, "soc": soc, "organisationId": organisation_id, + "metadataFields": metadata_fields, } ) - if metadata_fields is not UNSET: - field_dict["metadataFields"] = metadata_fields return field_dict @@ -103,8 +98,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: organisation_id = UUID(d.pop("organisationId")) metadata_fields = [] - _metadata_fields = d.pop("metadataFields", UNSET) - for componentsschemas_board_metadata_fields_item_data in _metadata_fields or []: + _metadata_fields = d.pop("metadataFields") + for componentsschemas_board_metadata_fields_item_data in _metadata_fields: componentsschemas_board_metadata_fields_item = MetadataField.from_dict( componentsschemas_board_metadata_fields_item_data ) diff --git a/src/infuse_iot/api_client/models/bt_le_route.py b/src/infuse_iot/api_client/models/bt_le_route.py index 45320399..60ec2026 100644 --- a/src/infuse_iot/api_client/models/bt_le_route.py +++ b/src/infuse_iot/api_client/models/bt_le_route.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/coap_file_stats.py b/src/infuse_iot/api_client/models/coap_file_stats.py index 51a0a2c2..d47e6d4d 100644 --- a/src/infuse_iot/api_client/models/coap_file_stats.py +++ b/src/infuse_iot/api_client/models/coap_file_stats.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/coap_files_list.py b/src/infuse_iot/api_client/models/coap_files_list.py index 13dd5be9..4afef3d8 100644 --- a/src/infuse_iot/api_client/models/coap_files_list.py +++ b/src/infuse_iot/api_client/models/coap_files_list.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/src/infuse_iot/api_client/models/created_board_properties.py b/src/infuse_iot/api_client/models/created_board_properties.py index e2679b19..72e9e840 100644 --- a/src/infuse_iot/api_client/models/created_board_properties.py +++ b/src/infuse_iot/api_client/models/created_board_properties.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/created_device_properties.py b/src/infuse_iot/api_client/models/created_device_properties.py index 9fbbf2ae..d68647d7 100644 --- a/src/infuse_iot/api_client/models/created_device_properties.py +++ b/src/infuse_iot/api_client/models/created_device_properties.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/created_organisation_properties.py b/src/infuse_iot/api_client/models/created_organisation_properties.py index fd625506..a298c336 100644 --- a/src/infuse_iot/api_client/models/created_organisation_properties.py +++ b/src/infuse_iot/api_client/models/created_organisation_properties.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/created_rpc_message.py b/src/infuse_iot/api_client/models/created_rpc_message.py index edd95fc5..20c152de 100644 --- a/src/infuse_iot/api_client/models/created_rpc_message.py +++ b/src/infuse_iot/api_client/models/created_rpc_message.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/definitions_enum_definition.py b/src/infuse_iot/api_client/models/definitions_enum_definition.py index b41ad5b2..0ad72c2e 100644 --- a/src/infuse_iot/api_client/models/definitions_enum_definition.py +++ b/src/infuse_iot/api_client/models/definitions_enum_definition.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -17,12 +19,12 @@ class DefinitionsEnumDefinition: Attributes: description (str): type_ (str): - values (list['DefinitionsEnumValue']): + values (list[DefinitionsEnumValue]): """ description: str type_: str - values: list["DefinitionsEnumValue"] + values: list[DefinitionsEnumValue] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_enum_value.py b/src/infuse_iot/api_client/models/definitions_enum_value.py index 8d425e33..5350b865 100644 --- a/src/infuse_iot/api_client/models/definitions_enum_value.py +++ b/src/infuse_iot/api_client/models/definitions_enum_value.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/definitions_field_conversion.py b/src/infuse_iot/api_client/models/definitions_field_conversion.py index a2eabcdb..629ec714 100644 --- a/src/infuse_iot/api_client/models/definitions_field_conversion.py +++ b/src/infuse_iot/api_client/models/definitions_field_conversion.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -15,14 +17,14 @@ class DefinitionsFieldConversion: """Conversion formula for a field (m * + c) Attributes: - m (Union[Unset, float]): - c (Union[Unset, float]): - int_ (Union[Unset, DefinitionsFieldConversionInt]): Byte array value should be treated as an integer + m (float | Unset): + c (float | Unset): + int_ (DefinitionsFieldConversionInt | Unset): Byte array value should be treated as an integer """ - m: Unset | float = UNSET - c: Unset | float = UNSET - int_: Unset | DefinitionsFieldConversionInt = UNSET + m: float | Unset = UNSET + c: float | Unset = UNSET + int_: DefinitionsFieldConversionInt | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -30,7 +32,7 @@ def to_dict(self) -> dict[str, Any]: c = self.c - int_: Unset | str = UNSET + int_: str | Unset = UNSET if not isinstance(self.int_, Unset): int_ = self.int_.value @@ -54,7 +56,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: c = d.pop("c", UNSET) _int_ = d.pop("int", UNSET) - int_: Unset | DefinitionsFieldConversionInt + int_: DefinitionsFieldConversionInt | Unset if isinstance(_int_, Unset): int_ = UNSET else: diff --git a/src/infuse_iot/api_client/models/definitions_field_definition.py b/src/infuse_iot/api_client/models/definitions_field_definition.py index ef14a30c..2c80ab1f 100644 --- a/src/infuse_iot/api_client/models/definitions_field_definition.py +++ b/src/infuse_iot/api_client/models/definitions_field_definition.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,21 +22,21 @@ class DefinitionsFieldDefinition: Attributes: name (str): Field name type_ (str): Field type - description (Union[Unset, str]): Field description - num (Union[Unset, int]): If field is array, the number of elements (0 for variable length) - counted_by (Union[Unset, str]): If field is array, the name of the field that contains the number of elements + description (str | Unset): Field description + num (int | Unset): If field is array, the number of elements (0 for variable length) + counted_by (str | Unset): If field is array, the name of the field that contains the number of elements (overrides num) - display (Union[Unset, DefinitionsFieldDisplay]): Display settings for a field - conversion (Union[Unset, DefinitionsFieldConversion]): Conversion formula for a field (m * + c) + display (DefinitionsFieldDisplay | Unset): Display settings for a field + conversion (DefinitionsFieldConversion | Unset): Conversion formula for a field (m * + c) """ name: str type_: str - description: Unset | str = UNSET - num: Unset | int = UNSET - counted_by: Unset | str = UNSET - display: Union[Unset, "DefinitionsFieldDisplay"] = UNSET - conversion: Union[Unset, "DefinitionsFieldConversion"] = UNSET + description: str | Unset = UNSET + num: int | Unset = UNSET + counted_by: str | Unset = UNSET + display: DefinitionsFieldDisplay | Unset = UNSET + conversion: DefinitionsFieldConversion | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -48,11 +50,11 @@ def to_dict(self) -> dict[str, Any]: counted_by = self.counted_by - display: Unset | dict[str, Any] = UNSET + display: dict[str, Any] | Unset = UNSET if not isinstance(self.display, Unset): display = self.display.to_dict() - conversion: Unset | dict[str, Any] = UNSET + conversion: dict[str, Any] | Unset = UNSET if not isinstance(self.conversion, Unset): conversion = self.conversion.to_dict() @@ -94,14 +96,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: counted_by = d.pop("counted_by", UNSET) _display = d.pop("display", UNSET) - display: Unset | DefinitionsFieldDisplay + display: DefinitionsFieldDisplay | Unset if isinstance(_display, Unset): display = UNSET else: display = DefinitionsFieldDisplay.from_dict(_display) _conversion = d.pop("conversion", UNSET) - conversion: Unset | DefinitionsFieldConversion + conversion: DefinitionsFieldConversion | Unset if isinstance(_conversion, Unset): conversion = UNSET else: diff --git a/src/infuse_iot/api_client/models/definitions_field_display.py b/src/infuse_iot/api_client/models/definitions_field_display.py index c8640f92..bf75217e 100644 --- a/src/infuse_iot/api_client/models/definitions_field_display.py +++ b/src/infuse_iot/api_client/models/definitions_field_display.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -15,18 +17,18 @@ class DefinitionsFieldDisplay: """Display settings for a field Attributes: - fmt (Union[Unset, DefinitionsFieldDisplayFmt]): Format string for field - digits (Union[Unset, int]): - postfix (Union[Unset, str]): + fmt (DefinitionsFieldDisplayFmt | Unset): Format string for field + digits (int | Unset): + postfix (str | Unset): """ - fmt: Unset | DefinitionsFieldDisplayFmt = UNSET - digits: Unset | int = UNSET - postfix: Unset | str = UNSET + fmt: DefinitionsFieldDisplayFmt | Unset = UNSET + digits: int | Unset = UNSET + postfix: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - fmt: Unset | str = UNSET + fmt: str | Unset = UNSET if not isinstance(self.fmt, Unset): fmt = self.fmt.value @@ -50,7 +52,7 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) _fmt = d.pop("fmt", UNSET) - fmt: Unset | DefinitionsFieldDisplayFmt + fmt: DefinitionsFieldDisplayFmt | Unset if isinstance(_fmt, Unset): fmt = UNSET else: diff --git a/src/infuse_iot/api_client/models/definitions_kv.py b/src/infuse_iot/api_client/models/definitions_kv.py index 41be149b..7f72b641 100644 --- a/src/infuse_iot/api_client/models/definitions_kv.py +++ b/src/infuse_iot/api_client/models/definitions_kv.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -20,8 +22,8 @@ class DefinitionsKV: definitions (DefinitionsKVDefinitions): """ - structs: "DefinitionsKVStructs" - definitions: "DefinitionsKVDefinitions" + structs: DefinitionsKVStructs + definitions: DefinitionsKVDefinitions additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_kv_definition.py b/src/infuse_iot/api_client/models/definitions_kv_definition.py index df29bc4d..314f5b3c 100644 --- a/src/infuse_iot/api_client/models/definitions_kv_definition.py +++ b/src/infuse_iot/api_client/models/definitions_kv_definition.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -19,24 +21,24 @@ class DefinitionsKVDefinition: Attributes: name (str): description (str): - fields (list['DefinitionsFieldDefinition']): - reflect (Union[Unset, bool]): - read_only (Union[Unset, bool]): - write_only (Union[Unset, bool]): - default (Union[Unset, str]): - depends_on (Union[Unset, str]): - range_ (Union[Unset, int]): + fields (list[DefinitionsFieldDefinition]): + reflect (bool | Unset): + read_only (bool | Unset): + write_only (bool | Unset): + default (str | Unset): + depends_on (str | Unset): + range_ (int | Unset): """ name: str description: str - fields: list["DefinitionsFieldDefinition"] - reflect: Unset | bool = UNSET - read_only: Unset | bool = UNSET - write_only: Unset | bool = UNSET - default: Unset | str = UNSET - depends_on: Unset | str = UNSET - range_: Unset | int = UNSET + fields: list[DefinitionsFieldDefinition] + reflect: bool | Unset = UNSET + read_only: bool | Unset = UNSET + write_only: bool | Unset = UNSET + default: str | Unset = UNSET + depends_on: str | Unset = UNSET + range_: int | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_kv_definitions.py b/src/infuse_iot/api_client/models/definitions_kv_definitions.py index 57d02cd4..261c224a 100644 --- a/src/infuse_iot/api_client/models/definitions_kv_definitions.py +++ b/src/infuse_iot/api_client/models/definitions_kv_definitions.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsKVDefinitions: """ """ - additional_properties: dict[str, "DefinitionsKVDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsKVDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsKVDefinition": + def __getitem__(self, key: str) -> DefinitionsKVDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsKVDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsKVDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_kv_response.py b/src/infuse_iot/api_client/models/definitions_kv_response.py index e8b1cb5f..48472255 100644 --- a/src/infuse_iot/api_client/models/definitions_kv_response.py +++ b/src/infuse_iot/api_client/models/definitions_kv_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -24,7 +26,7 @@ class DefinitionsKVResponse: created_at: datetime.datetime version: int - definitions: "DefinitionsKV" + definitions: DefinitionsKV additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_kv_structs.py b/src/infuse_iot/api_client/models/definitions_kv_structs.py index 7464fa15..3bf749f6 100644 --- a/src/infuse_iot/api_client/models/definitions_kv_structs.py +++ b/src/infuse_iot/api_client/models/definitions_kv_structs.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsKVStructs: """ """ - additional_properties: dict[str, "DefinitionsStructDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsStructDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsStructDefinition": + def __getitem__(self, key: str) -> DefinitionsStructDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsStructDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsStructDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_rpc.py b/src/infuse_iot/api_client/models/definitions_rpc.py index 91076f29..6b6b9978 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc.py +++ b/src/infuse_iot/api_client/models/definitions_rpc.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -22,9 +24,9 @@ class DefinitionsRPC: enums (DefinitionsRPCEnums): """ - commands: "DefinitionsRPCCommands" - structs: "DefinitionsRPCStructs" - enums: "DefinitionsRPCEnums" + commands: DefinitionsRPCCommands + structs: DefinitionsRPCStructs + enums: DefinitionsRPCEnums additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_rpc_command.py b/src/infuse_iot/api_client/models/definitions_rpc_command.py index 04acd3a1..73453459 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc_command.py +++ b/src/infuse_iot/api_client/models/definitions_rpc_command.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -21,21 +23,21 @@ class DefinitionsRPCCommand: name (str): description (str): default_auth (DefinitionsRPCCommandDefaultAuth): - request_params (list['DefinitionsFieldDefinition']): - response_params (list['DefinitionsFieldDefinition']): - depends_on (Union[Unset, str]): - default (Union[Unset, str]): - rpc_data (Union[Unset, bool]): Whether the command is an RPC data command + request_params (list[DefinitionsFieldDefinition]): + response_params (list[DefinitionsFieldDefinition]): + depends_on (str | Unset): + default (str | Unset): + rpc_data (bool | Unset): Whether the command is an RPC data command """ name: str description: str default_auth: DefinitionsRPCCommandDefaultAuth - request_params: list["DefinitionsFieldDefinition"] - response_params: list["DefinitionsFieldDefinition"] - depends_on: Unset | str = UNSET - default: Unset | str = UNSET - rpc_data: Unset | bool = UNSET + request_params: list[DefinitionsFieldDefinition] + response_params: list[DefinitionsFieldDefinition] + depends_on: str | Unset = UNSET + default: str | Unset = UNSET + rpc_data: bool | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_rpc_commands.py b/src/infuse_iot/api_client/models/definitions_rpc_commands.py index 9a300f77..b042f301 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc_commands.py +++ b/src/infuse_iot/api_client/models/definitions_rpc_commands.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsRPCCommands: """ """ - additional_properties: dict[str, "DefinitionsRPCCommand"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsRPCCommand] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsRPCCommand": + def __getitem__(self, key: str) -> DefinitionsRPCCommand: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsRPCCommand") -> None: + def __setitem__(self, key: str, value: DefinitionsRPCCommand) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_rpc_enums.py b/src/infuse_iot/api_client/models/definitions_rpc_enums.py index aff6ec2c..6735b34e 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc_enums.py +++ b/src/infuse_iot/api_client/models/definitions_rpc_enums.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsRPCEnums: """ """ - additional_properties: dict[str, "DefinitionsEnumDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsEnumDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsEnumDefinition": + def __getitem__(self, key: str) -> DefinitionsEnumDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsEnumDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsEnumDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_rpc_response.py b/src/infuse_iot/api_client/models/definitions_rpc_response.py index a3b58dc1..00459557 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc_response.py +++ b/src/infuse_iot/api_client/models/definitions_rpc_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -24,7 +26,7 @@ class DefinitionsRPCResponse: created_at: datetime.datetime version: int - definitions: "DefinitionsRPC" + definitions: DefinitionsRPC additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_rpc_structs.py b/src/infuse_iot/api_client/models/definitions_rpc_structs.py index 35e36c78..fd759a68 100644 --- a/src/infuse_iot/api_client/models/definitions_rpc_structs.py +++ b/src/infuse_iot/api_client/models/definitions_rpc_structs.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsRPCStructs: """ """ - additional_properties: dict[str, "DefinitionsStructDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsStructDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsStructDefinition": + def __getitem__(self, key: str) -> DefinitionsStructDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsStructDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsStructDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_struct_definition.py b/src/infuse_iot/api_client/models/definitions_struct_definition.py index 8065ffef..7898439a 100644 --- a/src/infuse_iot/api_client/models/definitions_struct_definition.py +++ b/src/infuse_iot/api_client/models/definitions_struct_definition.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -16,11 +18,11 @@ class DefinitionsStructDefinition: """ Attributes: description (str): - fields (list['DefinitionsFieldDefinition']): + fields (list[DefinitionsFieldDefinition]): """ description: str - fields: list["DefinitionsFieldDefinition"] + fields: list[DefinitionsFieldDefinition] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_tdf.py b/src/infuse_iot/api_client/models/definitions_tdf.py index 27f994b7..8f3df996 100644 --- a/src/infuse_iot/api_client/models/definitions_tdf.py +++ b/src/infuse_iot/api_client/models/definitions_tdf.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -20,8 +22,8 @@ class DefinitionsTDF: definitions (DefinitionsTDFDefinitions): """ - structs: "DefinitionsTDFStructs" - definitions: "DefinitionsTDFDefinitions" + structs: DefinitionsTDFStructs + definitions: DefinitionsTDFDefinitions additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_tdf_definition.py b/src/infuse_iot/api_client/models/definitions_tdf_definition.py index 92322e9f..f7d79599 100644 --- a/src/infuse_iot/api_client/models/definitions_tdf_definition.py +++ b/src/infuse_iot/api_client/models/definitions_tdf_definition.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -17,12 +19,12 @@ class DefinitionsTDFDefinition: Attributes: name (str): description (str): - fields (list['DefinitionsFieldDefinition']): + fields (list[DefinitionsFieldDefinition]): """ name: str description: str - fields: list["DefinitionsFieldDefinition"] + fields: list[DefinitionsFieldDefinition] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_tdf_definitions.py b/src/infuse_iot/api_client/models/definitions_tdf_definitions.py index c96f7284..dfa4c9bb 100644 --- a/src/infuse_iot/api_client/models/definitions_tdf_definitions.py +++ b/src/infuse_iot/api_client/models/definitions_tdf_definitions.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsTDFDefinitions: """ """ - additional_properties: dict[str, "DefinitionsTDFDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsTDFDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsTDFDefinition": + def __getitem__(self, key: str) -> DefinitionsTDFDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsTDFDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsTDFDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/definitions_tdf_response.py b/src/infuse_iot/api_client/models/definitions_tdf_response.py index 133a3974..d6c18ae7 100644 --- a/src/infuse_iot/api_client/models/definitions_tdf_response.py +++ b/src/infuse_iot/api_client/models/definitions_tdf_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -24,7 +26,7 @@ class DefinitionsTDFResponse: created_at: datetime.datetime version: int - definitions: "DefinitionsTDF" + definitions: DefinitionsTDF additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/definitions_tdf_structs.py b/src/infuse_iot/api_client/models/definitions_tdf_structs.py index 11804bba..7690b2c9 100644 --- a/src/infuse_iot/api_client/models/definitions_tdf_structs.py +++ b/src/infuse_iot/api_client/models/definitions_tdf_structs.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,7 +17,7 @@ class DefinitionsTDFStructs: """ """ - additional_properties: dict[str, "DefinitionsStructDefinition"] = _attrs_field(init=False, factory=dict) + additional_properties: dict[str, DefinitionsStructDefinition] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} @@ -44,10 +46,10 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> "DefinitionsStructDefinition": + def __getitem__(self, key: str) -> DefinitionsStructDefinition: return self.additional_properties[key] - def __setitem__(self, key: str, value: "DefinitionsStructDefinition") -> None: + def __setitem__(self, key: str, value: DefinitionsStructDefinition) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/src/infuse_iot/api_client/models/derive_device_key_body.py b/src/infuse_iot/api_client/models/derive_device_key_body.py index 5f8bce0e..abedd68b 100644 --- a/src/infuse_iot/api_client/models/derive_device_key_body.py +++ b/src/infuse_iot/api_client/models/derive_device_key_body.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,12 +22,12 @@ class DeriveDeviceKeyBody: Attributes: device_id (str): The ID of the device to send the RPC to as a hex string Example: d291d4d66bf0a955. interface (KeyInterface): - security_state (Union[Unset, SecurityState]): + security_state (SecurityState | Unset): """ device_id: str interface: KeyInterface - security_state: Union[Unset, "SecurityState"] = UNSET + security_state: SecurityState | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -33,7 +35,7 @@ def to_dict(self) -> dict[str, Any]: interface = self.interface.value - security_state: Unset | dict[str, Any] = UNSET + security_state: dict[str, Any] | Unset = UNSET if not isinstance(self.security_state, Unset): security_state = self.security_state.to_dict() @@ -60,7 +62,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: interface = KeyInterface(d.pop("interface")) _security_state = d.pop("securityState", UNSET) - security_state: Unset | SecurityState + security_state: SecurityState | Unset if isinstance(_security_state, Unset): security_state = UNSET else: diff --git a/src/infuse_iot/api_client/models/device.py b/src/infuse_iot/api_client/models/device.py index da6b068e..4b4b8d13 100644 --- a/src/infuse_iot/api_client/models/device.py +++ b/src/infuse_iot/api_client/models/device.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -27,10 +29,10 @@ class Device: mcu_id (str): Device's MCU ID as a hex string Example: 0011223344556677. board_id (UUID): ID of board of device organisation_id (UUID): ID of organisation for board to exist in - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: + device_id (str): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: d291d4d66bf0a955. - metadata (Union[Unset, DeviceMetadata]): Metadata fields for device Example: {'Field Name': 'Field Value'}. - initial_device_state (Union[Unset, NewDeviceState]): + metadata (DeviceMetadata): Metadata fields for device Example: {'Field Name': 'Field Value'}. + initial_device_state (NewDeviceState | Unset): """ id: UUID @@ -39,9 +41,9 @@ class Device: mcu_id: str board_id: UUID organisation_id: UUID - device_id: Unset | str = UNSET - metadata: Union[Unset, "DeviceMetadata"] = UNSET - initial_device_state: Union[Unset, "NewDeviceState"] = UNSET + device_id: str + metadata: DeviceMetadata + initial_device_state: NewDeviceState | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -59,11 +61,9 @@ def to_dict(self) -> dict[str, Any]: device_id = self.device_id - metadata: Unset | dict[str, Any] = UNSET - if not isinstance(self.metadata, Unset): - metadata = self.metadata.to_dict() + metadata = self.metadata.to_dict() - initial_device_state: Unset | dict[str, Any] = UNSET + initial_device_state: dict[str, Any] | Unset = UNSET if not isinstance(self.initial_device_state, Unset): initial_device_state = self.initial_device_state.to_dict() @@ -77,12 +77,10 @@ def to_dict(self) -> dict[str, Any]: "mcuId": mcu_id, "boardId": board_id, "organisationId": organisation_id, + "deviceId": device_id, + "metadata": metadata, } ) - if device_id is not UNSET: - field_dict["deviceId"] = device_id - if metadata is not UNSET: - field_dict["metadata"] = metadata if initial_device_state is not UNSET: field_dict["initialDeviceState"] = initial_device_state @@ -106,17 +104,12 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: organisation_id = UUID(d.pop("organisationId")) - device_id = d.pop("deviceId", UNSET) + device_id = d.pop("deviceId") - _metadata = d.pop("metadata", UNSET) - metadata: Unset | DeviceMetadata - if isinstance(_metadata, Unset): - metadata = UNSET - else: - metadata = DeviceMetadata.from_dict(_metadata) + metadata = DeviceMetadata.from_dict(d.pop("metadata")) _initial_device_state = d.pop("initialDeviceState", UNSET) - initial_device_state: Unset | NewDeviceState + initial_device_state: NewDeviceState | Unset if isinstance(_initial_device_state, Unset): initial_device_state = UNSET else: diff --git a/src/infuse_iot/api_client/models/device_and_state.py b/src/infuse_iot/api_client/models/device_and_state.py index 4e1acdbf..067ef3a6 100644 --- a/src/infuse_iot/api_client/models/device_and_state.py +++ b/src/infuse_iot/api_client/models/device_and_state.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -28,11 +30,11 @@ class DeviceAndState: mcu_id (str): Device's MCU ID as a hex string Example: 0011223344556677. board_id (UUID): ID of board of device organisation_id (UUID): ID of organisation for board to exist in - state (DeviceState): - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: + device_id (str): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: d291d4d66bf0a955. - metadata (Union[Unset, DeviceMetadata]): Metadata fields for device Example: {'Field Name': 'Field Value'}. - initial_device_state (Union[Unset, NewDeviceState]): + metadata (DeviceMetadata): Metadata fields for device Example: {'Field Name': 'Field Value'}. + state (DeviceState): + initial_device_state (NewDeviceState | Unset): """ id: UUID @@ -41,10 +43,10 @@ class DeviceAndState: mcu_id: str board_id: UUID organisation_id: UUID - state: "DeviceState" - device_id: Unset | str = UNSET - metadata: Union[Unset, "DeviceMetadata"] = UNSET - initial_device_state: Union[Unset, "NewDeviceState"] = UNSET + device_id: str + metadata: DeviceMetadata + state: DeviceState + initial_device_state: NewDeviceState | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -60,15 +62,13 @@ def to_dict(self) -> dict[str, Any]: organisation_id = str(self.organisation_id) - state = self.state.to_dict() - device_id = self.device_id - metadata: Unset | dict[str, Any] = UNSET - if not isinstance(self.metadata, Unset): - metadata = self.metadata.to_dict() + metadata = self.metadata.to_dict() + + state = self.state.to_dict() - initial_device_state: Unset | dict[str, Any] = UNSET + initial_device_state: dict[str, Any] | Unset = UNSET if not isinstance(self.initial_device_state, Unset): initial_device_state = self.initial_device_state.to_dict() @@ -82,13 +82,11 @@ def to_dict(self) -> dict[str, Any]: "mcuId": mcu_id, "boardId": board_id, "organisationId": organisation_id, + "deviceId": device_id, + "metadata": metadata, "state": state, } ) - if device_id is not UNSET: - field_dict["deviceId"] = device_id - if metadata is not UNSET: - field_dict["metadata"] = metadata if initial_device_state is not UNSET: field_dict["initialDeviceState"] = initial_device_state @@ -113,19 +111,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: organisation_id = UUID(d.pop("organisationId")) - state = DeviceState.from_dict(d.pop("state")) + device_id = d.pop("deviceId") - device_id = d.pop("deviceId", UNSET) + metadata = DeviceMetadata.from_dict(d.pop("metadata")) - _metadata = d.pop("metadata", UNSET) - metadata: Unset | DeviceMetadata - if isinstance(_metadata, Unset): - metadata = UNSET - else: - metadata = DeviceMetadata.from_dict(_metadata) + state = DeviceState.from_dict(d.pop("state")) _initial_device_state = d.pop("initialDeviceState", UNSET) - initial_device_state: Unset | NewDeviceState + initial_device_state: NewDeviceState | Unset if isinstance(_initial_device_state, Unset): initial_device_state = UNSET else: @@ -138,9 +131,9 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: mcu_id=mcu_id, board_id=board_id, organisation_id=organisation_id, - state=state, device_id=device_id, metadata=metadata, + state=state, initial_device_state=initial_device_state, ) diff --git a/src/infuse_iot/api_client/models/device_id_field.py b/src/infuse_iot/api_client/models/device_id_field.py index 9f92d322..346cedd2 100644 --- a/src/infuse_iot/api_client/models/device_id_field.py +++ b/src/infuse_iot/api_client/models/device_id_field.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -13,11 +15,11 @@ class DeviceIdField: """ Attributes: - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: d291d4d66bf0a955. """ - device_id: Unset | str = UNSET + device_id: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/device_kv_entry.py b/src/infuse_iot/api_client/models/device_kv_entry.py index e540b02a..46f1c314 100644 --- a/src/infuse_iot/api_client/models/device_kv_entry.py +++ b/src/infuse_iot/api_client/models/device_kv_entry.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,18 +25,18 @@ class DeviceKVEntry: crc (int): CRC32 of entry value created_at (datetime.datetime): updated_at (datetime.datetime): - key_name (Union[Unset, str]): Key name - if definition known - data (Union[Unset, str]): Raw entry data as a base64 encoded string - if not write_only - decoded (Union[Unset, DeviceKVEntryDecoded]): Decoded entry value - if not write_only and definition known + key_name (str | Unset): Key name - if definition known + data (str | Unset): Raw entry data as a base64 encoded string - if not write_only + decoded (DeviceKVEntryDecoded | Unset): Decoded entry value - if not write_only and definition known """ key_id: int crc: int created_at: datetime.datetime updated_at: datetime.datetime - key_name: Unset | str = UNSET - data: Unset | str = UNSET - decoded: Union[Unset, "DeviceKVEntryDecoded"] = UNSET + key_name: str | Unset = UNSET + data: str | Unset = UNSET + decoded: DeviceKVEntryDecoded | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -50,7 +52,7 @@ def to_dict(self) -> dict[str, Any]: data = self.data - decoded: Unset | dict[str, Any] = UNSET + decoded: dict[str, Any] | Unset = UNSET if not isinstance(self.decoded, Unset): decoded = self.decoded.to_dict() @@ -91,7 +93,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: data = d.pop("data", UNSET) _decoded = d.pop("decoded", UNSET) - decoded: Unset | DeviceKVEntryDecoded + decoded: DeviceKVEntryDecoded | Unset if isinstance(_decoded, Unset): decoded = UNSET else: diff --git a/src/infuse_iot/api_client/models/device_kv_entry_decoded.py b/src/infuse_iot/api_client/models/device_kv_entry_decoded.py index 4ca61b77..f82cc71e 100644 --- a/src/infuse_iot/api_client/models/device_kv_entry_decoded.py +++ b/src/infuse_iot/api_client/models/device_kv_entry_decoded.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/device_kv_entry_update.py b/src/infuse_iot/api_client/models/device_kv_entry_update.py index 90a847a5..9710eb54 100644 --- a/src/infuse_iot/api_client/models/device_kv_entry_update.py +++ b/src/infuse_iot/api_client/models/device_kv_entry_update.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -21,31 +23,33 @@ class DeviceKVEntryUpdate: """ Attributes: + data (str): Raw entry data as a base64 encoded string (must provide either data or decoded) id (UUID): ID of update key_id (int): Key id crc (int): CRC32 of entry update value status (DeviceEntryUpdateStatus): Status of device KV entry update created_at (datetime.datetime): updated_at (datetime.datetime): - data (Union[Unset, str]): Raw entry data as a base64 encoded string (must provide either data or decoded) - decoded (Union[Unset, NewDeviceKVEntryUpdateDecoded]): Decoded entry value (must provide either data or decoded) - last_error (Union[Unset, str]): Last error message if update failed - last_attempt_at (Union[Unset, datetime.datetime]): Time of last attempt + decoded (NewDeviceKVEntryUpdateDecoded | Unset): Decoded entry value (must provide either data or decoded) + last_error (str | Unset): Last error message if update failed + last_attempt_at (datetime.datetime | Unset): Time of last attempt """ + data: str id: UUID key_id: int crc: int status: DeviceEntryUpdateStatus created_at: datetime.datetime updated_at: datetime.datetime - data: Unset | str = UNSET - decoded: Union[Unset, "NewDeviceKVEntryUpdateDecoded"] = UNSET - last_error: Unset | str = UNSET - last_attempt_at: Unset | datetime.datetime = UNSET + decoded: NewDeviceKVEntryUpdateDecoded | Unset = UNSET + last_error: str | Unset = UNSET + last_attempt_at: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + data = self.data + id = str(self.id) key_id = self.key_id @@ -58,15 +62,13 @@ def to_dict(self) -> dict[str, Any]: updated_at = self.updated_at.isoformat() - data = self.data - - decoded: Unset | dict[str, Any] = UNSET + decoded: dict[str, Any] | Unset = UNSET if not isinstance(self.decoded, Unset): decoded = self.decoded.to_dict() last_error = self.last_error - last_attempt_at: Unset | str = UNSET + last_attempt_at: str | Unset = UNSET if not isinstance(self.last_attempt_at, Unset): last_attempt_at = self.last_attempt_at.isoformat() @@ -74,6 +76,7 @@ def to_dict(self) -> dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { + "data": data, "id": id, "keyId": key_id, "crc": crc, @@ -82,8 +85,6 @@ def to_dict(self) -> dict[str, Any]: "updatedAt": updated_at, } ) - if data is not UNSET: - field_dict["data"] = data if decoded is not UNSET: field_dict["decoded"] = decoded if last_error is not UNSET: @@ -98,6 +99,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.new_device_kv_entry_update_decoded import NewDeviceKVEntryUpdateDecoded d = dict(src_dict) + data = d.pop("data") + id = UUID(d.pop("id")) key_id = d.pop("keyId") @@ -110,10 +113,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: updated_at = isoparse(d.pop("updatedAt")) - data = d.pop("data", UNSET) - _decoded = d.pop("decoded", UNSET) - decoded: Unset | NewDeviceKVEntryUpdateDecoded + decoded: NewDeviceKVEntryUpdateDecoded | Unset if isinstance(_decoded, Unset): decoded = UNSET else: @@ -122,20 +123,20 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: last_error = d.pop("lastError", UNSET) _last_attempt_at = d.pop("lastAttemptAt", UNSET) - last_attempt_at: Unset | datetime.datetime + last_attempt_at: datetime.datetime | Unset if isinstance(_last_attempt_at, Unset): last_attempt_at = UNSET else: last_attempt_at = isoparse(_last_attempt_at) device_kv_entry_update = cls( + data=data, id=id, key_id=key_id, crc=crc, status=status, created_at=created_at, updated_at=updated_at, - data=data, decoded=decoded, last_error=last_error, last_attempt_at=last_attempt_at, diff --git a/src/infuse_iot/api_client/models/device_logger_state.py b/src/infuse_iot/api_client/models/device_logger_state.py index 6917b624..d3fed769 100644 --- a/src/infuse_iot/api_client/models/device_logger_state.py +++ b/src/infuse_iot/api_client/models/device_logger_state.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar @@ -15,24 +17,28 @@ class DeviceLoggerState: """ Attributes: - last_reported_block (Union[Unset, int]): Last reported block number - last_reported_time (Union[Unset, datetime.datetime]): Last time logger state was reported - last_downloaded_block (Union[Unset, int]): Last downloaded block number - last_downloaded_wrap_count (Union[Unset, int]): Last downloaded block wrap count - last_downloaded_time (Union[Unset, datetime.datetime]): Last time logger state was downloaded + download_enabled (bool): Whether logger download is enabled + last_reported_block (int | Unset): Last reported block number + last_reported_time (datetime.datetime | Unset): Last time logger state was reported + last_downloaded_block (int | Unset): Last downloaded block number + last_downloaded_wrap_count (int | Unset): Last downloaded block wrap count + last_downloaded_time (datetime.datetime | Unset): Last time logger state was downloaded """ - last_reported_block: Unset | int = UNSET - last_reported_time: Unset | datetime.datetime = UNSET - last_downloaded_block: Unset | int = UNSET - last_downloaded_wrap_count: Unset | int = UNSET - last_downloaded_time: Unset | datetime.datetime = UNSET + download_enabled: bool + last_reported_block: int | Unset = UNSET + last_reported_time: datetime.datetime | Unset = UNSET + last_downloaded_block: int | Unset = UNSET + last_downloaded_wrap_count: int | Unset = UNSET + last_downloaded_time: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + download_enabled = self.download_enabled + last_reported_block = self.last_reported_block - last_reported_time: Unset | str = UNSET + last_reported_time: str | Unset = UNSET if not isinstance(self.last_reported_time, Unset): last_reported_time = self.last_reported_time.isoformat() @@ -40,13 +46,17 @@ def to_dict(self) -> dict[str, Any]: last_downloaded_wrap_count = self.last_downloaded_wrap_count - last_downloaded_time: Unset | str = UNSET + last_downloaded_time: str | Unset = UNSET if not isinstance(self.last_downloaded_time, Unset): last_downloaded_time = self.last_downloaded_time.isoformat() field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({}) + field_dict.update( + { + "downloadEnabled": download_enabled, + } + ) if last_reported_block is not UNSET: field_dict["lastReportedBlock"] = last_reported_block if last_reported_time is not UNSET: @@ -63,10 +73,12 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) + download_enabled = d.pop("downloadEnabled") + last_reported_block = d.pop("lastReportedBlock", UNSET) _last_reported_time = d.pop("lastReportedTime", UNSET) - last_reported_time: Unset | datetime.datetime + last_reported_time: datetime.datetime | Unset if isinstance(_last_reported_time, Unset): last_reported_time = UNSET else: @@ -77,13 +89,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: last_downloaded_wrap_count = d.pop("lastDownloadedWrapCount", UNSET) _last_downloaded_time = d.pop("lastDownloadedTime", UNSET) - last_downloaded_time: Unset | datetime.datetime + last_downloaded_time: datetime.datetime | Unset if isinstance(_last_downloaded_time, Unset): last_downloaded_time = UNSET else: last_downloaded_time = isoparse(_last_downloaded_time) device_logger_state = cls( + download_enabled=download_enabled, last_reported_block=last_reported_block, last_reported_time=last_reported_time, last_downloaded_block=last_downloaded_block, diff --git a/src/infuse_iot/api_client/models/device_logger_state_update.py b/src/infuse_iot/api_client/models/device_logger_state_update.py new file mode 100644 index 00000000..30733a04 --- /dev/null +++ b/src/infuse_iot/api_client/models/device_logger_state_update.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define + +T = TypeVar("T", bound="DeviceLoggerStateUpdate") + + +@_attrs_define +class DeviceLoggerStateUpdate: + """ + Attributes: + download_enabled (bool): Whether logger download is enabled + """ + + download_enabled: bool + + def to_dict(self) -> dict[str, Any]: + download_enabled = self.download_enabled + + field_dict: dict[str, Any] = {} + + field_dict.update( + { + "downloadEnabled": download_enabled, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + download_enabled = d.pop("downloadEnabled") + + device_logger_state_update = cls( + download_enabled=download_enabled, + ) + + return device_logger_state_update diff --git a/src/infuse_iot/api_client/models/device_logger_state_with_index.py b/src/infuse_iot/api_client/models/device_logger_state_with_index.py new file mode 100644 index 00000000..2bbae3a6 --- /dev/null +++ b/src/infuse_iot/api_client/models/device_logger_state_with_index.py @@ -0,0 +1,132 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="DeviceLoggerStateWithIndex") + + +@_attrs_define +class DeviceLoggerStateWithIndex: + """ + Attributes: + download_enabled (bool): Whether logger download is enabled + index (int): Index of logger + last_reported_block (int | Unset): Last reported block number + last_reported_time (datetime.datetime | Unset): Last time logger state was reported + last_downloaded_block (int | Unset): Last downloaded block number + last_downloaded_wrap_count (int | Unset): Last downloaded block wrap count + last_downloaded_time (datetime.datetime | Unset): Last time logger state was downloaded + """ + + download_enabled: bool + index: int + last_reported_block: int | Unset = UNSET + last_reported_time: datetime.datetime | Unset = UNSET + last_downloaded_block: int | Unset = UNSET + last_downloaded_wrap_count: int | Unset = UNSET + last_downloaded_time: datetime.datetime | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + download_enabled = self.download_enabled + + index = self.index + + last_reported_block = self.last_reported_block + + last_reported_time: str | Unset = UNSET + if not isinstance(self.last_reported_time, Unset): + last_reported_time = self.last_reported_time.isoformat() + + last_downloaded_block = self.last_downloaded_block + + last_downloaded_wrap_count = self.last_downloaded_wrap_count + + last_downloaded_time: str | Unset = UNSET + if not isinstance(self.last_downloaded_time, Unset): + last_downloaded_time = self.last_downloaded_time.isoformat() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "downloadEnabled": download_enabled, + "index": index, + } + ) + if last_reported_block is not UNSET: + field_dict["lastReportedBlock"] = last_reported_block + if last_reported_time is not UNSET: + field_dict["lastReportedTime"] = last_reported_time + if last_downloaded_block is not UNSET: + field_dict["lastDownloadedBlock"] = last_downloaded_block + if last_downloaded_wrap_count is not UNSET: + field_dict["lastDownloadedWrapCount"] = last_downloaded_wrap_count + if last_downloaded_time is not UNSET: + field_dict["lastDownloadedTime"] = last_downloaded_time + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + download_enabled = d.pop("downloadEnabled") + + index = d.pop("index") + + last_reported_block = d.pop("lastReportedBlock", UNSET) + + _last_reported_time = d.pop("lastReportedTime", UNSET) + last_reported_time: datetime.datetime | Unset + if isinstance(_last_reported_time, Unset): + last_reported_time = UNSET + else: + last_reported_time = isoparse(_last_reported_time) + + last_downloaded_block = d.pop("lastDownloadedBlock", UNSET) + + last_downloaded_wrap_count = d.pop("lastDownloadedWrapCount", UNSET) + + _last_downloaded_time = d.pop("lastDownloadedTime", UNSET) + last_downloaded_time: datetime.datetime | Unset + if isinstance(_last_downloaded_time, Unset): + last_downloaded_time = UNSET + else: + last_downloaded_time = isoparse(_last_downloaded_time) + + device_logger_state_with_index = cls( + download_enabled=download_enabled, + index=index, + last_reported_block=last_reported_block, + last_reported_time=last_reported_time, + last_downloaded_block=last_downloaded_block, + last_downloaded_wrap_count=last_downloaded_wrap_count, + last_downloaded_time=last_downloaded_time, + ) + + device_logger_state_with_index.additional_properties = d + return device_logger_state_with_index + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/infuse_iot/api_client/models/device_metadata.py b/src/infuse_iot/api_client/models/device_metadata.py index efccd029..425a1764 100644 --- a/src/infuse_iot/api_client/models/device_metadata.py +++ b/src/infuse_iot/api_client/models/device_metadata.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/device_metadata_update.py b/src/infuse_iot/api_client/models/device_metadata_update.py index 03059918..760448ef 100644 --- a/src/infuse_iot/api_client/models/device_metadata_update.py +++ b/src/infuse_iot/api_client/models/device_metadata_update.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -24,7 +26,7 @@ class DeviceMetadataUpdate: """ operation: DeviceMetadataUpdateOperation - value: "DeviceMetadata" + value: DeviceMetadata additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/device_state.py b/src/infuse_iot/api_client/models/device_state.py index b2d07ca6..9a875bea 100644 --- a/src/infuse_iot/api_client/models/device_state.py +++ b/src/infuse_iot/api_client/models/device_state.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,20 +25,20 @@ class DeviceState: Attributes: created_at (datetime.datetime): updated_at (datetime.datetime): - application_id (Union[Unset, int]): Last announced application ID - application_version (Union[Unset, ApplicationVersion]): Application version - algorithms (Union[Unset, list['Algorithm']]): Last announced algorithms - last_route_interface (Union[Unset, RouteType]): Interface of route - last_route_udp_address (Union[Unset, str]): UDP address of last packet sent by device + application_id (int | Unset): Last announced application ID + application_version (ApplicationVersion | Unset): Application version + algorithms (list[Algorithm] | Unset): Last announced algorithms + last_route_interface (RouteType | Unset): Interface of route + last_route_udp_address (str | Unset): UDP address of last packet sent by device """ created_at: datetime.datetime updated_at: datetime.datetime - application_id: Unset | int = UNSET - application_version: Union[Unset, "ApplicationVersion"] = UNSET - algorithms: Unset | list["Algorithm"] = UNSET - last_route_interface: Unset | RouteType = UNSET - last_route_udp_address: Unset | str = UNSET + application_id: int | Unset = UNSET + application_version: ApplicationVersion | Unset = UNSET + algorithms: list[Algorithm] | Unset = UNSET + last_route_interface: RouteType | Unset = UNSET + last_route_udp_address: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -46,18 +48,18 @@ def to_dict(self) -> dict[str, Any]: application_id = self.application_id - application_version: Unset | dict[str, Any] = UNSET + application_version: dict[str, Any] | Unset = UNSET if not isinstance(self.application_version, Unset): application_version = self.application_version.to_dict() - algorithms: Unset | list[dict[str, Any]] = UNSET + algorithms: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.algorithms, Unset): algorithms = [] for algorithms_item_data in self.algorithms: algorithms_item = algorithms_item_data.to_dict() algorithms.append(algorithms_item) - last_route_interface: Unset | str = UNSET + last_route_interface: str | Unset = UNSET if not isinstance(self.last_route_interface, Unset): last_route_interface = self.last_route_interface.value @@ -97,21 +99,23 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: application_id = d.pop("applicationId", UNSET) _application_version = d.pop("applicationVersion", UNSET) - application_version: Unset | ApplicationVersion + application_version: ApplicationVersion | Unset if isinstance(_application_version, Unset): application_version = UNSET else: application_version = ApplicationVersion.from_dict(_application_version) - algorithms = [] _algorithms = d.pop("algorithms", UNSET) - for algorithms_item_data in _algorithms or []: - algorithms_item = Algorithm.from_dict(algorithms_item_data) + algorithms: list[Algorithm] | Unset = UNSET + if _algorithms is not UNSET: + algorithms = [] + for algorithms_item_data in _algorithms: + algorithms_item = Algorithm.from_dict(algorithms_item_data) - algorithms.append(algorithms_item) + algorithms.append(algorithms_item) _last_route_interface = d.pop("lastRouteInterface", UNSET) - last_route_interface: Unset | RouteType + last_route_interface: RouteType | Unset if isinstance(_last_route_interface, Unset): last_route_interface = UNSET else: diff --git a/src/infuse_iot/api_client/models/device_update.py b/src/infuse_iot/api_client/models/device_update.py index b878b0de..99c935a8 100644 --- a/src/infuse_iot/api_client/models/device_update.py +++ b/src/infuse_iot/api_client/models/device_update.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,14 +19,14 @@ class DeviceUpdate: """ Attributes: - metadata (Union[Unset, DeviceMetadataUpdate]): Metadata update + metadata (DeviceMetadataUpdate | Unset): Metadata update """ - metadata: Union[Unset, "DeviceMetadataUpdate"] = UNSET + metadata: DeviceMetadataUpdate | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - metadata: Unset | dict[str, Any] = UNSET + metadata: dict[str, Any] | Unset = UNSET if not isinstance(self.metadata, Unset): metadata = self.metadata.to_dict() @@ -42,7 +44,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) _metadata = d.pop("metadata", UNSET) - metadata: Unset | DeviceMetadataUpdate + metadata: DeviceMetadataUpdate | Unset if isinstance(_metadata, Unset): metadata = UNSET else: diff --git a/src/infuse_iot/api_client/models/downlink_message.py b/src/infuse_iot/api_client/models/downlink_message.py index 31cf0468..5464577a 100644 --- a/src/infuse_iot/api_client/models/downlink_message.py +++ b/src/infuse_iot/api_client/models/downlink_message.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -30,12 +32,12 @@ class DownlinkMessage: auth (int): The auth level of the message rpc_req (RpcReq): status (DownlinkMessageStatus): Status of downlink message - rpc_rsp (Union[Unset, RpcRsp]): - send_wait_timeout_ms (Union[Unset, int]): Maximum time to wait (in milliseconds) for the device to send a packet + rpc_rsp (RpcRsp | Unset): + send_wait_timeout_ms (int | Unset): Maximum time to wait (in milliseconds) for the device to send a packet before expiring. If 0 or not set, the RPC was sent immediately using the device's last route. - sent_at (Union[Unset, datetime.datetime]): The time the downlink message was sent - expires_at (Union[Unset, datetime.datetime]): The time the downlink message expires - completed_at (Union[Unset, datetime.datetime]): The time the downlink message was completed + sent_at (datetime.datetime | Unset): The time the downlink message was sent + expires_at (datetime.datetime | Unset): The time the downlink message expires + completed_at (datetime.datetime | Unset): The time the downlink message was completed """ id: UUID @@ -44,13 +46,13 @@ class DownlinkMessage: device_id: UUID payload_type: int auth: int - rpc_req: "RpcReq" + rpc_req: RpcReq status: DownlinkMessageStatus - rpc_rsp: Union[Unset, "RpcRsp"] = UNSET - send_wait_timeout_ms: Unset | int = UNSET - sent_at: Unset | datetime.datetime = UNSET - expires_at: Unset | datetime.datetime = UNSET - completed_at: Unset | datetime.datetime = UNSET + rpc_rsp: RpcRsp | Unset = UNSET + send_wait_timeout_ms: int | Unset = UNSET + sent_at: datetime.datetime | Unset = UNSET + expires_at: datetime.datetime | Unset = UNSET + completed_at: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -70,21 +72,21 @@ def to_dict(self) -> dict[str, Any]: status = self.status.value - rpc_rsp: Unset | dict[str, Any] = UNSET + rpc_rsp: dict[str, Any] | Unset = UNSET if not isinstance(self.rpc_rsp, Unset): rpc_rsp = self.rpc_rsp.to_dict() send_wait_timeout_ms = self.send_wait_timeout_ms - sent_at: Unset | str = UNSET + sent_at: str | Unset = UNSET if not isinstance(self.sent_at, Unset): sent_at = self.sent_at.isoformat() - expires_at: Unset | str = UNSET + expires_at: str | Unset = UNSET if not isinstance(self.expires_at, Unset): expires_at = self.expires_at.isoformat() - completed_at: Unset | str = UNSET + completed_at: str | Unset = UNSET if not isinstance(self.completed_at, Unset): completed_at = self.completed_at.isoformat() @@ -138,7 +140,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: status = DownlinkMessageStatus(d.pop("status")) _rpc_rsp = d.pop("rpcRsp", UNSET) - rpc_rsp: Unset | RpcRsp + rpc_rsp: RpcRsp | Unset if isinstance(_rpc_rsp, Unset): rpc_rsp = UNSET else: @@ -147,21 +149,21 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: send_wait_timeout_ms = d.pop("sendWaitTimeoutMs", UNSET) _sent_at = d.pop("sentAt", UNSET) - sent_at: Unset | datetime.datetime + sent_at: datetime.datetime | Unset if isinstance(_sent_at, Unset): sent_at = UNSET else: sent_at = isoparse(_sent_at) _expires_at = d.pop("expiresAt", UNSET) - expires_at: Unset | datetime.datetime + expires_at: datetime.datetime | Unset if isinstance(_expires_at, Unset): expires_at = UNSET else: expires_at = isoparse(_expires_at) _completed_at = d.pop("completedAt", UNSET) - completed_at: Unset | datetime.datetime + completed_at: datetime.datetime | Unset if isinstance(_completed_at, Unset): completed_at = UNSET else: diff --git a/src/infuse_iot/api_client/models/downlink_route.py b/src/infuse_iot/api_client/models/downlink_route.py index eb8ec3cc..5109d231 100644 --- a/src/infuse_iot/api_client/models/downlink_route.py +++ b/src/infuse_iot/api_client/models/downlink_route.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,20 +25,20 @@ class DownlinkRoute: Attributes: interface (RouteType): Interface of route interface_data (InterfaceData): - udp (Union[Unset, UdpDownlinkRoute]): - bt_adv (Union[Unset, BtLeRoute]): - bt_peripheral (Union[Unset, BtLeRoute]): - bt_central (Union[Unset, BtLeRoute]): - forwarded (Union[Unset, ForwardedDownlinkRoute]): + udp (UdpDownlinkRoute | Unset): + bt_adv (BtLeRoute | Unset): + bt_peripheral (BtLeRoute | Unset): + bt_central (BtLeRoute | Unset): + forwarded (ForwardedDownlinkRoute | Unset): """ interface: RouteType - interface_data: "InterfaceData" - udp: Union[Unset, "UdpDownlinkRoute"] = UNSET - bt_adv: Union[Unset, "BtLeRoute"] = UNSET - bt_peripheral: Union[Unset, "BtLeRoute"] = UNSET - bt_central: Union[Unset, "BtLeRoute"] = UNSET - forwarded: Union[Unset, "ForwardedDownlinkRoute"] = UNSET + interface_data: InterfaceData + udp: UdpDownlinkRoute | Unset = UNSET + bt_adv: BtLeRoute | Unset = UNSET + bt_peripheral: BtLeRoute | Unset = UNSET + bt_central: BtLeRoute | Unset = UNSET + forwarded: ForwardedDownlinkRoute | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -44,23 +46,23 @@ def to_dict(self) -> dict[str, Any]: interface_data = self.interface_data.to_dict() - udp: Unset | dict[str, Any] = UNSET + udp: dict[str, Any] | Unset = UNSET if not isinstance(self.udp, Unset): udp = self.udp.to_dict() - bt_adv: Unset | dict[str, Any] = UNSET + bt_adv: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_adv, Unset): bt_adv = self.bt_adv.to_dict() - bt_peripheral: Unset | dict[str, Any] = UNSET + bt_peripheral: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_peripheral, Unset): bt_peripheral = self.bt_peripheral.to_dict() - bt_central: Unset | dict[str, Any] = UNSET + bt_central: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_central, Unset): bt_central = self.bt_central.to_dict() - forwarded: Unset | dict[str, Any] = UNSET + forwarded: dict[str, Any] | Unset = UNSET if not isinstance(self.forwarded, Unset): forwarded = self.forwarded.to_dict() @@ -98,35 +100,35 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: interface_data = InterfaceData.from_dict(d.pop("interfaceData")) _udp = d.pop("udp", UNSET) - udp: Unset | UdpDownlinkRoute + udp: UdpDownlinkRoute | Unset if isinstance(_udp, Unset): udp = UNSET else: udp = UdpDownlinkRoute.from_dict(_udp) _bt_adv = d.pop("btAdv", UNSET) - bt_adv: Unset | BtLeRoute + bt_adv: BtLeRoute | Unset if isinstance(_bt_adv, Unset): bt_adv = UNSET else: bt_adv = BtLeRoute.from_dict(_bt_adv) _bt_peripheral = d.pop("btPeripheral", UNSET) - bt_peripheral: Unset | BtLeRoute + bt_peripheral: BtLeRoute | Unset if isinstance(_bt_peripheral, Unset): bt_peripheral = UNSET else: bt_peripheral = BtLeRoute.from_dict(_bt_peripheral) _bt_central = d.pop("btCentral", UNSET) - bt_central: Unset | BtLeRoute + bt_central: BtLeRoute | Unset if isinstance(_bt_central, Unset): bt_central = UNSET else: bt_central = BtLeRoute.from_dict(_bt_central) _forwarded = d.pop("forwarded", UNSET) - forwarded: Unset | ForwardedDownlinkRoute + forwarded: ForwardedDownlinkRoute | Unset if isinstance(_forwarded, Unset): forwarded = UNSET else: diff --git a/src/infuse_iot/api_client/models/error.py b/src/infuse_iot/api_client/models/error.py index 5ca3dbd7..e4cdb421 100644 --- a/src/infuse_iot/api_client/models/error.py +++ b/src/infuse_iot/api_client/models/error.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/forwarded_downlink_route.py b/src/infuse_iot/api_client/models/forwarded_downlink_route.py index 033b1212..1b8f4cdd 100644 --- a/src/infuse_iot/api_client/models/forwarded_downlink_route.py +++ b/src/infuse_iot/api_client/models/forwarded_downlink_route.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -21,7 +23,7 @@ class ForwardedDownlinkRoute: """ device_id: str - route: "DownlinkRoute" + route: DownlinkRoute auth: int additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/src/infuse_iot/api_client/models/forwarded_uplink_route.py b/src/infuse_iot/api_client/models/forwarded_uplink_route.py index cebda740..32746705 100644 --- a/src/infuse_iot/api_client/models/forwarded_uplink_route.py +++ b/src/infuse_iot/api_client/models/forwarded_uplink_route.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -22,7 +24,7 @@ class ForwardedUplinkRoute: """ device_id: str - route: "UplinkRoute" + route: UplinkRoute auth: int rssi: int additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/src/infuse_iot/api_client/models/generate_api_key_body.py b/src/infuse_iot/api_client/models/generate_api_key_body.py index 6f03921a..5e04ec86 100644 --- a/src/infuse_iot/api_client/models/generate_api_key_body.py +++ b/src/infuse_iot/api_client/models/generate_api_key_body.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID @@ -25,7 +27,7 @@ class GenerateAPIKeyBody: organisation_id: UUID user_type: APIKeyOrgUserType - resource_perms: "GenerateAPIKeyBodyResourcePerms" + resource_perms: GenerateAPIKeyBodyResourcePerms additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/generate_api_key_body_resource_perms.py b/src/infuse_iot/api_client/models/generate_api_key_body_resource_perms.py index f876ef66..ea322d97 100644 --- a/src/infuse_iot/api_client/models/generate_api_key_body_resource_perms.py +++ b/src/infuse_iot/api_client/models/generate_api_key_body_resource_perms.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/generate_mqtt_token_body.py b/src/infuse_iot/api_client/models/generate_mqtt_token_body.py index d7d28211..04aefa8e 100644 --- a/src/infuse_iot/api_client/models/generate_mqtt_token_body.py +++ b/src/infuse_iot/api_client/models/generate_mqtt_token_body.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar from uuid import UUID diff --git a/src/infuse_iot/api_client/models/generated_api_key.py b/src/infuse_iot/api_client/models/generated_api_key.py index deed412f..c742553b 100644 --- a/src/infuse_iot/api_client/models/generated_api_key.py +++ b/src/infuse_iot/api_client/models/generated_api_key.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/generated_mqtt_token.py b/src/infuse_iot/api_client/models/generated_mqtt_token.py index 3d318d42..8cf4506c 100644 --- a/src/infuse_iot/api_client/models/generated_mqtt_token.py +++ b/src/infuse_iot/api_client/models/generated_mqtt_token.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/get_last_routes_for_devices_body.py b/src/infuse_iot/api_client/models/get_last_routes_for_devices_body.py index 483826c7..26919e6e 100644 --- a/src/infuse_iot/api_client/models/get_last_routes_for_devices_body.py +++ b/src/infuse_iot/api_client/models/get_last_routes_for_devices_body.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/src/infuse_iot/api_client/models/health_check.py b/src/infuse_iot/api_client/models/health_check.py index dba19203..e26b4523 100644 --- a/src/infuse_iot/api_client/models/health_check.py +++ b/src/infuse_iot/api_client/models/health_check.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/interface_data.py b/src/infuse_iot/api_client/models/interface_data.py index c0c4754e..502e49be 100644 --- a/src/infuse_iot/api_client/models/interface_data.py +++ b/src/infuse_iot/api_client/models/interface_data.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -13,10 +15,10 @@ class InterfaceData: """ Attributes: - sequence (Union[Unset, int]): Sequence number of packet + sequence (int | Unset): Sequence number of packet """ - sequence: Unset | int = UNSET + sequence: int | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/key.py b/src/infuse_iot/api_client/models/key.py index 9d94cc07..926d6719 100644 --- a/src/infuse_iot/api_client/models/key.py +++ b/src/infuse_iot/api_client/models/key.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/metadata_field.py b/src/infuse_iot/api_client/models/metadata_field.py index eb12c0d7..9e6df44c 100644 --- a/src/infuse_iot/api_client/models/metadata_field.py +++ b/src/infuse_iot/api_client/models/metadata_field.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/network.py b/src/infuse_iot/api_client/models/network.py new file mode 100644 index 00000000..9b4f0119 --- /dev/null +++ b/src/infuse_iot/api_client/models/network.py @@ -0,0 +1,129 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +T = TypeVar("T", bound="Network") + + +@_attrs_define +class Network: + """ + Attributes: + name (str): Unique name of network + description (str): Description of network + key (str): Key bytes as a base64 encoded string (must be 32 bytes long) Example: + AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=. + organisation_id (UUID): ID of organisation the network belongs to + public (bool): Whether the network is public (visible to all infuse organisations) Default: False. + network_id (int): Network ID + id (UUID): UUID of network + created_at (datetime.datetime): + updated_at (datetime.datetime): + """ + + name: str + description: str + key: str + organisation_id: UUID + network_id: int + id: UUID + created_at: datetime.datetime + updated_at: datetime.datetime + public: bool = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description = self.description + + key = self.key + + organisation_id = str(self.organisation_id) + + public = self.public + + network_id = self.network_id + + id = str(self.id) + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "description": description, + "key": key, + "organisationId": organisation_id, + "public": public, + "networkId": network_id, + "id": id, + "createdAt": created_at, + "updatedAt": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + description = d.pop("description") + + key = d.pop("key") + + organisation_id = UUID(d.pop("organisationId")) + + public = d.pop("public") + + network_id = d.pop("networkId") + + id = UUID(d.pop("id")) + + created_at = isoparse(d.pop("createdAt")) + + updated_at = isoparse(d.pop("updatedAt")) + + network = cls( + name=name, + description=description, + key=key, + organisation_id=organisation_id, + public=public, + network_id=network_id, + id=id, + created_at=created_at, + updated_at=updated_at, + ) + + network.additional_properties = d + return network + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/infuse_iot/api_client/models/new_board.py b/src/infuse_iot/api_client/models/new_board.py index 9c552581..ce092b8a 100644 --- a/src/infuse_iot/api_client/models/new_board.py +++ b/src/infuse_iot/api_client/models/new_board.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID @@ -22,15 +24,15 @@ class NewBoard: description (str): Description of board Example: Extended description of board. soc (str): System on Chip (SoC) of board Example: nRF9151. organisation_id (UUID): ID of organisation for board to exist in - metadata_fields (Union[Unset, list['MetadataField']]): Metadata fields for board Example: [{'name': 'Field - Name', 'required': True, 'unique': False}]. + metadata_fields (list[MetadataField] | Unset): Metadata fields for board Example: [{'name': 'Field Name', + 'required': True, 'unique': False}]. """ name: str description: str soc: str organisation_id: UUID - metadata_fields: Unset | list["MetadataField"] = UNSET + metadata_fields: list[MetadataField] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -42,7 +44,7 @@ def to_dict(self) -> dict[str, Any]: organisation_id = str(self.organisation_id) - metadata_fields: Unset | list[dict[str, Any]] = UNSET + metadata_fields: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.metadata_fields, Unset): metadata_fields = [] for componentsschemas_board_metadata_fields_item_data in self.metadata_fields: @@ -79,14 +81,16 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: organisation_id = UUID(d.pop("organisationId")) - metadata_fields = [] _metadata_fields = d.pop("metadataFields", UNSET) - for componentsschemas_board_metadata_fields_item_data in _metadata_fields or []: - componentsschemas_board_metadata_fields_item = MetadataField.from_dict( - componentsschemas_board_metadata_fields_item_data - ) + metadata_fields: list[MetadataField] | Unset = UNSET + if _metadata_fields is not UNSET: + metadata_fields = [] + for componentsschemas_board_metadata_fields_item_data in _metadata_fields: + componentsschemas_board_metadata_fields_item = MetadataField.from_dict( + componentsschemas_board_metadata_fields_item_data + ) - metadata_fields.append(componentsschemas_board_metadata_fields_item) + metadata_fields.append(componentsschemas_board_metadata_fields_item) new_board = cls( name=name, diff --git a/src/infuse_iot/api_client/models/new_device.py b/src/infuse_iot/api_client/models/new_device.py index d081e036..4fd0ea9e 100644 --- a/src/infuse_iot/api_client/models/new_device.py +++ b/src/infuse_iot/api_client/models/new_device.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -22,18 +24,18 @@ class NewDevice: mcu_id (str): Device's MCU ID as a hex string Example: 0011223344556677. board_id (UUID): ID of board of device organisation_id (UUID): ID of organisation for board to exist in - device_id (Union[Unset, str]): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: + device_id (str | Unset): 8 byte DeviceID as a hex string (if not provided will be auto-generated) Example: d291d4d66bf0a955. - metadata (Union[Unset, DeviceMetadata]): Metadata fields for device Example: {'Field Name': 'Field Value'}. - initial_device_state (Union[Unset, NewDeviceState]): + metadata (DeviceMetadata | Unset): Metadata fields for device Example: {'Field Name': 'Field Value'}. + initial_device_state (NewDeviceState | Unset): """ mcu_id: str board_id: UUID organisation_id: UUID - device_id: Unset | str = UNSET - metadata: Union[Unset, "DeviceMetadata"] = UNSET - initial_device_state: Union[Unset, "NewDeviceState"] = UNSET + device_id: str | Unset = UNSET + metadata: DeviceMetadata | Unset = UNSET + initial_device_state: NewDeviceState | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -45,11 +47,11 @@ def to_dict(self) -> dict[str, Any]: device_id = self.device_id - metadata: Unset | dict[str, Any] = UNSET + metadata: dict[str, Any] | Unset = UNSET if not isinstance(self.metadata, Unset): metadata = self.metadata.to_dict() - initial_device_state: Unset | dict[str, Any] = UNSET + initial_device_state: dict[str, Any] | Unset = UNSET if not isinstance(self.initial_device_state, Unset): initial_device_state = self.initial_device_state.to_dict() @@ -86,14 +88,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: device_id = d.pop("deviceId", UNSET) _metadata = d.pop("metadata", UNSET) - metadata: Unset | DeviceMetadata + metadata: DeviceMetadata | Unset if isinstance(_metadata, Unset): metadata = UNSET else: metadata = DeviceMetadata.from_dict(_metadata) _initial_device_state = d.pop("initialDeviceState", UNSET) - initial_device_state: Unset | NewDeviceState + initial_device_state: NewDeviceState | Unset if isinstance(_initial_device_state, Unset): initial_device_state = UNSET else: diff --git a/src/infuse_iot/api_client/models/new_device_kv_entry_update.py b/src/infuse_iot/api_client/models/new_device_kv_entry_update.py index 1b89dfca..79fe48d8 100644 --- a/src/infuse_iot/api_client/models/new_device_kv_entry_update.py +++ b/src/infuse_iot/api_client/models/new_device_kv_entry_update.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,18 +19,18 @@ class NewDeviceKVEntryUpdate: """ Attributes: - data (Union[Unset, str]): Raw entry data as a base64 encoded string (must provide either data or decoded) - decoded (Union[Unset, NewDeviceKVEntryUpdateDecoded]): Decoded entry value (must provide either data or decoded) + data (str | Unset): Raw entry data as a base64 encoded string (must provide either data or decoded) + decoded (NewDeviceKVEntryUpdateDecoded | Unset): Decoded entry value (must provide either data or decoded) """ - data: Unset | str = UNSET - decoded: Union[Unset, "NewDeviceKVEntryUpdateDecoded"] = UNSET + data: str | Unset = UNSET + decoded: NewDeviceKVEntryUpdateDecoded | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: data = self.data - decoded: Unset | dict[str, Any] = UNSET + decoded: dict[str, Any] | Unset = UNSET if not isinstance(self.decoded, Unset): decoded = self.decoded.to_dict() @@ -50,7 +52,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: data = d.pop("data", UNSET) _decoded = d.pop("decoded", UNSET) - decoded: Unset | NewDeviceKVEntryUpdateDecoded + decoded: NewDeviceKVEntryUpdateDecoded | Unset if isinstance(_decoded, Unset): decoded = UNSET else: diff --git a/src/infuse_iot/api_client/models/new_device_kv_entry_update_decoded.py b/src/infuse_iot/api_client/models/new_device_kv_entry_update_decoded.py index 47eeed83..b55b1bac 100644 --- a/src/infuse_iot/api_client/models/new_device_kv_entry_update_decoded.py +++ b/src/infuse_iot/api_client/models/new_device_kv_entry_update_decoded.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/new_device_state.py b/src/infuse_iot/api_client/models/new_device_state.py index 6b53f1bd..a1c4bccd 100644 --- a/src/infuse_iot/api_client/models/new_device_state.py +++ b/src/infuse_iot/api_client/models/new_device_state.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,24 +20,24 @@ class NewDeviceState: """ Attributes: - application_id (Union[Unset, int]): Last announced application ID - application_version (Union[Unset, ApplicationVersion]): Application version - algorithms (Union[Unset, list['Algorithm']]): Last announced algorithms + application_id (int | Unset): Last announced application ID + application_version (ApplicationVersion | Unset): Application version + algorithms (list[Algorithm] | Unset): Last announced algorithms """ - application_id: Unset | int = UNSET - application_version: Union[Unset, "ApplicationVersion"] = UNSET - algorithms: Unset | list["Algorithm"] = UNSET + application_id: int | Unset = UNSET + application_version: ApplicationVersion | Unset = UNSET + algorithms: list[Algorithm] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: application_id = self.application_id - application_version: Unset | dict[str, Any] = UNSET + application_version: dict[str, Any] | Unset = UNSET if not isinstance(self.application_version, Unset): application_version = self.application_version.to_dict() - algorithms: Unset | list[dict[str, Any]] = UNSET + algorithms: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.algorithms, Unset): algorithms = [] for algorithms_item_data in self.algorithms: @@ -63,18 +65,20 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: application_id = d.pop("applicationId", UNSET) _application_version = d.pop("applicationVersion", UNSET) - application_version: Unset | ApplicationVersion + application_version: ApplicationVersion | Unset if isinstance(_application_version, Unset): application_version = UNSET else: application_version = ApplicationVersion.from_dict(_application_version) - algorithms = [] _algorithms = d.pop("algorithms", UNSET) - for algorithms_item_data in _algorithms or []: - algorithms_item = Algorithm.from_dict(algorithms_item_data) + algorithms: list[Algorithm] | Unset = UNSET + if _algorithms is not UNSET: + algorithms = [] + for algorithms_item_data in _algorithms: + algorithms_item = Algorithm.from_dict(algorithms_item_data) - algorithms.append(algorithms_item) + algorithms.append(algorithms_item) new_device_state = cls( application_id=application_id, diff --git a/src/infuse_iot/api_client/models/new_network.py b/src/infuse_iot/api_client/models/new_network.py new file mode 100644 index 00000000..aedd1c66 --- /dev/null +++ b/src/infuse_iot/api_client/models/new_network.py @@ -0,0 +1,103 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="NewNetwork") + + +@_attrs_define +class NewNetwork: + """ + Attributes: + name (str): Unique name of network + description (str): Description of network + key (str): Key bytes as a base64 encoded string (must be 32 bytes long) Example: + AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=. + organisation_id (UUID): ID of organisation the network belongs to + public (bool): Whether the network is public (visible to all infuse organisations) Default: False. + network_id (int): Network ID + """ + + name: str + description: str + key: str + organisation_id: UUID + network_id: int + public: bool = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description = self.description + + key = self.key + + organisation_id = str(self.organisation_id) + + public = self.public + + network_id = self.network_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "description": description, + "key": key, + "organisationId": organisation_id, + "public": public, + "networkId": network_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + description = d.pop("description") + + key = d.pop("key") + + organisation_id = UUID(d.pop("organisationId")) + + public = d.pop("public") + + network_id = d.pop("networkId") + + new_network = cls( + name=name, + description=description, + key=key, + organisation_id=organisation_id, + public=public, + network_id=network_id, + ) + + new_network.additional_properties = d + return new_network + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/infuse_iot/api_client/models/new_organisation.py b/src/infuse_iot/api_client/models/new_organisation.py index b6fffc27..992d91ec 100644 --- a/src/infuse_iot/api_client/models/new_organisation.py +++ b/src/infuse_iot/api_client/models/new_organisation.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/new_rpc_message.py b/src/infuse_iot/api_client/models/new_rpc_message.py index 5f560ada..13f39f3b 100644 --- a/src/infuse_iot/api_client/models/new_rpc_message.py +++ b/src/infuse_iot/api_client/models/new_rpc_message.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -19,13 +21,13 @@ class NewRPCMessage: Attributes: device_id (str): The ID of the device to send the RPC to as a hex string Example: d291d4d66bf0a955. rpc (NewRPCReq): - send_wait_timeout_ms (Union[Unset, int]): Maximum time to wait (in milliseconds) for the device to send a - packet. If 0 or not set, the RPC is sent immediately using the device's last route. Default: 60000. + send_wait_timeout_ms (int | Unset): Maximum time to wait (in milliseconds) for the device to send a packet. If 0 + or not set, the RPC is sent immediately using the device's last route. Default: 60000. """ device_id: str - rpc: "NewRPCReq" - send_wait_timeout_ms: Unset | int = 60000 + rpc: NewRPCReq + send_wait_timeout_ms: int | Unset = 60000 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/new_rpc_req.py b/src/infuse_iot/api_client/models/new_rpc_req.py index 1dd00834..78861c70 100644 --- a/src/infuse_iot/api_client/models/new_rpc_req.py +++ b/src/infuse_iot/api_client/models/new_rpc_req.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,21 +20,21 @@ class NewRPCReq: """ Attributes: - command_id (Union[Unset, int]): ID of RPC command (must provide either commandId or commandName) Example: 3. - command_name (Union[Unset, str]): Name of RPC command (must provide either commandId or commandName) Example: + command_id (int | Unset): ID of RPC command (must provide either commandId or commandName) Example: 3. + command_name (str | Unset): Name of RPC command (must provide either commandId or commandName) Example: time_get. - params (Union[Unset, RPCParams]): RPC request or response params (must be a JSON object with string or embedded - json values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': + params (RPCParams | Unset): RPC request or response params (must be a JSON object with string or embedded json + values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': 'value'}}. - params_encoded (Union[Unset, str]): Base64 encoded params (if provided, will be used instead of params) - data_header (Union[Unset, RPCReqDataHeader]): + params_encoded (str | Unset): Base64 encoded params (if provided, will be used instead of params) + data_header (RPCReqDataHeader | Unset): """ - command_id: Unset | int = UNSET - command_name: Unset | str = UNSET - params: Union[Unset, "RPCParams"] = UNSET - params_encoded: Unset | str = UNSET - data_header: Union[Unset, "RPCReqDataHeader"] = UNSET + command_id: int | Unset = UNSET + command_name: str | Unset = UNSET + params: RPCParams | Unset = UNSET + params_encoded: str | Unset = UNSET + data_header: RPCReqDataHeader | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -40,13 +42,13 @@ def to_dict(self) -> dict[str, Any]: command_name = self.command_name - params: Unset | dict[str, Any] = UNSET + params: dict[str, Any] | Unset = UNSET if not isinstance(self.params, Unset): params = self.params.to_dict() params_encoded = self.params_encoded - data_header: Unset | dict[str, Any] = UNSET + data_header: dict[str, Any] | Unset = UNSET if not isinstance(self.data_header, Unset): data_header = self.data_header.to_dict() @@ -77,7 +79,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: command_name = d.pop("commandName", UNSET) _params = d.pop("params", UNSET) - params: Unset | RPCParams + params: RPCParams | Unset if isinstance(_params, Unset): params = UNSET else: @@ -86,7 +88,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: params_encoded = d.pop("paramsEncoded", UNSET) _data_header = d.pop("dataHeader", UNSET) - data_header: Unset | RPCReqDataHeader + data_header: RPCReqDataHeader | Unset if isinstance(_data_header, Unset): data_header = UNSET else: diff --git a/src/infuse_iot/api_client/models/organisation.py b/src/infuse_iot/api_client/models/organisation.py index b0890b37..15268141 100644 --- a/src/infuse_iot/api_client/models/organisation.py +++ b/src/infuse_iot/api_client/models/organisation.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/rpc_message.py b/src/infuse_iot/api_client/models/rpc_message.py index 4cd7d0c3..50625e47 100644 --- a/src/infuse_iot/api_client/models/rpc_message.py +++ b/src/infuse_iot/api_client/models/rpc_message.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -30,8 +32,8 @@ class RpcMessage: created_at: datetime.datetime id: UUID downlink_message_id: UUID - device: "Device" - downlink_message: "DownlinkMessage" + device: Device + downlink_message: DownlinkMessage additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/models/rpc_params.py b/src/infuse_iot/api_client/models/rpc_params.py index 9121b1dc..8d86c789 100644 --- a/src/infuse_iot/api_client/models/rpc_params.py +++ b/src/infuse_iot/api_client/models/rpc_params.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/rpc_req.py b/src/infuse_iot/api_client/models/rpc_req.py index 14daae68..2d6d5f68 100644 --- a/src/infuse_iot/api_client/models/rpc_req.py +++ b/src/infuse_iot/api_client/models/rpc_req.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -21,20 +23,20 @@ class RpcReq: Attributes: request_id (int): The unique ID of the RPC request command_id (int): ID of RPC command - params (Union[Unset, RPCParams]): RPC request or response params (must be a JSON object with string or embedded - json values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': + params (RPCParams | Unset): RPC request or response params (must be a JSON object with string or embedded json + values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': 'value'}}. - params_encoded (Union[Unset, str]): Base64 encoded params (if provided, will be used instead of params) - data_header (Union[Unset, RPCReqDataHeader]): - route (Union[Unset, DownlinkRoute]): + params_encoded (str | Unset): Base64 encoded params (if provided, will be used instead of params) + data_header (RPCReqDataHeader | Unset): + route (DownlinkRoute | Unset): """ request_id: int command_id: int - params: Union[Unset, "RPCParams"] = UNSET - params_encoded: Unset | str = UNSET - data_header: Union[Unset, "RPCReqDataHeader"] = UNSET - route: Union[Unset, "DownlinkRoute"] = UNSET + params: RPCParams | Unset = UNSET + params_encoded: str | Unset = UNSET + data_header: RPCReqDataHeader | Unset = UNSET + route: DownlinkRoute | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -42,17 +44,17 @@ def to_dict(self) -> dict[str, Any]: command_id = self.command_id - params: Unset | dict[str, Any] = UNSET + params: dict[str, Any] | Unset = UNSET if not isinstance(self.params, Unset): params = self.params.to_dict() params_encoded = self.params_encoded - data_header: Unset | dict[str, Any] = UNSET + data_header: dict[str, Any] | Unset = UNSET if not isinstance(self.data_header, Unset): data_header = self.data_header.to_dict() - route: Unset | dict[str, Any] = UNSET + route: dict[str, Any] | Unset = UNSET if not isinstance(self.route, Unset): route = self.route.to_dict() @@ -87,7 +89,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: command_id = d.pop("commandId") _params = d.pop("params", UNSET) - params: Unset | RPCParams + params: RPCParams | Unset if isinstance(_params, Unset): params = UNSET else: @@ -96,14 +98,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: params_encoded = d.pop("paramsEncoded", UNSET) _data_header = d.pop("dataHeader", UNSET) - data_header: Unset | RPCReqDataHeader + data_header: RPCReqDataHeader | Unset if isinstance(_data_header, Unset): data_header = UNSET else: data_header = RPCReqDataHeader.from_dict(_data_header) _route = d.pop("route", UNSET) - route: Unset | DownlinkRoute + route: DownlinkRoute | Unset if isinstance(_route, Unset): route = UNSET else: diff --git a/src/infuse_iot/api_client/models/rpc_req_data_header.py b/src/infuse_iot/api_client/models/rpc_req_data_header.py index c134e1f4..2c1d9273 100644 --- a/src/infuse_iot/api_client/models/rpc_req_data_header.py +++ b/src/infuse_iot/api_client/models/rpc_req_data_header.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/rpc_rsp.py b/src/infuse_iot/api_client/models/rpc_rsp.py index 65eb0c97..8406dfb5 100644 --- a/src/infuse_iot/api_client/models/rpc_rsp.py +++ b/src/infuse_iot/api_client/models/rpc_rsp.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,17 +22,16 @@ class RpcRsp: Attributes: route (UplinkRoute): return_code (int): Return code of RPC - params (Union[Unset, RPCParams]): RPC request or response params (must be a JSON object with string or embedded - json values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': + params (RPCParams | Unset): RPC request or response params (must be a JSON object with string or embedded json + values - numbers sent as decimal strings) Example: {'primitive_vaue': '1000', 'struct_value': {'field': 'value'}}. - params_encoded (Union[Unset, str]): Base64 encoded params (provided if there was an issue decoding the RPC - params) + params_encoded (str | Unset): Base64 encoded params (provided if there was an issue decoding the RPC params) """ - route: "UplinkRoute" + route: UplinkRoute return_code: int - params: Union[Unset, "RPCParams"] = UNSET - params_encoded: Unset | str = UNSET + params: RPCParams | Unset = UNSET + params_encoded: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -38,7 +39,7 @@ def to_dict(self) -> dict[str, Any]: return_code = self.return_code - params: Unset | dict[str, Any] = UNSET + params: dict[str, Any] | Unset = UNSET if not isinstance(self.params, Unset): params = self.params.to_dict() @@ -70,7 +71,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: return_code = d.pop("returnCode") _params = d.pop("params", UNSET) - params: Unset | RPCParams + params: RPCParams | Unset if isinstance(_params, Unset): params = UNSET else: diff --git a/src/infuse_iot/api_client/models/security_state.py b/src/infuse_iot/api_client/models/security_state.py index 8348f794..40ea7584 100644 --- a/src/infuse_iot/api_client/models/security_state.py +++ b/src/infuse_iot/api_client/models/security_state.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/udp_downlink_route.py b/src/infuse_iot/api_client/models/udp_downlink_route.py index e9a7f892..74ee69b7 100644 --- a/src/infuse_iot/api_client/models/udp_downlink_route.py +++ b/src/infuse_iot/api_client/models/udp_downlink_route.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/udp_uplink_route.py b/src/infuse_iot/api_client/models/udp_uplink_route.py index 4bb1d5fa..bfd9937f 100644 --- a/src/infuse_iot/api_client/models/udp_uplink_route.py +++ b/src/infuse_iot/api_client/models/udp_uplink_route.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/src/infuse_iot/api_client/models/uplink_route.py b/src/infuse_iot/api_client/models/uplink_route.py index f2be48fc..f9f08588 100644 --- a/src/infuse_iot/api_client/models/uplink_route.py +++ b/src/infuse_iot/api_client/models/uplink_route.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -23,20 +25,20 @@ class UplinkRoute: Attributes: interface (RouteType): Interface of route interface_data (InterfaceData): - udp (Union[Unset, UdpUplinkRoute]): - bt_adv (Union[Unset, BtLeRoute]): - bt_peripheral (Union[Unset, BtLeRoute]): - bt_central (Union[Unset, BtLeRoute]): - forwarded (Union[Unset, ForwardedUplinkRoute]): + udp (UdpUplinkRoute | Unset): + bt_adv (BtLeRoute | Unset): + bt_peripheral (BtLeRoute | Unset): + bt_central (BtLeRoute | Unset): + forwarded (ForwardedUplinkRoute | Unset): """ interface: RouteType - interface_data: "InterfaceData" - udp: Union[Unset, "UdpUplinkRoute"] = UNSET - bt_adv: Union[Unset, "BtLeRoute"] = UNSET - bt_peripheral: Union[Unset, "BtLeRoute"] = UNSET - bt_central: Union[Unset, "BtLeRoute"] = UNSET - forwarded: Union[Unset, "ForwardedUplinkRoute"] = UNSET + interface_data: InterfaceData + udp: UdpUplinkRoute | Unset = UNSET + bt_adv: BtLeRoute | Unset = UNSET + bt_peripheral: BtLeRoute | Unset = UNSET + bt_central: BtLeRoute | Unset = UNSET + forwarded: ForwardedUplinkRoute | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -44,23 +46,23 @@ def to_dict(self) -> dict[str, Any]: interface_data = self.interface_data.to_dict() - udp: Unset | dict[str, Any] = UNSET + udp: dict[str, Any] | Unset = UNSET if not isinstance(self.udp, Unset): udp = self.udp.to_dict() - bt_adv: Unset | dict[str, Any] = UNSET + bt_adv: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_adv, Unset): bt_adv = self.bt_adv.to_dict() - bt_peripheral: Unset | dict[str, Any] = UNSET + bt_peripheral: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_peripheral, Unset): bt_peripheral = self.bt_peripheral.to_dict() - bt_central: Unset | dict[str, Any] = UNSET + bt_central: dict[str, Any] | Unset = UNSET if not isinstance(self.bt_central, Unset): bt_central = self.bt_central.to_dict() - forwarded: Unset | dict[str, Any] = UNSET + forwarded: dict[str, Any] | Unset = UNSET if not isinstance(self.forwarded, Unset): forwarded = self.forwarded.to_dict() @@ -98,35 +100,35 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: interface_data = InterfaceData.from_dict(d.pop("interfaceData")) _udp = d.pop("udp", UNSET) - udp: Unset | UdpUplinkRoute + udp: UdpUplinkRoute | Unset if isinstance(_udp, Unset): udp = UNSET else: udp = UdpUplinkRoute.from_dict(_udp) _bt_adv = d.pop("btAdv", UNSET) - bt_adv: Unset | BtLeRoute + bt_adv: BtLeRoute | Unset if isinstance(_bt_adv, Unset): bt_adv = UNSET else: bt_adv = BtLeRoute.from_dict(_bt_adv) _bt_peripheral = d.pop("btPeripheral", UNSET) - bt_peripheral: Unset | BtLeRoute + bt_peripheral: BtLeRoute | Unset if isinstance(_bt_peripheral, Unset): bt_peripheral = UNSET else: bt_peripheral = BtLeRoute.from_dict(_bt_peripheral) _bt_central = d.pop("btCentral", UNSET) - bt_central: Unset | BtLeRoute + bt_central: BtLeRoute | Unset if isinstance(_bt_central, Unset): bt_central = UNSET else: bt_central = BtLeRoute.from_dict(_bt_central) _forwarded = d.pop("forwarded", UNSET) - forwarded: Unset | ForwardedUplinkRoute + forwarded: ForwardedUplinkRoute | Unset if isinstance(_forwarded, Unset): forwarded = UNSET else: diff --git a/src/infuse_iot/api_client/models/uplink_route_and_device_id.py b/src/infuse_iot/api_client/models/uplink_route_and_device_id.py index 7cbe8849..f5f9d5a0 100644 --- a/src/infuse_iot/api_client/models/uplink_route_and_device_id.py +++ b/src/infuse_iot/api_client/models/uplink_route_and_device_id.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -21,7 +23,7 @@ class UplinkRouteAndDeviceId: """ device_id: str - last_route: "UplinkRoute" + last_route: UplinkRoute additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/src/infuse_iot/api_client/py.typed b/src/infuse_iot/api_client/py.typed new file mode 100644 index 00000000..1aad3271 --- /dev/null +++ b/src/infuse_iot/api_client/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561 \ No newline at end of file diff --git a/src/infuse_iot/api_client/types.py b/src/infuse_iot/api_client/types.py index ca68df1a..b64af095 100644 --- a/src/infuse_iot/api_client/types.py +++ b/src/infuse_iot/api_client/types.py @@ -1,8 +1,8 @@ """Contains some shared types for properties""" -from collections.abc import MutableMapping +from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, Literal, TypeVar +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -14,7 +14,15 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -FileJsonType = tuple[str | None, BinaryIO, str | None] +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = IO[bytes] | bytes | str +FileTypes = ( + # (filename, file (or bytes), content_type) + tuple[str | None, FileContent, str | None] + # (filename, file (or bytes), content_type, headers) + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) +RequestFiles = list[tuple[str, FileTypes]] @define @@ -25,7 +33,7 @@ class File: file_name: str | None = None mime_type: str | None = None - def to_tuple(self) -> FileJsonType: + def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -43,4 +51,4 @@ class Response(Generic[T]): parsed: T | None -__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"] +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/src/infuse_iot/tools/cloud.py b/src/infuse_iot/tools/cloud.py index ba2c6f7e..d4660730 100644 --- a/src/infuse_iot/tools/cloud.py +++ b/src/infuse_iot/tools/cloud.py @@ -23,6 +23,7 @@ get_device_by_device_id, get_device_kv_entries_by_device_id, get_device_last_route_by_device_id, + get_device_logger_states_by_device_id, get_device_state_by_id, ) from infuse_iot.api_client.api.organisation import ( @@ -192,6 +193,7 @@ def info(self, client: Client): board = get_board_by_id.sync(client=client, id=info.board_id) state = get_device_state_by_id.sync(client=client, id=info.id) route = get_device_last_route_by_device_id.sync(client=client, device_id=id_str) + logger_states = get_device_logger_states_by_device_id.sync(client=client, device_id=id_str) table: list[tuple[str, Any]] = [ ("UUID", info.id), @@ -221,6 +223,24 @@ def info(self, client: Client): if route.bt_adv: table += [("BT Address", f"{route.bt_adv.address} ({route.bt_adv.type_})")] + if isinstance(logger_states, list) and len(logger_states) > 0: + logger_names = { + 0: "Onboard", + 1: "Removable", + } + + for logger in logger_states: + name = logger_names.get(logger.index, str(logger.index)) + table += [ + (f"~~~{name} Logger Sync~~~", ""), + ("Last Report Time", logger.last_reported_time), + ("Last Downloaded Time", logger.last_downloaded_time), + ("Reported Block", logger.last_reported_block), + ("Downloaded Block", logger.last_downloaded_block), + ] + if isinstance(logger.last_reported_block, int) and isinstance(logger.last_downloaded_block, int): + table += [("Block Lag", logger.last_reported_block - logger.last_downloaded_block)] + print(tabulate(table)) def _kv_display(self, table: list[tuple[str, Any]], name_base: str, dictionary: dict):