ambertraceai 0.1.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 (121) hide show
  1. ambertraceai-0.1.0/LICENSE +21 -0
  2. ambertraceai-0.1.0/PKG-INFO +113 -0
  3. ambertraceai-0.1.0/README.md +86 -0
  4. ambertraceai-0.1.0/ambertraceai/__init__.py +24 -0
  5. ambertraceai-0.1.0/ambertraceai/api/__init__.py +1 -0
  6. ambertraceai-0.1.0/ambertraceai/api/default/__init__.py +1 -0
  7. ambertraceai-0.1.0/ambertraceai/api/default/api_keys_api_keys_get.py +128 -0
  8. ambertraceai-0.1.0/ambertraceai/api/default/api_keys_api_keys_int_id_delete.py +160 -0
  9. ambertraceai-0.1.0/ambertraceai/api/default/api_keys_api_keys_post.py +128 -0
  10. ambertraceai-0.1.0/ambertraceai/api/default/auth_forgot_password_post.py +138 -0
  11. ambertraceai-0.1.0/ambertraceai/api/default/auth_login_post.py +128 -0
  12. ambertraceai-0.1.0/ambertraceai/api/default/auth_register_post.py +128 -0
  13. ambertraceai-0.1.0/ambertraceai/api/default/auth_reset_password_post.py +130 -0
  14. ambertraceai-0.1.0/ambertraceai/api/default/billing_billing_pricing_backend_put.py +156 -0
  15. ambertraceai-0.1.0/ambertraceai/api/default/billing_billing_pricing_get.py +126 -0
  16. ambertraceai-0.1.0/ambertraceai/api/default/billing_billing_run_post.py +126 -0
  17. ambertraceai-0.1.0/ambertraceai/api/default/billing_billing_usage_summary_get.py +128 -0
  18. ambertraceai-0.1.0/ambertraceai/api/default/chat_chat_post.py +128 -0
  19. ambertraceai-0.1.0/ambertraceai/api/default/connectors_connectors_get.py +126 -0
  20. ambertraceai-0.1.0/ambertraceai/api/default/connectors_connectors_test_post.py +128 -0
  21. ambertraceai-0.1.0/ambertraceai/api/default/conversations_conversations_get.py +132 -0
  22. ambertraceai-0.1.0/ambertraceai/api/default/conversations_conversations_int_id_delete.py +160 -0
  23. ambertraceai-0.1.0/ambertraceai/api/default/conversations_conversations_int_id_messages_get.py +160 -0
  24. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_fetch_post.py +126 -0
  25. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_get.py +124 -0
  26. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_int_id_clean_post.py +156 -0
  27. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_int_id_delete.py +156 -0
  28. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_int_id_get.py +156 -0
  29. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_int_id_preview_get.py +156 -0
  30. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_int_id_quality_get.py +156 -0
  31. ambertraceai-0.1.0/ambertraceai/api/default/datasets_datasets_upload_post.py +126 -0
  32. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_get.py +124 -0
  33. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_build_ontology_post.py +156 -0
  34. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_delete.py +156 -0
  35. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_eval_config_delete.py +156 -0
  36. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_eval_config_get.py +156 -0
  37. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_eval_config_put.py +156 -0
  38. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_eval_config_suggest_post.py +156 -0
  39. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_feedback_stats_get.py +156 -0
  40. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_get.py +156 -0
  41. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_put.py +156 -0
  42. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_templates_get.py +156 -0
  43. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_templates_int_tid_delete.py +170 -0
  44. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_templates_int_tid_put.py +170 -0
  45. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_int_id_templates_post.py +156 -0
  46. ambertraceai-0.1.0/ambertraceai/api/default/domains_domains_post.py +124 -0
  47. ambertraceai-0.1.0/ambertraceai/api/default/graph_platforms_int_id_graph_get.py +156 -0
  48. ambertraceai-0.1.0/ambertraceai/api/default/graph_platforms_int_id_graph_nodes_uuid_get.py +170 -0
  49. ambertraceai-0.1.0/ambertraceai/api/default/health_health_get.py +124 -0
  50. ambertraceai-0.1.0/ambertraceai/api/default/jobs_jobs_int_id_get.py +156 -0
  51. ambertraceai-0.1.0/ambertraceai/api/default/leads_leads_post.py +128 -0
  52. ambertraceai-0.1.0/ambertraceai/api/default/leads_leads_verify_get.py +128 -0
  53. ambertraceai-0.1.0/ambertraceai/api/default/leads_leads_whitepaper_get.py +130 -0
  54. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_get.py +126 -0
  55. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_int_id_data_context_get.py +156 -0
  56. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_int_id_get.py +156 -0
  57. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_int_id_status_get.py +156 -0
  58. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_int_id_suggestor_settings_put.py +156 -0
  59. ambertraceai-0.1.0/ambertraceai/api/default/platforms_platforms_post.py +126 -0
  60. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_predict_post.py +156 -0
  61. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_prediction_configs_get.py +156 -0
  62. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_prediction_configs_int_cid_delete.py +170 -0
  63. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_prediction_configs_int_cid_train_post.py +170 -0
  64. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_prediction_configs_post.py +156 -0
  65. ambertraceai-0.1.0/ambertraceai/api/default/predictions_platforms_int_id_predictions_get.py +156 -0
  66. ambertraceai-0.1.0/ambertraceai/api/default/query_platforms_int_id_export_report_post.py +156 -0
  67. ambertraceai-0.1.0/ambertraceai/api/default/query_platforms_int_id_query_post.py +156 -0
  68. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_feedback_log_get.py +156 -0
  69. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_replay_post.py +156 -0
  70. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggest_rules_post.py +156 -0
  71. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggestions_get.py +156 -0
  72. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggestions_int_rid_approve_post.py +170 -0
  73. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggestions_int_rid_reject_post.py +170 -0
  74. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggestor_usage_get.py +160 -0
  75. ambertraceai-0.1.0/ambertraceai/api/default/rules_platforms_int_id_suggestor_usage_summary_get.py +160 -0
  76. ambertraceai-0.1.0/ambertraceai/api/default/usage_usage_get.py +124 -0
  77. ambertraceai-0.1.0/ambertraceai/client.py +282 -0
  78. ambertraceai-0.1.0/ambertraceai/convenience.py +203 -0
  79. ambertraceai-0.1.0/ambertraceai/errors.py +16 -0
  80. ambertraceai-0.1.0/ambertraceai/models/__init__.py +73 -0
  81. ambertraceai-0.1.0/ambertraceai/models/api_keys_api_keys_get_response_200.py +61 -0
  82. ambertraceai-0.1.0/ambertraceai/models/api_keys_api_keys_post_response_200.py +61 -0
  83. ambertraceai-0.1.0/ambertraceai/models/auth_forgot_password_post_response_200.py +61 -0
  84. ambertraceai-0.1.0/ambertraceai/models/auth_login_post_response_200.py +61 -0
  85. ambertraceai-0.1.0/ambertraceai/models/auth_register_post_response_200.py +61 -0
  86. ambertraceai-0.1.0/ambertraceai/models/auth_reset_password_post_response_200.py +61 -0
  87. ambertraceai-0.1.0/ambertraceai/models/billing_billing_pricing_get_response_200.py +61 -0
  88. ambertraceai-0.1.0/ambertraceai/models/billing_billing_run_post_response_200.py +61 -0
  89. ambertraceai-0.1.0/ambertraceai/models/billing_billing_usage_summary_get_response_200.py +61 -0
  90. ambertraceai-0.1.0/ambertraceai/models/chat_chat_post_response_200.py +61 -0
  91. ambertraceai-0.1.0/ambertraceai/models/connectors_connectors_get_response_200.py +61 -0
  92. ambertraceai-0.1.0/ambertraceai/models/connectors_connectors_test_post_response_200.py +61 -0
  93. ambertraceai-0.1.0/ambertraceai/models/conversations_conversations_get_response_200.py +61 -0
  94. ambertraceai-0.1.0/ambertraceai/models/datasets_datasets_fetch_post_response_200.py +61 -0
  95. ambertraceai-0.1.0/ambertraceai/models/datasets_datasets_get_response_200.py +61 -0
  96. ambertraceai-0.1.0/ambertraceai/models/datasets_datasets_upload_post_response_200.py +61 -0
  97. ambertraceai-0.1.0/ambertraceai/models/domains_domains_get_response_200.py +61 -0
  98. ambertraceai-0.1.0/ambertraceai/models/domains_domains_post_response_200.py +61 -0
  99. ambertraceai-0.1.0/ambertraceai/models/health_data.py +69 -0
  100. ambertraceai-0.1.0/ambertraceai/models/health_response.py +67 -0
  101. ambertraceai-0.1.0/ambertraceai/models/leads_leads_post_response_200.py +61 -0
  102. ambertraceai-0.1.0/ambertraceai/models/leads_leads_verify_get_response_200.py +61 -0
  103. ambertraceai-0.1.0/ambertraceai/models/leads_leads_whitepaper_get_response_200.py +61 -0
  104. ambertraceai-0.1.0/ambertraceai/models/platforms_platforms_get_response_200.py +61 -0
  105. ambertraceai-0.1.0/ambertraceai/models/platforms_platforms_post_response_200.py +61 -0
  106. ambertraceai-0.1.0/ambertraceai/models/usage_usage_get_response_200.py +61 -0
  107. ambertraceai-0.1.0/ambertraceai/models/validation_error_model.py +167 -0
  108. ambertraceai-0.1.0/ambertraceai/models/validation_error_model_ctx_type_0.py +47 -0
  109. ambertraceai-0.1.0/ambertraceai/py.typed +0 -0
  110. ambertraceai-0.1.0/ambertraceai/types.py +54 -0
  111. ambertraceai-0.1.0/ambertraceai.egg-info/PKG-INFO +113 -0
  112. ambertraceai-0.1.0/ambertraceai.egg-info/SOURCES.txt +119 -0
  113. ambertraceai-0.1.0/ambertraceai.egg-info/dependency_links.txt +1 -0
  114. ambertraceai-0.1.0/ambertraceai.egg-info/requires.txt +7 -0
  115. ambertraceai-0.1.0/ambertraceai.egg-info/top_level.txt +1 -0
  116. ambertraceai-0.1.0/pyproject.toml +42 -0
  117. ambertraceai-0.1.0/setup.cfg +4 -0
  118. ambertraceai-0.1.0/tests/test_client.py +57 -0
  119. ambertraceai-0.1.0/tests/test_resources.py +115 -0
  120. ambertraceai-0.1.0/tests/test_sdk_e2e.py +156 -0
  121. ambertraceai-0.1.0/tests/test_wait_for_job.py +92 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pilot Generative AI Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: ambertraceai
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the Ambertrace neurosymbolic AI platform API
5
+ Author-email: Pilot Generative AI <hello@ambertrace.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://ambertrace.ai
8
+ Project-URL: Documentation, https://app.ambertrace.ai/openapi/redoc
9
+ Project-URL: Repository, https://github.com/Pilot-Generative-AI/ambertraceai-python
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: httpx>=0.24.0
21
+ Requires-Dist: attrs>=23.1.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: pytest-httpx>=0.22; extra == "dev"
25
+ Requires-Dist: respx>=0.20; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # AmbertraceAI Python SDK
29
+
30
+ Python client for the [Ambertrace](https://ambertrace.ai) neurosymbolic AI platform API.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install ambertraceai
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```python
41
+ from ambertraceai import AmbertraceAPI
42
+
43
+ api = AmbertraceAPI(
44
+ base_url="https://app.ambertrace.ai",
45
+ api_key="at_...",
46
+ )
47
+
48
+ # Create a domain
49
+ domain = api.domains.create(
50
+ name="Legal Contracts",
51
+ description="Contract analysis for risk and compliance",
52
+ )
53
+
54
+ # Upload data
55
+ dataset = api.datasets.upload(
56
+ domain_id=domain["id"],
57
+ file_path="contracts.csv",
58
+ )
59
+
60
+ # Build a platform (async — returns a job)
61
+ result = api.platforms.create(
62
+ domain_id=domain["id"],
63
+ dataset_id=dataset["id"],
64
+ )
65
+
66
+ # Wait for the build to finish
67
+ job = api.wait_for_job(result["job_id"], timeout=600)
68
+
69
+ # Query the platform
70
+ answer = api.platforms.query(
71
+ platform_id=result["platform_id"],
72
+ query="What are the highest-risk clauses?",
73
+ )
74
+ print(answer["answer"])
75
+ print(answer["explanation"])
76
+ ```
77
+
78
+ ## Resources
79
+
80
+ | Resource | Methods |
81
+ |----------|---------|
82
+ | `api.domains` | `list`, `create`, `get`, `update`, `delete`, `build_ontology` |
83
+ | `api.datasets` | `list`, `get`, `upload`, `fetch`, `quality`, `clean`, `preview`, `delete` |
84
+ | `api.platforms` | `list`, `create`, `get`, `status`, `query`, `suggest_rules`, `list_suggestions`, `graph` |
85
+ | `api.predictions` | `predict`, `list_configs`, `create_config`, `train`, `list_predictions` |
86
+ | `api.jobs` | `get` |
87
+
88
+ ## Job Polling
89
+
90
+ Long-running operations (platform builds, data cleaning, training) return a `job_id`. Use `wait_for_job` to poll:
91
+
92
+ ```python
93
+ job = api.wait_for_job(job_id, timeout=300, poll_interval=5)
94
+ if job["status"] == "error":
95
+ print(f"Failed: {job.get('error_message')}")
96
+ ```
97
+
98
+ ## Error Handling
99
+
100
+ ```python
101
+ from ambertraceai import AmbertraceAPI, AmbertraceError
102
+
103
+ try:
104
+ api.domains.get(999)
105
+ except AmbertraceError as e:
106
+ print(e.status_code) # 404
107
+ print(e.code) # "not_found"
108
+ print(str(e)) # "Domain not found."
109
+ ```
110
+
111
+ ## API Documentation
112
+
113
+ Full API reference: [app.ambertrace.ai/openapi/redoc](https://app.ambertrace.ai/openapi/redoc)
@@ -0,0 +1,86 @@
1
+ # AmbertraceAI Python SDK
2
+
3
+ Python client for the [Ambertrace](https://ambertrace.ai) neurosymbolic AI platform API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install ambertraceai
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from ambertraceai import AmbertraceAPI
15
+
16
+ api = AmbertraceAPI(
17
+ base_url="https://app.ambertrace.ai",
18
+ api_key="at_...",
19
+ )
20
+
21
+ # Create a domain
22
+ domain = api.domains.create(
23
+ name="Legal Contracts",
24
+ description="Contract analysis for risk and compliance",
25
+ )
26
+
27
+ # Upload data
28
+ dataset = api.datasets.upload(
29
+ domain_id=domain["id"],
30
+ file_path="contracts.csv",
31
+ )
32
+
33
+ # Build a platform (async — returns a job)
34
+ result = api.platforms.create(
35
+ domain_id=domain["id"],
36
+ dataset_id=dataset["id"],
37
+ )
38
+
39
+ # Wait for the build to finish
40
+ job = api.wait_for_job(result["job_id"], timeout=600)
41
+
42
+ # Query the platform
43
+ answer = api.platforms.query(
44
+ platform_id=result["platform_id"],
45
+ query="What are the highest-risk clauses?",
46
+ )
47
+ print(answer["answer"])
48
+ print(answer["explanation"])
49
+ ```
50
+
51
+ ## Resources
52
+
53
+ | Resource | Methods |
54
+ |----------|---------|
55
+ | `api.domains` | `list`, `create`, `get`, `update`, `delete`, `build_ontology` |
56
+ | `api.datasets` | `list`, `get`, `upload`, `fetch`, `quality`, `clean`, `preview`, `delete` |
57
+ | `api.platforms` | `list`, `create`, `get`, `status`, `query`, `suggest_rules`, `list_suggestions`, `graph` |
58
+ | `api.predictions` | `predict`, `list_configs`, `create_config`, `train`, `list_predictions` |
59
+ | `api.jobs` | `get` |
60
+
61
+ ## Job Polling
62
+
63
+ Long-running operations (platform builds, data cleaning, training) return a `job_id`. Use `wait_for_job` to poll:
64
+
65
+ ```python
66
+ job = api.wait_for_job(job_id, timeout=300, poll_interval=5)
67
+ if job["status"] == "error":
68
+ print(f"Failed: {job.get('error_message')}")
69
+ ```
70
+
71
+ ## Error Handling
72
+
73
+ ```python
74
+ from ambertraceai import AmbertraceAPI, AmbertraceError
75
+
76
+ try:
77
+ api.domains.get(999)
78
+ except AmbertraceError as e:
79
+ print(e.status_code) # 404
80
+ print(e.code) # "not_found"
81
+ print(str(e)) # "Domain not found."
82
+ ```
83
+
84
+ ## API Documentation
85
+
86
+ Full API reference: [app.ambertrace.ai/openapi/redoc](https://app.ambertrace.ai/openapi/redoc)
@@ -0,0 +1,24 @@
1
+ """AmbertraceAI Python SDK"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+ from .convenience import (
5
+ AmbertraceAPI,
6
+ AmbertraceError,
7
+ DatasetResource,
8
+ DomainResource,
9
+ JobResource,
10
+ PlatformResource,
11
+ PredictionResource,
12
+ )
13
+
14
+ __all__ = (
15
+ "AmbertraceAPI",
16
+ "AmbertraceError",
17
+ "AuthenticatedClient",
18
+ "Client",
19
+ "DatasetResource",
20
+ "DomainResource",
21
+ "JobResource",
22
+ "PlatformResource",
23
+ "PredictionResource",
24
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,128 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_keys_api_keys_get_response_200 import ApiKeysApiKeysGetResponse200
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": "/api/v1/api-keys",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(
23
+ *, client: AuthenticatedClient | Client, response: httpx.Response
24
+ ) -> ApiKeysApiKeysGetResponse200 | None:
25
+ if response.status_code == 200:
26
+ response_200 = ApiKeysApiKeysGetResponse200.from_dict(response.json())
27
+
28
+ return response_200
29
+
30
+ if client.raise_on_unexpected_status:
31
+ raise errors.UnexpectedStatus(response.status_code, response.content)
32
+ else:
33
+ return None
34
+
35
+
36
+ def _build_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> Response[ApiKeysApiKeysGetResponse200]:
39
+ return Response(
40
+ status_code=HTTPStatus(response.status_code),
41
+ content=response.content,
42
+ headers=response.headers,
43
+ parsed=_parse_response(client=client, response=response),
44
+ )
45
+
46
+
47
+ def sync_detailed(
48
+ *,
49
+ client: AuthenticatedClient | Client,
50
+ ) -> Response[ApiKeysApiKeysGetResponse200]:
51
+ """List all API keys for the current organisation.
52
+
53
+ Raises:
54
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
55
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
56
+
57
+ Returns:
58
+ Response[ApiKeysApiKeysGetResponse200]
59
+ """
60
+
61
+ kwargs = _get_kwargs()
62
+
63
+ response = client.get_httpx_client().request(
64
+ **kwargs,
65
+ )
66
+
67
+ return _build_response(client=client, response=response)
68
+
69
+
70
+ def sync(
71
+ *,
72
+ client: AuthenticatedClient | Client,
73
+ ) -> ApiKeysApiKeysGetResponse200 | None:
74
+ """List all API keys for the current organisation.
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ ApiKeysApiKeysGetResponse200
82
+ """
83
+
84
+ return sync_detailed(
85
+ client=client,
86
+ ).parsed
87
+
88
+
89
+ async def asyncio_detailed(
90
+ *,
91
+ client: AuthenticatedClient | Client,
92
+ ) -> Response[ApiKeysApiKeysGetResponse200]:
93
+ """List all API keys for the current organisation.
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ Response[ApiKeysApiKeysGetResponse200]
101
+ """
102
+
103
+ kwargs = _get_kwargs()
104
+
105
+ response = await client.get_async_httpx_client().request(**kwargs)
106
+
107
+ return _build_response(client=client, response=response)
108
+
109
+
110
+ async def asyncio(
111
+ *,
112
+ client: AuthenticatedClient | Client,
113
+ ) -> ApiKeysApiKeysGetResponse200 | None:
114
+ """List all API keys for the current organisation.
115
+
116
+ Raises:
117
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
119
+
120
+ Returns:
121
+ ApiKeysApiKeysGetResponse200
122
+ """
123
+
124
+ return (
125
+ await asyncio_detailed(
126
+ client=client,
127
+ )
128
+ ).parsed
@@ -0,0 +1,160 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.validation_error_model import ValidationErrorModel
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: int,
15
+ ) -> dict[str, Any]:
16
+
17
+ _kwargs: dict[str, Any] = {
18
+ "method": "delete",
19
+ "url": "/api/v1/api-keys/{id}".format(
20
+ id=quote(str(id), safe=""),
21
+ ),
22
+ }
23
+
24
+ return _kwargs
25
+
26
+
27
+ def _parse_response(
28
+ *, client: AuthenticatedClient | Client, response: httpx.Response
29
+ ) -> list[ValidationErrorModel] | None:
30
+ if response.status_code == 422:
31
+ response_422 = []
32
+ _response_422 = response.json()
33
+ for response_422_item_data in _response_422:
34
+ response_422_item = ValidationErrorModel.from_dict(response_422_item_data)
35
+
36
+ response_422.append(response_422_item)
37
+
38
+ return response_422
39
+
40
+ if client.raise_on_unexpected_status:
41
+ raise errors.UnexpectedStatus(response.status_code, response.content)
42
+ else:
43
+ return None
44
+
45
+
46
+ def _build_response(
47
+ *, client: AuthenticatedClient | Client, response: httpx.Response
48
+ ) -> Response[list[ValidationErrorModel]]:
49
+ return Response(
50
+ status_code=HTTPStatus(response.status_code),
51
+ content=response.content,
52
+ headers=response.headers,
53
+ parsed=_parse_response(client=client, response=response),
54
+ )
55
+
56
+
57
+ def sync_detailed(
58
+ id: int,
59
+ *,
60
+ client: AuthenticatedClient | Client,
61
+ ) -> Response[list[ValidationErrorModel]]:
62
+ """Revoke (deactivate) an API key.
63
+
64
+ Args:
65
+ id (int): Resource ID
66
+
67
+ Raises:
68
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
69
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
70
+
71
+ Returns:
72
+ Response[list[ValidationErrorModel]]
73
+ """
74
+
75
+ kwargs = _get_kwargs(
76
+ id=id,
77
+ )
78
+
79
+ response = client.get_httpx_client().request(
80
+ **kwargs,
81
+ )
82
+
83
+ return _build_response(client=client, response=response)
84
+
85
+
86
+ def sync(
87
+ id: int,
88
+ *,
89
+ client: AuthenticatedClient | Client,
90
+ ) -> list[ValidationErrorModel] | None:
91
+ """Revoke (deactivate) an API key.
92
+
93
+ Args:
94
+ id (int): Resource ID
95
+
96
+ Raises:
97
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
98
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
99
+
100
+ Returns:
101
+ list[ValidationErrorModel]
102
+ """
103
+
104
+ return sync_detailed(
105
+ id=id,
106
+ client=client,
107
+ ).parsed
108
+
109
+
110
+ async def asyncio_detailed(
111
+ id: int,
112
+ *,
113
+ client: AuthenticatedClient | Client,
114
+ ) -> Response[list[ValidationErrorModel]]:
115
+ """Revoke (deactivate) an API key.
116
+
117
+ Args:
118
+ id (int): Resource ID
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ Response[list[ValidationErrorModel]]
126
+ """
127
+
128
+ kwargs = _get_kwargs(
129
+ id=id,
130
+ )
131
+
132
+ response = await client.get_async_httpx_client().request(**kwargs)
133
+
134
+ return _build_response(client=client, response=response)
135
+
136
+
137
+ async def asyncio(
138
+ id: int,
139
+ *,
140
+ client: AuthenticatedClient | Client,
141
+ ) -> list[ValidationErrorModel] | None:
142
+ """Revoke (deactivate) an API key.
143
+
144
+ Args:
145
+ id (int): Resource ID
146
+
147
+ Raises:
148
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
149
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
150
+
151
+ Returns:
152
+ list[ValidationErrorModel]
153
+ """
154
+
155
+ return (
156
+ await asyncio_detailed(
157
+ id=id,
158
+ client=client,
159
+ )
160
+ ).parsed
@@ -0,0 +1,128 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_keys_api_keys_post_response_200 import ApiKeysApiKeysPostResponse200
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "post",
16
+ "url": "/api/v1/api-keys",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(
23
+ *, client: AuthenticatedClient | Client, response: httpx.Response
24
+ ) -> ApiKeysApiKeysPostResponse200 | None:
25
+ if response.status_code == 200:
26
+ response_200 = ApiKeysApiKeysPostResponse200.from_dict(response.json())
27
+
28
+ return response_200
29
+
30
+ if client.raise_on_unexpected_status:
31
+ raise errors.UnexpectedStatus(response.status_code, response.content)
32
+ else:
33
+ return None
34
+
35
+
36
+ def _build_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> Response[ApiKeysApiKeysPostResponse200]:
39
+ return Response(
40
+ status_code=HTTPStatus(response.status_code),
41
+ content=response.content,
42
+ headers=response.headers,
43
+ parsed=_parse_response(client=client, response=response),
44
+ )
45
+
46
+
47
+ def sync_detailed(
48
+ *,
49
+ client: AuthenticatedClient | Client,
50
+ ) -> Response[ApiKeysApiKeysPostResponse200]:
51
+ """Create a new API key. Returns the full key exactly once.
52
+
53
+ Raises:
54
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
55
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
56
+
57
+ Returns:
58
+ Response[ApiKeysApiKeysPostResponse200]
59
+ """
60
+
61
+ kwargs = _get_kwargs()
62
+
63
+ response = client.get_httpx_client().request(
64
+ **kwargs,
65
+ )
66
+
67
+ return _build_response(client=client, response=response)
68
+
69
+
70
+ def sync(
71
+ *,
72
+ client: AuthenticatedClient | Client,
73
+ ) -> ApiKeysApiKeysPostResponse200 | None:
74
+ """Create a new API key. Returns the full key exactly once.
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ ApiKeysApiKeysPostResponse200
82
+ """
83
+
84
+ return sync_detailed(
85
+ client=client,
86
+ ).parsed
87
+
88
+
89
+ async def asyncio_detailed(
90
+ *,
91
+ client: AuthenticatedClient | Client,
92
+ ) -> Response[ApiKeysApiKeysPostResponse200]:
93
+ """Create a new API key. Returns the full key exactly once.
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ Response[ApiKeysApiKeysPostResponse200]
101
+ """
102
+
103
+ kwargs = _get_kwargs()
104
+
105
+ response = await client.get_async_httpx_client().request(**kwargs)
106
+
107
+ return _build_response(client=client, response=response)
108
+
109
+
110
+ async def asyncio(
111
+ *,
112
+ client: AuthenticatedClient | Client,
113
+ ) -> ApiKeysApiKeysPostResponse200 | None:
114
+ """Create a new API key. Returns the full key exactly once.
115
+
116
+ Raises:
117
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
119
+
120
+ Returns:
121
+ ApiKeysApiKeysPostResponse200
122
+ """
123
+
124
+ return (
125
+ await asyncio_detailed(
126
+ client=client,
127
+ )
128
+ ).parsed