atlassian-python-api 5.0.0__py3-none-any.whl → 5.0.2__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 (44) hide show
  1. atlassian/VERSION +1 -1
  2. atlassian/__init__.py +13 -2
  3. atlassian/assets.py +10 -3
  4. atlassian/bamboo.py +197 -4
  5. atlassian/bitbucket/__init__.py +87 -1
  6. atlassian/bitbucket/base.py +11 -14
  7. atlassian/bitbucket/cloud/repositories/__init__.py +33 -0
  8. atlassian/bitbucket/cloud/workspaces/__init__.py +15 -7
  9. atlassian/bitbucket/server/__init__.py +11 -0
  10. atlassian/cloud_admin.py +418 -0
  11. atlassian/confluence/__init__.py +13 -1
  12. atlassian/confluence/base.py +80 -14
  13. atlassian/confluence/cloud/__init__.py +233 -11
  14. atlassian/confluence/cloud/classification_levels.py +77 -0
  15. atlassian/confluence/cloud/cloud.py +79 -186
  16. atlassian/confluence/cloud/content_properties.py +71 -0
  17. atlassian/confluence/cloud/databases.py +59 -0
  18. atlassian/confluence/cloud/folders.py +48 -0
  19. atlassian/confluence/cloud/graphql.py +99 -0
  20. atlassian/confluence/cloud/tasks.py +86 -0
  21. atlassian/confluence/cloud/whiteboards.py +95 -0
  22. atlassian/confluence/server/__init__.py +603 -194
  23. atlassian/confluence_base.py +28 -3
  24. atlassian/crowd.py +78 -0
  25. atlassian/jira/__init__.py +21 -0
  26. atlassian/jira/core_methods.py +11698 -0
  27. atlassian/jira/jira_cloud.py +160 -0
  28. atlassian/{jira.py → jira/jira_server.py} +336 -8
  29. atlassian/jira/service_management_methods.py +1381 -0
  30. atlassian/jira/software_methods.py +2114 -0
  31. atlassian/rest_client.py +67 -8
  32. atlassian/service_desk.py +10 -3
  33. atlassian/yogi/__init__.py +17 -0
  34. atlassian/yogi/base.py +11 -0
  35. atlassian/yogi/cloud.py +2367 -0
  36. atlassian/yogi/yogi_confluence_cloud.py +10 -0
  37. atlassian/yogi/yogi_confluence_dc.py +94 -0
  38. atlassian/yogi/yogi_jira_cloud.py +10 -0
  39. atlassian/yogi/yogi_jira_dc.py +64 -0
  40. {atlassian_python_api-5.0.0.dist-info → atlassian_python_api-5.0.2.dist-info}/METADATA +80 -10
  41. {atlassian_python_api-5.0.0.dist-info → atlassian_python_api-5.0.2.dist-info}/RECORD +44 -25
  42. {atlassian_python_api-5.0.0.dist-info → atlassian_python_api-5.0.2.dist-info}/WHEEL +0 -0
  43. {atlassian_python_api-5.0.0.dist-info → atlassian_python_api-5.0.2.dist-info}/licenses/LICENSE +0 -0
  44. {atlassian_python_api-5.0.0.dist-info → atlassian_python_api-5.0.2.dist-info}/top_level.txt +0 -0
@@ -36,6 +36,8 @@ class ConfluenceEndpoints:
36
36
  "page_by_id": "api/v2/pages/{id}",
37
37
  "page": "api/v2/pages",
38
38
  "child_pages": "api/v2/pages/{id}/children/page",
39
+ "page_versions": "api/v2/pages/{id}/versions",
40
+ "page_version": "api/v2/pages/{id}/versions/{version_number}",
39
41
  "search": "api/v2/search",
40
42
  "spaces": "api/v2/spaces",
41
43
  "space_by_id": "api/v2/spaces/{id}",
@@ -58,6 +60,15 @@ class ConfluenceEndpoints:
58
60
  "whiteboard_by_id": "api/v2/whiteboards/{id}",
59
61
  "whiteboard_children": "api/v2/whiteboards/{id}/children",
60
62
  "whiteboard_ancestors": "api/v2/whiteboards/{id}/ancestors",
63
+ # Folder endpoints
64
+ "folder": "api/v2/folders",
65
+ "folder_by_id": "api/v2/folders/{id}",
66
+ # Task endpoints
67
+ "tasks": "api/v2/tasks",
68
+ "task_by_id": "api/v2/tasks/{id}",
69
+ # Database endpoints
70
+ "database": "api/v2/databases",
71
+ "database_by_id": "api/v2/databases/{id}",
61
72
  # Custom content endpoints
62
73
  "custom_content": "api/v2/custom-content",
63
74
  "custom_content_by_id": "api/v2/custom-content/{id}",
@@ -91,9 +102,21 @@ class ConfluenceBase(AtlassianRestAPI):
91
102
  if not parsed.hostname:
92
103
  return False
93
104
 
94
- # Check if the hostname ends with .atlassian.net or .jira.com
105
+ # Check Cloud tenant and API-gateway hostnames.
95
106
  hostname = parsed.hostname.lower()
96
- return hostname.endswith(".atlassian.net") or hostname.endswith(".jira.com")
107
+ return (
108
+ hostname.endswith(".atlassian.net")
109
+ or hostname.endswith(".jira.com")
110
+ or ConfluenceBase._is_api_gateway_url(url)
111
+ )
112
+
113
+ @staticmethod
114
+ def _is_api_gateway_url(url: str) -> bool:
115
+ """Return whether *url* is an Atlassian API gateway Confluence URL."""
116
+ parsed = urlparse(url)
117
+ if parsed.scheme not in {"http", "https"} or parsed.hostname != "api.atlassian.com":
118
+ return False
119
+ return parsed.path.startswith("/ex/confluence/")
97
120
 
