brynq-sdk-brynq 4.0.1__tar.gz → 4.0.3__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.

Potentially problematic release.


This version of brynq-sdk-brynq might be problematic. Click here for more details.

Files changed (26) hide show
  1. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/PKG-INFO +1 -1
  2. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/interfaces.py +49 -19
  3. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/credentials.py +5 -3
  4. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/interfaces.py +53 -1
  5. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/PKG-INFO +1 -1
  6. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/setup.py +1 -1
  7. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/__init__.py +0 -0
  8. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/brynq.py +0 -0
  9. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/credentials.py +0 -0
  10. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/customers.py +0 -0
  11. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/mappings.py +0 -0
  12. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/organization_chart.py +0 -0
  13. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/roles.py +0 -0
  14. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/__init__.py +0 -0
  15. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/customers.py +0 -0
  16. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/organization_chart.py +0 -0
  17. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/roles.py +0 -0
  18. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/schemas/users.py +0 -0
  19. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/source_systems.py +0 -0
  20. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq/users.py +0 -0
  21. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/SOURCES.txt +0 -0
  22. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/dependency_links.txt +0 -0
  23. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/not-zip-safe +0 -0
  24. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/requires.txt +0 -0
  25. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/brynq_sdk_brynq.egg-info/top_level.txt +0 -0
  26. {brynq_sdk_brynq-4.0.1 → brynq_sdk_brynq-4.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq_sdk_brynq
3
- Version: 4.0.1
3
+ Version: 4.0.3
4
4
  Summary: BrynQ SDK for the BrynQ.com platform
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -1,7 +1,7 @@
1
1
  from typing import Dict, List, Any, Optional
2
2
  from .credentials import Credentials
3
3
  from .mappings import Mappings
4
- from .schemas.interfaces import Interface, InterfaceDetail, InterfaceConfig, Schedule, Scope, DevSettings
4
+ from .schemas.interfaces import Interface, InterfaceDetail, InterfaceConfig, Schedule, Scope, DevSettings, Scenario
5
5
  from brynq_sdk_functions import Functions
6
6
 
7
7
  class Interfaces:
@@ -11,7 +11,7 @@ class Interfaces:
11
11
  def __init__(self, brynq_instance):
12
12
  """
13
13
  Initialize Interfaces manager.
14
-
14
+
15
15
  Args:
16
16
  brynq_instance: The parent BrynQ instance
17
17
  """
@@ -21,7 +21,7 @@ class Interfaces:
21
21
 
22
22
  def get_all(self) -> List[Dict[str, Any]]:
23
23
  """Get all interfaces this token has access to.
24
-
24
+
25
25
  Returns:
26
26
  List[Dict[str, Any]]: List of interfaces with their details including:
27
27
  - id (int): Interface ID
@@ -30,7 +30,7 @@ class Interfaces:
30
30
  - sourceSystems (List[int]): List of source system IDs
31
31
  - targetSystems (List[int]): List of target system IDs
32
32
  - taskSchedule (Dict): Task schedule details including status, timing, etc.
33
-
33
+
34
34
  Raises:
35
35
  ValueError: If the response data is invalid
36
36
  requests.exceptions.RequestException: If the API request fails
@@ -40,7 +40,7 @@ class Interfaces:
40
40
  timeout=self._brynq.timeout
41
41
  )
42
42
  response.raise_for_status()
43
-
43
+
44
44
  try:
45
45
  interfaces_data = response.json()
46
46
  valid_data, _ = Functions.validate_pydantic_data(interfaces_data, schema=Interface)
@@ -57,7 +57,7 @@ class Interfaces:
57
57
  - apps (Dict): Application configuration with:
58
58
  - source (str): Source application name
59
59
  - target (str): Target application name
60
-
60
+
61
61
  Raises:
62
62
  ValueError: If interface_id is not a positive integer or if the response data is invalid
63
63
  requests.exceptions.RequestException: If the API request fails
@@ -69,7 +69,7 @@ class Interfaces:
69
69
  timeout=self._brynq.timeout
70
70
  )
71
71
  response.raise_for_status()
72
-
72
+
73
73
  try:
74
74
  interface_data = response.json()
75
75
  valid_data, _ = Functions.validate_pydantic_data(interface_data, schema=InterfaceDetail)
@@ -79,15 +79,15 @@ class Interfaces:
79
79
 
80
80
  def get_config(self) -> Dict[str, Any]:
81
81
  """Get the base configuration of an interface.
82
-
82
+
83
83
  Args:
84
84
  interface_id (int): The ID of the interface
85
-
85
+
86
86
  Returns:
87
87
  Dict[str, Any]: Interface configuration including:
88
88
  - mapping (List): List of mapping configurations
89
89
  - variables (Dict): Configuration variables
90
-
90
+
91
91
  Raises:
92
92
  ValueError: If interface_id is not a positive integer or if the response data is invalid
93
93
  requests.exceptions.RequestException: If the API request fails
@@ -99,7 +99,7 @@ class Interfaces:
99
99
  timeout=self._brynq.timeout
100
100
  )
