peak-sdk 1.5.0__py3-none-any.whl → 1.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. peak/_metadata.py +80 -5
  2. peak/_version.py +1 -1
  3. peak/cli/args.py +1 -0
  4. peak/cli/cli.py +3 -2
  5. peak/cli/helpers.py +1 -0
  6. peak/cli/press/apps/specs.py +2 -0
  7. peak/cli/press/blocks/specs.py +68 -24
  8. peak/cli/press/deployments.py +41 -0
  9. peak/cli/press/specs.py +4 -2
  10. peak/cli/resources/alerts/__init__.py +35 -0
  11. peak/cli/resources/alerts/emails.py +360 -0
  12. peak/cli/resources/images.py +19 -7
  13. peak/cli/resources/services.py +23 -0
  14. peak/cli/resources/tenants.py +4 -1
  15. peak/cli/resources/workflows.py +81 -19
  16. peak/cli/ruff.toml +5 -3
  17. peak/compression.py +2 -2
  18. peak/exceptions.py +4 -6
  19. peak/handler.py +3 -5
  20. peak/helpers.py +8 -9
  21. peak/output.py +2 -2
  22. peak/press/apps.py +18 -19
  23. peak/press/blocks.py +396 -155
  24. peak/press/deployments.py +30 -4
  25. peak/press/specs.py +12 -14
  26. peak/resources/__init__.py +3 -2
  27. peak/resources/alerts.py +309 -0
  28. peak/resources/artifacts.py +2 -4
  29. peak/resources/images.py +317 -100
  30. peak/resources/services.py +7 -6
  31. peak/resources/webapps.py +3 -5
  32. peak/resources/workflows.py +103 -13
  33. peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
  34. peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
  35. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
  36. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
  37. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
  38. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
  39. peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
  40. peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
  41. peak/sample_yaml/resources/emails/send_email.yaml +15 -0
  42. peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
  43. peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
  44. peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
  45. peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
  46. peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
  47. peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
  48. peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
  49. peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
  50. peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
  51. peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
  52. peak/sample_yaml/resources/services/create_or_update_service.yaml +1 -0
  53. peak/sample_yaml/resources/services/create_service.yaml +1 -0
  54. peak/sample_yaml/resources/services/update_service.yaml +1 -0
  55. peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +36 -0
  56. peak/sample_yaml/resources/workflows/create_workflow.yaml +19 -1
  57. peak/sample_yaml/resources/workflows/patch_workflow.yaml +36 -0
  58. peak/sample_yaml/resources/workflows/update_workflow.yaml +36 -0
  59. peak/session.py +1 -1
  60. peak/telemetry.py +1 -1
  61. peak/template.py +6 -4
  62. peak/tools/logging/__init__.py +26 -268
  63. peak/tools/logging/log_level.py +35 -3
  64. peak/tools/logging/logger.py +389 -0
  65. {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/METADATA +19 -20
  66. {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/RECORD +69 -60
  67. {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/WHEEL +1 -1
  68. {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/LICENSE +0 -0
  69. {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/entry_points.txt +0 -0
peak/press/deployments.py CHANGED
@@ -19,6 +19,7 @@
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
21
  """Deployments client module."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import Any, Dict, Iterator, List, Literal, Optional, overload
@@ -44,8 +45,7 @@ class Deployment(BaseClient):
44
45
  page_number: Optional[int] = None,
45
46
  *,
46
47
  return_iterator: Literal[False],
47
- ) -> Dict[str, Any]:
48
- ...
48
+ ) -> Dict[str, Any]: ...
49
49
 
50
50
  @overload
51
51
  def list_deployments(
@@ -58,8 +58,7 @@ class Deployment(BaseClient):
58
58
  page_number: Optional[int] = None,
59
59
  *,
60
60
  return_iterator: Literal[True] = True,
61
- ) -> Iterator[Dict[str, Any]]:
62
- ...
61
+ ) -> Iterator[Dict[str, Any]]: ...
63
62
 
64
63
  def list_deployments(
65
64
  self,
@@ -130,6 +129,33 @@ class Deployment(BaseClient):
130
129
  subdomain="press",
131
130
  )
132
131
 
132
+ def execute_resources(self, deployment_id: str) -> Dict[str, Any]:
133
+ """Trigger the resources of an app or block deployment. This will execute the resources of the latest revision of the deployment.
134
+
135
+ REFERENCE:
136
+ 🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/Deployments/post_v1_deployments__deploymentId__trigger>`__
137
+
138
+ Args:
139
+ deployment_id (str): ID of the app or block deployment to trigger resources for.
140
+
141
+ Returns:
142
+ Dict[str, Any]: A dictionary containing the details of the triggered deployment.
143
+
144
+ Raises:
145
+ BadRequestException: The given parameters are invalid.
146
+ UnauthorizedException: The credentials are invalid.
147
+ ForbiddenException: The user does not have permission to perform the operation.
148
+ InternalServerErrorException: The server encountered an unexpected condition that
149
+ prevented it from fulfilling the request.
150
+ """
151
+ method, endpoint = HttpMethods.POST, f"{self.BASE_ENDPOINT}/{deployment_id}/execute"
152
+ return self.session.create_request( # type: ignore[no-any-return]
153
+ endpoint,
154
+ method,
155
+ content_type=ContentType.APPLICATION_JSON,
156
+ subdomain="press",
157
+ )
158
+
133
159
 
134
160
  def get_client(session: Optional[Session] = None) -> Deployment:
135
161
  """Returns a Deployment client.
peak/press/specs.py CHANGED
@@ -19,6 +19,7 @@
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
21
  """Specs client module."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import Any, Dict, Iterator, List, Literal, Optional, overload
@@ -46,8 +47,7 @@ class Spec(BaseClient):
46
47
  page_number: Optional[int] = None,
47
48
  *,
48
49
  return_iterator: Literal[False],
49
- ) -> Dict[str, Any]:
50
- ...
50
+ ) -> Dict[str, Any]: ...
51
51
 
52
52
  @overload
53
53
  def list_specs(
@@ -62,8 +62,7 @@ class Spec(BaseClient):
62
62
  page_number: Optional[int] = None,
63
63
  *,
64
64
  return_iterator: Literal[True] = True,
65
- ) -> Iterator[Dict[str, Any]]:
66
- ...
65
+ ) -> Iterator[Dict[str, Any]]: ...
67
66
 
68
67
  def list_specs(
69
68
  self,
@@ -144,7 +143,7 @@ class Spec(BaseClient):
144
143
  def list_spec_release_deployments(
145
144
  self,
146
145
  spec_id: str,
147
- version: str,
146
+ version: Optional[str],
148
147
  status: Optional[List[str]] = None,
149
148
  name: Optional[str] = None,
150
149
  title: Optional[str] = None,
@@ -153,14 +152,13 @@ class Spec(BaseClient):
153
152
  page_number: Optional[int] = None,
154
153
  *,
155
154
  return_iterator: Literal[False],
156
- ) -> Dict[str, Any]:
157
- ...
155
+ ) -> Dict[str, Any]: ...
158
156
 
159
157
  @overload
160
158
  def list_spec_release_deployments(
161
159
  self,
162
160
  spec_id: str,
163
- version: str,
161
+ version: Optional[str],
164
162
  status: Optional[List[str]] = None,
165
163
  name: Optional[str] = None,
166
164
  title: Optional[str] = None,
@@ -169,13 +167,12 @@ class Spec(BaseClient):
169
167
  page_number: Optional[int] = None,
170
168
  *,
171
169
  return_iterator: Literal[True] = True,
172
- ) -> Iterator[Dict[str, Any]]:
173
- ...
170
+ ) -> Iterator[Dict[str, Any]]: ...
174
171
 
175
172
  def list_spec_release_deployments(
176
173
  self,
177
174
  spec_id: str,
178
- version: str,
175
+ version: Optional[str],
179
176
  status: Optional[List[str]] = None,
180
177
  name: Optional[str] = None,
181
178
  title: Optional[str] = None,
@@ -188,11 +185,11 @@ class Spec(BaseClient):
188
185
  """Get all deployments of a App or Block spec release (ordered by most recently created to oldest).
189
186
 
190
187
  REFERENCE:
191
- 🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/Specs/get_v1_specs__specId__releases__version__deployments>`__
188
+ 🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/Specs/get_v1_specs__specId__releases_deployments>`__
192
189
 
193
190
  Args:
194
191
  spec_id (str): The ID of the App or Block spec.
195
- version (str): The release version of the spec in valid semantic versioning format.
192
+ version (str | None): The release version of the spec in valid semantic versioning format. If not provided, all deployments are returned.
196
193
  status (List[str] | None): List of statuses to filter deployments.
197
194
  Valid values are `deleting`, `delete_failed`, `deployed`, `deploying`, `failed`, `platform_resource_error`, `redeploying`, `rollback`, `rollback_complete`, `rollback_failed` and `warning`.
198
195
  name (str | None): String to filter deployments by name.
@@ -218,13 +215,14 @@ class Spec(BaseClient):
218
215
  InternalServerErrorException: the server encountered an unexpected condition that
219
216
  prevented it from fulfilling the request.
220
217
  """
221
- method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/{spec_id}/releases/{version}/deployments"
218
+ method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/{spec_id}/releases/deployments"
222
219
 
223
220
  params: Dict[str, Any] = {
224
221
  "status": status,
225
222
  "name": name,
226
223
  "title": title,
227
224
  "sort": sort,
225
+ "version": version,
228
226
  "pageSize": page_size,
229
227
  }
230
228
 
@@ -19,10 +19,11 @@
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
21
  """This module exports all platform resources from the `Peak-Platform`."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import List
25
26
 
26
- from peak.resources import artifacts, images, services, tenants, users, webapps, workflows
27
+ from peak.resources import alerts, artifacts, images, services, tenants, users, webapps, workflows
27
28
 
28
- __all__: List[str] = ["artifacts", "images", "services", "tenants", "users", "webapps", "workflows"]
29
+ __all__: List[str] = ["alerts", "artifacts", "images", "services", "tenants", "users", "webapps", "workflows"]
@@ -0,0 +1,309 @@
1
+ #
2
+ # # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+
22
+ """Alerts client module."""
23
+
24
+ from __future__ import annotations
25
+
26
+ from typing import Any, Dict, Iterator, List, Literal, Optional, overload
27
+
28
+ from peak.base_client import BaseClient
29
+ from peak.constants import ContentType, HttpMethods
30
+ from peak.session import Session
31
+
32
+
33
+ class Alert(BaseClient):
34
+ """Client class for interacting with alerts resource."""
35
+
36
+ BASE_ENDPOINT = "notifications/api/v1"
37
+
38
+ @overload
39
+ def list_emails(
40
+ self,
41
+ date_from: Optional[str] = None,
42
+ date_to: Optional[str] = None,
43
+ page_size: Optional[int] = None,
44
+ page_number: Optional[int] = None,
45
+ count: Optional[int] = None,
46
+ *,
47
+ return_iterator: Literal[False],
48
+ ) -> Dict[str, Any]: ...
49
+
50
+ @overload
51
+ def list_emails(
52
+ self,
53
+ date_from: Optional[str] = None,
54
+ date_to: Optional[str] = None,
55
+ page_size: Optional[int] = None,
56
+ page_number: Optional[int] = None,
57
+ count: Optional[int] = None,
58
+ *,
59
+ return_iterator: Literal[True] = True,
60
+ ) -> Iterator[Dict[str, Any]]: ...
61
+
62
+ def list_emails(
63
+ self,
64
+ date_from: Optional[str] = None,
65
+ date_to: Optional[str] = None,
66
+ page_size: Optional[int] = None,
67
+ page_number: Optional[int] = None,
68
+ count: Optional[int] = None,
69
+ *,
70
+ return_iterator: bool = True,
71
+ ) -> Iterator[Dict[str, Any]] | Dict[str, Any]:
72
+ """Retrieve the history of emails sent.
73
+
74
+ REFERENCE:
75
+ 🔗 `API Documentation <https://service.peak.ai/notifications/api-docs/index.htm#/emails/get_api_v1_emails>`__
76
+
77
+ Args:
78
+ date_from (str | None): The date after which the emails should be included (in ISO format).
79
+ It is 90 days from current date by default.
80
+ date_to (str | None): The date till which the emails should be included (in ISO format).
81
+ It is current date by default.
82
+ page_size (int | None): Number of emails to retrieve per page. It is 25 by default.
83
+ page_number (int | None): Page number to retrieve. Only used when return_iterator is False.
84
+ count (int | None): Number of emails required (Ordered by latest to earliest).
85
+ For example, if 5 is provided, it will return last 5 emails.
86
+ It is -1 by default which means it will return all the available emails within the given dates.
87
+ return_iterator (bool): Whether to return an iterator object or list of emails for a specified page number, defaults to True.
88
+
89
+ Returns:
90
+ Iterator[Dict[str, Any]] | Dict[str, Any]: an iterator object which returns an element per iteration, until there are no more elements to return.
91
+ If `return_iterator` is set to False, a dictionary containing the list and pagination details is returned instead.
92
+
93
+ Set `return_iterator` to True if you want automatic client-side pagination, or False if you want server-side pagination.
94
+
95
+ Raises:
96
+ BadRequestException: The given request parameters are invalid.
97
+ UnauthorizedException: The credentials are invalid.
98
+ ForbiddenException: The user does not have permission to perform the operation.
99
+ InternalServerErrorException: The server failed to process the request.
100
+ """
101
+ method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/emails"
102
+
103
+ params: Dict[str, Any] = {
104
+ "dateTo": date_to,
105
+ "dateFrom": date_from,
106
+ "pageSize": page_size,
107
+ "count": -1 if count is None else count,
108
+ }
109
+
110
+ if return_iterator:
111
+ return self.session.create_generator_request(
112
+ endpoint,
113
+ method,
114
+ content_type=ContentType.APPLICATION_JSON,
115
+ response_key="emails",
116
+ params=params,
117
+ )
118
+
119
+ return self.session.create_request( # type: ignore[no-any-return]
120
+ endpoint,
121
+ method,
122
+ content_type=ContentType.APPLICATION_JSON,
123
+ params={**params, "pageNumber": page_number},
124
+ )
125
+
126
+ def send_email(
127
+ self,
128
+ body: Dict[str, Any],
129
+ ) -> Dict[str, Any]:
130
+ """Send an email to the specified recipients using the specified template.
131
+
132
+ REFERENCE:
133
+ 🔗 `API Documentation <https://service.peak.ai/notifications/api-docs/index.htm#/Emails/post_api_v1_emails>`__
134
+
135
+ Args:
136
+ body (Dict[str, Any]): A dictionary containing the details of the email to send.
137
+
138
+ Returns:
139
+ Dict[str, Any]: A dictionary containing the ID of the email sent.
140
+
141
+ SCHEMA:
142
+ .. code-block:: json
143
+
144
+ {
145
+ "recipients": ["string"],
146
+ "cc": ["string"],
147
+ "bcc": ["string"],
148
+ "subject": "string",
149
+ "templateName": "string",
150
+ "templateParameters": {
151
+ "string": "string"
152
+ }
153
+ }
154
+
155
+ Raises:
156
+ UnauthorizedException: The credentials are invalid.
157
+ ForbiddenException: The user does not have permission to perform the operation.
158
+ NotFoundException: The given feature does not exist.
159
+ UnprocessableEntityException: The server was unable to process the request.
160
+ InternalServerErrorException: The server failed to process the request.
161
+ """
162
+ method, endpoint = HttpMethods.POST, f"{self.BASE_ENDPOINT}/emails"
163
+
164
+ return self.session.create_request( # type: ignore[no-any-return]
165
+ endpoint,
166
+ method,
167
+ body=body,
168
+ content_type=ContentType.APPLICATION_JSON,
169
+ )
170
+
171
+ def describe_email(self, email_id: int) -> Dict[str, Any]:
172
+ """Retrieve the details of a specific email.
173
+
174
+ REFERENCE:
175
+ 🔗 `API Documentation <https://service.peak.ai/notifications/api-docs/index.htm#/Emails/get_api_v1_emails__id_>`__
176
+
177
+ Args:
178
+ email_id (int): The ID of the email to retrieve.
179
+
180
+ Returns:
181
+ Dict[str, Any]: A dictionary containing the details of the email.
182
+
183
+ Raises:
184
+ UnauthorizedException: The credentials are invalid.
185
+ ForbiddenException: The user does not have permission to perform the operation.
186
+ NotFoundException: Email with the given ID does not exist.
187
+ UnprocessableEntityException: The server was unable to process the request.
188
+ InternalServerErrorException: The server failed to process the request.
189
+ """
190
+ method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/emails/{email_id}"
191
+
192
+ return self.session.create_request(endpoint, method, content_type=ContentType.APPLICATION_JSON) # type: ignore[no-any-return]
193
+
194
+ @overload
195
+ def list_templates(
196
+ self,
197
+ page_size: Optional[int] = None,
198
+ page_number: Optional[int] = None,
199
+ name: Optional[str] = None,
200
+ scope: Optional[List[str]] = None,
201
+ *,
202
+ return_iterator: Literal[False],
203
+ ) -> Dict[str, Any]: ...
204
+
205
+ @overload
206
+ def list_templates(
207
+ self,
208
+ page_size: Optional[int] = None,
209
+ page_number: Optional[int] = None,
210
+ name: Optional[str] = None,
211
+ scope: Optional[List[str]] = None,
212
+ *,
213
+ return_iterator: Literal[True] = True,
214
+ ) -> Iterator[Dict[str, Any]]: ...
215
+
216
+ def list_templates(
217
+ self,
218
+ page_size: Optional[int] = None,
219
+ page_number: Optional[int] = None,
220
+ name: Optional[str] = None,
221
+ scope: Optional[List[str]] = None,
222
+ *,
223
+ return_iterator: bool = True,
224
+ ) -> Iterator[Dict[str, Any]] | Dict[str, Any]:
225
+ """Retrieve the history of emails sent.
226
+
227
+ REFERENCE:
228
+ 🔗 `API Documentation <https://service.peak.ai/notifications/api-docs/index.htm#/Templates/get_api_v1_emails_templates>`__
229
+
230
+ Args:
231
+ name (str | None): The name of the email template
232
+ scope (List[str] | None): Filter out on the basis of the type of the template - global or custom.
233
+ page_size (int | None): Number of emails to retrieve per page. It is 25 by default.
234
+ page_number (int | None): Page number to retrieve. Only used when return_iterator is False.
235
+ return_iterator (bool): Whether to return an iterator object or list of emails for a specified page number, defaults to True.
236
+
237
+ Returns:
238
+ Iterator[Dict[str, Any]] | Dict[str, Any]: an iterator object which returns an element per iteration, until there are no more elements to return.
239
+ If `return_iterator` is set to False, a dictionary containing the list and pagination details is returned instead.
240
+
241
+ Set `return_iterator` to True if you want automatic client-side pagination, or False if you want server-side pagination.
242
+
243
+ Raises:
244
+ BadRequestException: The given request parameters are invalid.
245
+ UnauthorizedException: The credentials are invalid.
246
+ ForbiddenException: The user does not have permission to perform the operation.
247
+ InternalServerErrorException: The server failed to process the request.
248
+ """
249
+ method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/emails/templates"
250
+
251
+ params: Dict[str, Any] = {
252
+ "searchTerm": name,
253
+ "scope": scope,
254
+ "pageSize": page_size,
255
+ }
256
+
257
+ if return_iterator:
258
+ return self.session.create_generator_request(
259
+ endpoint,
260
+ method,
261
+ content_type=ContentType.APPLICATION_JSON,
262
+ response_key="templates",
263
+ params=params,
264
+ )
265
+
266
+ return self.session.create_request( # type: ignore[no-any-return]
267
+ endpoint,
268
+ method,
269
+ content_type=ContentType.APPLICATION_JSON,
270
+ params={**params, "pageNumber": page_number},
271
+ )
272
+
273
+ def describe_template(self, template_name: str) -> Dict[str, Any]:
274
+ """Retrieve the details of a specific template.
275
+
276
+ REFERENCE:
277
+ 🔗 `API Documentation <https://service.peak.ai/notifications/api-docs/index.htm#/Templates/get_api_v1_emails_templates__name_>`__
278
+
279
+ Args:
280
+ template_name (str): The name of the template to retrieve.
281
+
282
+ Returns:
283
+ Dict[str, Any]: A dictionary containing the details of the template.
284
+
285
+ Raises:
286
+ UnauthorizedException: The credentials are invalid.
287
+ ForbiddenException: The user does not have permission to perform the operation.
288
+ NotFoundException: Email with the given ID does not exist.
289
+ UnprocessableEntityException: The server was unable to process the request.
290
+ InternalServerErrorException: The server failed to process the request.
291
+ """
292
+ method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/emails/templates/{template_name}"
293
+
294
+ return self.session.create_request(endpoint, method, content_type=ContentType.APPLICATION_JSON) # type: ignore[no-any-return]
295
+
296
+
297
+ def get_client(session: Optional[Session] = None) -> Alert:
298
+ """Returns a Alert client, If no session is provided, a default session is used.
299
+
300
+ Args:
301
+ session (Optional[Session]): A Session Object. Default is None.
302
+
303
+ Returns:
304
+ Alert: The alert client object.
305
+ """
306
+ return Alert(session)
307
+
308
+
309
+ __all__ = ["get_client"]
@@ -40,8 +40,7 @@ class Artifact(BaseClient):
40
40
  page_number: Optional[int] = None,
41
41
  *,
42
42
  return_iterator: Literal[False],
43
- ) -> Dict[str, Any]:
44
- ...
43
+ ) -> Dict[str, Any]: ...
45
44
 
46
45
  @overload
47
46
  def list_artifacts(
@@ -50,8 +49,7 @@ class Artifact(BaseClient):
50
49
  page_number: Optional[int] = None,
51
50
  *,
52
51
  return_iterator: Literal[True] = True,
53
- ) -> Iterator[Dict[str, Any]]:
54
- ...
52
+ ) -> Iterator[Dict[str, Any]]: ...
55
53
 
56
54
  def list_artifacts(
57
55
  self,