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
@@ -0,0 +1,160 @@
1
+ # coding=utf-8
2
+ """Versioned Jira Cloud clients.
3
+
4
+ These clients are deliberately additive. ``Jira`` and ``ServiceDesk`` remain
5
+ the compatibility clients for Server, Data Center, and existing Cloud users.
6
+ """
7
+
8
+ from typing import Any, Dict, List, Optional, Union
9
+
10
+ from ..rest_client import AtlassianRestAPI
11
+ from .core_methods import JiraCloudCoreMethods
12
+ from .service_management_methods import JiraServiceManagementMethods
13
+ from .software_methods import JiraSoftwareMethods
14
+
15
+
16
+ class JiraCloud(JiraCloudCoreMethods, AtlassianRestAPI):
17
+ """Jira Cloud platform (Core) REST API client for version 2 or 3.
18
+
19
+ Use ``api_version=3`` for new integrations; version 2 is retained for
20
+ payload compatibility. The legacy ``Jira`` methods remain in
21
+ :class:`JiraServer` and are intentionally not mixed into this client.
22
+ """
23
+
24
+ SUPPORTED_API_VERSIONS = (2, 3)
25
+
26
+ def __init__(self, url: str, *args: Any, api_version: Union[str, int] = 3, **kwargs: Any):
27
+ api_version = int(api_version)
28
+ if api_version not in self.SUPPORTED_API_VERSIONS:
29
+ raise ValueError("Jira Cloud Core api_version must be 2 or 3")
30
+ kwargs["api_version"] = api_version
31
+ kwargs["cloud"] = True
32
+ super(JiraCloud, self).__init__(url, *args, **kwargs)
33
+
34
+ def endpoint(self, resource: str, api_version: Optional[Union[str, int]] = None) -> str:
35
+ """Return a Core REST endpoint path without issuing a request."""
36
+ version = self.api_version if api_version is None else int(api_version)
37
+ if version not in self.SUPPORTED_API_VERSIONS:
38
+ raise ValueError("Jira Cloud Core api_version must be 2 or 3")
39
+ return self.resource_url(resource, api_root="rest/api", api_version=version)
40
+
41
+ def enhanced_jql(
42
+ self,
43
+ jql: str,
44
+ fields: Union[str, List[str]] = "*all",
45
+ nextPageToken: Optional[str] = None,
46
+ limit: Optional[int] = None,
47
+ expand: Optional[str] = None,
48
+ ):
49
+ """Search Jira Cloud issues through the v3 enhanced JQL endpoint.
50
+
51
+ Use ``nextPageToken`` from a previous response to retrieve the next
52
+ page. Unlike the older search API, enhanced JQL is cursor-paginated.
53
+ """
54
+ params: Dict[str, Union[str, int]] = {"jql": jql}
55
+ if nextPageToken is not None:
56
+ params["nextPageToken"] = str(nextPageToken)
57
+ if limit is not None:
58
+ params["maxResults"] = int(limit)
59
+ if fields is not None:
60
+ params["fields"] = ",".join(fields) if isinstance(fields, (list, tuple, set)) else fields
61
+ if expand is not None:
62
+ params["expand"] = expand
63
+ return self.get(self.endpoint("search/jql", api_version=3), params=params)
64
+
65
+ def enhanced_jql_get_list_of_tickets(
66
+ self,
67
+ jql: str,
68
+ fields: Union[str, List[str]] = "*all",
69
+ limit: Optional[int] = None,
70
+ expand: Optional[str] = None,
71
+ ) -> list:
72
+ """Return all cursor-paginated enhanced JQL issues up to ``limit``.
73
+
74
+ When ``limit`` is omitted, iteration continues until Jira marks the
75
+ result set as final.
76
+ """
77
+ results = []
78
+ next_page_token = None
79
+ while True:
80
+ response = self.enhanced_jql(
81
+ jql,
82
+ fields=fields,
83
+ nextPageToken=next_page_token,
84
+ limit=limit,
85
+ expand=expand,
86
+ )
87
+ if not response:
88
+ break
89
+ results.extend(response.get("issues", []))
90
+ if limit is not None and len(results) >= limit:
91
+ return results[:limit]
92
+ next_page_token = response.get("nextPageToken")
93
+ if response.get("isLast", False) or not next_page_token:
94
+ break
95
+ return results
96
+
97
+
98
+ class JiraSoftware(JiraSoftwareMethods, AtlassianRestAPI):
99
+ """Jira Software Cloud REST APIs.
100
+
101
+ ``endpoint`` covers documented Agile, Software, DevInfo, deployments,
102
+ builds, feature-flags, remote-links, security, operations, and DevOps
103
+ component roots. Call ``get``, ``post``, ``put``, or ``delete`` with its
104
+ returned path.
105
+ """
106
+
107
+ API_VERSIONS = {
108
+ "agile": "1.0",
109
+ "software": "1.0",
110
+ "devinfo": "0.10",
111
+ "featureflags": "0.1",
112
+ "deployments": "0.1",
113
+ "builds": "0.1",
114
+ "remotelinks": "1.0",
115
+ "security": "1.0",
116
+ "operations": "1.0",
117
+ "devopscomponents": "1.0",
118
+ }
119
+
120
+ def __init__(self, url: str, *args: Any, **kwargs: Any):
121
+ # These APIs do not share one root/version, so endpoint() supplies it.
122
+ kwargs["cloud"] = True
123
+ kwargs.setdefault("api_root", "rest")
124
+ kwargs.setdefault("api_version", None)
125
+ super(JiraSoftware, self).__init__(url, *args, **kwargs)
126
+
127
+ def endpoint(self, api: str, resource: str = "", api_version: Optional[str] = None) -> str:
128
+ """Build a Jira Software Cloud endpoint path.
129
+
130
+ ``api`` is one of :attr:`API_VERSIONS`; ``resource`` is the documented
131
+ portion following its version (for example ``"board/42/sprint"``).
132
+ """
133
+ if api not in self.API_VERSIONS:
134
+ supported = ", ".join(sorted(self.API_VERSIONS))
135
+ raise ValueError(f"Unsupported Jira Software API '{api}'. Use one of: {supported}")
136
+ version = api_version or self.API_VERSIONS[api]
137
+ return self.resource_url(resource, api_root=f"rest/{api}", api_version=version)
138
+
139
+
140
+ class JiraServiceManagement(JiraServiceManagementMethods, AtlassianRestAPI):
141
+ """Jira Service Management Cloud public REST API client.
142
+
143
+ This client is independent from the legacy ``ServiceDesk`` surface, which
144
+ remains available unchanged for existing integrations.
145
+ """
146
+
147
+ API_VERSION = "1"
148
+
149
+ def __init__(self, url: str, *args: Any, **kwargs: Any):
150
+ kwargs["cloud"] = True
151
+ super(JiraServiceManagement, self).__init__(url, *args, **kwargs)
152
+
153
+ def endpoint(self, resource: str = "") -> str:
154
+ """Return a JSM public REST endpoint path without issuing a request."""
155
+ return self.url_joiner("rest/servicedeskapi", resource)
156
+
157
+
158
+ def create_jira_cloud(url: str, *args: Any, api_version: Union[str, int] = 3, **kwargs: Any) -> JiraCloud:
159
+ """Create a versioned Jira Cloud Core client (v3 by default)."""
160
+ return JiraCloud(url, *args, api_version=api_version, **kwargs)