truto-python-sdk 0.1.2__tar.gz → 0.1.4__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.
- truto_python_sdk-0.1.4/PKG-INFO +122 -0
- truto_python_sdk-0.1.4/README.md +104 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/pyproject.toml +1 -1
- truto_python_sdk-0.1.4/truto_python_sdk/alarm.py +26 -0
- truto_python_sdk-0.1.4/truto_python_sdk/api_token.py +14 -0
- truto_python_sdk-0.1.4/truto_python_sdk/batch_request.py +7 -0
- truto_python_sdk-0.1.4/truto_python_sdk/category.py +10 -0
- truto_python_sdk-0.1.4/truto_python_sdk/custom_api.py +23 -0
- truto_python_sdk-0.1.4/truto_python_sdk/daemon.py +26 -0
- truto_python_sdk-0.1.4/truto_python_sdk/daemon_job.py +26 -0
- truto_python_sdk-0.1.4/truto_python_sdk/daemon_job_cron_trigger.py +40 -0
- truto_python_sdk-0.1.4/truto_python_sdk/daemon_job_run.py +28 -0
- truto_python_sdk-0.1.4/truto_python_sdk/datastore.py +30 -0
- truto_python_sdk-0.1.4/truto_python_sdk/documentation.py +28 -0
- truto_python_sdk-0.1.4/truto_python_sdk/environment_integration_webhook.py +11 -0
- truto_python_sdk-0.1.4/truto_python_sdk/integrated_account_webhook.py +11 -0
- truto_python_sdk-0.1.4/truto_python_sdk/log.py +10 -0
- truto_python_sdk-0.1.4/truto_python_sdk/mcp.py +27 -0
- truto_python_sdk-0.1.4/truto_python_sdk/sandbox_integrated_account.py +26 -0
- truto_python_sdk-0.1.4/truto_python_sdk/static_gate.py +26 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/truto_api.py +38 -0
- truto_python_sdk-0.1.4/truto_python_sdk/workflow.py +26 -0
- truto_python_sdk-0.1.4/truto_python_sdk/workflow_run.py +26 -0
- truto_python_sdk-0.1.2/PKG-INFO +0 -78
- truto_python_sdk-0.1.2/README.md +0 -63
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/LICENSE +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/__init__.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/base_resource.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/dict_to_query_string.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/environment.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/environment_integration.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/environment_unified_model.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/integrated_account.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/integration.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/link_token.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/pagination_result.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/proxy_api.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/sync_job.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/sync_job_cron_trigger.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/sync_job_run.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/team.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/unified_api.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/unified_model.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/user.py +0 -0
- {truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/webhook.py +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: truto-python-sdk
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Python3 SDK for the Truto API
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Roopendra Talekar
|
|
7
|
+
Author-email: roopendratalekar@gmail.com
|
|
8
|
+
Requires-Python: >=3.12,<4.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Dist: aiohttp (==3.12.14)
|
|
14
|
+
Requires-Dist: asyncio (==3.4.3)
|
|
15
|
+
Project-URL: Repository, https://github.com/trutohq/truto-python-sdk
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# truto-python-sdk
|
|
19
|
+
|
|
20
|
+
`truto-python-sdk` is a Python SDK to interact with the Truto API, a powerful integration platform for connecting multiple SaaS applications. The SDK mirrors the Truto REST API endpoints, which are documented in the Truto Postman Collection.
|
|
21
|
+
|
|
22
|
+
[](https://app.getpostman.com/run-collection/25523816-b3550004-776b-4372-be86-562791b192ce?action=collection%2Ffork&collection-url=entityId%3D25523816-b3550004-776b-4372-be86-562791b192ce%26entityType%3Dcollection%26workspaceId%3D7cc4fe33-eb97-4dc7-98b5-2a7ff2e94e67)
|
|
23
|
+
|
|
24
|
+
## Requires
|
|
25
|
+
|
|
26
|
+
Python 3.8+
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Install the package via pip:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install truto-python-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import asyncio
|
|
40
|
+
from truto_python_sdk import TrutoApi
|
|
41
|
+
|
|
42
|
+
truto_api = TrutoApi(token="<your_api_token>")
|
|
43
|
+
|
|
44
|
+
async def main():
|
|
45
|
+
# Fetch all installed integrations for the environment
|
|
46
|
+
installed_integrations = truto_api.environment_integrations.list()
|
|
47
|
+
async for integration in installed_integrations:
|
|
48
|
+
print(integration)
|
|
49
|
+
|
|
50
|
+
# Fetch integrated accounts for a tenant
|
|
51
|
+
integrated_accounts = truto_api.integrated_accounts.list(tenant_id="acme-1")
|
|
52
|
+
print(await integrated_accounts.to_array())
|
|
53
|
+
|
|
54
|
+
# Make a request to the unified API
|
|
55
|
+
unified_cursor = truto_api.unified_api.list(
|
|
56
|
+
"accounting",
|
|
57
|
+
"accounts",
|
|
58
|
+
{
|
|
59
|
+
"integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c",
|
|
60
|
+
"created_at": "2023-05-01T00:00:00.000Z",
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
async for account in unified_cursor:
|
|
64
|
+
print(account)
|
|
65
|
+
|
|
66
|
+
unified_resource = await truto_api.unified_api.get(
|
|
67
|
+
"accounting",
|
|
68
|
+
"accounts",
|
|
69
|
+
"1",
|
|
70
|
+
{"integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c"},
|
|
71
|
+
)
|
|
72
|
+
print(unified_resource)
|
|
73
|
+
|
|
74
|
+
asyncio.run(main())
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## List Calls and Pagination
|
|
78
|
+
|
|
79
|
+
The SDK uses async iterators for list calls. This allows you to iterate through resources without manually handling pagination.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
cursor = truto_api.unified_api.list(
|
|
83
|
+
"ticketing",
|
|
84
|
+
"tickets",
|
|
85
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
86
|
+
)
|
|
87
|
+
async for ticket in cursor:
|
|
88
|
+
print(ticket)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
You can also call `to_array()` to auto-paginate and collect all resources:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
tickets = await truto_api.unified_api.list(
|
|
95
|
+
"ticketing",
|
|
96
|
+
"tickets",
|
|
97
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
98
|
+
).to_array()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or fetch one page at a time with `next_page()`:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
page = await truto_api.unified_api.list(
|
|
105
|
+
"ticketing",
|
|
106
|
+
"tickets",
|
|
107
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
108
|
+
).next_page()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Additional Endpoints
|
|
112
|
+
|
|
113
|
+
The SDK also includes endpoints for Custom API, MCP, Workflows, Workflow Runs, Alarms, Static Gates, Sandbox Integrated Accounts, and Webhooks. See full reference in [ADVANCED_USAGE.md](./ADVANCED_USAGE.md).
|
|
114
|
+
|
|
115
|
+
## Contributing
|
|
116
|
+
|
|
117
|
+
We welcome contributions to improve `truto-python-sdk`. Please submit issues or pull requests on the GitHub repository.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT
|
|
122
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# truto-python-sdk
|
|
2
|
+
|
|
3
|
+
`truto-python-sdk` is a Python SDK to interact with the Truto API, a powerful integration platform for connecting multiple SaaS applications. The SDK mirrors the Truto REST API endpoints, which are documented in the Truto Postman Collection.
|
|
4
|
+
|
|
5
|
+
[](https://app.getpostman.com/run-collection/25523816-b3550004-776b-4372-be86-562791b192ce?action=collection%2Ffork&collection-url=entityId%3D25523816-b3550004-776b-4372-be86-562791b192ce%26entityType%3Dcollection%26workspaceId%3D7cc4fe33-eb97-4dc7-98b5-2a7ff2e94e67)
|
|
6
|
+
|
|
7
|
+
## Requires
|
|
8
|
+
|
|
9
|
+
Python 3.8+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Install the package via pip:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install truto-python-sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import asyncio
|
|
23
|
+
from truto_python_sdk import TrutoApi
|
|
24
|
+
|
|
25
|
+
truto_api = TrutoApi(token="<your_api_token>")
|
|
26
|
+
|
|
27
|
+
async def main():
|
|
28
|
+
# Fetch all installed integrations for the environment
|
|
29
|
+
installed_integrations = truto_api.environment_integrations.list()
|
|
30
|
+
async for integration in installed_integrations:
|
|
31
|
+
print(integration)
|
|
32
|
+
|
|
33
|
+
# Fetch integrated accounts for a tenant
|
|
34
|
+
integrated_accounts = truto_api.integrated_accounts.list(tenant_id="acme-1")
|
|
35
|
+
print(await integrated_accounts.to_array())
|
|
36
|
+
|
|
37
|
+
# Make a request to the unified API
|
|
38
|
+
unified_cursor = truto_api.unified_api.list(
|
|
39
|
+
"accounting",
|
|
40
|
+
"accounts",
|
|
41
|
+
{
|
|
42
|
+
"integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c",
|
|
43
|
+
"created_at": "2023-05-01T00:00:00.000Z",
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
async for account in unified_cursor:
|
|
47
|
+
print(account)
|
|
48
|
+
|
|
49
|
+
unified_resource = await truto_api.unified_api.get(
|
|
50
|
+
"accounting",
|
|
51
|
+
"accounts",
|
|
52
|
+
"1",
|
|
53
|
+
{"integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c"},
|
|
54
|
+
)
|
|
55
|
+
print(unified_resource)
|
|
56
|
+
|
|
57
|
+
asyncio.run(main())
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## List Calls and Pagination
|
|
61
|
+
|
|
62
|
+
The SDK uses async iterators for list calls. This allows you to iterate through resources without manually handling pagination.
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
cursor = truto_api.unified_api.list(
|
|
66
|
+
"ticketing",
|
|
67
|
+
"tickets",
|
|
68
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
69
|
+
)
|
|
70
|
+
async for ticket in cursor:
|
|
71
|
+
print(ticket)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You can also call `to_array()` to auto-paginate and collect all resources:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
tickets = await truto_api.unified_api.list(
|
|
78
|
+
"ticketing",
|
|
79
|
+
"tickets",
|
|
80
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
81
|
+
).to_array()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or fetch one page at a time with `next_page()`:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
page = await truto_api.unified_api.list(
|
|
88
|
+
"ticketing",
|
|
89
|
+
"tickets",
|
|
90
|
+
{"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
|
|
91
|
+
).next_page()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Additional Endpoints
|
|
95
|
+
|
|
96
|
+
The SDK also includes endpoints for Custom API, MCP, Workflows, Workflow Runs, Alarms, Static Gates, Sandbox Integrated Accounts, and Webhooks. See full reference in [ADVANCED_USAGE.md](./ADVANCED_USAGE.md).
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
We welcome contributions to improve `truto-python-sdk`. Please submit issues or pull requests on the GitHub repository.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Alarm:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all alarms with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "alarm", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, alarm_id: str, **query_params):
|
|
13
|
+
"""Get a specific alarm by ID."""
|
|
14
|
+
return self.api_client._get(f"alarm/{alarm_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, alarm_data: dict, **query_params):
|
|
17
|
+
"""Create a new alarm."""
|
|
18
|
+
return self.api_client._post("alarm", data=alarm_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, alarm_id: str, alarm_data: dict, **query_params):
|
|
21
|
+
"""Update an existing alarm."""
|
|
22
|
+
return self.api_client._patch(f"alarm/{alarm_id}", data=alarm_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, alarm_id: str, **query_params):
|
|
25
|
+
"""Delete an alarm by ID."""
|
|
26
|
+
return self.api_client._delete(f"alarm/{alarm_id}", query_params)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ApiToken:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all api tokens with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "api-token", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, api_token_id: str, **query_params):
|
|
13
|
+
"""Get a specific api token by ID."""
|
|
14
|
+
return self.api_client._get(f"api-token/{api_token_id}", params=query_params)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class BatchRequest:
|
|
2
|
+
def __init__(self, api_client):
|
|
3
|
+
self.api_client = api_client
|
|
4
|
+
|
|
5
|
+
def create(self, batch_request_data: dict, **query_params):
|
|
6
|
+
"""Create a new batch request."""
|
|
7
|
+
return self.api_client._post("batch-request", data=batch_request_data, params=query_params)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Category:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all categories with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "category", query_params)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class CustomApi:
|
|
2
|
+
def __init__(self, api_client):
|
|
3
|
+
self.api_client = api_client
|
|
4
|
+
|
|
5
|
+
def get(self, path: str, **query_params):
|
|
6
|
+
"""Send GET request to custom endpoint."""
|
|
7
|
+
return self.api_client._get(f"custom/{path}", params=query_params)
|
|
8
|
+
|
|
9
|
+
def post(self, path: str, data=None, **query_params):
|
|
10
|
+
"""Send POST request to custom endpoint."""
|
|
11
|
+
return self.api_client._post(f"custom/{path}", data=data, params=query_params)
|
|
12
|
+
|
|
13
|
+
def put(self, path: str, data=None, **query_params):
|
|
14
|
+
"""Send PUT request to custom endpoint."""
|
|
15
|
+
return self.api_client._put(f"custom/{path}", data=data, params=query_params)
|
|
16
|
+
|
|
17
|
+
def patch(self, path: str, data=None, **query_params):
|
|
18
|
+
"""Send PATCH request to custom endpoint."""
|
|
19
|
+
return self.api_client._patch(f"custom/{path}", data=data, params=query_params)
|
|
20
|
+
|
|
21
|
+
def delete(self, path: str, **query_params):
|
|
22
|
+
"""Send DELETE request to custom endpoint."""
|
|
23
|
+
return self.api_client._delete(f"custom/{path}", query_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Daemon:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all daemons with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "daemon", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, daemon_id: str, **query_params):
|
|
13
|
+
"""Get a specific daemon by ID."""
|
|
14
|
+
return self.api_client._get(f"daemon/{daemon_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, daemon_data: dict, **query_params):
|
|
17
|
+
"""Create a new daemon."""
|
|
18
|
+
return self.api_client._post("daemon", data=daemon_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, daemon_id: str, daemon_data: dict, **query_params):
|
|
21
|
+
"""Update an existing daemon."""
|
|
22
|
+
return self.api_client._patch(f"daemon/{daemon_id}", data=daemon_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, daemon_id: str, **query_params):
|
|
25
|
+
"""Delete a daemon by ID."""
|
|
26
|
+
return self.api_client._delete(f"daemon/{daemon_id}", query_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DaemonJob:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all daemon jobs with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "daemon-job", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, daemon_job_id: str, **query_params):
|
|
13
|
+
"""Get a specific daemon job by ID."""
|
|
14
|
+
return self.api_client._get(f"daemon-job/{daemon_job_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, daemon_job_data: dict, **query_params):
|
|
17
|
+
"""Create a new daemon job."""
|
|
18
|
+
return self.api_client._post("daemon-job", data=daemon_job_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, daemon_job_id: str, daemon_job_data: dict, **query_params):
|
|
21
|
+
"""Update an existing daemon job."""
|
|
22
|
+
return self.api_client._patch(f"daemon-job/{daemon_job_id}", data=daemon_job_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, daemon_job_id: str, **query_params):
|
|
25
|
+
"""Delete a daemon job by ID."""
|
|
26
|
+
return self.api_client._delete(f"daemon-job/{daemon_job_id}", query_params)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DaemonJobCronTrigger:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all daemon job cron triggers with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "daemon-job-cron-trigger", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, daemon_job_cron_trigger_id: str, **query_params):
|
|
13
|
+
"""Get a specific daemon job cron trigger by ID."""
|
|
14
|
+
return self.api_client._get(
|
|
15
|
+
f"daemon-job-cron-trigger/{daemon_job_cron_trigger_id}", params=query_params
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def create(self, daemon_job_cron_trigger_data: dict, **query_params):
|
|
19
|
+
"""Create a new daemon job cron trigger."""
|
|
20
|
+
return self.api_client._post(
|
|
21
|
+
"daemon-job-cron-trigger", data=daemon_job_cron_trigger_data, params=query_params
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def update(self, daemon_job_cron_trigger_id: str, daemon_job_cron_trigger_data: dict, **query_params):
|
|
25
|
+
"""Update an existing daemon job cron trigger."""
|
|
26
|
+
return self.api_client._patch(
|
|
27
|
+
f"daemon-job-cron-trigger/{daemon_job_cron_trigger_id}",
|
|
28
|
+
data=daemon_job_cron_trigger_data,
|
|
29
|
+
params=query_params,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def delete(self, daemon_job_cron_trigger_id: str, **query_params):
|
|
33
|
+
"""Delete a daemon job cron trigger by ID."""
|
|
34
|
+
return self.api_client._delete(
|
|
35
|
+
f"daemon-job-cron-trigger/{daemon_job_cron_trigger_id}", query_params
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def schedule(self, daemon_job_cron_trigger_id: str):
|
|
39
|
+
"""Schedule a daemon job cron trigger by ID."""
|
|
40
|
+
return self.api_client._post(f"daemon-job-cron-trigger/{daemon_job_cron_trigger_id}/schedule")
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DaemonJobRun:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all daemon job runs with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "daemon-job-run", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, daemon_job_run_id: str, **query_params):
|
|
13
|
+
"""Get a specific daemon job run by ID."""
|
|
14
|
+
return self.api_client._get(f"daemon-job-run/{daemon_job_run_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, daemon_job_run_data: dict, **query_params):
|
|
17
|
+
"""Create a new daemon job run."""
|
|
18
|
+
return self.api_client._post("daemon-job-run", data=daemon_job_run_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, daemon_job_run_id: str, daemon_job_run_data: dict, **query_params):
|
|
21
|
+
"""Update an existing daemon job run."""
|
|
22
|
+
return self.api_client._patch(
|
|
23
|
+
f"daemon-job-run/{daemon_job_run_id}", data=daemon_job_run_data, params=query_params
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
def delete(self, daemon_job_run_id: str, **query_params):
|
|
27
|
+
"""Delete a daemon job run by ID."""
|
|
28
|
+
return self.api_client._delete(f"daemon-job-run/{daemon_job_run_id}", query_params)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Datastore:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all datastores with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "datastore", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, datastore_id: str, **query_params):
|
|
13
|
+
"""Get a specific datastore by ID."""
|
|
14
|
+
return self.api_client._get(f"datastore/{datastore_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, datastore_data: dict, **query_params):
|
|
17
|
+
"""Create a new datastore."""
|
|
18
|
+
return self.api_client._post("datastore", data=datastore_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, datastore_id: str, datastore_data: dict, **query_params):
|
|
21
|
+
"""Update an existing datastore."""
|
|
22
|
+
return self.api_client._patch(f"datastore/{datastore_id}", data=datastore_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, datastore_id: str, **query_params):
|
|
25
|
+
"""Delete a datastore by ID."""
|
|
26
|
+
return self.api_client._delete(f"datastore/{datastore_id}", query_params)
|
|
27
|
+
|
|
28
|
+
def test(self, datastore_id: str, method: str, body: dict = None):
|
|
29
|
+
"""Test a datastore method."""
|
|
30
|
+
return self.api_client._post(f"datastore/{datastore_id}/test/{method}", data=body)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Documentation:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all documentations with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "documentation", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, documentation_id: str, **query_params):
|
|
13
|
+
"""Get a specific documentation by ID."""
|
|
14
|
+
return self.api_client._get(f"documentation/{documentation_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, documentation_data: dict, **query_params):
|
|
17
|
+
"""Create a new documentation."""
|
|
18
|
+
return self.api_client._post("documentation", data=documentation_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, documentation_id: str, documentation_data: dict, **query_params):
|
|
21
|
+
"""Update an existing documentation."""
|
|
22
|
+
return self.api_client._patch(
|
|
23
|
+
f"documentation/{documentation_id}", data=documentation_data, params=query_params
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
def delete(self, documentation_id: str, **query_params):
|
|
27
|
+
"""Delete a documentation by ID."""
|
|
28
|
+
return self.api_client._delete(f"documentation/{documentation_id}", query_params)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class EnvironmentIntegrationWebhook:
|
|
2
|
+
def __init__(self, api_client):
|
|
3
|
+
self.api_client = api_client
|
|
4
|
+
|
|
5
|
+
def process(self, environment_integration_id: str, payload: dict, **query_params):
|
|
6
|
+
"""Process webhook payload for an environment integration."""
|
|
7
|
+
return self.api_client._post(
|
|
8
|
+
f"environment-integration-webhook/{environment_integration_id}",
|
|
9
|
+
data=payload,
|
|
10
|
+
params=query_params,
|
|
11
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class IntegratedAccountWebhook:
|
|
2
|
+
def __init__(self, api_client):
|
|
3
|
+
self.api_client = api_client
|
|
4
|
+
|
|
5
|
+
def process(self, integrated_account_id: str, payload: dict, **query_params):
|
|
6
|
+
"""Process webhook payload for an integrated account."""
|
|
7
|
+
return self.api_client._post(
|
|
8
|
+
f"integrated-account-webhook/{integrated_account_id}",
|
|
9
|
+
data=payload,
|
|
10
|
+
params=query_params,
|
|
11
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Log:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all logs with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "log", query_params)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class Mcp:
|
|
2
|
+
def __init__(self, api_client):
|
|
3
|
+
self.api_client = api_client
|
|
4
|
+
|
|
5
|
+
def call(self, token: str, payload: dict, **query_params):
|
|
6
|
+
"""Call the MCP endpoint with a payload."""
|
|
7
|
+
return self.api_client._post(f"mcp/{token}", data=payload, params=query_params)
|
|
8
|
+
|
|
9
|
+
def initialize(self, token: str, client_name: str, client_version: str, **query_params):
|
|
10
|
+
"""Initialize an MCP client."""
|
|
11
|
+
payload = {
|
|
12
|
+
"method": "initialize",
|
|
13
|
+
"params": {
|
|
14
|
+
"protocolVersion": "2024-11-05",
|
|
15
|
+
"clientInfo": {"name": client_name, "version": client_version},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
return self.call(token, payload, **query_params)
|
|
19
|
+
|
|
20
|
+
def list_tools(self, token: str, **query_params):
|
|
21
|
+
"""List MCP tools."""
|
|
22
|
+
return self.call(token, {"method": "tools/list", "id": 1}, **query_params)
|
|
23
|
+
|
|
24
|
+
def call_tool(self, token: str, name: str, args: dict, **query_params):
|
|
25
|
+
"""Call a specific MCP tool."""
|
|
26
|
+
payload = {"method": "tools/call", "id": 2, "params": {"name": name, "arguments": args}}
|
|
27
|
+
return self.call(token, payload, **query_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SandboxIntegratedAccount:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all sandbox integrated accounts with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "sandbox-integrated-account", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, sandbox_integrated_account_id: str, **query_params):
|
|
13
|
+
"""Get a specific sandbox integrated account by ID."""
|
|
14
|
+
return self.api_client._get(
|
|
15
|
+
f"sandbox-integrated-account/{sandbox_integrated_account_id}", params=query_params
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def create(self, sandbox_integrated_account_data: dict, **query_params):
|
|
19
|
+
"""Create a new sandbox integrated account."""
|
|
20
|
+
return self.api_client._post(
|
|
21
|
+
"sandbox-integrated-account", data=sandbox_integrated_account_data, params=query_params
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def delete(self, sandbox_integrated_account_id: str, **query_params):
|
|
25
|
+
"""Delete a sandbox integrated account by ID."""
|
|
26
|
+
return self.api_client._delete(f"sandbox-integrated-account/{sandbox_integrated_account_id}", query_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class StaticGate:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all static gates with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "static-gate", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, static_gate_id: str, **query_params):
|
|
13
|
+
"""Get a specific static gate by ID."""
|
|
14
|
+
return self.api_client._get(f"static-gate/{static_gate_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, static_gate_data: dict, **query_params):
|
|
17
|
+
"""Create a new static gate."""
|
|
18
|
+
return self.api_client._post("static-gate", data=static_gate_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, static_gate_id: str, static_gate_data: dict, **query_params):
|
|
21
|
+
"""Update an existing static gate."""
|
|
22
|
+
return self.api_client._patch(f"static-gate/{static_gate_id}", data=static_gate_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, static_gate_id: str, **query_params):
|
|
25
|
+
"""Delete a static gate by ID."""
|
|
26
|
+
return self.api_client._delete(f"static-gate/{static_gate_id}", query_params)
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import aiohttp
|
|
2
2
|
|
|
3
3
|
from .dict_to_query_string import dict_to_query_string
|
|
4
|
+
from .alarm import Alarm
|
|
5
|
+
from .api_token import ApiToken
|
|
6
|
+
from .batch_request import BatchRequest
|
|
7
|
+
from .category import Category
|
|
8
|
+
from .custom_api import CustomApi
|
|
9
|
+
from .daemon import Daemon
|
|
10
|
+
from .daemon_job import DaemonJob
|
|
11
|
+
from .daemon_job_cron_trigger import DaemonJobCronTrigger
|
|
12
|
+
from .daemon_job_run import DaemonJobRun
|
|
13
|
+
from .datastore import Datastore
|
|
14
|
+
from .documentation import Documentation
|
|
4
15
|
from .environment import Environment
|
|
5
16
|
from .environment_integration import EnvironmentIntegration
|
|
17
|
+
from .environment_integration_webhook import EnvironmentIntegrationWebhook
|
|
6
18
|
from .integrated_account import IntegratedAccount
|
|
19
|
+
from .integrated_account_webhook import IntegratedAccountWebhook
|
|
7
20
|
from .integration import Integration
|
|
8
21
|
from .link_token import LinkToken
|
|
22
|
+
from .log import Log
|
|
23
|
+
from .mcp import Mcp
|
|
9
24
|
from .proxy_api import ProxyApi
|
|
25
|
+
from .sandbox_integrated_account import SandboxIntegratedAccount
|
|
26
|
+
from .static_gate import StaticGate
|
|
10
27
|
from .sync_job import SyncJob
|
|
11
28
|
from .sync_job_cron_trigger import SyncJobCronTrigger
|
|
12
29
|
from .sync_job_run import SyncJobRun
|
|
@@ -16,6 +33,8 @@ from .user import User
|
|
|
16
33
|
from .unified_model import UnifiedModel
|
|
17
34
|
from .environment_unified_model import EnvironmentUnifiedModel
|
|
18
35
|
from .webhook import Webhook
|
|
36
|
+
from .workflow import Workflow
|
|
37
|
+
from .workflow_run import WorkflowRun
|
|
19
38
|
|
|
20
39
|
|
|
21
40
|
class TrutoApi:
|
|
@@ -29,17 +48,36 @@ class TrutoApi:
|
|
|
29
48
|
}
|
|
30
49
|
self.users = User(self)
|
|
31
50
|
self.teams = Team(self)
|
|
51
|
+
self.api_tokens = ApiToken(self)
|
|
32
52
|
self.environments = Environment(self)
|
|
53
|
+
self.categories = Category(self)
|
|
33
54
|
self.link_tokens = LinkToken(self)
|
|
34
55
|
self.integrated_accounts = IntegratedAccount(self)
|
|
56
|
+
self.sandbox_integrated_accounts = SandboxIntegratedAccount(self)
|
|
35
57
|
self.integrations = Integration(self)
|
|
36
58
|
self.environment_integrations = EnvironmentIntegration(self)
|
|
59
|
+
self.environment_integration_webhooks = EnvironmentIntegrationWebhook(self)
|
|
60
|
+
self.integrated_account_webhooks = IntegratedAccountWebhook(self)
|
|
37
61
|
self.unified_models = UnifiedModel(self)
|
|
38
62
|
self.environment_unified_models = EnvironmentUnifiedModel(self)
|
|
39
63
|
self.sync_jobs = SyncJob(self)
|
|
40
64
|
self.sync_job_runs = SyncJobRun(self)
|
|
41
65
|
self.sync_job_cron_triggers = SyncJobCronTrigger(self)
|
|
66
|
+
self.daemons = Daemon(self)
|
|
67
|
+
self.daemon_jobs = DaemonJob(self)
|
|
68
|
+
self.daemon_job_runs = DaemonJobRun(self)
|
|
69
|
+
self.daemon_job_cron_triggers = DaemonJobCronTrigger(self)
|
|
70
|
+
self.datastores = Datastore(self)
|
|
71
|
+
self.alarms = Alarm(self)
|
|
72
|
+
self.workflows = Workflow(self)
|
|
73
|
+
self.workflow_runs = WorkflowRun(self)
|
|
74
|
+
self.documentations = Documentation(self)
|
|
75
|
+
self.logs = Log(self)
|
|
76
|
+
self.static_gates = StaticGate(self)
|
|
42
77
|
self.webhooks = Webhook(self)
|
|
78
|
+
self.batch_requests = BatchRequest(self)
|
|
79
|
+
self.mcp = Mcp(self)
|
|
80
|
+
self.custom_api = CustomApi(self)
|
|
43
81
|
self.unified_api = UnifiedApi(self)
|
|
44
82
|
self.proxy_api = ProxyApi(self)
|
|
45
83
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Workflow:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all workflows with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "workflow", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, workflow_id: str, **query_params):
|
|
13
|
+
"""Get a specific workflow by ID."""
|
|
14
|
+
return self.api_client._get(f"workflow/{workflow_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, workflow_data: dict, **query_params):
|
|
17
|
+
"""Create a new workflow."""
|
|
18
|
+
return self.api_client._post("workflow", data=workflow_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, workflow_id: str, workflow_data: dict, **query_params):
|
|
21
|
+
"""Update an existing workflow."""
|
|
22
|
+
return self.api_client._patch(f"workflow/{workflow_id}", data=workflow_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, workflow_id: str, **query_params):
|
|
25
|
+
"""Delete a workflow by ID."""
|
|
26
|
+
return self.api_client._delete(f"workflow/{workflow_id}", query_params)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from .pagination_result import PaginationResult
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class WorkflowRun:
|
|
5
|
+
def __init__(self, api_client):
|
|
6
|
+
self.api_client = api_client
|
|
7
|
+
|
|
8
|
+
def list(self, **query_params):
|
|
9
|
+
"""List all workflow runs with pagination support."""
|
|
10
|
+
return PaginationResult(self.api_client, "workflow-run", query_params)
|
|
11
|
+
|
|
12
|
+
def get(self, workflow_run_id: str, **query_params):
|
|
13
|
+
"""Get a specific workflow run by ID."""
|
|
14
|
+
return self.api_client._get(f"workflow-run/{workflow_run_id}", params=query_params)
|
|
15
|
+
|
|
16
|
+
def create(self, workflow_run_data: dict, **query_params):
|
|
17
|
+
"""Create a new workflow run."""
|
|
18
|
+
return self.api_client._post("workflow-run", data=workflow_run_data, params=query_params)
|
|
19
|
+
|
|
20
|
+
def update(self, workflow_run_id: str, workflow_run_data: dict, **query_params):
|
|
21
|
+
"""Update an existing workflow run."""
|
|
22
|
+
return self.api_client._patch(f"workflow-run/{workflow_run_id}", data=workflow_run_data, params=query_params)
|
|
23
|
+
|
|
24
|
+
def delete(self, workflow_run_id: str, **query_params):
|
|
25
|
+
"""Delete a workflow run by ID."""
|
|
26
|
+
return self.api_client._delete(f"workflow-run/{workflow_run_id}", query_params)
|
truto_python_sdk-0.1.2/PKG-INFO
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: truto-python-sdk
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Python3 SDK for the Truto API
|
|
5
|
-
Author: Roopendra Talekar
|
|
6
|
-
Author-email: roopendratalekar@gmail.com
|
|
7
|
-
Requires-Python: >=3.12,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
-
Requires-Dist: aiohttp (==3.12.14)
|
|
12
|
-
Requires-Dist: asyncio (==3.4.3)
|
|
13
|
-
Project-URL: Repository, https://github.com/trutohq/truto-python-sdk
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
# truto-python-sdk
|
|
17
|
-
Python3 SDK for the Truto API. The SDK mirrors the Truto REST API endpoints which are documented in the Truto Postman Collection.
|
|
18
|
-
|
|
19
|
-
[](https://app.getpostman.com/run-collection/25523816-b3550004-776b-4372-be86-562791b192ce?action=collection%2Ffork&collection-url=entityId%3D25523816-b3550004-776b-4372-be86-562791b192ce%26entityType%3Dcollection%26workspaceId%3D7cc4fe33-eb97-4dc7-98b5-2a7ff2e94e67)
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
```bash
|
|
23
|
-
pip install truto-python-sdk
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
import asyncio
|
|
30
|
-
from truto_python_sdk import TrutoApi
|
|
31
|
-
|
|
32
|
-
# Initialize the SDK with your token
|
|
33
|
-
truto_api = TrutoApi(token="<your_api_token>")
|
|
34
|
-
|
|
35
|
-
async def main():
|
|
36
|
-
async for ticket in truto_api.unified_api.list("ticketing", "tickets", {
|
|
37
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
38
|
-
}):
|
|
39
|
-
print(await truto_api.proxy_api.get("ticketing-tickets", ticket["id"], {
|
|
40
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
41
|
-
}))
|
|
42
|
-
|
|
43
|
-
# Run the async function
|
|
44
|
-
asyncio.run(main())
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## List calls and pagination
|
|
48
|
-
|
|
49
|
-
The SDK uses async generators to handle list calls. This allows you to iterate over the results of a list call without having to worry about pagination. The SDK will automatically fetch the next page of results when needed.
|
|
50
|
-
|
|
51
|
-
```python
|
|
52
|
-
async for ticket in truto_api.unified_api.list("ticketing", "tickets", {
|
|
53
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
54
|
-
}):
|
|
55
|
-
print(ticket)
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
You can also call `to_array()`, which will auto-paginate all the resources and return them as a list.
|
|
59
|
-
|
|
60
|
-
```python
|
|
61
|
-
tickets = await truto_api.unified_api.list("ticketing", "tickets", {
|
|
62
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
63
|
-
}).to_array()
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Getting each page of results manually is also possible.
|
|
67
|
-
|
|
68
|
-
```python
|
|
69
|
-
page = await truto_api.unified_api.list("ticketing", "tickets", {
|
|
70
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
71
|
-
}).next_page()
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Contributing
|
|
75
|
-
We welcome contributions to improve `truto-python-sdk`. Please submit issues or pull requests on the GitHub repository.
|
|
76
|
-
|
|
77
|
-
## License
|
|
78
|
-
MIT
|
truto_python_sdk-0.1.2/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# truto-python-sdk
|
|
2
|
-
Python3 SDK for the Truto API. The SDK mirrors the Truto REST API endpoints which are documented in the Truto Postman Collection.
|
|
3
|
-
|
|
4
|
-
[](https://app.getpostman.com/run-collection/25523816-b3550004-776b-4372-be86-562791b192ce?action=collection%2Ffork&collection-url=entityId%3D25523816-b3550004-776b-4372-be86-562791b192ce%26entityType%3Dcollection%26workspaceId%3D7cc4fe33-eb97-4dc7-98b5-2a7ff2e94e67)
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
```bash
|
|
8
|
-
pip install truto-python-sdk
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
import asyncio
|
|
15
|
-
from truto_python_sdk import TrutoApi
|
|
16
|
-
|
|
17
|
-
# Initialize the SDK with your token
|
|
18
|
-
truto_api = TrutoApi(token="<your_api_token>")
|
|
19
|
-
|
|
20
|
-
async def main():
|
|
21
|
-
async for ticket in truto_api.unified_api.list("ticketing", "tickets", {
|
|
22
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
23
|
-
}):
|
|
24
|
-
print(await truto_api.proxy_api.get("ticketing-tickets", ticket["id"], {
|
|
25
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
26
|
-
}))
|
|
27
|
-
|
|
28
|
-
# Run the async function
|
|
29
|
-
asyncio.run(main())
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## List calls and pagination
|
|
33
|
-
|
|
34
|
-
The SDK uses async generators to handle list calls. This allows you to iterate over the results of a list call without having to worry about pagination. The SDK will automatically fetch the next page of results when needed.
|
|
35
|
-
|
|
36
|
-
```python
|
|
37
|
-
async for ticket in truto_api.unified_api.list("ticketing", "tickets", {
|
|
38
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
39
|
-
}):
|
|
40
|
-
print(ticket)
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
You can also call `to_array()`, which will auto-paginate all the resources and return them as a list.
|
|
44
|
-
|
|
45
|
-
```python
|
|
46
|
-
tickets = await truto_api.unified_api.list("ticketing", "tickets", {
|
|
47
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
48
|
-
}).to_array()
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Getting each page of results manually is also possible.
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
page = await truto_api.unified_api.list("ticketing", "tickets", {
|
|
55
|
-
"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
|
|
56
|
-
}).next_page()
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Contributing
|
|
60
|
-
We welcome contributions to improve `truto-python-sdk`. Please submit issues or pull requests on the GitHub repository.
|
|
61
|
-
|
|
62
|
-
## License
|
|
63
|
-
MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/environment_integration.py
RENAMED
|
File without changes
|
{truto_python_sdk-0.1.2 → truto_python_sdk-0.1.4}/truto_python_sdk/environment_unified_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|