truto-python-sdk 0.1.6__tar.gz → 0.2.0__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 (52) hide show
  1. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/PKG-INFO +7 -5
  2. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/README.md +3 -3
  3. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/pyproject.toml +3 -2
  4. truto_python_sdk-0.2.0/truto_python_sdk/analytics.py +33 -0
  5. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/environment.py +1 -1
  6. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/environment_integration.py +9 -1
  7. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/environment_unified_model.py +9 -1
  8. truto_python_sdk-0.2.0/truto_python_sdk/environment_unified_model_resource_method.py +26 -0
  9. truto_python_sdk-0.2.0/truto_python_sdk/integrated_account.py +97 -0
  10. truto_python_sdk-0.2.0/truto_python_sdk/integration.py +52 -0
  11. truto_python_sdk-0.2.0/truto_python_sdk/observability_destination.py +32 -0
  12. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/pagination_result.py +2 -1
  13. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/proxy_api.py +7 -7
  14. truto_python_sdk-0.2.0/truto_python_sdk/sync_job_run_state.py +26 -0
  15. truto_python_sdk-0.2.0/truto_python_sdk/sync_job_template.py +26 -0
  16. truto_python_sdk-0.2.0/truto_python_sdk/tenant.py +30 -0
  17. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/truto_api.py +33 -19
  18. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/unified_api.py +17 -7
  19. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/unified_model.py +10 -3
  20. truto_python_sdk-0.2.0/truto_python_sdk/unified_model_resource_method.py +26 -0
  21. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/webhook.py +8 -3
  22. truto_python_sdk-0.1.6/truto_python_sdk/integrated_account.py +0 -37
  23. truto_python_sdk-0.1.6/truto_python_sdk/integration.py +0 -33
  24. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/LICENSE +0 -0
  25. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/__init__.py +0 -0
  26. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/alarm.py +0 -0
  27. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/api_token.py +0 -0
  28. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/base_resource.py +0 -0
  29. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/batch_request.py +0 -0
  30. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/category.py +0 -0
  31. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/custom_api.py +0 -0
  32. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/daemon.py +0 -0
  33. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/daemon_job.py +0 -0
  34. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/daemon_job_cron_trigger.py +0 -0
  35. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/daemon_job_run.py +0 -0
  36. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/datastore.py +0 -0
  37. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/dict_to_query_string.py +0 -0
  38. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/documentation.py +0 -0
  39. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/environment_integration_webhook.py +0 -0
  40. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/integrated_account_webhook.py +0 -0
  41. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/link_token.py +0 -0
  42. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/log.py +0 -0
  43. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/mcp.py +0 -0
  44. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/sandbox_integrated_account.py +0 -0
  45. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/static_gate.py +0 -0
  46. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/sync_job.py +0 -0
  47. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/sync_job_cron_trigger.py +0 -0
  48. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/sync_job_run.py +0 -0
  49. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/team.py +0 -0
  50. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/user.py +0 -0
  51. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/workflow.py +0 -0
  52. {truto_python_sdk-0.1.6 → truto_python_sdk-0.2.0}/truto_python_sdk/workflow_run.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truto-python-sdk
3
- Version: 0.1.6
3
+ Version: 0.2.0
4
4
  Summary: Python3 SDK for the Truto API
5
5
  License-File: LICENSE
6
6
  Author: Roopendra Talekar
@@ -10,9 +10,11 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Classifier: Programming Language :: Python :: 3.14
13
- Requires-Dist: aiohttp (>=3.14.3,<4.0.0)
13
+ Classifier: Programming Language :: Python :: 3.15
14
+ Requires-Dist: aiohttp (>=3.14.4,<4.0.0)
14
15
  Requires-Dist: asyncio (==3.4.3)
15
16
  Requires-Dist: idna (>=3.15,<4.0)
17
+ Requires-Dist: multidict (>=6.9.1,<7.0.0)
16
18
  Project-URL: Repository, https://github.com/trutohq/truto-python-sdk
17
19
  Description-Content-Type: text/markdown
18
20
 
@@ -24,7 +26,7 @@ Description-Content-Type: text/markdown
24
26
 
25
27
  ## Requires
26
28
 
27
- Python 3.8+
29
+ Python 3.12+
28
30
 
29
31
  ## Installation
30
32
 
@@ -109,9 +111,9 @@ page = await truto_api.unified_api.list(
109
111
  ).next_page()
110
112
  ```
111
113
 
112
- ## Additional Endpoints
114
+ ## Full reference
113
115
 
114
- 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).
116
+ Every resource and method, with examples, is documented at **[truto.one/docs/sdks/python](https://truto.one/docs/sdks/python)**: the Unified, Proxy and Custom APIs, MCP, integrated accounts, tenants, integrations, unified models and mappings, sync jobs, webhooks, workflows, datastores, analytics, and more.
115
117
 
116
118
  ## Contributing
117
119
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## Requires
8
8
 
9
- Python 3.8+
9
+ Python 3.12+
10
10
 
11
11
  ## Installation
12
12
 
@@ -91,9 +91,9 @@ page = await truto_api.unified_api.list(
91
91
  ).next_page()
92
92
  ```
93
93
 
