neris-api-client 0.0.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.
- neris_api_client-0.0.1/LICENSE +21 -0
- neris_api_client-0.0.1/PKG-INFO +35 -0
- neris_api_client-0.0.1/README.md +16 -0
- neris_api_client-0.0.1/pyproject.toml +29 -0
- neris_api_client-0.0.1/setup.cfg +4 -0
- neris_api_client-0.0.1/src/neris_api_client/__init__.py +1 -0
- neris_api_client-0.0.1/src/neris_api_client/client.py +215 -0
- neris_api_client-0.0.1/src/neris_api_client/models.py +673 -0
- neris_api_client-0.0.1/src/neris_api_client.egg-info/PKG-INFO +35 -0
- neris_api_client-0.0.1/src/neris_api_client.egg-info/SOURCES.txt +11 -0
- neris_api_client-0.0.1/src/neris_api_client.egg-info/dependency_links.txt +1 -0
- neris_api_client-0.0.1/src/neris_api_client.egg-info/requires.txt +5 -0
- neris_api_client-0.0.1/src/neris_api_client.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Underwriters Laboratories, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: neris_api_client
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: NERIS API Client
|
|
5
|
+
Author-email: Ben Coleman <ben.coleman@ul.org>
|
|
6
|
+
Project-URL: Homepage, https://github.com/ulfsri/neris
|
|
7
|
+
Project-URL: Issues, https://github.com/ulfsri/neris/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: boto3
|
|
15
|
+
Requires-Dist: PyJWT
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Requires-Dist: typing_extensions
|
|
19
|
+
|
|
20
|
+
# NERIS API Client
|
|
21
|
+
|
|
22
|
+
A Python class to interact with the NERIS API programmatically.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
|
|
26
|
+
at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from neris_api_client import NerisApiClient
|
|
30
|
+
|
|
31
|
+
client = NerisApiClient(username="neris.user", password="*******", env="dev")
|
|
32
|
+
|
|
33
|
+
# Get an organization
|
|
34
|
+
org = client.get_org("FD24027240")
|
|
35
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# NERIS API Client
|
|
2
|
+
|
|
3
|
+
A Python class to interact with the NERIS API programmatically.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
|
|
7
|
+
at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from neris_api_client import NerisApiClient
|
|
11
|
+
|
|
12
|
+
client = NerisApiClient(username="neris.user", password="*******", env="dev")
|
|
13
|
+
|
|
14
|
+
# Get an organization
|
|
15
|
+
org = client.get_org("FD24027240")
|
|
16
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "neris_api_client"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Ben Coleman", email="ben.coleman@ul.org" },
|
|
10
|
+
]
|
|
11
|
+
description = "NERIS API Client"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"boto3",
|
|
21
|
+
"PyJWT",
|
|
22
|
+
"requests",
|
|
23
|
+
"pydantic>=2",
|
|
24
|
+
"typing_extensions",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/ulfsri/neris"
|
|
29
|
+
Issues = "https://github.com/ulfsri/neris/issues"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import *
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import jwt
|
|
2
|
+
import json
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
from typing import Optional, Dict, Any, Callable
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from datetime import datetime, timedelta
|
|
8
|
+
|
|
9
|
+
import boto3
|
|
10
|
+
import requests
|
|
11
|
+
from pydantic import BaseModel
|
|
12
|
+
|
|
13
|
+
from .models import (
|
|
14
|
+
CreateDepartmentPayload,
|
|
15
|
+
DepartmentPayload,
|
|
16
|
+
CreateUserPayload,
|
|
17
|
+
UpdateUserPayload,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = ("NerisApiClient",)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Environment(str, Enum):
|
|
24
|
+
DEV = "dev"
|
|
25
|
+
PROD = "prod"
|
|
26
|
+
LOCAL = "local"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
BASE_URLS = {
|
|
30
|
+
Environment.LOCAL: "http://localhost:8000",
|
|
31
|
+
Environment.DEV: "https://api-dev.neris.fsri.org/v1",
|
|
32
|
+
Environment.PROD: "https://api.neris.fsri.org/v1",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
COGNTIO_CLIENT_CONFIG_URL = (
|
|
36
|
+
"https://neris-{env}-public.s3.us-east-2.amazonaws.com/cognito_config.json"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class _NerisApiClient:
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
env: Environment = Environment.LOCAL,
|
|
44
|
+
username: str = "",
|
|
45
|
+
password: str = "",
|
|
46
|
+
):
|
|
47
|
+
self._username = username
|
|
48
|
+
self._password = password
|
|
49
|
+
self._base_url = BASE_URLS[env]
|
|
50
|
+
self._env = env
|
|
51
|
+
|
|
52
|
+
self._access_token: str = None
|
|
53
|
+
self._access_token_exp: datetime = None
|
|
54
|
+
self._refresh_token: str = None
|
|
55
|
+
self._id_token: str = None
|
|
56
|
+
self._id_token_exp: datetime = None
|
|
57
|
+
self._cognito_config = None
|
|
58
|
+
self._session: requests.Session = requests.Session()
|
|
59
|
+
|
|
60
|
+
# Don't mess with auth on localhost
|
|
61
|
+
if env == Environment.LOCAL:
|
|
62
|
+
# Non-existent auth token never expires
|
|
63
|
+
self._access_token_exp = datetime.now() + timedelta(weeks=52)
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
self._cognito = boto3.client("cognito-idp")
|
|
67
|
+
|
|
68
|
+
self._token_cache_path = Path("./.token_cache")
|
|
69
|
+
self._access_token_cache_path = self._token_cache_path / "access_token"
|
|
70
|
+
self._refresh_token_cache_path = self._token_cache_path / "refresh_token"
|
|
71
|
+
self._id_token_cache_path = self._token_cache_path / "id_token"
|
|
72
|
+
self._cognito_config_cache_path = self._token_cache_path / "cognito_config.json"
|
|
73
|
+
|
|
74
|
+
self._read_token_cache()
|
|
75
|
+
|
|
76
|
+
if self._access_token:
|
|
77
|
+
self._set_token_exp()
|
|
78
|
+
|
|
79
|
+
if not self._access_token:
|
|
80
|
+
self._initiate_auth()
|
|
81
|
+
|
|
82
|
+
def _fetch_cognito_config(f: Callable) -> Callable:
|
|
83
|
+
def fetch_cognito_config(self):
|
|
84
|
+
if self._cognito_config is None:
|
|
85
|
+
self._cognito_config = requests.get(
|
|
86
|
+
COGNTIO_CLIENT_CONFIG_URL.format(env=self._env)
|
|
87
|
+
).json()
|
|
88
|
+
return f(self)
|
|
89
|
+
|
|
90
|
+
return fetch_cognito_config
|
|
91
|
+
|
|
92
|
+
@_fetch_cognito_config
|
|
93
|
+
def _initiate_auth(self) -> None:
|
|
94
|
+
res = self._cognito.initiate_auth(
|
|
95
|
+
AuthFlow="USER_PASSWORD_AUTH",
|
|
96
|
+
AuthParameters={"USERNAME": self._username, "PASSWORD": self._password},
|
|
97
|
+
ClientId=self._cognito_config["client_id"],
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
self._access_token = res["AuthenticationResult"]["AccessToken"]
|
|
101
|
+
self._refresh_token = res["AuthenticationResult"]["RefreshToken"]
|
|
102
|
+
self._id_token = res["AuthenticationResult"]["IdToken"]
|
|
103
|
+
|
|
104
|
+
self._set_token_exp()
|
|
105
|
+
|
|
106
|
+
self._write_token_cache()
|
|
107
|
+
|
|
108
|
+
@_fetch_cognito_config
|
|
109
|
+
def _refresh_auth(self) -> None:
|
|
110
|
+
res = self._cognito.initiate_auth(
|
|
111
|
+
AuthFlow="REFRESH_TOKEN_AUTH",
|
|
112
|
+
AuthParameters={"REFRESH_TOKEN": self._refresh_token},
|
|
113
|
+
ClientId=self._cogntio_config["client_id"],
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
self._access_token = res["AuthenticationResult"]["AccessToken"]
|
|
117
|
+
self._id_token = res["AuthenticationResult"]["IdToken"]
|
|
118
|
+
|
|
119
|
+
self._set_token_exp()
|
|
120
|
+
|
|
121
|
+
self._write_token_cache()
|
|
122
|
+
|
|
123
|
+
def _set_token_exp(self):
|
|
124
|
+
self._access_token_exp = datetime.fromtimestamp(
|
|
125
|
+
self._decode_token(self._access_token)["exp"]
|
|
126
|
+
)
|
|
127
|
+
self._id_token_exp = datetime.fromtimestamp(
|
|
128
|
+
self._decode_token(self._id_token)["exp"]
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
def _read_token_cache(self):
|
|
132
|
+
if self._access_token_cache_path.exists():
|
|
133
|
+
self._access_token = self._access_token_cache_path.read_text()
|
|
134
|
+
if self._refresh_token_cache_path.exists():
|
|
135
|
+
self._refresh_token = self._refresh_token_cache_path.read_text()
|
|
136
|
+
if self._id_token_cache_path.exists():
|
|
137
|
+
self._id_token = self._id_token_cache_path.read_text()
|
|
138
|
+
if self._cognito_config_cache_path.exists():
|
|
139
|
+
self._cognito_config = json.loads(
|
|
140
|
+
self._cognito_config_cache_path.read_text()
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
def _write_token_cache(self):
|
|
144
|
+
self._token_cache_path.mkdir(exist_ok=True)
|
|
145
|
+
self._access_token_cache_path.write_text(self._access_token)
|
|
146
|
+
self._refresh_token_cache_path.write_text(self._refresh_token)
|
|
147
|
+
self._id_token_cache_path.write_text(self._id_token)
|
|
148
|
+
self._cognito_config_cache_path.write_text(json.dumps(self._cognito_config))
|
|
149
|
+
|
|
150
|
+
@staticmethod
|
|
151
|
+
def _decode_token(token: str, verify: bool = False):
|
|
152
|
+
return jwt.decode(token, options={"verify_signature": verify})
|
|
153
|
+
|
|
154
|
+
def _call(
|
|
155
|
+
self,
|
|
156
|
+
method: str,
|
|
157
|
+
path: str,
|
|
158
|
+
data: Optional[str | Dict[str, Any]] = None,
|
|
159
|
+
model: Optional[BaseModel] = None,
|
|
160
|
+
):
|
|
161
|
+
if self._access_token_exp - datetime.now() <= timedelta(seconds=0):
|
|
162
|
+
try:
|
|
163
|
+
self._refresh_auth()
|
|
164
|
+
except:
|
|
165
|
+
self._initiate_auth()
|
|
166
|
+
|
|
167
|
+
if self._env != Environment.LOCAL:
|
|
168
|
+
self._session.headers.update(
|
|
169
|
+
{"Authorization": f"Bearer {self._access_token}"}
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
if model:
|
|
173
|
+
if isinstance(data, str):
|
|
174
|
+
data = model.model_validate_json(data).model_dump(mode="json")
|
|
175
|
+
if isinstance(data, dict):
|
|
176
|
+
data = model.model_validate(data).model_dump(mode="json")
|
|
177
|
+
|
|
178
|
+
res = getattr(self._session, method)(f"{self._base_url}{path}", json=data)
|
|
179
|
+
|
|
180
|
+
try:
|
|
181
|
+
res.raise_for_status()
|
|
182
|
+
except requests.exceptions.HTTPError as e:
|
|
183
|
+
try:
|
|
184
|
+
e.args = e.args + (e.response.json(),)
|
|
185
|
+
raise e
|
|
186
|
+
except requests.exceptions.JSONDecodeError as f:
|
|
187
|
+
e.args = e.args + (e.response.text,)
|
|
188
|
+
raise e
|
|
189
|
+
|
|
190
|
+
return res.json()
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class NerisApiClient(_NerisApiClient):
|
|
194
|
+
def health(self):
|
|
195
|
+
return self._call("get", "/health")
|
|
196
|
+
|
|
197
|
+
def get_org(self, neris_id: str) -> Dict[str, Any]:
|
|
198
|
+
return self._call("get", f"/org/{neris_id}")
|
|
199
|
+
|
|
200
|
+
def create_org(self, body: str | Dict[str, Any]) -> Dict[str, Any]:
|
|
201
|
+
return self._call("post", "/org/", body, model=CreateDepartmentPayload)
|
|
202
|
+
|
|
203
|
+
def update_org(self, neris_id: str, body: str | Dict[str, Any]) -> Dict[str, Any]:
|
|
204
|
+
return self._call("put", f"/org/{neris_id}", body, model=DepartmentPayload)
|
|
205
|
+
|
|
206
|
+
def get_user(self, sub: str | UUID) -> Dict[str, Any]:
|
|
207
|
+
return self._call("get", f"/user/{sub}")
|
|
208
|
+
|
|
209
|
+
def create_user(self, body: str | Dict[str, Any]) -> Dict[str, Any]:
|
|
210
|
+
return self._call("post", "/user", body, model=CreateUserPayload)
|
|
211
|
+
|
|
212
|
+
def update_user(
|
|
213
|
+
self, sub: str | UUID, body: str | Dict[str, Any]
|
|
214
|
+
) -> Dict[str, Any]:
|
|
215
|
+
return self._call("put", f"/user/{sub}", body, model=UpdateUserPayload)
|
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
# generated by datamodel-codegen:
|
|
2
|
+
# filename: openapi.json
|
|
3
|
+
# timestamp: 2024-03-22T18:44:46+00:00
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from typing import List, Optional, Union
|
|
9
|
+
from uuid import UUID
|
|
10
|
+
|
|
11
|
+
from pydantic import AwareDatetime, BaseModel, EmailStr, Field, constr
|
|
12
|
+
from typing_extensions import Literal
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AssessmentPayload(BaseModel):
|
|
16
|
+
iso_rating: Optional[int] = Field(None, title='Iso Rating')
|
|
17
|
+
cpse_acredited: Optional[bool] = Field(None, title='Cpse Acredited')
|
|
18
|
+
caas_acredited: Optional[bool] = Field(None, title='Caas Acredited')
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AssessmentResponse(BaseModel):
|
|
22
|
+
iso_rating: Optional[int] = Field(None, title='Iso Rating')
|
|
23
|
+
cpse_acredited: Optional[bool] = Field(None, title='Cpse Acredited')
|
|
24
|
+
caas_acredited: Optional[bool] = Field(None, title='Caas Acredited')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ContactPayload(BaseModel):
|
|
28
|
+
name: Optional[str] = Field(None, title='Name')
|
|
29
|
+
title: Optional[str] = Field(None, title='Title')
|
|
30
|
+
phone: Optional[str] = Field(None, title='Phone')
|
|
31
|
+
email: Optional[str] = Field(None, title='Email')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ContactResponse(BaseModel):
|
|
35
|
+
name: Optional[str] = Field(None, title='Name')
|
|
36
|
+
title: Optional[str] = Field(None, title='Title')
|
|
37
|
+
phone: Optional[str] = Field(None, title='Phone')
|
|
38
|
+
email: Optional[str] = Field(None, title='Email')
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CreateUserPayload(BaseModel):
|
|
42
|
+
username: str = Field(..., title='Username')
|
|
43
|
+
email: EmailStr = Field(..., title='Email')
|
|
44
|
+
phone_number: Optional[
|
|
45
|
+
constr(
|
|
46
|
+
pattern=r'^(\+?[1|0])?( )*([ \[\(])?\d{3}([\)\]\. \-])?( )*\d{3}([\. \-])?( )*\d{4}$'
|
|
47
|
+
)
|
|
48
|
+
] = Field(None, title='Phone Number')
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class GeoJsonMultiPolygon(BaseModel):
|
|
52
|
+
type: Literal['MultiPolygon'] = Field(..., title='Type')
|
|
53
|
+
coordinates: List[List[List[List[float]]]] = Field(..., title='Coordinates')
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class GeoJsonPoint(BaseModel):
|
|
57
|
+
type: Literal['Point'] = Field(..., title='Type')
|
|
58
|
+
coordinates: List[float] = Field(..., title='Coordinates')
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ShiftPayload(BaseModel):
|
|
62
|
+
count: Optional[int] = Field(None, title='Count')
|
|
63
|
+
duration: Optional[int] = Field(None, title='Duration')
|
|
64
|
+
signup: Optional[int] = Field(None, title='Signup')
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ShiftResponse(BaseModel):
|
|
68
|
+
count: Optional[int] = Field(None, title='Count')
|
|
69
|
+
duration: Optional[int] = Field(None, title='Duration')
|
|
70
|
+
signup: Optional[int] = Field(None, title='Signup')
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class StaffingPayload(BaseModel):
|
|
74
|
+
active_firefighters_career_ft: Optional[int] = Field(
|
|
75
|
+
None, title='Active Firefighters Career Ft'
|
|
76
|
+
)
|
|
77
|
+
active_firefighters_career_pt: Optional[int] = Field(
|
|
78
|
+
None, title='Active Firefighters Career Pt'
|
|
79
|
+
)
|
|
80
|
+
active_firefighters_volunteer: Optional[int] = Field(
|
|
81
|
+
None, title='Active Firefighters Volunteer'
|
|
82
|
+
)
|
|
83
|
+
active_ems_only_career_ft: Optional[int] = Field(None, title='Active Ems Only Career Ft')
|
|
84
|
+
active_ems_only_career_pt: Optional[int] = Field(None, title='Active Ems Only Career Pt')
|
|
85
|
+
active_ems_only_volunteer: Optional[int] = Field(None, title='Active Ems Only Volunteer')
|
|
86
|
+
active_civilians_career_ft: Optional[int] = Field(None, title='Active Civilians Career Ft')
|
|
87
|
+
active_civilians_career_pt: Optional[int] = Field(None, title='Active Civilians Career Pt')
|
|
88
|
+
active_civilians_volunteer: Optional[int] = Field(None, title='Active Civilians Volunteer')
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class StaffingResponse(BaseModel):
|
|
92
|
+
active_firefighters_career_ft: Optional[int] = Field(
|
|
93
|
+
None, title='Active Firefighters Career Ft'
|
|
94
|
+
)
|
|
95
|
+
active_firefighters_career_pt: Optional[int] = Field(
|
|
96
|
+
None, title='Active Firefighters Career Pt'
|
|
97
|
+
)
|
|
98
|
+
active_firefighters_volunteer: Optional[int] = Field(
|
|
99
|
+
None, title='Active Firefighters Volunteer'
|
|
100
|
+
)
|
|
101
|
+
active_ems_only_career_ft: Optional[int] = Field(None, title='Active Ems Only Career Ft')
|
|
102
|
+
active_ems_only_career_pt: Optional[int] = Field(None, title='Active Ems Only Career Pt')
|
|
103
|
+
active_ems_only_volunteer: Optional[int] = Field(None, title='Active Ems Only Volunteer')
|
|
104
|
+
active_civilians_career_ft: Optional[int] = Field(None, title='Active Civilians Career Ft')
|
|
105
|
+
active_civilians_career_pt: Optional[int] = Field(None, title='Active Civilians Career Pt')
|
|
106
|
+
active_civilians_volunteer: Optional[int] = Field(None, title='Active Civilians Volunteer')
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class StatesTerrs(Enum):
|
|
110
|
+
AL = 'AL'
|
|
111
|
+
AK = 'AK'
|
|
112
|
+
AS = 'AS'
|
|
113
|
+
AZ = 'AZ'
|
|
114
|
+
AR = 'AR'
|
|
115
|
+
CA = 'CA'
|
|
116
|
+
CO = 'CO'
|
|
117
|
+
CT = 'CT'
|
|
118
|
+
DE = 'DE'
|
|
119
|
+
DC = 'DC'
|
|
120
|
+
FL = 'FL'
|
|
121
|
+
GA = 'GA'
|
|
122
|
+
GU = 'GU'
|
|
123
|
+
HI = 'HI'
|
|
124
|
+
ID = 'ID'
|
|
125
|
+
IL = 'IL'
|
|
126
|
+
IN = 'IN'
|
|
127
|
+
IA = 'IA'
|
|
128
|
+
KS = 'KS'
|
|
129
|
+
KY = 'KY'
|
|
130
|
+
LA = 'LA'
|
|
131
|
+
ME = 'ME'
|
|
132
|
+
MD = 'MD'
|
|
133
|
+
MA = 'MA'
|
|
134
|
+
MI = 'MI'
|
|
135
|
+
MN = 'MN'
|
|
136
|
+
MS = 'MS'
|
|
137
|
+
MO = 'MO'
|
|
138
|
+
MP = 'MP'
|
|
139
|
+
MT = 'MT'
|
|
140
|
+
NA = 'NA'
|
|
141
|
+
NE = 'NE'
|
|
142
|
+
NV = 'NV'
|
|
143
|
+
NH = 'NH'
|
|
144
|
+
NJ = 'NJ'
|
|
145
|
+
NM = 'NM'
|
|
146
|
+
NY = 'NY'
|
|
147
|
+
NC = 'NC'
|
|
148
|
+
ND = 'ND'
|
|
149
|
+
OH = 'OH'
|
|
150
|
+
OK = 'OK'
|
|
151
|
+
OR = 'OR'
|
|
152
|
+
PA = 'PA'
|
|
153
|
+
PR = 'PR'
|
|
154
|
+
RI = 'RI'
|
|
155
|
+
SC = 'SC'
|
|
156
|
+
SD = 'SD'
|
|
157
|
+
TN = 'TN'
|
|
158
|
+
TX = 'TX'
|
|
159
|
+
UT = 'UT'
|
|
160
|
+
VT = 'VT'
|
|
161
|
+
VA = 'VA'
|
|
162
|
+
VI = 'VI'
|
|
163
|
+
WA = 'WA'
|
|
164
|
+
WV = 'WV'
|
|
165
|
+
WI = 'WI'
|
|
166
|
+
WY = 'WY'
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class TypeDeptValue(Enum):
|
|
170
|
+
CAREER = 'CAREER'
|
|
171
|
+
VOLUNTEER = 'VOLUNTEER'
|
|
172
|
+
COMBINED = 'COMBINED'
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class TypeDispProtoFireValue(Enum):
|
|
176
|
+
PROQA = 'PROQA'
|
|
177
|
+
IAED = 'IAED'
|
|
178
|
+
APCO = 'APCO'
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class TypeDispProtoMedValue(Enum):
|
|
182
|
+
PROQA = 'PROQA'
|
|
183
|
+
IAED = 'IAED'
|
|
184
|
+
APCO = 'APCO'
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class TypeEmsServValue(Enum):
|
|
188
|
+
NO_MEDICAL = 'NO_MEDICAL'
|
|
189
|
+
BLS_NO_TRANSPORT = 'BLS_NO_TRANSPORT'
|
|
190
|
+
ALS_NO_TRANSPORT = 'ALS_NO_TRANSPORT'
|
|
191
|
+
BLS_TRANSPORT = 'BLS_TRANSPORT'
|
|
192
|
+
ALS_TRANSPORT = 'ALS_TRANSPORT'
|
|
193
|
+
AERO_TRANSPORT = 'AERO_TRANSPORT'
|
|
194
|
+
COMMUNITY_MED = 'COMMUNITY_MED'
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class TypeFdServValue(Enum):
|
|
198
|
+
STRUCTURAL_FIREFIGHTING = 'STRUCTURAL_FIREFIGHTING'
|
|
199
|
+
HIGHRISE_FIREFIGHTING = 'HIGHRISE_FIREFIGHTING'
|
|
200
|
+
WILDLAND_FIREFIGHTING = 'WILDLAND_FIREFIGHTING'
|
|
201
|
+
PETROCHEM_FIREFIGHTING = 'PETROCHEM_FIREFIGHTING'
|
|
202
|
+
ARFF_FIREFIGHTING = 'ARFF_FIREFIGHTING'
|
|
203
|
+
MARINE_FIREFIGHTING = 'MARINE_FIREFIGHTING'
|
|
204
|
+
HAZMAT_OPS = 'HAZMAT_OPS'
|
|
205
|
+
HAZMAT_TECHNICIAN = 'HAZMAT_TECHNICIAN'
|
|
206
|
+
ROPE_RESCUE = 'ROPE_RESCUE'
|
|
207
|
+
COLLAPSE_RESCUE = 'COLLAPSE_RESCUE'
|
|
208
|
+
VEHICLE_RESCUE = 'VEHICLE_RESCUE'
|
|
209
|
+
ANIMAL_TECHRESCUE = 'ANIMAL_TECHRESCUE'
|
|
210
|
+
WILDERNESS_SAR = 'WILDERNESS_SAR'
|
|
211
|
+
TRENCH_RESCUE = 'TRENCH_RESCUE'
|
|
212
|
+
CONFINED_SPACE = 'CONFINED_SPACE'
|
|
213
|
+
MACHINERY_RESCUE = 'MACHINERY_RESCUE'
|
|
214
|
+
CAVE_SAR = 'CAVE_SAR'
|
|
215
|
+
MINE_SAR = 'MINE_SAR'
|
|
216
|
+
HELO_SAR = 'HELO_SAR'
|
|
217
|
+
WATER_SAR = 'WATER_SAR'
|
|
218
|
+
SWIFTWATER_SAR = 'SWIFTWATER_SAR'
|
|
219
|
+
DIVE_SAR = 'DIVE_SAR'
|
|
220
|
+
ICE_RESCUE = 'ICE_RESCUE'
|
|
221
|
+
SURF_RESCUE = 'SURF_RESCUE'
|
|
222
|
+
WATERCRAFT_RESCUE = 'WATERCRAFT_RESCUE'
|
|
223
|
+
FLOOD_SAR = 'FLOOD_SAR'
|
|
224
|
+
TOWER_SAR = 'TOWER_SAR'
|
|
225
|
+
REHABILITATION = 'REHABILITATION'
|
|
226
|
+
RRD_EXISTING = 'RRD_EXISTING'
|
|
227
|
+
RRD_NEWCONST = 'RRD_NEWCONST'
|
|
228
|
+
RRD_PUBLICED = 'RRD_PUBLICED'
|
|
229
|
+
RRD_PLANS = 'RRD_PLANS'
|
|
230
|
+
CAUSE_ORIGIN = 'CAUSE_ORIGIN'
|
|
231
|
+
TRAINING_ELF = 'TRAINING_ELF'
|
|
232
|
+
TRAINING_VETFF = 'TRAINING_VETFF'
|
|
233
|
+
TRAINING_OD = 'TRAINING_OD'
|
|
234
|
+
TRAINING_DRIVER = 'TRAINING_DRIVER'
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class TypeGeoSourceValue(Enum):
|
|
238
|
+
DEPT_UPLOAD = 'DEPT_UPLOAD'
|
|
239
|
+
DEPT_FILE = 'DEPT_FILE'
|
|
240
|
+
AWS = 'AWS'
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class TypeInvestServValue(Enum):
|
|
244
|
+
COMPANY_LEVEL = 'COMPANY_LEVEL'
|
|
245
|
+
JUVENILE_FIRESETTER = 'JUVENILE_FIRESETTER'
|
|
246
|
+
DEDICATED = 'DEDICATED'
|
|
247
|
+
LAW_ENFORCEMENT = 'LAW_ENFORCEMENT'
|
|
248
|
+
K9_DETECT = 'K9_DETECT'
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class TypeOrgValue(Enum):
|
|
252
|
+
LOCAL = 'LOCAL'
|
|
253
|
+
TRIBAL_GOVT = 'TRIBAL_GOVT'
|
|
254
|
+
PRIVATE = 'PRIVATE'
|
|
255
|
+
DOD = 'DOD'
|
|
256
|
+
SFM = 'SFM'
|
|
257
|
+
FEDERAL = 'FEDERAL'
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class TypePopSourceValue(Enum):
|
|
261
|
+
DEPARTMENT_ENTERED = 'DEPARTMENT_ENTERED'
|
|
262
|
+
CENSUS_DERIVED = 'CENSUS_DERIVED'
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class TypePsapCapaValue(Enum):
|
|
266
|
+
LEGACY = 'LEGACY'
|
|
267
|
+
NG911 = 'NG911'
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class TypePsapDiscValue(Enum):
|
|
271
|
+
SINGLE = 'SINGLE'
|
|
272
|
+
MULTIPLE = 'MULTIPLE'
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class TypePsapJurisValue(Enum):
|
|
276
|
+
SINGLE = 'SINGLE'
|
|
277
|
+
MULTIPLE = 'MULTIPLE'
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class TypePsapValue(Enum):
|
|
281
|
+
PRIMARY = 'PRIMARY'
|
|
282
|
+
SECONDARY = 'SECONDARY'
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class TypeRegionValue(Enum):
|
|
286
|
+
BATTALION = 'BATTALION'
|
|
287
|
+
COUNCIL_DISTRICT = 'COUNCIL_DISTRICT'
|
|
288
|
+
DISTRICT = 'DISTRICT'
|
|
289
|
+
DIVISION = 'DIVISION'
|
|
290
|
+
FIRST_DUE = 'FIRST_DUE'
|
|
291
|
+
OTHER = 'OTHER'
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
class TypeUnitValue(Enum):
|
|
295
|
+
CREW_TRANS = 'CREW_TRANS'
|
|
296
|
+
ENGINE_STRUCT = 'ENGINE_STRUCT'
|
|
297
|
+
ENGINE_WUI = 'ENGINE_WUI'
|
|
298
|
+
BOAT = 'BOAT'
|
|
299
|
+
BOAT_LARGE = 'BOAT_LARGE'
|
|
300
|
+
LADDER_SMALL = 'LADDER_SMALL'
|
|
301
|
+
LADDER_QUINT = 'LADDER_QUINT'
|
|
302
|
+
LADDER_TALL = 'LADDER_TALL'
|
|
303
|
+
QUINT_TALL = 'QUINT_TALL'
|
|
304
|
+
PLATFORM = 'PLATFORM'
|
|
305
|
+
PLATFORM_QUINT = 'PLATFORM_QUINT'
|
|
306
|
+
LADDER_TILLER = 'LADDER_TILLER'
|
|
307
|
+
ARFF = 'ARFF'
|
|
308
|
+
FOAM = 'FOAM'
|
|
309
|
+
TENDER = 'TENDER'
|
|
310
|
+
CREW = 'CREW'
|
|
311
|
+
HELO_GENERAL = 'HELO_GENERAL'
|
|
312
|
+
HELO_FIRE = 'HELO_FIRE'
|
|
313
|
+
HELO_RESCUE = 'HELO_RESCUE'
|
|
314
|
+
UAS_FIRE = 'UAS_FIRE'
|
|
315
|
+
UAS_RECON = 'UAS_RECON'
|
|
316
|
+
AIR_TANKER = 'AIR_TANKER'
|
|
317
|
+
AIR_EMS = 'AIR_EMS'
|
|
318
|
+
AIR_RECON = 'AIR_RECON'
|
|
319
|
+
ALS_AMB = 'ALS_AMB'
|
|
320
|
+
BLS_AMB = 'BLS_AMB'
|
|
321
|
+
EMS_NOTRANS = 'EMS_NOTRANS'
|
|
322
|
+
EMS_SUPV = 'EMS_SUPV'
|
|
323
|
+
CHIEF = 'CHIEF'
|
|
324
|
+
HAZMAT = 'HAZMAT'
|
|
325
|
+
DECON = 'DECON'
|
|
326
|
+
POV = 'POV'
|
|
327
|
+
RESCUE_HEAVY = 'RESCUE_HEAVY'
|
|
328
|
+
RESCUE_MEDIUM = 'RESCUE_MEDIUM'
|
|
329
|
+
RESCUE_LIGHT = 'RESCUE_LIGHT'
|
|
330
|
+
RESCUE_USAR = 'RESCUE_USAR'
|
|
331
|
+
RESCUE_WATER = 'RESCUE_WATER'
|
|
332
|
+
SCBA = 'SCBA'
|
|
333
|
+
AIR_LIGHT = 'AIR_LIGHT'
|
|
334
|
+
REHAB = 'REHAB'
|
|
335
|
+
MOBILE_ICP = 'MOBILE_ICP'
|
|
336
|
+
MOBILE_COMMS = 'MOBILE_COMMS'
|
|
337
|
+
DOZER = 'DOZER'
|
|
338
|
+
OTHER_GROUND = 'OTHER_GROUND'
|
|
339
|
+
ATV_EMS = 'ATV_EMS'
|
|
340
|
+
ATV_FIRE = 'ATV_FIRE'
|
|
341
|
+
INVEST = 'INVEST'
|
|
342
|
+
UTIL = 'UTIL'
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
class UnitCreatedModifiedResponse(BaseModel):
|
|
346
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
347
|
+
version: int = Field(..., title='Version')
|
|
348
|
+
valid_start: AwareDatetime = Field(..., title='Valid Start')
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class UnitPayload(BaseModel):
|
|
352
|
+
type: TypeUnitValue
|
|
353
|
+
staffing: int = Field(..., title='Staffing')
|
|
354
|
+
cad_designation_1: Optional[str] = Field(None, title='Cad Designation 1')
|
|
355
|
+
cad_designation_2: Optional[str] = Field(None, title='Cad Designation 2')
|
|
356
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
class UnitResponse(BaseModel):
|
|
360
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
361
|
+
version: int = Field(..., title='Version')
|
|
362
|
+
type: TypeUnitValue
|
|
363
|
+
staffing: int = Field(..., title='Staffing')
|
|
364
|
+
cad_designation_1: Optional[str] = Field(None, title='Cad Designation 1')
|
|
365
|
+
cad_designation_2: Optional[str] = Field(None, title='Cad Designation 2')
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class UpdateUserPayload(BaseModel):
|
|
369
|
+
email: EmailStr = Field(..., title='Email')
|
|
370
|
+
phone_number: Optional[
|
|
371
|
+
constr(
|
|
372
|
+
pattern=r'^(\+?[1|0])?( )*([ \[\(])?\d{3}([\)\]\. \-])?( )*\d{3}([\. \-])?( )*\d{4}$'
|
|
373
|
+
)
|
|
374
|
+
] = Field(None, title='Phone Number')
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
class UserActivationPayload(BaseModel):
|
|
378
|
+
active: bool = Field(..., title='Active')
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
class UserStatus(Enum):
|
|
382
|
+
UNCONFIRMED = 'UNCONFIRMED'
|
|
383
|
+
CONFIRMED = 'CONFIRMED'
|
|
384
|
+
UNKNOWN = 'UNKNOWN'
|
|
385
|
+
RESET_REQUIRED = 'RESET_REQUIRED'
|
|
386
|
+
FORCE_CHANGE_PASSWORD = 'FORCE_CHANGE_PASSWORD'
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class ValidationError(BaseModel):
|
|
390
|
+
loc: List[Union[str, int]] = Field(..., title='Location')
|
|
391
|
+
msg: str = Field(..., title='Message')
|
|
392
|
+
type: str = Field(..., title='Error Type')
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class CreateUnitPayload(BaseModel):
|
|
396
|
+
type: TypeUnitValue
|
|
397
|
+
staffing: int = Field(..., title='Staffing')
|
|
398
|
+
cad_designation_1: Optional[str] = Field(None, title='Cad Designation 1')
|
|
399
|
+
cad_designation_2: Optional[str] = Field(None, title='Cad Designation 2')
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class DispatchPayload(BaseModel):
|
|
403
|
+
avl_usage: Optional[bool] = Field(None, title='Avl Usage')
|
|
404
|
+
center_id: Optional[int] = Field(None, title='Center Id')
|
|
405
|
+
cad_software: Optional[str] = Field(None, title='Cad Software')
|
|
406
|
+
psap_type: Optional[TypePsapValue] = None
|
|
407
|
+
psap_capability: Optional[TypePsapCapaValue] = None
|
|
408
|
+
psap_discipline: Optional[TypePsapDiscValue] = None
|
|
409
|
+
psap_jurisdiction: Optional[TypePsapJurisValue] = None
|
|
410
|
+
protocol_fire: Optional[TypeDispProtoFireValue] = None
|
|
411
|
+
protocol_med: Optional[TypeDispProtoMedValue] = None
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
class DispatchResponse(BaseModel):
|
|
415
|
+
avl_usage: Optional[bool] = Field(None, title='Avl Usage')
|
|
416
|
+
center_id: Optional[int] = Field(None, title='Center Id')
|
|
417
|
+
cad_software: Optional[str] = Field(None, title='Cad Software')
|
|
418
|
+
psap_type: Optional[TypePsapValue] = None
|
|
419
|
+
psap_capability: Optional[TypePsapCapaValue] = None
|
|
420
|
+
protocol_fire: Optional[TypeDispProtoFireValue] = None
|
|
421
|
+
protocol_med: Optional[TypeDispProtoMedValue] = None
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
class GeoPoint(BaseModel):
|
|
425
|
+
crs: Optional[Union[int, str]] = Field(4326, title='Crs')
|
|
426
|
+
source: TypeGeoSourceValue
|
|
427
|
+
geometry: GeoJsonPoint
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class GeoPointResponse(BaseModel):
|
|
431
|
+
crs: Optional[int] = Field(4326, title='Crs')
|
|
432
|
+
source: TypeGeoSourceValue
|
|
433
|
+
geometry: GeoJsonPoint
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class HTTPValidationError(BaseModel):
|
|
437
|
+
detail: Optional[List[ValidationError]] = Field(None, title='Detail')
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class OrgSummaryInfoResponse(BaseModel):
|
|
441
|
+
name: str = Field(..., title='Name')
|
|
442
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
443
|
+
city: str = Field(..., title='City')
|
|
444
|
+
state: StatesTerrs
|
|
445
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class OrgsSummaryInfoResponse(BaseModel):
|
|
449
|
+
count: int = Field(..., title='Count')
|
|
450
|
+
orgs: List[OrgSummaryInfoResponse] = Field(..., title='Orgs')
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class PopulationPayload(BaseModel):
|
|
454
|
+
source: Optional[TypePopSourceValue] = None
|
|
455
|
+
protected: Optional[int] = Field(None, title='Protected')
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
class PopulationResponse(BaseModel):
|
|
459
|
+
source: Optional[TypePopSourceValue] = None
|
|
460
|
+
protected: Optional[int] = Field(None, title='Protected')
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class RegionPayload(BaseModel):
|
|
464
|
+
crs: Optional[Union[int, str]] = Field(4326, title='Crs')
|
|
465
|
+
source: TypeGeoSourceValue
|
|
466
|
+
geometry: GeoJsonMultiPolygon
|
|
467
|
+
name: Optional[str] = Field(None, title='Name')
|
|
468
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
class RegionResponse(BaseModel):
|
|
472
|
+
crs: Optional[int] = Field(4326, title='Crs')
|
|
473
|
+
source: TypeGeoSourceValue
|
|
474
|
+
geometry: GeoJsonMultiPolygon
|
|
475
|
+
name: Optional[str] = Field(None, title='Name')
|
|
476
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
class RegionSetPayload(BaseModel):
|
|
480
|
+
name: Optional[str] = Field(None, title='Name')
|
|
481
|
+
type: TypeRegionValue
|
|
482
|
+
primary: bool = Field(..., title='Primary')
|
|
483
|
+
coverage: bool = Field(..., title='Coverage')
|
|
484
|
+
juris: bool = Field(..., title='Juris')
|
|
485
|
+
regions: Optional[List[RegionPayload]] = Field(None, title='Regions')
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class RegionSetResponse(BaseModel):
|
|
489
|
+
name: Optional[str] = Field(None, title='Name')
|
|
490
|
+
type: TypeRegionValue
|
|
491
|
+
primary: bool = Field(..., title='Primary')
|
|
492
|
+
coverage: bool = Field(..., title='Coverage')
|
|
493
|
+
juris: bool = Field(..., title='Juris')
|
|
494
|
+
regions: Optional[List[RegionResponse]] = Field(None, title='Regions')
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
class StationCreatedModifiedResponse(BaseModel):
|
|
498
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
499
|
+
version: int = Field(..., title='Version')
|
|
500
|
+
valid_start: AwareDatetime = Field(..., title='Valid Start')
|
|
501
|
+
units: Optional[List[UnitCreatedModifiedResponse]] = Field(None, title='Units')
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
class StationPayload(BaseModel):
|
|
505
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
506
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
507
|
+
city: str = Field(..., title='City')
|
|
508
|
+
state: StatesTerrs
|
|
509
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
510
|
+
station_id: str = Field(..., title='Station Id')
|
|
511
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
512
|
+
staffing: Optional[int] = Field(None, title='Staffing')
|
|
513
|
+
units: Optional[List[Union[UnitPayload, CreateUnitPayload]]] = Field(None, title='Units')
|
|
514
|
+
location: Optional[GeoPoint] = None
|
|
515
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
class StationResponse(BaseModel):
|
|
519
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
520
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
521
|
+
city: str = Field(..., title='City')
|
|
522
|
+
state: StatesTerrs
|
|
523
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
524
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
525
|
+
version: int = Field(..., title='Version')
|
|
526
|
+
station_id: str = Field(..., title='Station Id')
|
|
527
|
+
staffing: Optional[int] = Field(None, title='Staffing')
|
|
528
|
+
location: Optional[GeoPointResponse] = None
|
|
529
|
+
units: Optional[List[UnitResponse]] = Field(None, title='Units')
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
class UserResponse(BaseModel):
|
|
533
|
+
username: str = Field(..., title='Username')
|
|
534
|
+
sub: UUID = Field(..., title='Sub')
|
|
535
|
+
email: Optional[EmailStr] = Field(None, title='Email')
|
|
536
|
+
phone_number: Optional[
|
|
537
|
+
constr(
|
|
538
|
+
pattern=r'^(\+?[1|0])?( )*([ \[\(])?\d{3}([\)\]\. \-])?( )*\d{3}([\. \-])?( )*\d{4}$'
|
|
539
|
+
)
|
|
540
|
+
] = Field(None, title='Phone Number')
|
|
541
|
+
status: UserStatus
|
|
542
|
+
active: bool = Field(..., title='Active')
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
class CreateStationPayload(BaseModel):
|
|
546
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
547
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
548
|
+
city: str = Field(..., title='City')
|
|
549
|
+
state: StatesTerrs
|
|
550
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
551
|
+
station_id: str = Field(..., title='Station Id')
|
|
552
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
553
|
+
staffing: Optional[int] = Field(None, title='Staffing')
|
|
554
|
+
units: Optional[List[CreateUnitPayload]] = Field(None, title='Units')
|
|
555
|
+
location: Optional[GeoPoint] = None
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
class DepartmentCreatedModifiedResponse(BaseModel):
|
|
559
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
560
|
+
version: int = Field(..., title='Version')
|
|
561
|
+
valid_start: AwareDatetime = Field(..., title='Valid Start')
|
|
562
|
+
stations: Optional[List[StationCreatedModifiedResponse]] = Field(None, title='Stations')
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class DepartmentPayload(BaseModel):
|
|
566
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
567
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
568
|
+
city: str = Field(..., title='City')
|
|
569
|
+
state: StatesTerrs
|
|
570
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
571
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
572
|
+
name: str = Field(..., title='Name')
|
|
573
|
+
mail_address_line_1: Optional[str] = Field(None, title='Mail Address Line 1')
|
|
574
|
+
mail_address_line_2: Optional[str] = Field(None, title='Mail Address Line 2')
|
|
575
|
+
mail_city: Optional[str] = Field(None, title='Mail City')
|
|
576
|
+
mail_state: Optional[StatesTerrs] = None
|
|
577
|
+
mail_zip_code: Optional[str] = Field(None, title='Mail Zip Code')
|
|
578
|
+
email: Optional[str] = Field(None, title='Email')
|
|
579
|
+
website: Optional[str] = Field(None, title='Website')
|
|
580
|
+
continue_edu: Optional[bool] = Field(None, title='Continue Edu')
|
|
581
|
+
department_type: Optional[TypeDeptValue] = None
|
|
582
|
+
organization_type: Optional[TypeOrgValue] = None
|
|
583
|
+
rms_software: Optional[str] = Field(None, title='Rms Software')
|
|
584
|
+
population: Optional[PopulationPayload] = None
|
|
585
|
+
dispatch: Optional[DispatchPayload] = None
|
|
586
|
+
staffing: Optional[StaffingPayload] = None
|
|
587
|
+
assessment: Optional[AssessmentPayload] = None
|
|
588
|
+
contact: Optional[ContactPayload] = None
|
|
589
|
+
shift: Optional[ShiftPayload] = None
|
|
590
|
+
fire_services: Optional[List[TypeFdServValue]] = Field(None, title='Fire Services')
|
|
591
|
+
ems_services: Optional[List[TypeEmsServValue]] = Field(None, title='Ems Services')
|
|
592
|
+
investigation_services: Optional[List[TypeInvestServValue]] = Field(
|
|
593
|
+
None, title='Investigation Services'
|
|
594
|
+
)
|
|
595
|
+
stations: Optional[List[Union[StationPayload, CreateStationPayload]]] = Field(
|
|
596
|
+
None, title='Stations'
|
|
597
|
+
)
|
|
598
|
+
location: Optional[GeoPoint] = None
|
|
599
|
+
region_sets: Optional[List[RegionSetPayload]] = Field(None, title='Region Sets')
|
|
600
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
class DepartmentResponse(BaseModel):
|
|
604
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
605
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
606
|
+
city: str = Field(..., title='City')
|
|
607
|
+
state: StatesTerrs
|
|
608
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
609
|
+
last_modified: AwareDatetime = Field(..., title='Last Modified')
|
|
610
|
+
neris_id: str = Field(..., title='Neris Id')
|
|
611
|
+
version: int = Field(..., title='Version')
|
|
612
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
613
|
+
name: str = Field(..., title='Name')
|
|
614
|
+
mail_address_line_1: Optional[str] = Field(None, title='Mail Address Line 1')
|
|
615
|
+
mail_address_line_2: Optional[str] = Field(None, title='Mail Address Line 2')
|
|
616
|
+
mail_city: Optional[str] = Field(None, title='Mail City')
|
|
617
|
+
mail_state: Optional[StatesTerrs] = None
|
|
618
|
+
mail_zip_code: Optional[str] = Field(None, title='Mail Zip Code')
|
|
619
|
+
email: Optional[str] = Field(None, title='Email')
|
|
620
|
+
website: Optional[str] = Field(None, title='Website')
|
|
621
|
+
continue_edu: Optional[bool] = Field(None, title='Continue Edu')
|
|
622
|
+
department_type: Optional[TypeDeptValue] = None
|
|
623
|
+
organization_type: Optional[TypeOrgValue] = None
|
|
624
|
+
rms_software: Optional[str] = Field(None, title='Rms Software')
|
|
625
|
+
population: Optional[PopulationResponse] = None
|
|
626
|
+
dispatch: Optional[DispatchResponse] = None
|
|
627
|
+
staffing: Optional[StaffingResponse] = None
|
|
628
|
+
assessment: Optional[AssessmentResponse] = None
|
|
629
|
+
contact: Optional[ContactResponse] = None
|
|
630
|
+
shift: Optional[ShiftResponse] = None
|
|
631
|
+
fire_services: Optional[List[TypeFdServValue]] = Field(None, title='Fire Services')
|
|
632
|
+
ems_services: Optional[List[TypeEmsServValue]] = Field(None, title='Ems Services')
|
|
633
|
+
investigation_services: Optional[List[TypeInvestServValue]] = Field(
|
|
634
|
+
None, title='Investigation Services'
|
|
635
|
+
)
|
|
636
|
+
stations: Optional[List[StationResponse]] = Field(None, title='Stations')
|
|
637
|
+
location: Optional[GeoPointResponse] = None
|
|
638
|
+
region_sets: Optional[List[RegionSetResponse]] = Field(None, title='Region Sets')
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
class CreateDepartmentPayload(BaseModel):
|
|
642
|
+
address_line_1: str = Field(..., title='Address Line 1')
|
|
643
|
+
address_line_2: Optional[str] = Field(None, title='Address Line 2')
|
|
644
|
+
city: str = Field(..., title='City')
|
|
645
|
+
state: StatesTerrs
|
|
646
|
+
zip_code: str = Field(..., title='Zip Code')
|
|
647
|
+
internal_id: Optional[str] = Field(None, title='Internal Id')
|
|
648
|
+
name: str = Field(..., title='Name')
|
|
649
|
+
mail_address_line_1: Optional[str] = Field(None, title='Mail Address Line 1')
|
|
650
|
+
mail_address_line_2: Optional[str] = Field(None, title='Mail Address Line 2')
|
|
651
|
+
mail_city: Optional[str] = Field(None, title='Mail City')
|
|
652
|
+
mail_state: Optional[StatesTerrs] = None
|
|
653
|
+
mail_zip_code: Optional[str] = Field(None, title='Mail Zip Code')
|
|
654
|
+
email: Optional[str] = Field(None, title='Email')
|
|
655
|
+
website: Optional[str] = Field(None, title='Website')
|
|
656
|
+
continue_edu: Optional[bool] = Field(None, title='Continue Edu')
|
|
657
|
+
department_type: Optional[TypeDeptValue] = None
|
|
658
|
+
organization_type: Optional[TypeOrgValue] = None
|
|
659
|
+
rms_software: Optional[str] = Field(None, title='Rms Software')
|
|
660
|
+
population: Optional[PopulationPayload] = None
|
|
661
|
+
dispatch: Optional[DispatchPayload] = None
|
|
662
|
+
staffing: Optional[StaffingPayload] = None
|
|
663
|
+
assessment: Optional[AssessmentPayload] = None
|
|
664
|
+
contact: Optional[ContactPayload] = None
|
|
665
|
+
shift: Optional[ShiftPayload] = None
|
|
666
|
+
fire_services: Optional[List[TypeFdServValue]] = Field(None, title='Fire Services')
|
|
667
|
+
ems_services: Optional[List[TypeEmsServValue]] = Field(None, title='Ems Services')
|
|
668
|
+
investigation_services: Optional[List[TypeInvestServValue]] = Field(
|
|
669
|
+
None, title='Investigation Services'
|
|
670
|
+
)
|
|
671
|
+
stations: Optional[List[CreateStationPayload]] = Field(None, title='Stations')
|
|
672
|
+
location: Optional[GeoPoint] = None
|
|
673
|
+
region_sets: Optional[List[RegionSetPayload]] = Field(None, title='Region Sets')
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: neris_api_client
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: NERIS API Client
|
|
5
|
+
Author-email: Ben Coleman <ben.coleman@ul.org>
|
|
6
|
+
Project-URL: Homepage, https://github.com/ulfsri/neris
|
|
7
|
+
Project-URL: Issues, https://github.com/ulfsri/neris/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: boto3
|
|
15
|
+
Requires-Dist: PyJWT
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Requires-Dist: typing_extensions
|
|
19
|
+
|
|
20
|
+
# NERIS API Client
|
|
21
|
+
|
|
22
|
+
A Python class to interact with the NERIS API programmatically.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
The client requires a username and password for authentication and authorization of requests unless the `env` argument is set to `local`
|
|
26
|
+
at instantiation. The `local` environment is intended for development use on local machines and bypasses auth.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from neris_api_client import NerisApiClient
|
|
30
|
+
|
|
31
|
+
client = NerisApiClient(username="neris.user", password="*******", env="dev")
|
|
32
|
+
|
|
33
|
+
# Get an organization
|
|
34
|
+
org = client.get_org("FD24027240")
|
|
35
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/neris_api_client/__init__.py
|
|
5
|
+
src/neris_api_client/client.py
|
|
6
|
+
src/neris_api_client/models.py
|
|
7
|
+
src/neris_api_client.egg-info/PKG-INFO
|
|
8
|
+
src/neris_api_client.egg-info/SOURCES.txt
|
|
9
|
+
src/neris_api_client.egg-info/dependency_links.txt
|
|
10
|
+
src/neris_api_client.egg-info/requires.txt
|
|
11
|
+
src/neris_api_client.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neris_api_client
|