98
121
  def __init__(self, url: str, *args, api_version: Union[str, int] = 1, **kwargs):
99
122
  """
@@ -105,7 +128,9 @@ class ConfluenceBase(AtlassianRestAPI):
105
128
  args: Arguments to pass to AtlassianRestAPI constructor
106
129
  kwargs: Keyword arguments to pass to AtlassianRestAPI constructor
107
130
  """
108
- if self._is_cloud_url(url) and "/wiki" not in url:
131
+ # Tenant URLs need the Confluence context path. Gateway URLs already
132
+ # contain ``/ex/confluence/{cloudId}`` and must not be rewritten.
133
+ if self._is_cloud_url(url) and not self._is_api_gateway_url(url) and "/wiki" not in url:
109
134
  url = AtlassianRestAPI.url_joiner(url, "/wiki")
110
135
  if "cloud" not in kwargs:
111
136
  kwargs["cloud"] = True
atlassian/crowd.py CHANGED
@@ -180,6 +180,84 @@ class Crowd(AtlassianRestAPI):
180
180
  json=data,
181
181
  )
182
182
 
183
+ def group_remove_user(self, username, groupname):
184
+ """Remove a direct user-to-group membership."""
185
+ return self.delete(
186
+ self._crowd_api_url("usermanagement", "user/group/direct"),
187
+ params={"username": username, "groupname": groupname},
188
+ )
189
+
190
+ def user_update(self, username, data):
191
+ """Update a user with a Crowd user representation."""
192
+ return self.put(self._crowd_api_url("usermanagement", "user"), params={"username": username}, data=data)
193
+
194
+ def user_update_password(self, username, password):
195
+ """Update a user's password."""
196
+ return self.put(
197
+ self._crowd_api_url("usermanagement", "user/password"),
198
+ params={"username": username},
199
+ data={"value": password},
200
+ )
201
+
202
+ def user_attributes(self, username):
203
+ """Return all attributes for a user."""
204
+ return self.get(self._crowd_api_url("usermanagement", "user/attribute"), params={"username": username})
205
+
206
+ def user_store_attributes(self, username, attributes):
207
+ """Store user attributes using Crowd's attribute request body."""
208
+ return self.put(
209
+ self._crowd_api_url("usermanagement", "user/attribute"), params={"username": username}, data=attributes
210
+ )
211
+
212
+ def user_remove_attribute(self, username, attribute_name):
213
+ """Delete one user attribute."""
214
+ return self.delete(
215
+ self._crowd_api_url("usermanagement", "user/attribute"),
216
+ params={"username": username, "attributename": attribute_name},
217
+ )
218
+
219
+ def group(self, groupname):
220
+ """Return a group by name."""
221
+ return self.get(self._crowd_api_url("usermanagement", "group"), params={"groupname": groupname})
222
+
223
+ def group_update(self, groupname, data):
224
+ """Update a group with a Crowd group representation."""
225
+ return self.put(self._crowd_api_url("usermanagement", "group"), params={"groupname": groupname}, data=data)
226
+
227
+ def group_delete(self, groupname):
228
+ """Delete a group by name."""
229
+ return self.delete(self._crowd_api_url("usermanagement", "group"), params={"groupname": groupname})
230
+
231
+ def group_attributes(self, groupname):
232
+ """Return all attributes for a group."""
233
+ return self.get(self._crowd_api_url("usermanagement", "group/attribute"), params={"groupname": groupname})
234
+
235
+ def group_store_attributes(self, groupname, attributes):
236
+ """Store group attributes using Crowd's attribute request body."""
237
+ return self.put(
238
+ self._crowd_api_url("usermanagement", "group/attribute"), params={"groupname": groupname}, data=attributes
239
+ )
240
+
241
+ def group_remove_attribute(self, groupname, attribute_name):
242
+ """Delete one group attribute."""
243
+ return self.delete(
244
+ self._crowd_api_url("usermanagement", "group/attribute"),
245
+ params={"groupname": groupname, "attributename": attribute_name},
246
+ )
247
+
248
+ def nested_group_members(self, groupname, max_results=99999):
249
+ """Return users who are direct or nested members of a group."""
250
+ response = self.get(
251
+ self._crowd_api_url("usermanagement", "group/user/nested"),
252
+ params={"groupname": groupname, "max-results": max_results},
253
+ )
254
+ return search("users[*].name", response)
255
+
256
+ def nested_user_groups(self, username):
257
+ """Return direct and nested groups for a user."""
258
+ response = self.get(self._crowd_api_url("usermanagement", "user/group/nested"), params={"username": username})
259
+ return search("groups[*].name", response)
260
+
183
261
  def health_check(self):
184
262
  """
185
263
  Get health status
@@ -0,0 +1,21 @@
1
+ # coding=utf-8
2
+ """Jira API clients split by deployment target.
3
+
4
+ ``Jira`` remains the legacy-compatible Server/Data Center client. Use
5
+ ``JiraCloud`` for Jira Cloud Core REST v2/v3.
6
+ """
7
+
8
+ from .jira_cloud import JiraCloud, JiraServiceManagement, JiraSoftware, create_jira_cloud
9
+ from .jira_server import Jira as JiraServer
10
+
11
+ # Preserve ``from atlassian.jira import Jira`` and ``from atlassian import Jira``.
12
+ Jira = JiraServer
13
+
14
+ __all__ = [
15
+ "Jira",
16
+ "JiraServer",
17
+ "JiraCloud",
18
+ "JiraSoftware",
19
+ "JiraServiceManagement",
20
+ "create_jira_cloud",
21
+ ]