94
- ## Additional Endpoints
94
+ ## Full reference
95
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).
96
+ Every resource and method, with examples, is documented at **[truto.one/docs/sdks/python](https://truto.one/docs/sdks/python)**: the Unified, Proxy and Custom APIs, MCP, integrated accounts, tenants, integrations, unified models and mappings, sync jobs, webhooks, workflows, datastores, analytics, and more.
97
97
 
98
98
  ## Contributing
99
99
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "truto-python-sdk"
3
- version = "0.1.6"
3
+ version = "0.2.0"
4
4
  description = "Python3 SDK for the Truto API"
5
5
  authors = ["Roopendra Talekar <roopendratalekar@gmail.com>"]
6
6
  readme = "README.md"
@@ -8,8 +8,9 @@ repository = "https://github.com/trutohq/truto-python-sdk"
8
8
 
9
9
  [tool.poetry.dependencies]
10
10
  python = "^3.12"
11
- aiohttp = "^3.14.3"
11
+ aiohttp = "^3.14.4"
12
12
  idna = "^3.15"
13
+ multidict = "^6.9.1"
13
14
  asyncio = "3.4.3"
14
15
 
15
16
 
@@ -0,0 +1,33 @@
1
+ class Analytics:
2
+ """Analytics endpoints.
3
+
4
+ Every method takes query parameters as keyword arguments. Pass a dict as the
5
+ first argument for names that aren't valid Python identifiers, such as `from`:
6
+ `analytics.timeseries({"from": "2026-10-01"}, environment_id=..., metric=...)`.
7
+ """
8
+
9
+ def __init__(self, api_client):
10
+ self.api_client = api_client
11
+
12
+ def _get(self, path: str, query_params: dict = None, **kwargs):
13
+ return self.api_client._get(f"analytics/{path}", params={**(query_params or {}), **kwargs})
14
+
15
+ def status(self, query_params: dict = None, **kwargs):
16
+ """Check whether analytics is available for the environment."""
17
+ return self._get("status", query_params, **kwargs)
18
+
19
+ def metrics(self, query_params: dict = None, **kwargs):
20
+ """List the metrics that can be queried."""
21
+ return self._get("metrics", query_params, **kwargs)
22
+
23
+ def dashboard(self, query_params: dict = None, **kwargs):
24
+ """Get the summary dashboard (`range` or `from`/`to`, optional `environment_id`)."""
25
+ return self._get("dashboard", query_params, **kwargs)
26
+
27
+ def timeseries(self, query_params: dict = None, **kwargs):
28
+ """Get a metric over time (`environment_id`, `metric`, optional `from`, `to`, `granularity`, `group_by`)."""
29
+ return self._get("timeseries", query_params, **kwargs)
30
+
31
+ def breakdown(self, query_params: dict = None, **kwargs):
32
+ """Get a metric broken down by a dimension (`environment_id`, `metric`, `dimension`)."""
33
+ return self._get("breakdown", query_params, **kwargs)
@@ -10,4 +10,4 @@ class Environment:
10
10
 
11
11
  def get(self, environment_id: str):
12
12
  """Get a specific environment by ID."""
13
- return self.api_client._get(f"environment/{environment_id}")
13
+ return self.api_client._get(f"environment/{environment_id}")
@@ -14,4 +14,12 @@ class EnvironmentIntegration:
14
14
 
15
15
  def update(self, environment_integration_id: str, environment_integration_data: dict):
16
16
  """Update an existing environment_integration."""
17
- return self.api_client._patch(f"environment-integration/{environment_integration_id}", data=environment_integration_data)
17
+ return self.api_client._patch(f"environment-integration/{environment_integration_id}", data=environment_integration_data)
18
+
19
+ def create(self, environment_integration_data: dict):
20
+ """Install an integration in the environment (`integration_id`, optional `is_enabled`, `override`)."""
21
+ return self.api_client._post("environment-integration", data=environment_integration_data)
22
+
23
+ def delete(self, environment_integration_id: str):
24
+ """Uninstall an integration from the environment."""
25
+ return self.api_client._delete(f"environment-integration/{environment_integration_id}")
@@ -14,4 +14,12 @@ class EnvironmentUnifiedModel:
14
14
 
15
15
  def update(self, environment_unified_model_id: str, environment_unified_model_data: dict):
16
16
  """Update an existing environment_unified_model."""
17
- return self.api_client._patch(f"environment-unified-model/{environment_unified_model_id}", data=environment_unified_model_data)
17
+ return self.api_client._patch(f"environment-unified-model/{environment_unified_model_id}", data=environment_unified_model_data)
18
+
19
+ def create(self, environment_unified_model_data: dict):
20
+ """Install a unified model in the environment (`unified_model_id`)."""
21
+ return self.api_client._post("environment-unified-model", data=environment_unified_model_data)
22
+
23
+ def delete(self, environment_unified_model_id: str):
24
+ """Uninstall a unified model from the environment."""
25
+ return self.api_client._delete(f"environment-unified-model/{environment_unified_model_id}")
@@ -0,0 +1,26 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class EnvironmentUnifiedModelResourceMethod:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all environment unified model resource methods with pagination support."""
10
+ return PaginationResult(self.api_client, "environment-unified-model-resource-method", query_params)
11
+
12
+ def get(self, environment_unified_model_resource_method_id: str, **query_params):
13
+ """Get a specific environment unified model resource method by ID."""
14
+ return self.api_client._get(f"environment-unified-model-resource-method/{environment_unified_model_resource_method_id}", params=query_params)
15
+
16
+ def create(self, environment_unified_model_resource_method_data: dict, **query_params):
17
+ """Create a new environment unified model resource method."""
18
+ return self.api_client._post("environment-unified-model-resource-method", data=environment_unified_model_resource_method_data, params=query_params)
19
+
20
+ def update(self, environment_unified_model_resource_method_id: str, environment_unified_model_resource_method_data: dict, **query_params):
21
+ """Update an existing environment unified model resource method."""
22
+ return self.api_client._patch(f"environment-unified-model-resource-method/{environment_unified_model_resource_method_id}", data=environment_unified_model_resource_method_data, params=query_params)
23
+
24
+ def delete(self, environment_unified_model_resource_method_id: str, **query_params):
25
+ """Delete a environment unified model resource method by ID."""
26
+ return self.api_client._delete(f"environment-unified-model-resource-method/{environment_unified_model_resource_method_id}", query_params)
@@ -0,0 +1,97 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+ class IntegratedAccount:
4
+ def __init__(self, api_client):
5
+ self.api_client = api_client
6
+
7
+ def list(self, **query_params):
8
+ """List all integrated_accounts with pagination support."""
9
+ return PaginationResult(self.api_client, "integrated-account", query_params)
10
+
11
+ def get(self, integrated_account_id: str):
12
+ """Get a specific integrated_account by ID."""
13
+ return self.api_client._get(f"integrated-account/{integrated_account_id}")
14
+
15
+ def _import(self, integrated_account_data: dict):
16
+ """Create a new integrated_account."""
17
+ return self.api_client._post("integrated-account", data=integrated_account_data)
18
+
19
+ def update(self, integrated_account_id: str, integrated_account_data: dict):
20
+ """Update an existing integrated_account."""
21
+ return self.api_client._patch(f"integrated-account/{integrated_account_id}", data=integrated_account_data)
22
+
23
+ def delete(self, integrated_account_id: str):
24
+ """Delete an integrated_account by ID."""
25
+ return self.api_client._delete(f"integrated-account/{integrated_account_id}")
26
+
27
+ def create_integrated_account_token(self, integrated_account_id: str):
28
+ """Create a new token for the integrated account."""
29
+ return self.api_client._post(f"integrated-account/token", data={"integrated_account_id": integrated_account_id})
30
+
31
+ def refresh_credentials(self, integrated_account_id: str):
32
+ """Refresh the credentials for the integrated account."""
33
+ return self.api_client._post(f"integrated-account/refresh-credentials", data={"id": integrated_account_id})
34
+
35
+ def run_post_install_actions(self, integrated_account_id: str):
36
+ """Run post install actions for the integrated account."""
37
+ return self.api_client._post(f"integrated-account/run-post-install-actions", data={"id": integrated_account_id})
38
+
39
+ def create(self, integrated_account_data: dict, **query_params):
40
+ """Create (import) an integrated account with existing credentials."""
41
+ return self.api_client._post("integrated-account", data=integrated_account_data, params=query_params)
42
+
43
+ def update_credentials(self, integrated_account_id: str, credentials_data: dict, **query_params):
44
+ """Replace the credentials of an integrated account."""
45
+ return self.api_client._patch(
46
+ f"integrated-account/{integrated_account_id}/credentials", data=credentials_data, params=query_params
47
+ )
48
+
49
+ def bulk_delete(self, bulk_delete_data: dict, **query_params):
50
+ """Delete many integrated accounts at once, by `ids` or `tenant_id`."""
51
+ return self.api_client._post("integrated-account/bulk-delete", data=bulk_delete_data, params=query_params)
52
+
53
+ def refresh_mapping_cache(self, refresh_data: dict = None, **query_params):
54
+ """Refresh cached unified API mappings (optionally scoped by `integration_id`, `environment_id`)."""
55
+ return self.api_client._post("integrated-account/refresh-mapping-cache", data=refresh_data or {}, params=query_params)
56
+
57
+ def create_form_token(self, integrated_account_id: str, **query_params):
58
+ """Create a token for the integrated account's post-connect form."""
59
+ return self.api_client._post(
60
+ "integrated-account/form-token", data={"integrated_account_id": integrated_account_id}, params=query_params
61
+ )
62
+
63
+ def validate(self, integrated_account_id: str, **query_params):
64
+ """Validate the integrated account's connection now."""
65
+ return self.api_client._post(f"integrated-account/{integrated_account_id}/validate", params=query_params)
66
+
67
+ def tools(self, integrated_account_id: str, **query_params):
68
+ """Deprecated by Truto in favour of capabilities(). List the tools available on the integrated account."""
69
+ return self.api_client._get(f"integrated-account/{integrated_account_id}/tools", params=query_params)
70
+
71
+ def capabilities(self, integrated_account_id: str, **query_params):
72
+ """Get the capabilities (resources and methods) available on the integrated account."""
73
+ return self.api_client._get(f"integrated-account/{integrated_account_id}/capabilities", params=query_params)
74
+
75
+ def list_mcp_servers(self, integrated_account_id: str, **query_params):
76
+ """List the MCP servers created for the integrated account."""
77
+ return self.api_client._get(f"integrated-account/{integrated_account_id}/mcp", params=query_params)
78
+
79
+ def get_mcp_server(self, integrated_account_id: str, mcp_server_id: str, **query_params):
80
+ """Get an MCP server of the integrated account."""
81
+ return self.api_client._get(f"integrated-account/{integrated_account_id}/mcp/{mcp_server_id}", params=query_params)
82
+
83
+ def create_mcp_server(self, integrated_account_id: str, mcp_server_data: dict, **query_params):
84
+ """Create an MCP server for the integrated account (`name`, optional `config`)."""
85
+ return self.api_client._post(
86
+ f"integrated-account/{integrated_account_id}/mcp", data=mcp_server_data, params=query_params
87
+ )
88
+
89
+ def update_mcp_server(self, integrated_account_id: str, mcp_server_id: str, mcp_server_data: dict, **query_params):
90
+ """Update an MCP server of the integrated account."""
91
+ return self.api_client._patch(
92
+ f"integrated-account/{integrated_account_id}/mcp/{mcp_server_id}", data=mcp_server_data, params=query_params
93
+ )
94
+
95
+ def delete_mcp_server(self, integrated_account_id: str, mcp_server_id: str, **query_params):
96
+ """Delete an MCP server of the integrated account."""
97
+ return self.api_client._delete(f"integrated-account/{integrated_account_id}/mcp/{mcp_server_id}", query_params)
@@ -0,0 +1,52 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+ class Integration:
4
+ def __init__(self, api_client):
5
+ self.api_client = api_client
6
+
7
+ def list(self, **query_params):
8
+ """List all integrations with pagination support."""
9
+ return PaginationResult(self.api_client, "integration", query_params)
10
+
11
+ def get(self, integration_id: str):
12
+ """Get a specific integration by ID."""
13
+ return self.api_client._get(f"integration/{integration_id}")
14
+
15
+ def create(self, integration_data: dict):
16
+ """Create a new integration."""
17
+ return self.api_client._post("integration", data=integration_data)
18
+
19
+ def update(self, integration_id: str, integration_data: dict):
20
+ """Update an existing integration."""
21
+ return self.api_client._patch(f"integration/{integration_id}", data=integration_data)
22
+
23
+ def delete(self, integration_id: str):
24
+ """Delete an integration by ID."""
25
+ return self.api_client._delete(f"integration/{integration_id}")
26
+
27
+ def install(self, integration_id: str, is_enabled: bool = True):
28
+ """Install an integration by ID."""
29
+ return self.api_client._post(f"environment-integration", data={"integration_id": integration_id, "is_enabled": is_enabled})
30
+
31
+ async def uninstall(self, integration_id: str):
32
+ """Uninstall an integration by ID from the environment."""
33
+ # The delete route takes the environment integration ID, so look it up first.
34
+ environment_integrations = await PaginationResult(
35
+ self.api_client, "environment-integration", {"integration_id": integration_id}
36
+ ).to_array()
37
+ return [
38
+ await self.api_client._delete(f"environment-integration/{environment_integration['id']}")
39
+ for environment_integration in environment_integrations
40
+ ]
41
+
42
+ def capabilities(self, integration_id: str, **query_params):
43
+ """Get the capabilities (resources and methods) of an integration by ID or name."""
44
+ return self.api_client._get(f"integration/{integration_id}/capabilities", params=query_params)
45
+
46
+ def tools(self, integration_id: str, **query_params):
47
+ """Deprecated by Truto in favour of capabilities(). List the tools an integration exposes, by ID or name."""
48
+ return self.api_client._get(f"integration/{integration_id}/tools", params=query_params)
49
+
50
+ def unified_apis(self, integration_id: str, **query_params):
51
+ """Deprecated by Truto in favour of capabilities(). List the unified APIs an integration supports, by ID or name."""
52
+ return self.api_client._get(f"integration/{integration_id}/unified-apis", params=query_params)
@@ -0,0 +1,32 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class ObservabilityDestination:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all observability destinations with pagination support."""
10
+ return PaginationResult(self.api_client, "observability-destination", query_params)
11
+
12
+ def get(self, observability_destination_id: str, **query_params):
13
+ """Get a specific observability destination by ID."""
14
+ return self.api_client._get(f"observability-destination/{observability_destination_id}", params=query_params)
15
+
16
+ def create(self, observability_destination_data: dict, **query_params):
17
+ """Create a new observability destination."""
18
+ return self.api_client._post("observability-destination", data=observability_destination_data, params=query_params)
19
+
20
+ def update(self, observability_destination_id: str, observability_destination_data: dict, **query_params):
21
+ """Update an existing observability destination."""
22
+ return self.api_client._patch(f"observability-destination/{observability_destination_id}", data=observability_destination_data, params=query_params)
23
+
24
+ def delete(self, observability_destination_id: str, **query_params):
25
+ """Delete a observability destination by ID."""
26
+ return self.api_client._delete(f"observability-destination/{observability_destination_id}", query_params)
27
+
28
+ def test(self, observability_destination_id: str, **query_params):
29
+ """Send a test event to a saved observability destination."""
30
+ return self.api_client._post(
31
+ f"observability-destination/{observability_destination_id}/test", params=query_params
32
+ )
@@ -4,7 +4,8 @@ class PaginationResult:
4
4
  def __init__(self, api_client, endpoint, query_params):
5
5
  self.api_client = api_client
6
6
  self.endpoint = endpoint
7
- self.query_params = query_params
7
+ # Copy so paging never writes next_cursor into the caller's dict.
8
+ self.query_params = dict(query_params or {})
8
9
  self.next_cursor = None
9
10
  self.items = []
10
11
  self.initial_fetch_done = False # To check if we fetched the first page
@@ -4,26 +4,26 @@ class ProxyApi:
4
4
  def __init__(self, api_client):
5
5
  self.api_client = api_client
6
6
 
7
- def list(self, resource: str, query_params: dict):
7
+ def list(self, resource: str, query_params: dict = None):
8
8
  """List all proxy api resources with pagination support."""
9
9
  return PaginationResult(self.api_client, f"proxy/{resource}", query_params)
10
10
 
11
- def get(self, resource: str, id: str, query_params: dict):
11
+ def get(self, resource: str, id: str, query_params: dict = None):
12
12
  """Get a specific proxy api resource by ID."""
13
13
  return self.api_client._get(f"proxy/{resource}/{id}", params=query_params)
14
14
 
15
- def create(self, resource: str, data: dict, query_params: dict):
15
+ def create(self, resource: str, data: dict, query_params: dict = None):
16
16
  """Create a new proxy api resource."""
17
17
  return self.api_client._post(f"proxy/{resource}", data=data, params=query_params)
18
18
 
19
- def update(self, resource: str, id: str, data: dict, query_params: dict):
19
+ def update(self, resource: str, id: str, data: dict, query_params: dict = None):
20
20
  """Update an existing proxy api resource."""
21
21
  return self.api_client._patch(f"proxy/{resource}/{id}", data=data, params=query_params)
22
22
 
23
- def delete(self, resource: str, id: str, query_params: dict):
23
+ def delete(self, resource: str, id: str, query_params: dict = None):
24
24
  """Delete a proxy api resource by ID."""
25
25
  return self.api_client._delete(f"proxy/{resource}/{id}", query_params)
26
26
 
27
- def custom_method(self, resource: str, method: str, data: dict, query_params: dict):
27
+ def custom_method(self, resource: str, method: str, data: dict, query_params: dict = None):
28
28
  """Call a custom method on a proxy api resource."""
29
- return self.api_client._post(method, f"proxy/{resource}/{method}", data=data, params=query_params)
29
+ return self.api_client._post(f"proxy/{resource}/{method}", data=data, params=query_params)
@@ -0,0 +1,26 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class SyncJobRunState:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all sync job run states with pagination support."""
10
+ return PaginationResult(self.api_client, "sync-job-run-state", query_params)
11
+
12
+ def get(self, sync_job_run_state_id: str, **query_params):
13
+ """Get a specific sync job run state by ID."""
14
+ return self.api_client._get(f"sync-job-run-state/{sync_job_run_state_id}", params=query_params)
15
+
16
+ def create(self, sync_job_run_state_data: dict, **query_params):
17
+ """Create a new sync job run state."""
18
+ return self.api_client._post("sync-job-run-state", data=sync_job_run_state_data, params=query_params)
19
+
20
+ def update(self, sync_job_run_state_id: str, sync_job_run_state_data: dict, **query_params):
21
+ """Update an existing sync job run state."""
22
+ return self.api_client._patch(f"sync-job-run-state/{sync_job_run_state_id}", data=sync_job_run_state_data, params=query_params)
23
+
24
+ def delete(self, sync_job_run_state_id: str, **query_params):
25
+ """Delete a sync job run state by ID."""
26
+ return self.api_client._delete(f"sync-job-run-state/{sync_job_run_state_id}", query_params)
@@ -0,0 +1,26 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class SyncJobTemplate:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all sync job templates with pagination support."""
10
+ return PaginationResult(self.api_client, "sync-job-template", query_params)
11
+
12
+ def get(self, sync_job_template_id: str, **query_params):
13
+ """Get a specific sync job template by ID."""
14
+ return self.api_client._get(f"sync-job-template/{sync_job_template_id}", params=query_params)
15
+
16
+ def create(self, sync_job_template_data: dict, **query_params):
17
+ """Create a new sync job template."""
18
+ return self.api_client._post("sync-job-template", data=sync_job_template_data, params=query_params)
19
+
20
+ def update(self, sync_job_template_id: str, sync_job_template_data: dict, **query_params):
21
+ """Update an existing sync job template."""
22
+ return self.api_client._patch(f"sync-job-template/{sync_job_template_id}", data=sync_job_template_data, params=query_params)
23
+
24
+ def delete(self, sync_job_template_id: str, **query_params):
25
+ """Delete a sync job template by ID."""
26
+ return self.api_client._delete(f"sync-job-template/{sync_job_template_id}", query_params)
@@ -0,0 +1,30 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class Tenant:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all tenants with pagination support."""
10
+ return PaginationResult(self.api_client, "tenant", query_params)
11
+
12
+ def get(self, tenant_id: str, **query_params):
13
+ """Get a specific tenant by ID."""
14
+ return self.api_client._get(f"tenant/{tenant_id}", params=query_params)
15
+
16
+ def create(self, tenant_data: dict, **query_params):
17
+ """Create a new tenant."""
18
+ return self.api_client._post("tenant", data=tenant_data, params=query_params)
19
+
20
+ def update(self, tenant_id: str, tenant_data: dict, **query_params):
21
+ """Update an existing tenant."""
22
+ return self.api_client._patch(f"tenant/{tenant_id}", data=tenant_data, params=query_params)
23
+
24
+ def delete(self, tenant_id: str, **query_params):
25
+ """Delete a tenant by ID."""
26
+ return self.api_client._delete(f"tenant/{tenant_id}", query_params)
27
+
28
+ def bulk_create(self, bulk_data: dict, **query_params):
29
+ """Create or upsert many tenants at once (`tenants`, optional `mode`)."""
30
+ return self.api_client._post("tenant/bulk", data=bulk_data, params=query_params)
@@ -2,39 +2,46 @@ import aiohttp
2
2
 
3
3
  from .dict_to_query_string import dict_to_query_string
4
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
5
  from .daemon import Daemon
10
6
  from .daemon_job import DaemonJob
11
7
  from .daemon_job_cron_trigger import DaemonJobCronTrigger
12
8
  from .daemon_job_run import DaemonJobRun
9
+ from .environment_integration_webhook import EnvironmentIntegrationWebhook
10
+ from .integrated_account_webhook import IntegratedAccountWebhook
11
+ from .sandbox_integrated_account import SandboxIntegratedAccount
12
+ from .team import Team
13
+ from .user import User
14
+ from .api_token import ApiToken
15
+ from .batch_request import BatchRequest
16
+ from .category import Category
17
+ from .custom_api import CustomApi
13
18
  from .datastore import Datastore
14
19
  from .documentation import Documentation
15
20
  from .environment import Environment
16
21
  from .environment_integration import EnvironmentIntegration
17
- from .environment_integration_webhook import EnvironmentIntegrationWebhook
18
22
  from .integrated_account import IntegratedAccount
19
- from .integrated_account_webhook import IntegratedAccountWebhook
20
23
  from .integration import Integration
21
24
  from .link_token import LinkToken
22
25
  from .log import Log
23
26
  from .mcp import Mcp
24
27
  from .proxy_api import ProxyApi
25
- from .sandbox_integrated_account import SandboxIntegratedAccount
26
28
  from .static_gate import StaticGate
27
29
  from .sync_job import SyncJob
28
30
  from .sync_job_cron_trigger import SyncJobCronTrigger
29
31
  from .sync_job_run import SyncJobRun
30
- from .team import Team
31
32
  from .unified_api import UnifiedApi
32
- from .user import User
33
33
  from .unified_model import UnifiedModel
34
34
  from .environment_unified_model import EnvironmentUnifiedModel
35
35
  from .webhook import Webhook
36
36
  from .workflow import Workflow
37
37
  from .workflow_run import WorkflowRun
38
+ from .analytics import Analytics
39
+ from .environment_unified_model_resource_method import EnvironmentUnifiedModelResourceMethod
40
+ from .observability_destination import ObservabilityDestination
41
+ from .sync_job_run_state import SyncJobRunState
42
+ from .sync_job_template import SyncJobTemplate
43
+ from .tenant import Tenant
44
+ from .unified_model_resource_method import UnifiedModelResourceMethod
38
45
 
39
46
 
40
47
  class TrutoApi:
@@ -46,29 +53,19 @@ class TrutoApi:
46
53
  "Content-Type": "application/json",
47
54
  "Accept": "application/json"
48
55
  }
