anaplan-sdk 0.5.0a1__tar.gz → 0.5.0a3__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.
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/PKG-INFO +2 -2
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_alm.py +24 -31
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_audit.py +7 -9
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_bulk.py +141 -88
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_cloud_works.py +36 -34
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_cw_flow.py +13 -15
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/_transactional.py +62 -42
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_alm.py +22 -31
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_audit.py +7 -10
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_bulk.py +78 -62
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_cloud_works.py +33 -33
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_cw_flow.py +11 -13
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/_transactional.py +42 -33
- anaplan_sdk-0.5.0a1/anaplan_sdk/_base.py → anaplan_sdk-0.5.0a3/anaplan_sdk/_services.py +145 -87
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/__init__.py +2 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/_bulk.py +2 -9
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/cloud_works.py +6 -2
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_transactional_client.md +1 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_transactional_client.md +1 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/alm.md +0 -17
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/bulk.md +29 -24
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/transactional.md +17 -34
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/pyproject.toml +5 -3
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/conftest.py +12 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_alm_client.py +1 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_client.py +9 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_transactional_client.py +25 -25
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/conftest.py +12 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_alm_client.py +1 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_client.py +9 -1
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_transactional_client.py +25 -25
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/uv.lock +623 -621
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.github/dependabot.yml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.github/workflows/docs.yml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.github/workflows/lint.yml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.github/workflows/tests.yml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.gitignore +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/.pre-commit-config.yaml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/LICENSE +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/README.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/__init__.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_async_clients/__init__.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_auth.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_clients/__init__.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/_oauth.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/exceptions.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/_alm.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/_base.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/_transactional.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/anaplan_sdk/models/flows.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_alm_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_audit_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_cw_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_flows_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/async/async_oauth_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/exceptions.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/models/alm.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/models/bulk.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/models/cloud_works.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/models/flows.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/models/transactional.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_alm_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_audit_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_cw_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_flows_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/api/sync/sync_oauth_client.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/assets/overview.html +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/concepts.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/css/styles.css +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/audit.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/authentication.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/bulk_vs_transactional.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/cloud_works.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/index.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/logging.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/guides/multiple_models.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/img/anaplan-sdk.webp +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/index.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/installation.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/assets/hljs.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/assets/hljs.min.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/assets/python.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/assets/python.min.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/highlight.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/js/highlight.min.js +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/docs/quickstart.md +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/mkdocs.yml +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_audit_client.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_cloud_works_client.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/async/test_async_flows_client.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/conftest.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_audit_client.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_cloud_works_client.py +0 -0
- {anaplan_sdk-0.5.0a1 → anaplan_sdk-0.5.0a3}/tests/sync/test_flows_client.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: anaplan-sdk
|
3
|
-
Version: 0.5.
|
4
|
-
Summary: Streamlined Python Interface for Anaplan
|
3
|
+
Version: 0.5.0a3
|
4
|
+
Summary: Streamlined Python Interface for the Anaplan API.
|
5
5
|
Project-URL: Homepage, https://vinzenzklass.github.io/anaplan-sdk/
|
6
6
|
Project-URL: Repository, https://github.com/VinzenzKlass/anaplan-sdk
|
7
7
|
Project-URL: Documentation, https://vinzenzklass.github.io/anaplan-sdk/
|
@@ -1,10 +1,7 @@
|
|
1
1
|
import logging
|
2
|
-
from asyncio import sleep
|
3
2
|
from typing import Literal, overload
|
4
3
|
|
5
|
-
import
|
6
|
-
|
7
|
-
from anaplan_sdk._base import _AsyncBaseClient
|
4
|
+
from anaplan_sdk._services import _AsyncHttpService
|
8
5
|
from anaplan_sdk.exceptions import AnaplanActionError
|
9
6
|
from anaplan_sdk.models import (
|
10
7
|
ModelRevision,
|
@@ -18,14 +15,11 @@ from anaplan_sdk.models import (
|
|
18
15
|
logger = logging.getLogger("anaplan_sdk")
|
19
16
|
|
20
17
|
|
21
|
-
class _AsyncAlmClient
|
22
|
-
def __init__(
|
23
|
-
self
|
24
|
-
) -> None:
|
25
|
-
self.status_poll_delay = status_poll_delay
|
18
|
+
class _AsyncAlmClient:
|
19
|
+
def __init__(self, http: _AsyncHttpService, model_id: str) -> None:
|
20
|
+
self._http = http
|
26
21
|
self._model_id = model_id
|
27
22
|
self._url = f"https://api.anaplan.com/2/0/models/{model_id}"
|
28
|
-
super().__init__(retry_count, client)
|
29
23
|
|
30
24
|
async def change_model_status(self, status: Literal["online", "offline"]) -> None:
|
31
25
|
"""
|
@@ -33,14 +27,14 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
33
27
|
:param status: The status of the model. Can be either "online" or "offline".
|
34
28
|
"""
|
35
29
|
logger.info(f"Changed model status to '{status}' for model {self._model_id}.")
|
36
|
-
await self.
|
30
|
+
await self._http.put(f"{self._url}/onlineStatus", json={"status": status})
|
37
31
|
|
38
32
|
async def get_revisions(self) -> list[Revision]:
|
39
33
|
"""
|
40
34
|
Use this call to return a list of revisions for a specific model.
|
41
35
|
:return: A list of revisions for a specific model.
|
42
36
|
"""
|
43
|
-
res = await self.
|
37
|
+
res = await self._http.get(f"{self._url}/alm/revisions")
|
44
38
|
return [Revision.model_validate(e) for e in res.get("revisions", [])]
|
45
39
|
|
46
40
|
async def get_latest_revision(self) -> Revision | None:
|
@@ -52,7 +46,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
52
46
|
latest revision.
|
53
47
|
:return: The latest revision for a specific model, or None if no revisions exist.
|
54
48
|
"""
|
55
|
-
res = (await self.
|
49
|
+
res = (await self._http.get(f"{self._url}/alm/latestRevision")).get("revisions")
|
56
50
|
return Revision.model_validate(res[0]) if res else None
|
57
51
|
|
58
52
|
async def get_syncable_revisions(self, source_model_id: str) -> list[Revision]:
|
@@ -65,7 +59,9 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
65
59
|
:param source_model_id: The ID of the source model.
|
66
60
|
:return: A list of revisions that can be synchronized to the target model.
|
67
61
|
"""
|
68
|
-
res = await self.
|
62
|
+
res = await self._http.get(
|
63
|
+
f"{self._url}/alm/syncableRevisions?sourceModelId={source_model_id}"
|
64
|
+
)
|
69
65
|
return [Revision.model_validate(e) for e in res.get("revisions", [])]
|
70
66
|
|
71
67
|
async def create_revision(self, name: str, description: str) -> Revision:
|
@@ -75,7 +71,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
75
71
|
:param description: The description of the revision.
|
76
72
|
:return: The created Revision Info.
|
77
73
|
"""
|
78
|
-
res = await self.
|
74
|
+
res = await self._http.post(
|
79
75
|
f"{self._url}/alm/revisions", json={"name": name, "description": description}
|
80
76
|
)
|
81
77
|
rev = Revision.model_validate(res["revision"])
|
@@ -88,7 +84,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
88
84
|
they completed within the last 48 hours.
|
89
85
|
:return: A list of sync tasks in descending order of creation time.
|
90
86
|
"""
|
91
|
-
res = await self.
|
87
|
+
res = await self._http.get(f"{self._url}/alm/syncTasks")
|
92
88
|
return [TaskSummary.model_validate(e) for e in res.get("tasks", [])]
|
93
89
|
|
94
90
|
async def get_sync_task(self, task_id: str) -> SyncTask:
|
@@ -97,7 +93,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
97
93
|
:param task_id: The ID of the sync task.
|
98
94
|
:return: The sync task information.
|
99
95
|
"""
|
100
|
-
res = await self.
|
96
|
+
res = await self._http.get(f"{self._url}/alm/syncTasks/{task_id}")
|
101
97
|
return SyncTask.model_validate(res["task"])
|
102
98
|
|
103
99
|
async def sync_models(
|
@@ -123,7 +119,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
123
119
|
"sourceModelId": source_model_id,
|
124
120
|
"targetRevisionId": target_revision_id,
|
125
121
|
}
|
126
|
-
res = await self.
|
122
|
+
res = await self._http.post(f"{self._url}/alm/syncTasks", json=payload)
|
127
123
|
task = await self.get_sync_task(res["task"]["taskId"])
|
128
124
|
logger.info(
|
129
125
|
f"Started sync task '{task.id}' from Model '{source_model_id}' "
|
@@ -131,8 +127,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
131
127
|
)
|
132
128
|
if not wait_for_completion:
|
133
129
|
return task
|
134
|
-
|
135
|
-
await sleep(self.status_poll_delay)
|
130
|
+
task = await self._http.poll_task(self.get_sync_task, task.id)
|
136
131
|
if not task.result.successful:
|
137
132
|
msg = f"Sync task {task.id} completed with errors: {task.result.error}."
|
138
133
|
logger.error(msg)
|
@@ -147,7 +142,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
147
142
|
:param revision_id: The ID of the revision.
|
148
143
|
:return: A list of models that had a specific revision applied to them.
|
149
144
|
"""
|
150
|
-
res = await self.
|
145
|
+
res = await self._http.get(f"{self._url}/alm/revisions/{revision_id}/appliedToModels")
|
151
146
|
return [ModelRevision.model_validate(e) for e in res.get("appliedToModels", [])]
|
152
147
|
|
153
148
|
async def create_comparison_report(
|
@@ -172,7 +167,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
172
167
|
"sourceModelId": source_model_id,
|
173
168
|
"targetRevisionId": target_revision_id,
|
174
169
|
}
|
175
|
-
res = await self.
|
170
|
+
res = await self._http.post(f"{self._url}/alm/comparisonReportTasks", json=payload)
|
176
171
|
task = await self.get_comparison_report_task(res["task"]["taskId"])
|
177
172
|
logger.info(
|
178
173
|
f"Started Comparison Report task '{task.id}' between Model '{source_model_id}' "
|
@@ -180,8 +175,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
180
175
|
)
|
181
176
|
if not wait_for_completion:
|
182
177
|
return task
|
183
|
-
|
184
|
-
await sleep(self.status_poll_delay)
|
178
|
+
task = await self._http.poll_task(self.get_comparison_report_task, task.id)
|
185
179
|
if not task.result.successful:
|
186
180
|
msg = f"Comparison Report task {task.id} completed with errors: {task.result.error}."
|
187
181
|
logger.error(msg)
|
@@ -195,7 +189,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
195
189
|
:param task_id: The ID of the comparison report task.
|
196
190
|
:return: The report task information.
|
197
191
|
"""
|
198
|
-
res = await self.
|
192
|
+
res = await self._http.get(f"{self._url}/alm/comparisonReportTasks/{task_id}")
|
199
193
|
return ReportTask.model_validate(res["task"])
|
200
194
|
|
201
195
|
async def get_comparison_report(self, task: ReportTask) -> bytes:
|
@@ -204,7 +198,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
204
198
|
:param task: The report task object containing the task ID.
|
205
199
|
:return: The binary content of the comparison report.
|
206
200
|
"""
|
207
|
-
return await self.
|
201
|
+
return await self._http.get_binary(
|
208
202
|
f"{self._url}/alm/comparisonReports/"
|
209
203
|
f"{task.result.target_revision_id}/{task.result.source_revision_id}"
|
210
204
|
)
|
@@ -248,7 +242,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
248
242
|
"sourceModelId": source_model_id,
|
249
243
|
"targetRevisionId": target_revision_id,
|
250
244
|
}
|
251
|
-
res = await self.
|
245
|
+
res = await self._http.post(f"{self._url}/alm/summaryReportTasks", json=payload)
|
252
246
|
task = await self.get_comparison_summary_task(res["task"]["taskId"])
|
253
247
|
logger.info(
|
254
248
|
f"Started Comparison Summary task '{task.id}' between Model '{source_model_id}' "
|
@@ -256,8 +250,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
256
250
|
)
|
257
251
|
if not wait_for_completion:
|
258
252
|
return task
|
259
|
-
|
260
|
-
await sleep(self.status_poll_delay)
|
253
|
+
task = await self._http.poll_task(self.get_comparison_summary_task, task.id)
|
261
254
|
if not task.result.successful:
|
262
255
|
msg = f"Comparison Summary task {task.id} completed with errors: {task.result.error}."
|
263
256
|
logger.error(msg)
|
@@ -271,7 +264,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
271
264
|
:param task_id: The ID of the comparison summary task.
|
272
265
|
:return: The report task information.
|
273
266
|
"""
|
274
|
-
res = await self.
|
267
|
+
res = await self._http.get(f"{self._url}/alm/summaryReportTasks/{task_id}")
|
275
268
|
return ReportTask.model_validate(res["task"])
|
276
269
|
|
277
270
|
async def get_comparison_summary(self, task: ReportTask) -> SummaryReport:
|
@@ -280,7 +273,7 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
280
273
|
:param task: The summary task object containing the task ID.
|
281
274
|
:return: The binary content of the comparison summary.
|
282
275
|
"""
|
283
|
-
res = await self.
|
276
|
+
res = await self._http.get(
|
284
277
|
f"{self._url}/alm/summaryReports/"
|
285
278
|
f"{task.result.target_revision_id}/{task.result.source_revision_id}"
|
286
279
|
)
|
@@ -1,18 +1,16 @@
|
|
1
1
|
from typing import Any, Literal
|
2
2
|
|
3
|
-
import
|
4
|
-
|
5
|
-
from anaplan_sdk._base import _AsyncBaseClient
|
3
|
+
from anaplan_sdk._services import _AsyncHttpService
|
6
4
|
from anaplan_sdk.models import User
|
7
5
|
|
8
6
|
Event = Literal["all", "byok", "user_activity"]
|
9
7
|
|
10
8
|
|
11
|
-
class _AsyncAuditClient
|
12
|
-
def __init__(self,
|
9
|
+
class _AsyncAuditClient:
|
10
|
+
def __init__(self, http: _AsyncHttpService) -> None:
|
11
|
+
self._http = http
|
13
12
|
self._limit = 10_000
|
14
13
|
self._url = "https://audit.anaplan.com/audit/api/1/events"
|
15
|
-
super().__init__(retry_count, client)
|
16
14
|
|
17
15
|
async def get_users(self, search_pattern: str | None = None) -> list[User]:
|
18
16
|
"""
|
@@ -26,7 +24,7 @@ class _AsyncAuditClient(_AsyncBaseClient):
|
|
26
24
|
params = {"s": search_pattern} if search_pattern else None
|
27
25
|
return [
|
28
26
|
User.model_validate(e)
|
29
|
-
for e in await self.
|
27
|
+
for e in await self._http.get_paginated(
|
30
28
|
"https://api.anaplan.com/2/0/users", "users", params=params
|
31
29
|
)
|
32
30
|
]
|
@@ -37,7 +35,7 @@ class _AsyncAuditClient(_AsyncBaseClient):
|
|
37
35
|
:return: The requested or currently authenticated User.
|
38
36
|
"""
|
39
37
|
return User.model_validate(
|
40
|
-
(await self.
|
38
|
+
(await self._http.get(f"https://api.anaplan.com/2/0/users/{user_id}")).get("user")
|
41
39
|
)
|
42
40
|
|
43
41
|
async def get_events(
|
@@ -51,7 +49,7 @@ class _AsyncAuditClient(_AsyncBaseClient):
|
|
51
49
|
:return: A list of log entries, each containing a dictionary with event details.
|
52
50
|
"""
|
53
51
|
return list(
|
54
|
-
await self.
|
52
|
+
await self._http.get_paginated(
|
55
53
|
self._url,
|
56
54
|
"response",
|
57
55
|
params={"type": event_type, "intervalInHours": days_into_past * 24},
|