101
101
  response.raise_for_status()
102
-
102
+
103
103
  try:
104
104
  config_data = response.json()
105
105
  valid_data, _ = Functions.validate_pydantic_data(config_data, schema=InterfaceConfig)
@@ -113,7 +113,7 @@ class Interfaces:
113
113
 
114
114
  Returns:
115
115
  Dict[str, Any]: Response from the flush operation
116
-
116
+
117
117
  Raises:
118
118
  requests.exceptions.RequestException: If the API request fails
119
119
  """
@@ -138,7 +138,7 @@ class Interfaces:
138
138
  - startAfterPrecedingTask (bool, optional): Whether to start after preceding task
139
139
  - lastReload (str): Last reload time
140
140
  - lastErrorMessage (str): Last error message
141
-
141
+
142
142
  Raises:
143
143
  ValueError: If interface_id is not a positive integer or if the response data is invalid
144
144
  requests.exceptions.RequestException: If the API request fails
@@ -148,7 +148,7 @@ class Interfaces:
148
148
  timeout=self._brynq.timeout
149
149
  )
150
150
  response.raise_for_status()
151
-
151
+
152
152
  try:
153
153
  schedule_data = response.json()
154
154
  valid_data, _ = Functions.validate_pydantic_data(schedule_data, schema=Schedule)
@@ -162,7 +162,7 @@ class Interfaces:
162
162
 
163
163
  Returns:
164
164
  Dict[str, Any]: Template configuration
165
-
165
+
166
166
  Raises:
167
167
  requests.exceptions.RequestException: If the API request fails
168
168
  """
@@ -180,7 +180,7 @@ class Interfaces:
180
180
  Dict[str, Any]: Scope configuration including:
181
181
  - live (Dict, optional): Live scope configuration
182
182
  - draft (Dict, optional): Draft scope configuration
183
-
183
+
184
184
  Raises:
185
185
  ValueError: If interface_id is not a positive integer or if the response data is invalid
186
186
  requests.exceptions.RequestException: If the API request fails
@@ -190,7 +190,7 @@ class Interfaces:
190
190
  timeout=self._brynq.timeout
191
191
  )
192
192
  response.raise_for_status()
193
-
193
+
194
194
  try:
195
195
  scope_data = response.json()
196
196
  valid_data, _ = Functions.validate_pydantic_data(scope_data, schema=Scope)
@@ -219,7 +219,7 @@ class Interfaces:
219
219
  timeout=self._brynq.timeout
220
220
  )
221
221
  response.raise_for_status()
222
-
222
+
223
223
  valid_data, _ = Functions.validate_pydantic_data(response.json(), schema=DevSettings)
224
224
  return valid_data
225
225
 
@@ -245,4 +245,34 @@ class Interfaces:
245
245
  return variable
246
246
  else:
247
247
  self.flush_config()
248
- return variables
248
+ return variables
249
+
250
+ def get_scenario(self, strict: bool = True) -> List[Dict[str, Any]]:
251
+ """
252
+ Get the scenarios of an interface.
253
+
254
+ Args:
255
+ strict (bool): If True, raises an error when all scenario records fail validation.
256
+
257
+ Returns:
258
+ List[Dict[str, Any]]: List of scenario configurations.
259
+ """
260
+ response = self._brynq.brynq_session.get(
261
+ url=f"{self._brynq.url}interfaces/{self._brynq.data_interface_id}/scenarios",
262
+ timeout=self._brynq.timeout
263
+ )
264
+ response.raise_for_status()
265
+
266
+ try:
267
+ scenario_data = response.json()
268
+ valid_data, invalid_data = Functions.validate_pydantic_data(
269
+ scenario_data, schema=Scenario, debug=True
270
+ )
271
+
272
+ if strict and not valid_data and invalid_data:
273
+ raise ValueError(f"Invalid scenario data, see debug for more information")
274
+
275
+ return valid_data
276
+
277
+ except ValueError as e:
278
+ raise ValueError(f"Invalid scenario data: {str(e)}")
@@ -8,7 +8,7 @@ class CredentialData(RootModel[Dict[str, Any]]):
8
8
 