49
- self.users = User(self)
50
- self.teams = Team(self)
51
56
  self.api_tokens = ApiToken(self)
52
57
  self.environments = Environment(self)
53
58
  self.categories = Category(self)
54
59
  self.link_tokens = LinkToken(self)
55
60
  self.integrated_accounts = IntegratedAccount(self)
56
- self.sandbox_integrated_accounts = SandboxIntegratedAccount(self)
57
61
  self.integrations = Integration(self)
58
62
  self.environment_integrations = EnvironmentIntegration(self)
59
- self.environment_integration_webhooks = EnvironmentIntegrationWebhook(self)
60
- self.integrated_account_webhooks = IntegratedAccountWebhook(self)
61
63
  self.unified_models = UnifiedModel(self)
62
64
  self.environment_unified_models = EnvironmentUnifiedModel(self)
63
65
  self.sync_jobs = SyncJob(self)
64
66
  self.sync_job_runs = SyncJobRun(self)
65
67
  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
68
  self.datastores = Datastore(self)
71
- self.alarms = Alarm(self)
72
69
  self.workflows = Workflow(self)
73
70
  self.workflow_runs = WorkflowRun(self)
74
71
  self.documentations = Documentation(self)
@@ -80,6 +77,23 @@ class TrutoApi:
80
77
  self.custom_api = CustomApi(self)
