bosa-connectors-binary 0.1.7__cp311-cp311-win_amd64.whl → 0.1.8__cp311-cp311-win_amd64.whl
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.
- bosa_connectors/action.pyi +2 -0
- bosa_connectors/connector.pyi +16 -3
- bosa_connectors/helpers/integrations.pyi +14 -1
- bosa_connectors/models/action.pyi +1 -0
- bosa_connectors/models/user.pyi +1 -0
- bosa_connectors/module.pyi +2 -1
- bosa_connectors.cp311-win_amd64.pyd +0 -0
- {bosa_connectors_binary-0.1.7.dist-info → bosa_connectors_binary-0.1.8.dist-info}/METADATA +41 -28
- {bosa_connectors_binary-0.1.7.dist-info → bosa_connectors_binary-0.1.8.dist-info}/RECORD +11 -11
- {bosa_connectors_binary-0.1.7.dist-info → bosa_connectors_binary-0.1.8.dist-info}/WHEEL +0 -0
- {bosa_connectors_binary-0.1.7.dist-info → bosa_connectors_binary-0.1.8.dist-info}/top_level.txt +0 -0
bosa_connectors/action.pyi
CHANGED
@@ -32,6 +32,8 @@ class ActionExecutor:
|
|
32
32
|
"""
|
33
33
|
def params(self, params: dict[str, Any]) -> ActionExecutor:
|
34
34
|
"""Set additional parameters."""
|
35
|
+
def account(self, account: str | None = None) -> ActionExecutor:
|
36
|
+
"""Set the user account for the action."""
|
35
37
|
def headers(self, headers: dict[str, str]) -> ActionExecutor:
|
36
38
|
"""Set request headers."""
|
37
39
|
def max_attempts(self, attempts: int) -> ActionExecutor:
|
bosa_connectors/connector.pyi
CHANGED
@@ -78,12 +78,24 @@ class BosaConnector:
|
|
78
78
|
Returns:
|
79
79
|
True if the user has an integration for the given app
|
80
80
|
"""
|
81
|
-
def
|
82
|
-
"""
|
81
|
+
def select_integration(self, app_name: str, token: str, user_identifier: str) -> ActionResult:
|
82
|
+
"""Selects a 3rd party integration for a user against a certain client.
|
83
83
|
|
84
84
|
Args:
|
85
|
+
token: The BOSA User Token
|
85
86
|
app_name: The name of the app/connector to use
|
87
|
+
user_identifier: User identifier to specify which integration to select
|
88
|
+
|
89
|
+
Returns:
|
90
|
+
Result that contains an error message (if any), and the success status.
|
91
|
+
"""
|
92
|
+
def remove_integration(self, app_name: str, token: str, user_identifier: str) -> ActionResult:
|
93
|
+
"""Removes a 3rd party integration for a user against a certain client.
|
94
|
+
|
95
|
+
Args:
|
86
96
|
token: The BOSA User Token
|
97
|
+
app_name: The name of the app/connector to use
|
98
|
+
user_identifier: User identifier to specify which integration to remove
|
87
99
|
|
88
100
|
Returns:
|
89
101
|
Result that contains an error message (if any), and the success status.
|
@@ -115,7 +127,7 @@ class BosaConnector:
|
|
115
127
|
Returns:
|
116
128
|
Action: A new Action instance for the specified connector
|
117
129
|
"""
|
118
|
-
def execute(self, app_name: str, action: str, *, max_attempts: int = ..., input_: dict[str, Any] = None, token: str | None = None, headers: dict[str, str] | None = None, timeout: int | None = ..., **kwargs) -> tuple[dict[str, Any] | ConnectorFile, int]:
|
130
|
+
def execute(self, app_name: str, action: str, *, account: str | None = None, max_attempts: int = ..., input_: dict[str, Any] = None, token: str | None = None, headers: dict[str, str] | None = None, timeout: int | None = ..., **kwargs) -> tuple[dict[str, Any] | ConnectorFile, int]:
|
119
131
|
"""Execute an action on a specific module and return raw response.
|
120
132
|
|
121
133
|
The method supports both ways of passing parameters:
|
@@ -127,6 +139,7 @@ class BosaConnector:
|
|
127
139
|
action: The action to execute
|
128
140
|
input_: Optional input data for the action
|
129
141
|
token: The BOSA User Token
|
142
|
+
account: Optional user integration account identifier
|
130
143
|
headers: Optional headers to include in the request
|
131
144
|
max_attempts: The number of times the request can be retried for. Default is 0 (does not retry). Note that
|
132
145
|
the backoff factor is 2^(N - 1) with the basic value being 1 second (1, 2, 4, 8, 16, 32, ...).
|
@@ -5,6 +5,7 @@ from bosa_connectors.models.result import ActionResult as ActionResult
|
|
5
5
|
class BosaIntegrationHelper:
|
6
6
|
"""Helper class for BOSA API integrations."""
|
7
7
|
OAUTH2_FLOW_ENDPOINT: str
|
8
|
+
INTEGRATION_USER_ENDPOINT: str
|
8
9
|
INTEGRATION_CHECK_ENDPOINT: str
|
9
10
|
DEFAULT_TIMEOUT: int
|
10
11
|
api_base_url: Incomplete
|
@@ -37,12 +38,24 @@ class BosaIntegrationHelper:
|
|
37
38
|
Returns:
|
38
39
|
The integration URL
|
39
40
|
"""
|
40
|
-
def
|
41
|
+
def select_integration(self, app_name: str, token: str, user_identifier: str) -> ActionResult:
|
42
|
+
"""Selects a 3rd party integration for a user against a certain client.
|
43
|
+
|
44
|
+
Args:
|
45
|
+
token: The BOSA User Token
|
46
|
+
app_name: The name of the app/connector to use
|
47
|
+
user_identifier: User identifier to specify which integration to select
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
Result that contains an error message (if any), and the success status.
|
51
|
+
"""
|
52
|
+
def remove_integration(self, app_name: str, token: str, user_identifier: str) -> ActionResult:
|
41
53
|
"""Removes a 3rd party integration for a user against a certain client.
|
42
54
|
|
43
55
|
Args:
|
44
56
|
app_name: The name of the app/connector to use
|
45
57
|
token: The BOSA User Token
|
58
|
+
user_identifier: User identifier to specify which integration to remove
|
46
59
|
|
47
60
|
Returns:
|
48
61
|
Result that contains an error message (if any), and the success status.
|
bosa_connectors/models/user.pyi
CHANGED
bosa_connectors/module.pyi
CHANGED
@@ -55,7 +55,7 @@ class BosaConnectorModule:
|
|
55
55
|
Returns:
|
56
56
|
Tuple of (cleaned_params, error_details) where error_details is empty if validation passed
|
57
57
|
"""
|
58
|
-
def execute(self, action: str, max_attempts: int, input_: dict = None, token: str | None = None, authenticator: BaseAuthenticator | None = None, headers: dict[str, str] | None = None, timeout: int | None = ...) -> tuple[dict[str, Any] | ConnectorFile, int]:
|
58
|
+
def execute(self, action: str, max_attempts: int, input_: dict = None, token: str | None = None, account: str | None = None, authenticator: BaseAuthenticator | None = None, headers: dict[str, str] | None = None, timeout: int | None = ...) -> tuple[dict[str, Any] | ConnectorFile, int]:
|
59
59
|
"""Execute an action with validated parameters and return typed response.
|
60
60
|
|
61
61
|
Args:
|
@@ -64,6 +64,7 @@ class BosaConnectorModule:
|
|
64
64
|
Will be capped at MAX_RETRY (10) to prevent excessive retries.
|
65
65
|
input_: Optional dictionary of parameters
|
66
66
|
token: Optional BOSA User Token. If not provided, will use the default token
|
67
|
+
account: Optional integration account to use for the request
|
67
68
|
authenticator: Optional authenticator to use for the request
|
68
69
|
headers: Optional headers to include in the request
|
69
70
|
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: bosa-connectors-binary
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
4
4
|
Summary: BOSA Connectors
|
5
5
|
Author-email: Bosa Engineers <bosa-eng@gdplabs.id>
|
6
6
|
Requires-Python: <3.14,>=3.11
|
@@ -38,32 +38,34 @@ A Python SDK for seamlessly connecting to APIs that implement BOSA's Plugin Arch
|
|
38
38
|
- Response fields filtering based on action and output
|
39
39
|
|
40
40
|
## Prerequisites
|
41
|
+
|
41
42
|
After the `bosa-api` ready, you can perform the following tasks:
|
43
|
+
|
42
44
|
- Ensure Bosa API is running. If you want to test locally, or you can use Staging or Production environments.
|
43
45
|
- Create Client
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
- You can send a `create-client` request to the `bosa-api` using Postman with the following header and body:
|
47
|
+
- Header
|
48
|
+
- `x-api-key`: KEY1
|
49
|
+
- Body
|
50
|
+
- `name`: "`{client name}`"
|
51
|
+
- Response :
|
52
|
+
```json
|
53
|
+
{
|
54
|
+
"data": {
|
55
|
+
"id": "{client_id}",
|
56
|
+
"name": "admin",
|
57
|
+
"api_key": "{client_api_key}",
|
58
|
+
"is_active": true
|
59
|
+
},
|
60
|
+
"meta": null
|
61
|
+
}
|
62
|
+
```
|
61
63
|
- Register the user, see the details [here](/python/bosa-connectors/README.md#user-authentication).
|
62
64
|
|
63
|
-
|
64
65
|
## Installation
|
65
66
|
|
66
67
|
### Prerequisites
|
68
|
+
|
67
69
|
- Python 3.11+ - [Install here](https://www.python.org/downloads/)
|
68
70
|
- Pip (if using Pip) - [Install here](https://pip.pypa.io/en/stable/installation/)
|
69
71
|
- Poetry 2.1.3+ (if using Poetry) - [Install here](https://python-poetry.org/docs/#installation)
|
@@ -72,20 +74,25 @@ After the `bosa-api` ready, you can perform the following tasks:
|
|
72
74
|
- Access to the [GDP Labs SDK github repository](https://github.com/GDP-ADMIN/bosa-sdk)
|
73
75
|
|
74
76
|
### 1. Installation from Pypi
|
77
|
+
|
75
78
|
Choose one of the following methods to install the package:
|
76
79
|
|
77
80
|
#### Using pip
|
81
|
+
|
78
82
|
```bash
|
79
83
|
pip install bosa-connectors-binary
|
80
84
|
```
|
81
85
|
|
82
86
|
#### Using Poetry
|
87
|
+
|
83
88
|
```bash
|
84
89
|
poetry add bosa-connectors-binary
|
85
90
|
```
|
86
91
|
|
87
92
|
### 2. Development Installation (Git)
|
93
|
+
|
88
94
|
For development purposes, you can install directly from the Git repository:
|
95
|
+
|
89
96
|
```bash
|
90
97
|
poetry add "git+ssh://git@github.com/GDP-ADMIN/bosa-sdk.git#subdirectory=python/bosa-connectors"
|
91
98
|
```
|
@@ -109,7 +116,6 @@ bosa = BosaConnector(api_base_url="YOUR_BOSA_API_BASE_URL", api_key="YOUR_API_KE
|
|
109
116
|
|
110
117
|
After initializing the connector, you can authenticate with your BOSA API key.
|
111
118
|
|
112
|
-
|
113
119
|
```python
|
114
120
|
# User token from authentication
|
115
121
|
user_token = "Enter your key (bearer token) here from authentication, or refer to User Authentication section below"
|
@@ -151,6 +157,7 @@ data, status = bosa.execute("github", "list_collaborators", token=user_token, ma
|
|
151
157
|
print(data)
|
152
158
|
print(status)
|
153
159
|
```
|
160
|
+
|
154
161
|
More details about parameters and actions in bosa-api docs `{domain}/docs`
|
155
162
|
|
156
163
|
### Alternative Approach (Fluent Interface)
|
@@ -225,7 +232,7 @@ params = {
|
|
225
232
|
}
|
226
233
|
|
227
234
|
# Execute actions with run method
|
228
|
-
response = bosa.run('github', 'list_pull_requests', params)
|
235
|
+
response = bosa.run('github', 'list_pull_requests', input_=params)
|
229
236
|
print(response.get_data())
|
230
237
|
```
|
231
238
|
|
@@ -375,25 +382,31 @@ user_info = bosa.get_user_info(token.token)
|
|
375
382
|
|
376
383
|
### ❗ Important Notes
|
377
384
|
|
378
|
-
|
379
|
-
|
380
|
-
***⚠️ Security Reminder:*** When you register a new BOSA user, you will receive a token that starts with **"sk-user-..."**. It is essential to keep this token safe, as it **cannot be recovered if lost**, and currently, there is **no option to reset** it.
|
385
|
+
**_🛡️ Best Practice:_** Since bearer tokens can have a long lifespan, it is highly recommended to **reuse existing tokens** whenever possible. While creating new tokens is functionally acceptable, be aware that older tokens may become dangling and can pose a security risk if they are exposed or misused.
|
381
386
|
|
387
|
+
**_⚠️ Security Reminder:_** When you register a new BOSA user, you will receive a token that starts with **"sk-user-..."**. It is essential to keep this token safe, as it **cannot be recovered if lost**, and currently, there is **no option to reset** it.
|
382
388
|
|
383
389
|
## Integration Management
|
384
390
|
|
385
391
|
The BOSA Connector provides methods to manage third-party integrations for authenticated users:
|
386
392
|
|
387
393
|
```python
|
388
|
-
# Check if a user has an integration for a connector
|
389
|
-
has_integration = bosa.user_has_integration("github", user_token)
|
390
|
-
|
391
394
|
# Initiate the OAuth2 flow for a connector
|
392
395
|
auth_url = bosa.initiate_connector_auth("github", user_token, "https://your-callback-uri.com")
|
393
396
|
# Redirect the user to auth_url to complete authentication
|
394
397
|
|
398
|
+
# Check if a user has an integration for a connector
|
399
|
+
has_integration = bosa.user_has_integration("github", user_token)
|
400
|
+
|
401
|
+
# Retrieve all user integrations information
|
402
|
+
user_info = bosa.get_user_info(user_token)
|
403
|
+
integrations = user_info.integrations
|
404
|
+
|
405
|
+
# Select an integration
|
406
|
+
select_result = bosa.select_integration("github", user_token, integrations[0].user_identifier)
|
407
|
+
|
395
408
|
# Remove an integration
|
396
|
-
remove_result = bosa.remove_integration("github", user_token)
|
409
|
+
remove_result = bosa.remove_integration("github", user_token, integrations[0].user_identifier)
|
397
410
|
```
|
398
411
|
|
399
412
|
## References
|
@@ -1,26 +1,26 @@
|
|
1
|
-
bosa_connectors.cp311-win_amd64.pyd,sha256=
|
1
|
+
bosa_connectors.cp311-win_amd64.pyd,sha256=vbWyZAksfjta-XfGqMZ9XfCOEjQ_QCRhj7g_cKjRLps,857088
|
2
2
|
bosa_connectors.pyi,sha256=nHURoVUwcgMfcsbiXPeT96DBCaaiRIuNm0va3oT_wC8,676
|
3
3
|
bosa_connectors/__init__.pyi,sha256=QMIggUyhAA-5o6XI5jl8Mt_xWHSvxrYRZR9zr7qHfXI,390
|
4
|
-
bosa_connectors/action.pyi,sha256=
|
4
|
+
bosa_connectors/action.pyi,sha256=liB79eOQJFyWHr98tQU6RX_GFMx5-nk7kXBYEdSZZ9I,3560
|
5
5
|
bosa_connectors/action_response.pyi,sha256=Ppen9Tp96oubgMopfA9Tx2GYSfH3-QDvW_18roxKvCY,3760
|
6
|
-
bosa_connectors/connector.pyi,sha256=
|
7
|
-
bosa_connectors/module.pyi,sha256=
|
6
|
+
bosa_connectors/connector.pyi,sha256=j8FQyNkfXJ8KaPOCEzgIbtuiakO4oLEWCiZlaKj3oqg,8143
|
7
|
+
bosa_connectors/module.pyi,sha256=4CvPptWuRkN0Xo0kZ98loqnBy4EA0o_gfzju5tz6xfU,3455
|
8
8
|
bosa_connectors/tool.pyi,sha256=Rbd28iEiqChHv7zOrtq5B0dmVS5gwJWToU9Rwuyue0Q,1771
|
9
9
|
bosa_connectors/auth/__init__.pyi,sha256=G-QUJ_hSlhki_Hg7BNGwsUtRD04zHDKqCc_XuriVZik,181
|
10
10
|
bosa_connectors/auth/api_key.pyi,sha256=jsG1n5cqU_6vcsgsd3ZavXA_CUuqatvo5nVtFW-OOAE,649
|
11
11
|
bosa_connectors/auth/base.pyi,sha256=xnNHnbI1SJYNYIfrW6XuBmcLvMArBjs5u8BAx8nDd3Y,329
|
12
12
|
bosa_connectors/helpers/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
bosa_connectors/helpers/authenticator.pyi,sha256=vNvEbf_x6h7haom6H3nWCLc1XUZ0TYBh_elbizYE6ck,1566
|
14
|
-
bosa_connectors/helpers/integrations.pyi,sha256=
|
14
|
+
bosa_connectors/helpers/integrations.pyi,sha256=ja1B_nhTNrbUsr3Oby7-h2U87-kNUCX8mYuBRqkzxQY,2654
|
15
15
|
bosa_connectors/helpers/model_request_generator.pyi,sha256=blbmp249-R7Qhx04x3wXfpw7Wclb2apWbmw-bXHc5n0,642
|
16
16
|
bosa_connectors/models/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
bosa_connectors/models/action.pyi,sha256=
|
17
|
+
bosa_connectors/models/action.pyi,sha256=tc1pEQYD4L7POjZMHhwxMziwvJovECLXnV1lyn4_hqI,572
|
18
18
|
bosa_connectors/models/file.pyi,sha256=R0srYRhrMyYzkPpiZzE6CEVt4QZal0URr6-Yqh4kMtM,245
|
19
19
|
bosa_connectors/models/result.pyi,sha256=OSCprPSOgz6BplUzeG8kqpMJ4HCoG6KpLv0j45q3flE,142
|
20
20
|
bosa_connectors/models/token.pyi,sha256=2bg8OdilTkUS3WdQzJHQkTofkvD6VglVm9U3Fn-b7r0,216
|
21
|
-
bosa_connectors/models/user.pyi,sha256=
|
21
|
+
bosa_connectors/models/user.pyi,sha256=wgkVol54K5lnRiqrtSf31ToZTD9rnKMYVxPcAi-Lb2I,708
|
22
22
|
bosa_connectors.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
23
|
-
bosa_connectors_binary-0.1.
|
24
|
-
bosa_connectors_binary-0.1.
|
25
|
-
bosa_connectors_binary-0.1.
|
26
|
-
bosa_connectors_binary-0.1.
|
23
|
+
bosa_connectors_binary-0.1.8.dist-info/METADATA,sha256=CHnXGKytQLQAh2hk938A4RLQBVhCNcPglC4rcrk8tp0,16934
|
24
|
+
bosa_connectors_binary-0.1.8.dist-info/WHEEL,sha256=l2aKBREYfqJ7T2ljmr6hUiXPoNvvXF47bG4IHjuSyS4,96
|
25
|
+
bosa_connectors_binary-0.1.8.dist-info/top_level.txt,sha256=3UzTb-ce0A17T_gQLs-Bhq-ilOx6tosXQJkZbGsRWW8,16
|
26
|
+
bosa_connectors_binary-0.1.8.dist-info/RECORD,,
|
File without changes
|
{bosa_connectors_binary-0.1.7.dist-info → bosa_connectors_binary-0.1.8.dist-info}/top_level.txt
RENAMED
File without changes
|