9
9
  class Config:
10
10
  frozen = True
11
- strict = True
11
+ strict = False
12
12
 
13
13
 
14
14
  class CredentialSource(BaseModel):
@@ -20,8 +20,9 @@ class CredentialSource(BaseModel):
20
20
 
21
21
  class Config:
22
22
  frozen = True
23
- strict = True
23
+ strict = False
24
24
  populate_by_name = True
25
+ extra = 'allow'
25
26
 
26
27
 
27
28
  class CredentialsConfig(BaseModel):
@@ -31,5 +32,6 @@ class CredentialsConfig(BaseModel):
31
32
 
32
33
  class Config:
33
34
  frozen = True
34
- strict = True
35
+ strict = False
35
36
  populate_by_name = True
37
+ extra = 'allow'
@@ -1,4 +1,4 @@
1
- from typing import Dict, List, Any, Optional
1
+ from typing import Dict, List, Any, Optional, Union
2
2
  from datetime import datetime
3
3
  from pydantic import BaseModel, Field, field_validator
4
4
 
@@ -179,3 +179,55 @@ class DevSettings(BaseModel):
179
179
  frozen = True
180
180
  strict = True
181
181
  populate_by_name = True
182
+
183
+
184
+ class SourceTarget(BaseModel):
185
+ """Schema for source/target configuration in scenario details"""
186
+ data: List[str] = Field(..., description="List of data field names")
187
+ type: str = Field(..., description="Type of the source/target (e.g., 'LIBRARY')")
188
+
189
+ class Config:
190
+ frozen = True
191
+ strict = True
192
+ populate_by_name = True
193
+
194
+
195
+ class ScenarioMappingConfiguration(BaseModel):
196
+ """Schema for mapping configuration in scenario details"""
197
+ values: List[str] = Field(default_factory=list, description="List of mapping values")
198
+ default_value: str = Field(default="", alias="defaultValue", description="Default value for mapping")
199
+
200
+ class Config:
201
+ frozen = True
202
+ strict = True
203
+ populate_by_name = True
204
+
205
+
206
+ class ScenarioDetail(BaseModel):
207
+ """Schema for scenario detail mapping"""
208
+ id: str = Field(..., description="Detail ID")
209
+ logic: str = Field(default="", description="Mapping logic")
210
+ unique: bool = Field(..., description="Whether the mapping is unique")
211
+ required: bool = Field(..., description="Whether the field is required")
212
+ mapping_required: bool = Field(..., alias="mappingRequired", description="Whether the mapping is required")
213
+ source: SourceTarget = Field(..., description="Source configuration")
214
+ target: SourceTarget = Field(..., description="Target configuration")
215
+ mapping: ScenarioMappingConfiguration = Field(..., description="Mapping configuration")
216
+
217
+ class Config:
218
+ frozen = True
219
+ strict = True
220
+ populate_by_name = True
221
+
222
+
223
+ class Scenario(BaseModel):
224
+ """Schema for interface scenario configuration"""
225
+ id: str = Field(..., description="Scenario ID")
226
+ name: str = Field(..., description="Scenario name")
227
+ description: str = Field(default="", description="Scenario description")
228
+ details: List[ScenarioDetail] = Field(..., description="Scenario mapping details")
229
+
230
+ class Config:
231
+ frozen = True
232
+ strict = True
233
+ populate_by_name = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-brynq
3
- Version: 4.0.1
3
+ Version: 4.0.3
4
4
  Summary: BrynQ SDK for the BrynQ.com platform
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_brynq',
5
- version='4.0.1',
5
+ version='4.0.3',
6
6
  description='BrynQ SDK for the BrynQ.com platform',
7
7
  long_description='BrynQ SDK for the BrynQ.com platform',
8
8
  author='BrynQ',