81
78
  self.unified_api = UnifiedApi(self)
82
79
  self.proxy_api = ProxyApi(self)
80
+ self.tenants = Tenant(self)
81
+ self.unified_model_resource_methods = UnifiedModelResourceMethod(self)
82
+ self.environment_unified_model_resource_methods = EnvironmentUnifiedModelResourceMethod(self)
83
+ self.sync_job_run_states = SyncJobRunState(self)
84
+ self.sync_job_templates = SyncJobTemplate(self)
85
+ self.observability_destinations = ObservabilityDestination(self)
86
+ self.analytics = Analytics(self)
87
+ self.users = User(self)
88
+ self.teams = Team(self)
89
+ self.sandbox_integrated_accounts = SandboxIntegratedAccount(self)
90
+ self.environment_integration_webhooks = EnvironmentIntegrationWebhook(self)
91
+ self.integrated_account_webhooks = IntegratedAccountWebhook(self)
92
+ self.daemons = Daemon(self)
93
+ self.daemon_jobs = DaemonJob(self)
94
+ self.daemon_job_runs = DaemonJobRun(self)
95
+ self.daemon_job_cron_triggers = DaemonJobCronTrigger(self)
96
+ self.alarms = Alarm(self)
83
97
 
84
98
  async def _process_response(self, response):
