neris-api-client 1.4.0__tar.gz → 1.5.1__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,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neris_api_client
3
- Version: 1.4.0
3
+ Version: 1.5.1
4
4
  Summary: NERIS API Client
5
- Author-email: Ben Coleman <ben.coleman@ul.org>, Tommy Messbauer <thomas.messbauer@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
5
+ Author-email: Ben Coleman <ben.coleman@ul.org>, Joseph Pagani <joseph.pagani@ul.org>
6
6
  Project-URL: Homepage, https://github.com/ulfsri/neris-api-client
7
7
  Project-URL: Issues, https://neris.atlassian.net/servicedesk/customer/portal/3/group/3/create/10027
8
8
  Classifier: Programming Language :: Python :: 3
@@ -4,10 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neris_api_client"
7
- version = "1.4.0"
7
+ version = "1.5.1"
8
8
  authors = [
9
9
  { name="Ben Coleman", email="ben.coleman@ul.org" },
10
- { name="Tommy Messbauer", email="thomas.messbauer@ul.org" },
11
10
  { name="Joseph Pagani", email="joseph.pagani@ul.org"}
12
11
  ]
13
12
  description = "NERIS API Client"
@@ -11,6 +11,10 @@ from pydantic import BaseModel
11
11
  from .config import Config, GrantType, TokenSet
12
12
 
13
13
  from .models import (
14
+ DeptSortBy,
15
+ StatesTerrs,
16
+ SortDirection,
17
+ TypeEntityValue,
14
18
  IncidentPayload,
15
19
  PatchUnitPayload,
16
20
  CreateUnitPayload,
@@ -228,6 +232,37 @@ class NerisApiClient(_NerisApiClient):
228
232
  def get_entity(self, neris_id: str) -> Dict[str, Any]:
229
233
  return self._call("get", f"/entity/{neris_id}")
230
234
 
235
+ def list_entities(
236
+ self,
237
+ name: str | None = None,
238
+ neris_id: str | None = None,
239
+ state: StatesTerrs | None = None,
240
+ entity_subtype: TypeEntityValue | None = None,
241
+ last_modified: str | None = None,
242
+ page_number: int | None = None,
243
+ page_size: int | None = None,
244
+ sort_by: DeptSortBy | None = None,
245
+ sort_direction: SortDirection | None = None,
246
+ ) -> Dict[str, Any]:
247
+ params = dict(
248
+ name=name,
249
+ neris_id=neris_id,
250
+ state=state,
251
+ entity_subtype=entity_subtype,
252
+ last_modified=last_modified,
253
+ page_number=page_number,
254
+ page_size=page_size,
255
+ sort_by=sort_by,
256
+ sort_direction=sort_direction,
257
+ )
258
+
259
+ # delete null params
260
+ for k in list(params.keys()):
261
+ if params[k] is None:
262
+ del params[k]
263
+
264
+ return self._call("get", "/entity", params=params)
265
+
231
266
  def create_entity(self, body: str | Dict[str, Any]) -> Dict[str, Any]:
232
267
  return self._call("post", "/entity/", body, model=CreateDepartmentPayload)
233
268
 
@@ -294,6 +329,7 @@ class NerisApiClient(_NerisApiClient):
294
329
  incident_number: str | None = None,
295
330
  dispatch_incident_number: str | None = None,
296
331
  status: list[Literal["APPROVED", "PENDING_APPROVAL", "REJECTED", "SUBMITTED"]] | None = None,
332
+ state: str | None = None,
297
333
  last_modified: str | None = None,
298
334
  sort_by: Literal["call_create", "neris_id_entity", "incident_number", "dispatch_incident_number", "status", "last_modified"] | None = None,
299
335
  sort_direction: Literal["ASCENDING", "DESCENDING"] | None = None,
@@ -309,6 +345,7 @@ class NerisApiClient(_NerisApiClient):
309
345
  incident_number=incident_number,
310
346
  dispatch_incident_number=dispatch_incident_number,
311
347
  status=status,
348
+ state=state,
312
349
  last_modified=last_modified,
313
350
  sort_by=sort_by,
314
351
  sort_direction=sort_direction,