biotmed-notification-sdk 2.3.40__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.
Files changed (47) hide show
  1. biotmed_notification_sdk-2.3.40/PKG-INFO +477 -0
  2. biotmed_notification_sdk-2.3.40/README.md +458 -0
  3. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/__init__.py +117 -0
  4. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api/__init__.py +26 -0
  5. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api/configuration_api_api.py +813 -0
  6. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api/email_api_api.py +593 -0
  7. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api/health_check_api_api.py +284 -0
  8. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api/smsapi_api.py +314 -0
  9. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api_client.py +809 -0
  10. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/api_response.py +21 -0
  11. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/configuration.py +627 -0
  12. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/exceptions.py +219 -0
  13. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/__init__.py +50 -0
  14. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/add_attachment_response.py +189 -0
  15. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/configuration_request.py +192 -0
  16. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/configuration_response.py +192 -0
  17. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/email_request.py +205 -0
  18. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/email_template.py +202 -0
  19. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/error_response.py +199 -0
  20. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/send_sms_request.py +199 -0
  21. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/send_sms_response.py +189 -0
  22. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/sms_provider_configuration_response.py +189 -0
  23. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/models/version_response.py +193 -0
  24. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/py.typed +0 -0
  25. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk/rest.py +263 -0
  26. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk.egg-info/PKG-INFO +477 -0
  27. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk.egg-info/SOURCES.txt +46 -0
  28. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk.egg-info/dependency_links.txt +1 -0
  29. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk.egg-info/requires.txt +6 -0
  30. biotmed_notification_sdk-2.3.40/biotmed_notification_sdk.egg-info/top_level.txt +1 -0
  31. biotmed_notification_sdk-2.3.40/pyproject.toml +98 -0
  32. biotmed_notification_sdk-2.3.40/setup.cfg +7 -0
  33. biotmed_notification_sdk-2.3.40/setup.py +50 -0
  34. biotmed_notification_sdk-2.3.40/test/test_add_attachment_response.py +51 -0
  35. biotmed_notification_sdk-2.3.40/test/test_configuration_api_api.py +52 -0
  36. biotmed_notification_sdk-2.3.40/test/test_configuration_request.py +54 -0
  37. biotmed_notification_sdk-2.3.40/test/test_configuration_response.py +54 -0
  38. biotmed_notification_sdk-2.3.40/test/test_email_api_api.py +45 -0
  39. biotmed_notification_sdk-2.3.40/test/test_email_request.py +73 -0
  40. biotmed_notification_sdk-2.3.40/test/test_email_template.py +61 -0
  41. biotmed_notification_sdk-2.3.40/test/test_error_response.py +58 -0
  42. biotmed_notification_sdk-2.3.40/test/test_health_check_api_api.py +38 -0
  43. biotmed_notification_sdk-2.3.40/test/test_send_sms_request.py +54 -0
  44. biotmed_notification_sdk-2.3.40/test/test_send_sms_response.py +51 -0
  45. biotmed_notification_sdk-2.3.40/test/test_sms_provider_configuration_response.py +51 -0
  46. biotmed_notification_sdk-2.3.40/test/test_smsapi_api.py +38 -0
  47. biotmed_notification_sdk-2.3.40/test/test_version_response.py +53 -0