85
99
  # Get the Content-Type header
@@ -4,26 +4,36 @@ class UnifiedApi:
4
4
  def __init__(self, api_client):
5
5
  self.api_client = api_client
6
6
 
7
- def list(self, unified_model_name: str, unified_model_resource: str, query_params: dict):
7
+ def list(self, unified_model_name: str, unified_model_resource: str, query_params: dict = None):
8
8
  """List all unified api resources with pagination support."""
9
9
  return PaginationResult(self.api_client, f"unified/{unified_model_name}/{unified_model_resource}", query_params)
10
10
 
11
- def get(self, unified_model_name: str, unified_model_resource: str, id: str, query_params: dict):
11
+ def get(self, unified_model_name: str, unified_model_resource: str, id: str, query_params: dict = None):
12
12
  """Get a specific unified api resource by ID."""
13
13
  return self.api_client._get(f"unified/{unified_model_name}/{unified_model_resource}/{id}", query_params)
14
14
 
15
- def create(self, unified_model_name: str, unified_model_resource: str, data: dict, query_params: dict):
15
+ def create(self, unified_model_name: str, unified_model_resource: str, data: dict, query_params: dict = None):
16
16
  """Create a new unified api resource."""
17
17
  return self.api_client._post(f"unified/{unified_model_name}/{unified_model_resource}", data=data, params=query_params)
