atlassian-python-api 5.0.2__py3-none-any.whl → 5.0.3__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.
@@ -0,0 +1,109 @@
1
+ """Atlassian Compass REST API client."""
2
+
3
+ from ..rest_client import AtlassianRestAPI
4
+
5
+
6
+ class Compass(AtlassianRestAPI):
7
+ """Client for the Compass gateway REST API.
8
+
9
+ Compass Cloud exposes these endpoints below ``/gateway/api`` on an
10
+ Atlassian site. JSON requests use ``data`` or ``json`` as accepted by the
11
+ base REST client; multipart methods accept a file path or a ``files``
12
+ mapping.
13
+ """
14
+
15
+ def __init__(self, *args, **kwargs):
16
+ kwargs["api_root"] = "gateway/api"
17
+ super().__init__(*args, **kwargs)
18
+
19
+ @staticmethod
20
+ def _multipart_file(filename, files=None):
21
+ if files is not None:
22
+ return files, None
23
+ if filename is None:
24
+ raise ValueError("filename or files is required")
25
+ handle = open(filename, "rb")
26
+ return {"file": handle}, handle
27
+
28
+ def send_metric(self, data=None):
29
+ """Send a metric value to Compass."""
30
+ return self.post(self.url_joiner(self.api_root, "compass/v1/metrics"), data=data)
31
+
32
+ def send_event(self, data=None):
33
+ """Send a streamlined event to Compass."""
34
+ return self.post(self.url_joiner(self.api_root, "compass/v1/events"), data=data)
35
+
36
+ def get_entitlement_results(self, data=None):
37
+ """Retrieve entitlement results for a Compass component."""
38
+ return self.post(self.url_joiner(self.api_root, "compass/v1/entitlements"), data=data)
39
+
40
+ def invoke_webhook(self, webhook_id, data=None):
41
+ """Invoke an inbound Compass webhook."""
42
+ path = self.url_joiner(self.api_root, f"compass/v1/webhooks/{webhook_id}")
43
+ return self.post(path, data=data)
44
+
45
+ def upload_package_dependencies_lock_file(
46
+ self, source_id, base_source_url, component_id, filename=None, files=None
47
+ ):
48
+ """Upload a package dependency lock file."""
49
+ multipart, handle = self._multipart_file(filename, files)
50
+ try:
51
+ path = self.url_joiner(self.api_root, "compass/v1/package_dependencies/lock_file")
52
+ params = {
53
+ "sourceId": source_id,
54
+ "baseSourceUrl": base_source_url,
55
+ "componentId": component_id,
56
+ }
57
+ return self.put(path, params=params, files=multipart)
58
+ finally:
59
+ if handle:
60
+ handle.close()
61
+
62
+ def delete_package_dependencies(self, component_id, source_id):
63
+ """Delete package dependencies for a component and source."""
64
+ path = self.url_joiner(self.api_root, f"compass/v1/package_dependencies/lock_file/{component_id}/{source_id}")
65
+ return self.delete(path)
66
+
67
+ def get_forge_app_attachment(self, component_id, forge_app_id, key, not_json_response=True):
68
+ """Download a Forge app attachment belonging to a component."""
69
+ path = self.url_joiner(
70
+ self.api_root, f"compass/v1/component/{component_id}/app/{forge_app_id}/attachment/{key}"
71
+ )
72
+ return self.get(path, not_json_response=not_json_response)
73
+
74
+ def upload_forge_app_attachment(self, component_id, forge_app_id, key, filename=None, files=None):
75
+ """Upload a Forge app attachment."""
76
+ multipart, handle = self._multipart_file(filename, files)
77
+ try:
78
+ path = self.url_joiner(
79
+ self.api_root, f"compass/v1/component/{component_id}/app/{forge_app_id}/attachment/{key}"
80
+ )
81
+ return self.put(path, files=multipart)
82
+ finally:
83
+ if handle:
84
+ handle.close()
85
+
86
+ def delete_forge_app_attachment(self, component_id, forge_app_id, key):
87
+ """Delete a Forge app attachment."""
88
+ path = self.url_joiner(
89
+ self.api_root, f"compass/v1/component/{component_id}/app/{forge_app_id}/attachment/{key}"
90
+ )
91
+ return self.delete(path)
92
+
93
+ def upload_component_api_spec(self, component_id, filename=None, files=None):
94
+ """Upload an OpenAPI specification for a Compass component."""
95
+ multipart, handle = self._multipart_file(filename, files)
96
+ try:
97
+ path = self.url_joiner(self.api_root, f"compass/v1/component/{component_id}/api_specs")
98
+ return self.put(path, files=multipart)
99
+ finally:
100
+ if handle:
101
+ handle.close()
102
+
103
+ def delete_component_api_spec(self, component_id):
104
+ """Delete the API specification for a Compass component."""
105
+ path = self.url_joiner(self.api_root, f"compass/v1/component/{component_id}/api_specs")
106
+ return self.delete(path)
107
+
108
+
109
+ __all__ = ["Compass"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  import copy
4
4
  import re
5
- from urllib.parse import urljoin, urlparse
5
+ from urllib.parse import parse_qsl, urljoin, urlparse
6
6
  import logging
7
7
  from requests import HTTPError
8
8
  from ..rest_client import AtlassianRestAPI
@@ -167,6 +167,7 @@ class ConfluenceBase(AtlassianRestAPI):
167
167
  params = {}
168
168
 
169
169
  while True:
170
+ current_url = url
170
171
  response = self.get(
171
172
  url,
172
173
  trailing=trailing,
@@ -190,6 +191,16 @@ class ConfluenceBase(AtlassianRestAPI):
190
191
  if url is None:
191
192
  break
192
193
 
194
+ # Cloud V2 cursor links contain a relative endpoint and a cursor
195
+ # query. Reusing the already-resolved endpoint preserves both
196
+ # ``/wiki`` and API-gateway tenant prefixes.
197
+ parsed_next = urlparse(url)
198
+ if getattr(self, "api_version", None) == 2 and parsed_next.query and not parsed_next.scheme:
199
+ url = current_url
200
+ params = dict(parse_qsl(parsed_next.query, keep_blank_values=True))
201
+ trailing = False
202
+ continue
203
+
193
204
  if not urlparse(url).scheme:
194
205
  # Confluence returns both ``/rest/api/...`` and
195
206
  # ``rest/api/...`` forms for next links. Neither is an
@@ -155,6 +155,23 @@ class Cloud(ConfluenceCloudBase):
155
155
  """Return every version of a legacy Confluence Cloud page as a list."""
156
156
  return list(self.iter_page_versions(page_id, limit=limit, expand=expand))
157
157
 
158
+ def remove_content_history(self, page_id, version_number):
159
+ """Remove one historical page version from Confluence Cloud.
160
+
161
+ The old implementation used the retired ``rest/experimental`` route.
162
+ Cloud exposes the operation through the versioned v1 content endpoint.
163
+ """
164
+ endpoint = self._cloud_wiki_url(f"rest/api/content/{page_id}/version/{version_number}")
165
+ return self.delete(endpoint, absolute=True)
166
+
167
+ def remove_page_history(self, page_id, version_number):
168
+ """Alias for :meth:`remove_content_history`."""
169
+ return self.remove_content_history(page_id, version_number)
170
+
171
+ def remove_content_history_in_cloud(self, page_id, version_id):
172
+ """Backward-compatible alias for removing a Cloud page version."""
173
+ return self.remove_content_history(page_id, version_id)
174
+
158
175
  def get_content_by_type(self, content_type, **kwargs):
159
176
  """Get content by type (page, blogpost, etc.)."""
160
177
  return self.get("content", params={"type": content_type, **kwargs})
@@ -0,0 +1,125 @@
1
+ """Confluence Cloud v2 administrative and workspace operations."""
2
+
3
+
4
+ class AdminManagementOperations:
5
+ """Wrappers for v2 administrative resources not covered by legacy helpers."""
6
+
7
+ @staticmethod
8
+ def _query(**values):
9
+ return {key: value for key, value in values.items() if value is not None}
10
+
11
+ def _v2(self, path):
12
+ return self.url_joiner("api/v2", path)
13
+
14
+ def get_admin_key(self):
15
+ return self.get(self._v2("admin-key"))
16
+
17
+ def enable_admin_key(self):
18
+ return self.post(self._v2("admin-key"))
19
+
20
+ def disable_admin_key(self):
21
+ return self.delete(self._v2("admin-key"))
22
+
23
+ def get_space_permissions(self, cursor=None, limit=None):
24
+ return self.get(self._v2("space-permissions"), params=self._query(cursor=cursor, limit=limit))
25
+
26
+ def get_space_permission_combinations(self, cursor=None, limit=None):
27
+ return self.get(
28
+ self._v2("space-permissions/transition/combinations"),
29
+ params=self._query(cursor=cursor, limit=limit),
30
+ )
31
+
32
+ def generate_space_permission_combinations(self, data=None):
33
+ return self.post(self._v2("space-permissions/transition/combinations"), data=data)
34
+
35
+ def assign_space_permission_roles(self, data=None):
36
+ return self.post(self._v2("space-permissions/transition/role-assignments"), data=data)
37
+
38
+ def remove_space_permission_access(self, data=None):
39
+ return self.post(self._v2("space-permissions/transition/access-removals"), data=data)
40
+
41
+ def get_space_permission_transition_task(self, task_id):
42
+ return self.get(self._v2(f"space-permissions/transition/tasks/{task_id}"))
43
+
44
+ def get_space_roles(
45
+ self,
46
+ space_id=None,
47
+ role_type=None,
48
+ principal_id=None,
49
+ principal_type=None,
50
+ cursor=None,
51
+ limit=None,
52
+ ):
53
+ return self.get(
54
+ self._v2("space-roles"),
55
+ params=self._query(
56
+ **{
57
+ "space-id": space_id,
58
+ "role-type": role_type,
59
+ "principal-id": principal_id,
60
+ "principal-type": principal_type,
61
+ "cursor": cursor,
62
+ "limit": limit,
63
+ }
64
+ ),
65
+ )
66
+
67
+ def create_space_role(self, data=None):
68
+ return self.post(self._v2("space-roles"), data=data)
69
+
70
+ def get_space_role(self, role_id):
71
+ return self.get(self._v2(f"space-roles/{role_id}"))
72
+
73
+ def update_space_role(self, role_id, data=None):
74
+ return self.put(self._v2(f"space-roles/{role_id}"), data=data)
75
+
76
+ def delete_space_role(self, role_id):
77
+ return self.delete(self._v2(f"space-roles/{role_id}"))
78
+
79
+ def get_space_role_mode(self):
80
+ return self.get(self._v2("space-role-mode"))
81
+
82
+ def bulk_get_users(self, data=None):
83
+ return self.post(self._v2("users-bulk"), data=data)
84
+
85
+ def check_user_access_by_email(self, data=None):
86
+ return self.post(self._v2("user/access/check-access-by-email"), data=data)
87
+
88
+ def invite_user_by_email(self, data=None):
89
+ return self.post(self._v2("user/access/invite-by-email"), data=data)
90
+
91
+ def get_data_policy_metadata(self):
92
+ return self.get(self._v2("data-policies/metadata"))
93
+
94
+ def get_data_policy_spaces(self, **filters):
95
+ return self.get(self._v2("data-policies/spaces"), params=self._query(**filters))
96
+
97
+ def get_global_footer_comments(self, **params):
98
+ return self.get(self._v2("footer-comments"), params=self._query(**params))
99
+
100
+ def create_global_footer_comment(self, data=None):
101
+ return self.post(self._v2("footer-comments"), data=data)
102
+
103
+ def get_global_inline_comments(self, **params):
104
+ return self.get(self._v2("inline-comments"), params=self._query(**params))
105
+
106
+ def create_global_inline_comment(self, data=None):
107
+ return self.post(self._v2("inline-comments"), data=data)
108
+
109
+ def get_comment_children_v2(self, comment_id, comment_type="footer-comments", **params):
110
+ return self.get(self._v2(f"{comment_type}/{comment_id}/children"), params=self._query(**params))
111
+
112
+ def get_comment_likes_count_v2(self, comment_id, comment_type="footer-comments"):
113
+ return self.get(self._v2(f"{comment_type}/{comment_id}/likes/count"))
114
+
115
+ def get_comment_likes_users_v2(self, comment_id, comment_type="footer-comments", **params):
116
+ return self.get(self._v2(f"{comment_type}/{comment_id}/likes/users"), params=self._query(**params))
117
+
118
+ def get_comment_operations_v2(self, comment_id, comment_type="footer-comments"):
119
+ return self.get(self._v2(f"{comment_type}/{comment_id}/operations"))
120
+
121
+ def get_comment_versions_v2(self, comment_id, comment_type="footer-comments", **params):
122
+ return self.get(self._v2(f"{comment_type}/{comment_id}/versions"), params=self._query(**params))
123
+
124
+ def get_comment_version_v2(self, comment_id, version_number, comment_type="footer-comments"):
125
+ return self.get(self._v2(f"{comment_type}/{comment_id}/versions/{version_number}"))
@@ -18,6 +18,7 @@ from .folders import FolderOperations
18
18
  from .graphql import GraphQLOperations
19
19
  from .tasks import TaskOperations
20
20
  from .whiteboards import WhiteboardOperations
21
+ from .admin_management import AdminManagementOperations
21
22
 
22
23
  log = logging.getLogger(__name__)
23
24
 
@@ -30,6 +31,7 @@ class ConfluenceCloud(
30
31
  TaskOperations,
31
32
  FolderOperations,
32
33
  DatabaseOperations,
34
+ AdminManagementOperations,
33
35
  ):
34
36
  """
35
37
  Confluence Cloud API implementation class
@@ -157,11 +159,7 @@ class ConfluenceCloud(
157
159
  if expand:
158
160
  params["expand"] = ",".join(expand)
159
161
 
160
- try:
161
- return self.get(endpoint, params=params)
162
- except Exception as e:
163
- log.error(f"Failed to retrieve page with ID {page_id}: {e}")
164
- raise
162
+ return self.get(endpoint, params=params)
165
163
 
166
164
  def get_pages(
167
165
  self,
@@ -444,11 +442,7 @@ class ConfluenceCloud(
444
442
  if parent_id:
445
443
  data["parentId"] = parent_id
446
444
 
447
- try:
448
- return self.post(endpoint, data=data)
449
- except Exception as e:
450
- log.error(f"Failed to create page: {e}")
451
- raise
445
+ return self.post(endpoint, data=data)
452
446
 
453
447
  def update_page(
454
448
  self,
@@ -503,12 +497,8 @@ class ConfluenceCloud(
503
497
 
504
498
  # First, get the current page to get its version
505
499
  if version is None:
506
- try:
507
- current_page = self.get_page_by_id(page_id, get_body=False)
508
- version = current_page.get("version", {}).get("number", 1)
509
- except Exception as e:
510
- log.error(f"Failed to retrieve page for update: {e}")
511
- raise
500
+ current_page = self.get_page_by_id(page_id, get_body=False)
501
+ version = current_page.get("version", {}).get("number", 1)
512
502
 
513
503
  # Prepare update data
514
504
  data = {
@@ -528,11 +518,7 @@ class ConfluenceCloud(
528
518
  if representation:
529
519
  data["body"][body_format]["representation"] = representation
530
520
 
531
- try:
532
- return self.put(endpoint, data=data)
533
- except Exception as e:
534
- log.error(f"Failed to update page: {e}")
535
- raise
521
+ return self.put(endpoint, data=data)
536
522
 
537
523
  def delete_page(self, page_id: str) -> bool:
538
524
  """
@@ -42,6 +42,25 @@ class Server(ConfluenceServerBase):
42
42
  Confluence Server REST API wrapper
43
43
  """
44
44
 
45
+ _api_resources = frozenset(
46
+ {
47
+ "accessmode",
48
+ "admin",
49
+ "audit",
50
+ "content",
51
+ "contentbody",
52
+ "group",
53
+ "health",
54
+ "longtask",
55
+ "metadata",
56
+ "reindex",
57
+ "search",
58
+ "space",
59
+ "template",
60
+ "user",
61
+ }
62
+ )
63
+
45
64
  content_types = {
46
65
  ".gif": "image/gif",
47
66
  ".png": "image/png",
@@ -54,6 +73,7 @@ class Server(ConfluenceServerBase):
54
73
  }
55
74
 
56
75
  def __init__(self, url, *args, **kwargs):
76
+ api_version_is_explicit = "api_version" in kwargs
57
77
  # Set default values only if not provided
58
78
  if "cloud" not in kwargs:
59
79
  kwargs["cloud"] = False
@@ -61,8 +81,56 @@ class Server(ConfluenceServerBase):
61
81
  kwargs["api_version"] = "1.0"
62
82
  if "api_root" not in kwargs:
63
83
  kwargs["api_root"] = "rest/api"
64
- url = url.strip("/") + f"/{kwargs['api_root']}/{kwargs['api_version']}"
65
- super(Server, self).__init__(url, *args, **kwargs)
84
+ super(Server, self).__init__(url.rstrip("/"), *args, **kwargs)
85
+ self._api_version_is_explicit = api_version_is_explicit
86
+
87
+ def _server_api_path(self, path):
88
+ """Prefix unrooted Server REST resources without changing legacy paths."""
89
+ if not isinstance(path, str):
90
+ return path
91
+
92
+ normalized_path = path.lstrip("/")
93
+ resource = normalized_path.split("/", 1)[0].split("?", 1)[0]
94
+ if resource not in self._api_resources:
95
+ return path
96
+
97
+ api_parts = [self.api_root]
98
+ if self._api_version_is_explicit:
99
+ api_parts.append(self.api_version)
100
+ api_parts.append(normalized_path)
101
+ return "/".join(str(part).strip("/") for part in api_parts if part is not None and str(part).strip("/"))
102
+
103
+ def request(
104
+ self,
105
+ method="GET",
106
+ path="/",
107
+ data=None,
108
+ json=None,
109
+ flags=None,
110
+ params=None,
111
+ headers=None,
112
+ files=None,
113
+ trailing=None,
114
+ absolute=False,
115
+ advanced_mode=False,
116
+ allow_redirects=True,
117
+ ):
118
+ if not absolute:
119
+ path = self._server_api_path(path)
120
+ return super(Server, self).request(
121
+ method=method,
122
+ path=path,
123
+ data=data,
124
+ json=json,
125
+ flags=flags,
126
+ params=params,
127
+ headers=headers,
128
+ files=files,
129
+ trailing=trailing,
130
+ absolute=absolute,
131
+ advanced_mode=advanced_mode,
132
+ allow_redirects=allow_redirects,
133
+ )
66
134
 
67
135
  @staticmethod
68
136
  def _create_body(body, representation):
@@ -4,7 +4,7 @@ Confluence base module for shared functionality between API versions
4
4
 
5
5
  import logging
6
6
  from typing import Dict, List, Optional, Union
7
- from urllib.parse import urlparse
7
+ from urllib.parse import parse_qsl, urlparse
8
8
 
9
9
  from atlassian.rest_client import AtlassianRestAPI
10
10
 
@@ -259,21 +259,32 @@ class ConfluenceBase(AtlassianRestAPI):
259
259
  if not next_url:
260
260
  break
261
261
 
262
- # Use the next URL directly
263
- # Check if the response has a base URL provided (common in Confluence v2 API)
264
- base_url = response.get("_links", {}).get("base")
265
- if base_url and next_url.startswith("/"):
266
- # Construct the full URL using the base URL from the response
267
- url = f"{base_url}{next_url}"
262
+ if isinstance(next_url, dict):
263
+ next_url = next_url.get("href")
264
+ if not next_url:
265
+ break
266
+
267
+ # Cursor links are commonly relative and include the endpoint
268
+ # path (for example ``/wiki/api/v2/spaces?cursor=...``). The
269
+ # endpoint used for the first request is already resolved
270
+ # against the tenant or API-gateway context, so rebuilding it
271
+ # from ``_links.base`` can duplicate ``/wiki`` or drop an
272
+ # ``/ex/confluence/{cloud_id}`` prefix. Keep the resolved
273
+ # endpoint and advance only its query parameters.
274
+ parsed_next = urlparse(next_url)
275
+ if parsed_next.scheme:
276
+ url = next_url
268
277
  absolute = True
278
+ params = {}
279
+ elif parsed_next.query:
280
+ params = dict(parse_qsl(parsed_next.query, keep_blank_values=True))
269
281
  else:
282
+ # A relative link without a query is unusual for cursor
283
+ # pagination; retain the previous behavior as a safe
284
+ # fallback for such responses.
270
285
  url = next_url
271
- # Check if the URL is absolute (has http:// or https://) or contains the server's domain
272
- if next_url.startswith(("http://", "https://")) or self.url.split("/")[2] in next_url:
273
- absolute = True
274
- else:
275
- absolute = False
276
- params = {}
286
+ absolute = False
287
+ params = {}
277
288
  trailing = False
278
289
 
279
290
  return
@@ -94,6 +94,61 @@ class JiraCloud(JiraCloudCoreMethods, AtlassianRestAPI):
94
94
  break
95
95
  return results
96
96
 
97
+ def get_project_workflow_scheme_associations(self, project_ids):
98
+ """Return workflow-scheme associations for one or more project IDs.
99
+
100
+ Team-managed and non-existent projects are omitted by Jira Cloud. The
101
+ caller requires the Administer Jira global permission.
102
+
103
+ :param project_ids: Project ID or iterable of project IDs.
104
+ :return: Jira's workflow-scheme association container.
105
+ """
106
+ if isinstance(project_ids, (str, int)):
107
+ project_ids = [project_ids]
108
+ else:
109
+ project_ids = list(project_ids)
110
+ if not project_ids:
111
+ raise ValueError("project_ids must contain at least one project ID")
112
+ return self.get(self.endpoint("workflowscheme/project", api_version=3), params={"projectId": project_ids})
113
+
114
+ def assign_project_workflow_scheme(self, project_id, workflow_scheme_id):
115
+ """Assign a workflow scheme to a classic Jira Cloud project.
116
+
117
+ Jira only permits this operation when the project has no issues. The
118
+ caller requires the Administer Jira global permission.
119
+
120
+ :param project_id: Numeric Jira project ID.
121
+ :param workflow_scheme_id: Workflow scheme ID.
122
+ :return: Jira response (normally ``None`` for HTTP 204).
123
+ """
124
+ data = {"projectId": str(project_id), "workflowSchemeId": str(workflow_scheme_id)}
125
+ return self.put(self.endpoint("workflowscheme/project", api_version=3), data=data)
126
+
127
+ def add_version(
128
+ self,
129
+ project_id,
130
+ version,
131
+ project_key: Optional[str] = None,
132
+ is_archived: bool = False,
133
+ is_released: bool = False,
134
+ ):
135
+ """Create a Jira Cloud project version through REST v3.
136
+
137
+ ``version`` can be a name or a complete payload dictionary. Cloud's
138
+ create-version API identifies the project with its numeric ID.
139
+ """
140
+ if isinstance(version, dict):
141
+ data = dict(version)
142
+ else:
143
+ data = {"name": version, "archived": is_archived, "released": is_released}
144
+ try:
145
+ data["projectId"] = int(data.get("projectId", project_id))
146
+ except (TypeError, ValueError) as error:
147
+ raise ValueError("project_id must be a numeric Jira Cloud project ID") from error
148
+ if project_key is not None:
149
+ data.setdefault("project", project_key)
150
+ return self.post(self.endpoint("version", api_version=3), data=data)
151
+
97
152
 
98
153
  class JiraSoftware(JiraSoftwareMethods, AtlassianRestAPI):
99
154
  """Jira Software Cloud REST APIs.
@@ -154,6 +209,34 @@ class JiraServiceManagement(JiraServiceManagementMethods, AtlassianRestAPI):
154
209
  """Return a JSM public REST endpoint path without issuing a request."""
155
210
  return self.url_joiner("rest/servicedeskapi", resource)
156
211
 
212
+ def get_sla_metrics(self, service_desk_id, start=None, limit=None):
213
+ """Return SLA metric configuration from Jira's agent endpoint.
214
+
215
+ This is an internal endpoint used by the JSM settings UI and may not
216
+ be available on every Cloud or Data Center release.
217
+ """
218
+ params = {key: value for key, value in {"start": start, "limit": limit}.items() if value is not None}
219
+ return self.get(
220
+ f"rest/servicedesk/1/servicedesk/agent/{service_desk_id}/sla/metrics",
221
+ params=params or None,
222
+ )
223
+
224
+ def update_sla_metric(self, service_desk_id, sla_id, data):
225
+ """Update an SLA metric configuration for a service desk.
226
+
227
+ Jira exposes this through an internal agent endpoint used by the JSM
228
+ settings UI. The payload is passed through unchanged to support the
229
+ metric schema used by the target Jira release.
230
+ """
231
+ return self.put(
232
+ f"rest/servicedesk/1/servicedesk/agent/{service_desk_id}/sla/metrics/{sla_id}",
233
+ data=data,
234
+ )
235
+
236
+ def set_sla_metric(self, service_desk_id, sla_id, data):
237
+ """Backward-compatible alias for :meth:`update_sla_metric`."""
238
+ return self.update_sla_metric(service_desk_id, sla_id, data)
239
+
157
240
 
158
241
  def create_jira_cloud(url: str, *args: Any, api_version: Union[str, int] = 3, **kwargs: Any) -> JiraCloud:
159
242
  """Create a versioned Jira Cloud Core client (v3 by default)."""