@@ -0,0 +1,477 @@
1
+ Metadata-Version: 2.4
2
+ Name: biotmed_notification_sdk
3
+ Version: 2.3.40
4
+ Summary: BioT Notification Service
5
+ Home-page:
6
+ Author: OpenAPI Generator community
7
+ Author-email: OpenAPI Generator Community <team@openapitools.org>
8
+ Project-URL: Repository, https://github.com/GIT_USER_ID/GIT_REPO_ID
9
+ Keywords: OpenAPI,OpenAPI-Generator,BioT Notification Service
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
13
+ Requires-Dist: python-dateutil>=2.8.2
14
+ Requires-Dist: pydantic>=2
15
+ Requires-Dist: typing-extensions>=4.7.1
16
+ Requires-Dist: lazy-imports<2,>=1
17
+ Requires-Dist: certifi>=2024.0.0
18
+ Dynamic: author
19
+
20
+ # biotmed_notification_sdk
21
+
22
+ APIs document (version: 5.3.32)
23
+
24
+ This Python SDK provides a client library for interacting with the BioT Service API. BioT is a comprehensive platform for medical device integration and healthcare data management, enabling secure communication between medical devices and cloud services.
25
+
26
+ For more information about BioT, see [BioT](https://www.biot-med.com).
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install biotmed_notification_sdk
32
+ ```
33
+
34
+ ## Configuration
35
+
36
+ ### Creating and Configuring the ApiClient
37
+
38
+ The SDK requires configuration with an access token and the service endpoint. You'll need to:
39
+
40
+ 1. **Configure the service path** by appending the service-specific path to your BioT base URL
41
+ 2. **Provide an access token** (as a string or callable function)
42
+ 3. **Optionally set up language management** (as a string or callable function)
43
+
44
+ #### Service Path Configuration
45
+
46
+ Each BioT service has its own path that must be appended to the base URL:
47
+
48
+ - **Generic Entity Service**: `/generic-entity`
49
+ - **Organization Service**: `/organization`
50
+ - **DMS Service**: `/dms`
51
+ - **File Service**: `/file`
52
+ - **Notification Service**: `/notification`
53
+ - **UMS Service**: `/ums`
54
+ - **Settings Service**: `/settings`
55
+ - **Measurement Service**: `/measurement`
56
+ - **Device Service**: `/device`
57
+
58
+ **Important**: Always append the service path to your `biot_base_url` when configuring the SDK.
59
+
60
+ #### Access Token Configuration
61
+
62
+ The SDK supports both static tokens and dynamic token providers (callable pattern). You can pass either:
63
+
64
+ - **A string**: A static access token (not recommended for long-running applications)
65
+ - **A callable** (function or callable object): A token provider that returns a token when called, enabling automatic token refresh
66
+
67
+ Using a callable allows the SDK to refresh tokens automatically before they expire, ensuring your API calls remain authenticated.
68
+
69
+ ```python
70
+ # Option 1: Static token (simple but tokens expire)
71
+ access_token = "your-static-token-here"
72
+
73
+ # Option 2: Callable function for dynamic token refresh
74
+ def get_access_token() -> str:
75
+ # Implement your token retrieval/refresh logic here
76
+ # This function will be called by the SDK when authentication is needed
77
+ # You can authenticate however you prefer (OAuth, service user, etc.)
78
+ return "your-access-token"
79
+
80
+ # Option 3: Callable object (Token Provider pattern)
81
+ class TokenProvider:
82
+ def __call__(self) -> str:
83
+ # Return the token, only refresh if expired
84
+ if self._is_token_expired():
85
+ self._token = self._refresh_token()
86
+ return self._token
87
+
88
+ def _is_token_expired(self) -> bool:
89
+ # Check if token needs refresh
90
+ # Your expiration check logic here
91
+ return True
92
+
93
+ def _refresh_token(self) -> str:
94
+ # Your token refresh implementation
95
+ # This is only called when token is expired
96
+ return "your-new-access-token"
97
+
98
+ token_provider = TokenProvider()
99
+ ```
100
+
101
+ #### Language Configuration
102
+
103
+ Similarly, the `accept_language` parameter supports both static strings and callables for dynamic language selection:
104
+
105
+ ```python
106
+ # Option 1: Static language
107
+ accept_language = "en-us"
108
+
109
+ # Option 2: Callable for dynamic language selection
110
+ def get_accept_language() -> str:
111
+ # Return language based on user preferences, system settings, etc.
112
+ return "en-us" # Examples: "en-us", "fr-fr", "de-de", etc.
113
+ ```
114
+
115
+ #### Complete Configuration Example
116
+
117
+ ```python
118
+ import biotmed_notification_sdk
119
+ from typing import Callable
120
+
121
+ # BioT configuration
122
+ biot_base_url = "https://api.example.biot-med.com" # or your production URL
123
+
124
+ # Token provider (callable for automatic refresh)
125
+ def get_access_token() -> str:
126
+ # Implement your token retrieval/refresh logic
127
+ # This will be called by the SDK when authentication is needed
128
+ # Authenticate using your preferred method (OAuth, service user credentials, etc.)
129
+ return "your-access-token"
130
+
131
+ # Language provider (optional, callable for dynamic language)
132
+ def get_accept_language() -> str:
133
+ return "en-us"
134
+
135
+ # Configure SDK with service path appended to base URL
136
+ configuration = biotmed_notification_sdk.Configuration(
137
+ host=biot_base_url + "/service-path", # Replace with your service path (e.g., "/generic-entity", "/organization", "/dms")
138
+ access_token=get_access_token, # Callable token provider
139
+ accept_language=get_accept_language # Optional: callable language provider
140
+ )
141
+
142
+ # Create ApiClient
143
+ with biotmed_notification_sdk.ApiClient(configuration) as api_client:
144
+ # Create API instances
145
+ api = biotmed_notification_sdk.YourAPIClass(api_client) # Replace with your actual API class name
146
+ # Use the API...
147
+ ```
148
+
149
+ ## Usage Examples
150
+
151
+ ### Different Approaches for Creating Resources
152
+
153
+ The SDK supports multiple approaches for creating resources, each with different trade-offs between type safety, flexibility, and developer experience. Choose the approach that best fits your use case.
154
+
155
+ #### Approach 1: Direct Model Construction with Inline Custom Attributes
156
+
157
+ Use direct Pydantic model construction when you want maximum type safety for standard fields and don't mind type checker warnings for custom attributes:
158
+
159
+ ```python
160
+ from uuid import UUID
161
+
162
+ create_request = biotmed_notification_sdk.CreateResourceRequest( # Replace with your actual request model name
163
+ _name="My Resource",
164
+ _ownerOrganization=biotmed_notification_sdk.ReferenceAttributeUUIDIdRequest(
165
+ id=UUID("your-organization-id")
166
+ ),
167
+ customField1="value1", # pyright: ignore[reportCallIssue]
168
+ customField2="value2", # pyright: ignore[reportCallIssue]
169
+ # ... other fields
170
+ )
171
+
172
+ response = api.create_resource(create_request, template_name="YourTemplate") # Replace with your actual method name
173
+ ```
174
+
175
+ **Pros:**
176
+ - Full type safety and IDE autocomplete for all schema-defined fields
177
+ - Direct, intuitive syntax
178
+ - Compile-time validation for standard fields
179
+ - Clear separation between standard and custom fields in code
180
+
181
+ **Cons:**
182
+ - Type checker warnings for custom attributes (requires `# pyright: ignore[reportCallIssue]` comments)
183
+ - Custom attributes are not statically typed
184
+ - Can clutter constructor calls with many custom attributes
185
+
186
+ **Best for:** When you have a few custom attributes and want maximum type safety for standard fields.
187
+
188
+ ---
189
+
190
+ #### Approach 2: Custom Attributes with **kwargs
191
+
192
+ Separate custom attributes into a dictionary and unpack them using `**kwargs`. This provides cleaner code organization:
193
+
194
+ ```python
195
+ from typing import Dict, Any
196
+ from uuid import UUID
197
+
198
+ # Custom attributes not defined in the schema
199
+ custom_attrs: Dict[str, Any] = {
200
+ "customField1": "value1",
201
+ "customField2": "value2"
202
+ }
203
+
204
+ create_request = biotmed_notification_sdk.CreateResourceRequest( # Replace with your actual request model name
205
+ _name="My Resource",
206
+ _ownerOrganization=biotmed_notification_sdk.ReferenceAttributeUUIDIdRequest(
207
+ id=UUID("your-organization-id")
208
+ ),
209
+ **custom_attrs # Unpack custom attributes
210
+ )
211
+
212
+ response = api.create_resource(create_request, template_name="YourTemplate") # Replace with your actual method name
213
+ ```
214
+
215
+ **Pros:**
216
+ - No type checker warnings on the model construction line
217
+ - Full type safety for standard fields
218
+ - Easy to build custom attributes dynamically
219
+ - Better code organization when you have many custom attributes
220
+
221
+ **Cons:**
222
+ - Separation of custom attributes from standard fields
223
+ - Slightly more verbose than Approach 1
224
+
225
+ **Best for:** When you have many custom attributes or need to build them dynamically. This is the recommended approach for most use cases.
226
+
227
+ ---
228
+
229
+ #### Approach 3: Using model_validate with Dictionary
230
+
231
+ Use `model_validate` when you're working with dictionaries, need maximum flexibility, or are building requests from external data sources:
232
+
233
+ ```python
234
+ create_request = biotmed_notification_sdk.CreateResourceRequest.model_validate({ # Replace with your actual request model name
235
+ "_name": "My Resource",
236
+ "_ownerOrganization": {
237
+ "id": "your-organization-id"
238
+ },
239
+ "customField1": "value1",
240
+ "customField2": "value2",
241
+ # ... other fields (all as dictionary keys)
242
+ })
243
+
244
+ response = api.create_resource(create_request, template_name="YourTemplate") # Replace with your actual method name
245
+ ```
246
+
247
+ **Pros:**
248
+ - Maximum flexibility - works with any dictionary structure
249
+ - Perfect for building requests from external data (JSON, API responses, etc.)
250
+ - Can easily handle dynamic field names
251
+ - Runtime validation still occurs via Pydantic
252
+
253
+ **Cons:**
254
+ - No static type checking or IDE autocomplete
255
+ - No compile-time validation
256
+ - Field names must match JSON names (e.g., `_name` not `name`)
257
+ - Less readable than constructor-based approaches
258
+
259
+ **Best for:** When working with dynamic data, parsing JSON, or when field names are determined at runtime. Also useful for global entities or cases where you need to set fields to `None`.
260
+
261
+ ---
262
+
263
+ ### Comparison Summary
264
+
265
+ | Feature | Approach 1<br/>(Direct + Inline) | Approach 2<br/>(Direct + **kwargs) | Approach 3<br/>(model_validate) |
266
+ |---------|----------------------------------|-----------------------------------|----------------------------------|
267
+ | Type safety (standard fields) | ✅ Full | ✅ Full | ❌ None |
268
+ | IDE autocomplete | ✅ Yes | ✅ Yes | ❌ No |
269
+ | Custom attributes support | ⚠️ With warnings | ✅ Clean | ✅ Clean |
270
+
271
+
272
+ ### Accessing Response Data
273
+
274
+ When retrieving resources, you can access both standard fields and custom attributes using these recommended approaches:
275
+
276
+ #### Using .get() Method (Recommended)
277
+
278
+ The `.get()` method is the simplest and safest way to access both standard fields and custom attributes:
279
+
280
+ ```python
281
+ response = api.get_resource(template_name, resource_id) # Replace with your actual method name
282
+
283
+ # Access standard fields
284
+ resource_name = response.get("_name")
285
+ resource_id = response.get("id")
286
+
287
+ # Access custom attributes
288
+ custom_value = response.get("customField1")
289
+ ```
290
+
291
+ #### Using Dot Notation (Recommended for Standard Fields)
292
+
293
+ For standard fields, dot notation provides type safety and IDE autocomplete:
294
+
295
+ ```python
296
+ response = api.get_resource(template_name, resource_id) # Replace with your actual method name
297
+
298
+ # Access standard fields (type-safe, IDE autocomplete)
299
+ resource_name = response._name
300
+ resource_id = response.id
301
+
302
+ # For custom attributes, use getattr with default
303
+ custom_value = getattr(response, "customField1", None)
304
+ ```
305
+
306
+ #### Using additional_properties (Recommended for Custom Attributes)
307
+
308
+ For custom attributes specifically, you can access them directly through `additional_properties`:
309
+
310
+ ```python
311
+ response = api.get_resource(template_name, resource_id) # Replace with your actual method name
312
+
313
+ # Access custom attributes
314
+ custom_value = response.additional_properties.get("customField1")
315
+ ```
316
+
317
+ **Note**: When accessing custom attributes that aren't defined in the response model schema, type checkers may show warnings. You can safely ignore these warnings since custom attributes are stored in `additional_properties` and are accessible at runtime.
318
+
319
+ ### Search Examples
320
+
321
+ The SDK provides powerful search capabilities with various filter options.
322
+
323
+ #### Basic Search
324
+
325
+ ```python
326
+ from biotmed_notification_sdk import SearchRequestV2, FilterV2, Order
327
+
328
+ search_request = SearchRequestV2(
329
+ limit=10,
330
+ page=0,
331
+ sort=[Order(prop="_creationTime", order="DESC")]
332
+ )
333
+
334
+ response = api.search_resources(search_request) # Replace with your actual method name
335
+ ```
336
+
337
+ #### Search with Filters
338
+
339
+ ```python
340
+ # Search by name (like filter)
341
+ search_request = SearchRequestV2(
342
+ filter={
343
+ "_name": FilterV2(like="test")
344
+ },
345
+ limit=10,
346
+ page=0,
347
+ sort=[Order(prop="_creationTime", order="DESC")]
348
+ )
349
+
350
+ response = api.search_resources(search_request) # Replace with your actual method name
351
+ ```
352
+
353
+ #### Search with Multiple Filters
354
+
355
+ ```python
356
+ # Search with multiple conditions
357
+ search_request = SearchRequestV2(
358
+ filter={
359
+ "_name": FilterV2(like="test"),
360
+ "_creationTime": FilterV2(
361
+ var_from="2024-01-01T00:00:00Z",
362
+ to="2024-12-31T23:59:59Z"
363
+ )
364
+ },
365
+ limit=10,
366
+ page=0
367
+ )
368
+
369
+ response = api.search_resources(search_request) # Replace with your actual method name
370
+ ```
371
+
372
+ ### Error Handling
373
+
374
+ Always wrap API calls in try-except blocks to handle errors gracefully:
375
+
376
+ ```python
377
+ from biotmed_notification_sdk import ApiException
378
+
379
+ try:
380
+ response = api.get_resource(template_name, resource_id) # Replace with your actual method name
381
+ print(response.model_dump_json(by_alias=True, indent=2))
382
+ except ApiException as e:
383
+ # Handle API errors
384
+ error_response = e.data
385
+ if isinstance(error_response, biotmed_notification_sdk.ErrorResponse):
386
+ print(f"API Error: {error_response.model_dump_json(by_alias=True, indent=2)}")
387
+ else:
388
+ print(f"Exception: {e}")
389
+ ```
390
+
391
+ ### Complete Example
392
+
393
+ Here's a complete example combining all the concepts:
394
+
395
+ ```python
396
+ import biotmed_notification_sdk
397
+ from biotmed_notification_sdk import ApiException
398
+ from uuid import UUID
399
+ from typing import Dict, Any
400
+
401
+ # Configuration
402
+ biot_base_url = "https://api.<>.biot-med.com"
403
+
404
+ def get_access_token() -> str:
405
+ # Implement your token retrieval/refresh logic
406
+ # Authenticate using your preferred method (OAuth, service user credentials, etc.)
407
+ return "your-access-token"
408
+
409
+ configuration = biotmed_notification_sdk.Configuration(
410
+ host=biot_base_url + "/service-path", # Replace with your service path
411
+ access_token=get_access_token, # Callable token provider
412
+ accept_language=lambda: "en-us" # Optional: callable language provider
413
+ )
414
+
415
+ # Use ApiClient
416
+ with biotmed_notification_sdk.ApiClient(configuration) as api_client:
417
+ api = biotmed_notification_sdk.YourAPIClass(api_client) # Replace with your actual API class name
418
+
419
+ # Search example
420
+ try:
421
+ search_request = biotmed_notification_sdk.SearchRequestV2(
422
+ filter={
423
+ "_name": biotmed_notification_sdk.FilterV2(like="test")
424
+ },
425
+ limit=10,
426
+ page=0
427
+ )
428
+ search_response = api.search_resources(search_request) # Replace with your actual method name
429
+ print(f"Found {len(search_response.data)} resources")
430
+ except ApiException as e:
431
+ print(f"Search error: {e}")
432
+
433
+ # Create example with custom attributes
434
+ try:
435
+ custom_attrs: Dict[str, Any] = {
436
+ "customField": "customValue"
437
+ }
438
+ create_request = biotmed_notification_sdk.CreateResourceRequest( # Replace with your actual request model name
439
+ _name="My Resource",
440
+ _ownerOrganization=biotmed_notification_sdk.ReferenceAttributeUUIDIdRequest(
441
+ id=UUID("your-organization-id")
442
+ ),
443
+ **custom_attrs
444
+ )
445
+ create_response = api.create_resource( # Replace with your actual method name
446
+ create_request,
447
+ template_name="YourTemplate"
448
+ )
449
+ print(f"Created resource: {create_response.id}")
450
+ except ApiException as e:
451
+ print(f"Create error: {e}")
452
+
453
+ # Get example
454
+ try:
455
+ get_response = api.get_resource("YourTemplate", resource_id) # Replace with your actual method name
456
+
457
+ # Access data using .get() method
458
+ name = get_response.get("_name")
459
+ custom_value = get_response.get("customField")
460
+
461
+ print(f"Resource name: {name}")
462
+ print(f"Custom field: {custom_value}")
463
+ except ApiException as e:
464
+ print(f"Get error: {e}")
465
+ ```
466
+
467
+ ## Additional Resources
468
+
469
+ - [BioT Developer Guide](https://docs.biot-med.com/docs/device-integration)
470
+ - [BioT API Reference](https://docs.biot-med.com/api-reference)
471
+ - [BioT Search API Documentation](https://docs.biot-med.com/docs/using-biot-search-apis)
472
+
473
+ ## License
474
+
475
+ This project is licensed under the MIT License.
476
+
477
+