18
18
 
19
- def update(self, unified_model_name: str, unified_model_resource: str, id: str, data: dict, query_params: dict):
19
+ def update(self, unified_model_name: str, unified_model_resource: str, id: str, data: dict, query_params: dict = None):
20
20
  """Update an existing unified api resource."""
21
21
  return self.api_client._patch(f"unified/{unified_model_name}/{unified_model_resource}/{id}", data=data, params=query_params)
22
22
 
23
- def delete(self, unified_model_name: str, unified_model_resource: str, id: str, query_params: dict):
23
+ def delete(self, unified_model_name: str, unified_model_resource: str, id: str, query_params: dict = None):
24
24
  """Delete an unified api resource by ID."""
25
25
  return self.api_client._delete(f"unified/{unified_model_name}/{unified_model_resource}/{id}", query_params)
26
26
 
27
- def custom_method(self, unified_model_name: str, unified_model_resource: str, method: str, data: dict, query_params: dict):
27
+ def custom_method(self, unified_model_name: str, unified_model_resource: str, method: str, data: dict, query_params: dict = None):
28
28
  """Call a custom method on a unified api resource."""
29
- return self.api_client._post(method, f"unified/{unified_model_name}/{unified_model_resource}/{method}", data=data, params=query_params)
29
+ return self.api_client._post(f"unified/{unified_model_name}/{unified_model_resource}/{method}", data=data, params=query_params)
30
+
31
+ def meta(self, unified_model_name: str, unified_model_resource: str, integration_name: str, method: str, query_params: dict = None):
32
+ """Get an integration's mapping metadata (schema, supported parameters) for a unified api method."""
33
+ return self.api_client._get(
34
+ f"unified/{unified_model_name}/{unified_model_resource}/{integration_name}/meta/{method}", query_params
35
+ )
36
+
37
+ def model_meta(self, unified_model_name: str, integration_name: str, query_params: dict = None):
38
+ """Get the resources and methods of a unified model that an integration supports."""
39
+ return self.api_client._get(f"unified/meta/{unified_model_name}/{integration_name}", query_params)
@@ -28,6 +28,13 @@ class UnifiedModel:
28
28
  """Install an unified_model by ID."""
