ul-data-logger-api-sdk 3.1.1__tar.gz → 3.2.0__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.1.1
3
+ Version: 3.2.0
4
4
  Summary: Data logger API sdk
5
5
  Author: Unic-lab
6
6
  License-Expression: MIT
@@ -13,6 +13,7 @@ from data_logger_api_sdk.data_logger_sdk_config import DataLoggerApiSdkConfig
13
13
  from data_logger_api_sdk.types.api_base_stations import (
14
14
  ApiBaseStationDetailResponse,
15
15
  ApiBaseStationDeviceLogsResponse,
16
+ ApiBaseStationDeviceLogsStatResponse,
16
17
  ApiBaseStationDevicesResponse,
17
18
  ApiBaseStationLogsStatForIntervalsResponse,
18
19
  ApiBaseStationLogsStatResponse,
@@ -209,13 +210,23 @@ class DataLoggerApiSdk:
209
210
  end_at: datetime | None = None,
210
211
  limit: int = 100,
211
212
  offset: int = 0,
213
+ exclude_log_types: List[str] | None = None,
214
+ sort: str | None = None,
212
215
  ) -> ApiBaseStationLogsListResult:
213
- """GET /base-stations/<uuid>/logs — журнал логов базовой станции."""
216
+ """GET /base-stations/<uuid>/logs — журнал логов базовой станции.
217
+
218
+ exclude_log_types передаётся стандартным filter-параметром
219
+ (например, ['heartbit'] прячет служебные heartbeat-логи).
220
+ """
214
221
  query: Dict[str, Any] = {"limit": limit, "offset": offset}
215
222
  if start_at is not None:
216
223
  query["start_at"] = start_at.isoformat()
217
224
  if end_at is not None:
218
225
  query["end_at"] = end_at.isoformat()
226
+ if exclude_log_types:
227
+ query["filter"] = json.dumps([{"name": "log_type", "op": "not_in", "val": exclude_log_types}])
228
+ if sort:
229
+ query["sort"] = sort
219
230
  items, total_count = self._request_list_payload_once(
220
231
  ApiMethod.GET,
221
232
  f"/base-stations/{base_station_id}/logs",
@@ -259,6 +270,23 @@ class DataLoggerApiSdk:
259
270
  {"day": day.isoformat()},
260
271
  )
261
272
 
273
+ def get_base_station_device_logs_stat(
274
+ self,
275
+ base_station_id: UUID,
276
+ start_at: datetime,
277
+ end_at: datetime | None = None,
278
+ ) -> ApiBaseStationDeviceLogsStatResponse:
279
+ """GET /base-stations/<uuid>/device-logs-stat — число логов устройств БС по дням."""
280
+ query: Dict[str, Any] = {"start_at": start_at.isoformat()}
281
+ if end_at is not None:
282
+ query["end_at"] = end_at.isoformat()
283
+ return self._request_payload_once(
284
+ ApiMethod.GET,
285
+ f"/base-stations/{base_station_id}/device-logs-stat",
286
+ ApiBaseStationDeviceLogsStatResponse,
287
+ query,
288
+ )
289
+
262
290
  def get_base_station_logs_stat_for_intervals(
263
291
  self,
264
292
  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.1.1"
7
+ version = "3.2.0"
8
8
  description = "Data logger API sdk"
9
9
  license = "MIT"
10
10
  requires-python = ">=3.14"
@@ -1,4 +1,4 @@
1
- from datetime import datetime
1
+ from datetime import date, datetime
2
2
  from typing import Any, Dict, List, NamedTuple, Tuple
3
3
 
4
4
  from pydantic.types import UUID4
@@ -110,6 +110,12 @@ class ApiBaseStationLogsStatForIntervalsResponse(JsonApiResponsePayload):
110
110
  stats: List[datetime]
111
111
 
112
112
 
113
+ class ApiBaseStationDeviceLogsStatResponse(JsonApiResponsePayload):
114
+ """Ответ GET /base-stations/<uuid>/device-logs-stat: число логов устройств по дням."""
115
+
116
+ stats: List[Tuple[date, int]]
117
+
118
+
113
119
  class ApiBaseStationDeviceResponse(JsonApiResponsePayload):
114
120
  """Элемент devices ответа GET /base-stations/<uuid>/devices (ApiDeviceResponse без вложенной БС)."""
115
121