ul-data-logger-api-sdk 3.3.2__tar.gz → 3.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ul-data-logger-api-sdk
3
- Version: 3.3.2
3
+ Version: 3.3.4
4
4
  Summary: Data logger API sdk
5
5
  Author: Unic-lab
6
6
  License-Expression: MIT
@@ -25,7 +25,12 @@ from data_logger_api_sdk.types.api_base_stations import (
25
25
  ApiBaseStationSystemLogResponse,
26
26
  ApiBaseStationSystemLogsListResult,
27
27
  )
28
+ from data_logger_api_sdk.types.api_bs_device_links import ApiBsDeviceLinkResponse, ApiBsDeviceLinksListResult
28
29
  from data_logger_api_sdk.types.api_bs_traffic_stats import ApiBsTrafficStatsResponse, ApiDeviceTrafficStatsQuery
30
+ from data_logger_api_sdk.types.api_uplink_signal import (
31
+ ApiDeviceUplinkSignalLatestResponse,
32
+ ApiDeviceUplinkSignalsListResult,
33
+ )
29
34
  from data_logger_api_sdk.types.api_device_data_history import ApiDeviceDataHistoryBody, ApiDeviceDataHistoryResponse
30
35
  from data_logger_api_sdk.types.api_last_bs_data_by_device_macs import ApiDeviceLastBsDataResponse, ApiDeviceMacsListBodyModel
31
36
  from data_logger_api_sdk.types.api_packet_types import ApiPacketTypesListResponse
@@ -191,6 +196,52 @@ class DataLoggerApiSdk:
191
196
  )
192
197
  return ApiBaseStationsListResult(items=items, total_count=total_count)
193
198
 
199
+ def get_uplink_signal_latest(
200
+ self,
201
+ limit: int,
202
+ offset: int = 0,
203
+ macs: List[int] | None = None,
204
+ ) -> ApiDeviceUplinkSignalsListResult:
205
+ """GET /uplink-signal-latest — последний uplink-сигнал каждого мака.
206
+
207
+ Последний по метеру, группировка по маку (один мак = одна строка);
208
+ macs — рантайм-фильтр по конкретным устройствам. bs_id —
209
+ идентификатор БС Data Logger (= external_bs_id потребителя).
210
+ """
211
+ query: Dict[str, Any] = {"limit": limit, "offset": offset}
212
+ if macs:
213
+ query["mac"] = macs
214
+ items, total_count = self._request_list_payload_once(
215
+ ApiMethod.GET,
216
+ "/uplink-signal-latest",
217
+ List[ApiDeviceUplinkSignalLatestResponse], # type: ignore
218
+ query,
219
+ )
220
+ return ApiDeviceUplinkSignalsListResult(items=items, total_count=total_count)
221
+
222
+ def get_bs_device_links(
223
+ self,
224
+ start_at: datetime,
225
+ end_at: datetime | None = None,
226
+ limit: int = 500,
227
+ offset: int = 0,
228
+ ) -> ApiBsDeviceLinksListResult:
229
+ """GET /bs-device-links — связи «мак ↔ БС» за период («когда-либо» при start_at из далёкого прошлого).
230
+
231
+ Один запрос по журналу device_log (дистинкт по паре мак+БС) вместо
232
+ обхода всех БС; для ночного синка слоя «Объекты и устройства».
233
+ """
234
+ query: Dict[str, Any] = {"start_at": start_at.isoformat(), "limit": limit, "offset": offset}
235
+ if end_at is not None:
236
+ query["end_at"] = end_at.isoformat()
237
+ items, total_count = self._request_list_payload_once(
238
+ ApiMethod.GET,
239
+ "/bs-device-links",
240
+ List[ApiBsDeviceLinkResponse], # type: ignore
241
+ query,
242
+ )
243
+ return ApiBsDeviceLinksListResult(items=items, total_count=total_count)
244
+
194
245
  def get_base_station(
195
246
  self,
196
247
  base_station_id: UUID,
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ul-data-logger-api-sdk"
7
- version = "3.3.2"
7
+ version = "3.3.4"
8
8
  description = "Data logger API sdk"
9
9
  license = "MIT"
10
10
  requires-python = ">=3.14"
@@ -0,0 +1,25 @@
1
+ from typing import List, NamedTuple
2
+
3
+ from pydantic import UUID4
4
+ from ul_api_utils.api_resource.api_response import JsonApiResponsePayload
5
+
6
+
7
+ class ApiBsDeviceLinkResponse(JsonApiResponsePayload):
8
+ """Связь «мак ↔ БС» за период: элемент ответа GET /bs-device-links.
9
+
10
+ Пара существует, если БС когда-либо получала пакет устройства в
11
+ запрошенном окне (дистинкт по журналу device_log). bs_id — идентификатор
12
+ БС Data Logger (у потребителя unified API это external_bs_id);
13
+ bs_identifier — её серийный номер.
14
+ """
15
+
16
+ device_network_mac: int
17
+ bs_id: UUID4
18
+ bs_identifier: str
19
+
20
+
21
+ class ApiBsDeviceLinksListResult(NamedTuple):
22
+ """Результат спискового вызова: страница элементов и total_count."""
23
+
24
+ items: List[ApiBsDeviceLinkResponse]
25
+ total_count: int
@@ -0,0 +1,29 @@
1
+ from datetime import datetime
2
+ from typing import List, NamedTuple
3
+
4
+ from pydantic import UUID4
5
+ from ul_api_utils.api_resource.api_response import JsonApiResponsePayload
6
+
7
+
8
+ class ApiDeviceUplinkSignalLatestResponse(JsonApiResponsePayload):
9
+ """Последний uplink-сигнал мака: элемент ответа GET /uplink-signal-latest.
10
+
11
+ bs_id — идентификатор базовой станции Data Logger (у потребителя unified
12
+ API это external_bs_id, маппинг по серийнику не нужен); bs_identifier —
13
+ серийный номер БС. packet_date — время последнего пакета устройства.
14
+ """
15
+
16
+ mac: int
17
+ device_id: UUID4
18
+ bs_id: UUID4 | None = None
19
+ bs_identifier: str | None = None
20
+ rssi: int | None = None
21
+ snr: int | None = None
22
+ packet_date: datetime | None = None
23
+
24
+
25
+ class ApiDeviceUplinkSignalsListResult(NamedTuple):
26
+ """Результат спискового вызова: страница элементов и total_count."""
27
+
28
+ items: List[ApiDeviceUplinkSignalLatestResponse]
29
+ total_count: int