29
29
  return self.api_client._post(f"environment-unified-model", data={"unified_model_id": unified_model_id})
30
30
 
31
- def uninstall(self, unified_model_id: str):
32
- """Uninstall an unified_model by ID."""
33
- return self.api_client._delete(f"environment-unified-model/{unified_model_id}")
31
+ async def uninstall(self, unified_model_id: str):
32
+ """Uninstall a unified_model by ID from the environment."""
33
+ # The delete route takes the environment unified model ID, so look it up first.
34
+ environment_unified_models = await PaginationResult(
35
+ self.api_client, "environment-unified-model", {"unified_model_id": unified_model_id}
36
+ ).to_array()
37
+ return [
38
+ await self.api_client._delete(f"environment-unified-model/{environment_unified_model['id']}")
39
+ for environment_unified_model in environment_unified_models
40
+ ]
@@ -0,0 +1,26 @@
1
+ from .pagination_result import PaginationResult
2
+
3
+
4
+ class UnifiedModelResourceMethod:
5
+ def __init__(self, api_client):
6
+ self.api_client = api_client
7
+
8
+ def list(self, **query_params):
9
+ """List all unified model resource methods with pagination support."""
10
+ return PaginationResult(self.api_client, "unified-model-resource-method", query_params)
11
+
12
+ def get(self, unified_model_resource_method_id: str, **query_params):
13
+ """Get a specific unified model resource method by ID."""
14
+ return self.api_client._get(f"unified-model-resource-method/{unified_model_resource_method_id}", params=query_params)
15
+
16
+ def create(self, unified_model_resource_method_data: dict, **query_params):
17
+ """Create a new unified model resource method."""
18
+ return self.api_client._post("unified-model-resource-method", data=unified_model_resource_method_data, params=query_params)
19
+
20
+ def update(self, unified_model_resource_method_id: str, unified_model_resource_method_data: dict, **query_params):
21
+ """Update an existing unified model resource method."""
22
+ return self.api_client._patch(f"unified-model-resource-method/{unified_model_resource_method_id}", data=unified_model_resource_method_data, params=query_params)
23
+
24
+ def delete(self, unified_model_resource_method_id: str, **query_params):
25
+ """Delete a unified model resource method by ID."""
26
+ return self.api_client._delete(f"unified-model-resource-method/{unified_model_resource_method_id}", query_params)
@@ -24,6 +24,11 @@ class Webhook:
24
24
  """Delete a webhook by ID."""
25
25
  return self.api_client._delete(f"webhook/{webhook_id}")
26
26
 
27
- def test(self, webhook_id: str):
28
- """Test a webhook by ID."""
29
- return self.api_client._post(f"webhook/test", data={"id": webhook_id})
27
+ def test(self, webhook_id: str, event_type: str = None, integrated_account_id: str = None):
28
+ """Send a test event to a webhook, optionally of a given `event_type` and for an integrated account."""
29
+ data = {"id": webhook_id}
30
+ if event_type is not None:
31
+ data["event_type"] = event_type
32
+ if integrated_account_id is not None:
33
+ data["integrated_account_id"] = integrated_account_id
34
+ return self.api_client._post("webhook/test", data=data)
@@ -1,37 +0,0 @@
1
- from .pagination_result import PaginationResult
2
-
3
- class IntegratedAccount:
4
- def __init__(self, api_client):
5
- self.api_client = api_client
6
-
7
- def list(self, **query_params):
8
- """List all integrated_accounts with pagination support."""
9
- return PaginationResult(self.api_client, "integrated-account", query_params)
10
-
11
- def get(self, integrated_account_id: str):
12
- """Get a specific integrated_account by ID."""
13
- return self.api_client._get(f"integrated-account/{integrated_account_id}")
14
-
15
- def _import(self, integrated_account_data: dict):
16
- """Create a new integrated_account."""
17
- return self.api_client._post("integrated-account", data=integrated_account_data)
18
-
19
- def update(self, integrated_account_id: str, integrated_account_data: dict):
20
- """Update an existing integrated_account."""
21
- return self.api_client._patch(f"integrated-account/{integrated_account_id}", data=integrated_account_data)
22
-
23
- def delete(self, integrated_account_id: str):
24
- """Delete an integrated_account by ID."""
25
- return self.api_client._delete(f"integrated-account/{integrated_account_id}")
26
-
27
- def create_integrated_account_token(self, integrated_account_id: str):
28
- """Create a new token for the integrated account."""
29
- return self.api_client._post(f"integrated-account/token", data={"integrated_account_id": integrated_account_id})
30
-
31
- def refresh_credentials(self, integrated_account_id: str):
32
- """Refresh the credentials for the integrated account."""
33
- return self.api_client._post(f"integrated-account/refresh-credentials", data={"id": integrated_account_id})
34
-
35
- def run_post_install_actions(self, integrated_account_id: str):
36
- """Run post install actions for the integrated account."""
37
- return self.api_client._post(f"integrated-account/run-post-install-actions", data={"id": integrated_account_id})
@@ -1,33 +0,0 @@
1
- from .pagination_result import PaginationResult
2
-
3
- class Integration:
4
- def __init__(self, api_client):
5
- self.api_client = api_client
6
-
7
- def list(self, **query_params):
8
- """List all integrations with pagination support."""
9
- return PaginationResult(self.api_client, "integration", query_params)
10
-
11
- def get(self, integration_id: str):
12
- """Get a specific integration by ID."""
13
- return self.api_client._get(f"integration/{integration_id}")
14
-
15
- def create(self, integration_data: dict):
16
- """Create a new integration."""
17
- return self.api_client._post("integration", data=integration_data)
18
-
19
- def update(self, integration_id: str, integration_data: dict):
20
- """Update an existing integration."""
21
- return self.api_client._patch(f"integration/{integration_id}", data=integration_data)
22
-
23
- def delete(self, integration_id: str):
24
- """Delete an integration by ID."""
25
- return self.api_client._delete(f"integration/{integration_id}")
26
-
27
- def install(self, integration_id: str, is_enabled: bool = True):
28
- """Install an integration by ID."""
29
- return self.api_client._post(f"environment-integration", data={"integration_id": integration_id, "is_enabled": is_enabled})
30
-
31
- def uninstall(self, integration_id: str):
32
- """Uninstall an integration by ID."""
33
- return self.api_client._delete(f"environment-integration/{integration_id}")