atlassian-python-api 4.0.3__py3-none-any.whl → 4.0.4__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.
- atlassian/VERSION +1 -1
- atlassian/__init__.py +7 -1
- atlassian/assets.py +626 -0
- atlassian/bamboo.py +1 -0
- atlassian/bitbucket/__init__.py +0 -1
- atlassian/bitbucket/base.py +1 -1
- atlassian/bitbucket/cloud/__init__.py +5 -1
- atlassian/bitbucket/cloud/base.py +2 -2
- atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py +1 -1
- atlassian/cloud_admin.py +85 -0
- atlassian/confluence.py +58 -11
- atlassian/jira.py +77 -30
- atlassian/request_utils.py +3 -28
- atlassian/rest_client.py +8 -2
- {atlassian_python_api-4.0.3.dist-info → atlassian_python_api-4.0.4.dist-info}/METADATA +1 -2
- {atlassian_python_api-4.0.3.dist-info → atlassian_python_api-4.0.4.dist-info}/RECORD +19 -18
- {atlassian_python_api-4.0.3.dist-info → atlassian_python_api-4.0.4.dist-info}/WHEEL +1 -1
- {atlassian_python_api-4.0.3.dist-info → atlassian_python_api-4.0.4.dist-info}/licenses/LICENSE +0 -0
- {atlassian_python_api-4.0.3.dist-info → atlassian_python_api-4.0.4.dist-info}/top_level.txt +0 -0
atlassian/cloud_admin.py
CHANGED
|
@@ -16,9 +16,94 @@ class CloudAdminOrgs(AtlassianRestAPI):
|
|
|
16
16
|
super(CloudAdminOrgs, self).__init__(url=ADMIN_URL, *args, **kwargs)
|
|
17
17
|
|
|
18
18
|
def get_organizations(self):
|
|
19
|
+
"""
|
|
20
|
+
Returns a list of your organizations (based on your API key).
|
|
21
|
+
:return:
|
|
22
|
+
"""
|
|
19
23
|
url = self.resource_url("orgs")
|
|
20
24
|
return self.get(url)
|
|
21
25
|
|
|
26
|
+
def get_organization(self, org_id):
|
|
27
|
+
"""
|
|
28
|
+
Returns information about a single organization by ID
|
|
29
|
+
:param org_id:
|
|
30
|
+
:return:
|
|
31
|
+
"""
|
|
32
|
+
url = self.resource_url(f"orgs/{org_id}")
|
|
33
|
+
return self.get(url)
|
|
34
|
+
|
|
35
|
+
def get_managed_accounts_in_organization(self, org_id, cursor=None):
|
|
36
|
+
"""
|
|
37
|
+
Returns a list of accounts managed by the organization
|
|
38
|
+
:param org_id:
|
|
39
|
+
:param cursor:
|
|
40
|
+
:return:
|
|
41
|
+
"""
|
|
42
|
+
url = self.resource_url(f"orgs/{org_id}/users")
|
|
43
|
+
params = {}
|
|
44
|
+
if cursor:
|
|
45
|
+
params["cursor"] = cursor
|
|
46
|
+
return self.get(url, params=params)
|
|
47
|
+
|
|
48
|
+
def search_users_in_organization(
|
|
49
|
+
self,
|
|
50
|
+
org_id,
|
|
51
|
+
account_ids=None,
|
|
52
|
+
account_types=None,
|
|
53
|
+
account_statuses=None,
|
|
54
|
+
name_or_nicknames=None,
|
|
55
|
+
email_usernames=None,
|
|
56
|
+
email_domains=None,
|
|
57
|
+
is_suspended=None,
|
|
58
|
+
cursor=None,
|
|
59
|
+
limit=10000,
|
|
60
|
+
expand=None,
|
|
61
|
+
):
|
|
62
|
+
"""
|
|
63
|
+
Returns a list of accounts in the organization that match the search criteria.
|
|
64
|
+
The API is available for customers using the new user management experience only.
|
|
65
|
+
How the new user management experience works
|
|
66
|
+
Returns a list of users within an organization,
|
|
67
|
+
offering search functionality through multiple parameters for more precise results.
|
|
68
|
+
:param org_id:
|
|
69
|
+
:param account_ids: Unique ID of the users account. The format is [a-zA-Z0-9_|-:]{1,128}
|
|
70
|
+
:param account_types: The type of account Valid values: atlassian, customer, app
|
|
71
|
+
:param account_statuses: The lifecycle status of the account
|
|
72
|
+
:param name_or_nicknames:
|
|
73
|
+
:param email_usernames:
|
|
74
|
+
:param email_domains:
|
|
75
|
+
:param is_suspended: Suspended users with no access. This is independent of the user account status
|
|
76
|
+
:param cursor: Starting point marker for page result retrieval
|
|
77
|
+
:param limit: The number of items to return. Default = max = 10000
|
|
78
|
+
:param expand: Valid values: NAME, EMAIL, EMAIL_VERIFIED, PRODUCT_LAST_ACCESS, GROUPS
|
|
79
|
+
:return:
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
url = self.resource_url(f"orgs/{org_id}/users/search")
|
|
83
|
+
params = {}
|
|
84
|
+
if cursor:
|
|
85
|
+
params["cursor"] = cursor
|
|
86
|
+
if limit:
|
|
87
|
+
params["limit"] = limit
|
|
88
|
+
if account_ids:
|
|
89
|
+
params["accountIds"] = account_ids
|
|
90
|
+
if account_types:
|
|
91
|
+
params["accountTypes"] = account_types
|
|
92
|
+
if account_statuses:
|
|
93
|
+
params["accountStatuses"] = account_statuses
|
|
94
|
+
if name_or_nicknames:
|
|
95
|
+
params["nameOrNicknames"] = name_or_nicknames
|
|
96
|
+
if email_usernames:
|
|
97
|
+
params["emailUsernames"] = email_usernames
|
|
98
|
+
if email_domains:
|
|
99
|
+
params["emailDomains"] = email_domains
|
|
100
|
+
if is_suspended:
|
|
101
|
+
params["isSuspended"] = is_suspended
|
|
102
|
+
if expand:
|
|
103
|
+
params["expand"] = expand
|
|
104
|
+
|
|
105
|
+
return self.get(url, params=params)
|
|
106
|
+
|
|
22
107
|
|
|
23
108
|
class CloudAdminUsers(AtlassianRestAPI):
|
|
24
109
|
def __init__(self, admin_api_key, *args, **kwargs):
|
atlassian/confluence.py
CHANGED
|
@@ -1322,6 +1322,42 @@ class Confluence(AtlassianRestAPI):
|
|
|
1322
1322
|
params["status"] = space_status
|
|
1323
1323
|
return self.get(url, params=params)
|
|
1324
1324
|
|
|
1325
|
+
def archive_space(self, space_key):
|
|
1326
|
+
"""
|
|
1327
|
+
Archive space
|
|
1328
|
+
:param space_key:
|
|
1329
|
+
:return:
|
|
1330
|
+
"""
|
|
1331
|
+
url = f"rest/api/space/{space_key}/archive"
|
|
1332
|
+
return self.put(url)
|
|
1333
|
+
|
|
1334
|
+
def get_trashed_contents_by_space(self, space_key, cursor=None, expand=None, limit=100):
|
|
1335
|
+
"""
|
|
1336
|
+
Get trashed contents by space
|
|
1337
|
+
:param space_key:
|
|
1338
|
+
:param cursor:
|
|
1339
|
+
:param expand:
|
|
1340
|
+
:param limit:
|
|
1341
|
+
:return:
|
|
1342
|
+
"""
|
|
1343
|
+
url = f"rest/api/space/{space_key}/content/trash"
|
|
1344
|
+
params = {"limit": limit}
|
|
1345
|
+
if cursor:
|
|
1346
|
+
params["cursor"] = cursor
|
|
1347
|
+
if expand:
|
|
1348
|
+
params["expand"] = expand
|
|
1349
|
+
return self.get(url, params=params)
|
|
1350
|
+
|
|
1351
|
+
def remove_trashed_contents_by_space(self, space_key):
|
|
1352
|
+
"""
|
|
1353
|
+
Remove all content from the trash in the given space,
|
|
1354
|
+
deleting them permanently.Example request URI:
|
|
1355
|
+
:param space_key:
|
|
1356
|
+
:return:
|
|
1357
|
+
"""
|
|
1358
|
+
url = f"rest/api/space/{space_key}/content/trash"
|
|
1359
|
+
return self.delete(url)
|
|
1360
|
+
|
|
1325
1361
|
def add_comment(self, page_id, text):
|
|
1326
1362
|
"""
|
|
1327
1363
|
Add comment into page
|
|
@@ -1466,16 +1502,15 @@ class Confluence(AtlassianRestAPI):
|
|
|
1466
1502
|
content_type = self.content_types.get(extension, "application/binary")
|
|
1467
1503
|
|
|
1468
1504
|
with open(filename, "rb") as infile:
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
)
|
|
1505
|
+
return self.attach_content(
|
|
1506
|
+
infile,
|
|
1507
|
+
name,
|
|
1508
|
+
content_type,
|
|
1509
|
+
page_id=page_id,
|
|
1510
|
+
title=title,
|
|
1511
|
+
space=space,
|
|
1512
|
+
comment=comment,
|
|
1513
|
+
)
|
|
1479
1514
|
|
|
1480
1515
|
def download_attachments_from_page(self, page_id, path=None, start=0, limit=50, filename=None, to_memory=False):
|
|
1481
1516
|
"""
|
|
@@ -3368,9 +3403,21 @@ class Confluence(AtlassianRestAPI):
|
|
|
3368
3403
|
:param group_name: str - name of group to add user to
|
|
3369
3404
|
:return: Current state of the group
|
|
3370
3405
|
"""
|
|
3371
|
-
url = "rest/api/user
|
|
3406
|
+
url = f"rest/api/user/{username}/group/{group_name}"
|
|
3372
3407
|
return self.put(url)
|
|
3373
3408
|
|
|
3409
|
+
def remove_user_from_group(self, username, group_name):
|
|
3410
|
+
"""
|
|
3411
|
+
Remove the given {@link User} identified by username from the given {@link Group} identified by groupName.
|
|
3412
|
+
This method is idempotent i.e. if the membership is not present then no action will be taken.
|
|
3413
|
+
|
|
3414
|
+
:param username: str - username of user to add to group
|
|
3415
|
+
:param group_name: str - name of group to add user to
|
|
3416
|
+
:return: Current state of the group
|
|
3417
|
+
"""
|
|
3418
|
+
url = f"rest/api/user/{username}/group/{group_name}"
|
|
3419
|
+
return self.delete(url)
|
|
3420
|
+
|
|
3374
3421
|
# Space Permissions
|
|
3375
3422
|
def get_all_space_permissions(self, space_key):
|
|
3376
3423
|
"""
|
atlassian/jira.py
CHANGED
|
@@ -4993,6 +4993,19 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
4993
4993
|
# Resource: https://docs.atlassian.com/jira-software/REST/7.3.1/
|
|
4994
4994
|
#######################################################################
|
|
4995
4995
|
# /rest/agile/1.0/backlog/issue
|
|
4996
|
+
def get_agile_resource_url(self, resource: str, legacy_api: bool = False) -> str:
|
|
4997
|
+
"""
|
|
4998
|
+
Prepare an 'Agile' API-specific URL relying on defaults set for the client.
|
|
4999
|
+
|
|
5000
|
+
:param resource: Name of an endpoint
|
|
5001
|
+
:param legacy_api: If True - use 'greenhopper' as an API type, else - use a newer, 'agile', name.
|
|
5002
|
+
:return: String with a full URL path to resource
|
|
5003
|
+
"""
|
|
5004
|
+
api_version = "1.0"
|
|
5005
|
+
api_type = "greenhopper" if legacy_api else "agile"
|
|
5006
|
+
api_root = self.api_root.replace("rest/api", f"rest/{api_type}")
|
|
5007
|
+
return self.resource_url(resource=resource, api_root=api_root, api_version=api_version)
|
|
5008
|
+
|
|
4996
5009
|
def move_issues_to_backlog(self, issue_keys: list) -> T_resp_json:
|
|
4997
5010
|
"""
|
|
4998
5011
|
Move issues to backlog
|
|
@@ -5012,7 +5025,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5012
5025
|
"""
|
|
5013
5026
|
if not isinstance(issues, list):
|
|
5014
5027
|
raise ValueError("`issues` param should be List of Issue Keys")
|
|
5015
|
-
|
|
5028
|
+
resource = "backlog/issue"
|
|
5029
|
+
url = self.get_agile_resource_url(resource)
|
|
5016
5030
|
data = dict(issues=issues)
|
|
5017
5031
|
return self.post(url, data=data)
|
|
5018
5032
|
|
|
@@ -5021,7 +5035,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5021
5035
|
Gets an agile board by the filter id
|
|
5022
5036
|
:param filter_id: int, str
|
|
5023
5037
|
"""
|
|
5024
|
-
|
|
5038
|
+
resource = f"board/filter/{filter_id}"
|
|
5039
|
+
url = self.get_agile_resource_url(resource)
|
|
5025
5040
|
return self.get(url)
|
|
5026
5041
|
|
|
5027
5042
|
# /rest/agile/1.0/board
|
|
@@ -5033,10 +5048,11 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5033
5048
|
:param filter_id: int
|
|
5034
5049
|
:param location: dict, Optional. Only specify this for Jira Cloud!
|
|
5035
5050
|
"""
|
|
5051
|
+
resource = "board"
|
|
5052
|
+
url = self.get_agile_resource_url(resource)
|
|
5036
5053
|
data: dict = {"name": name, "type": type, "filterId": filter_id}
|
|
5037
5054
|
if location:
|
|
5038
5055
|
data["location"] = location
|
|
5039
|
-
url = "rest/agile/1.0/board"
|
|
5040
5056
|
return self.post(url, data=data)
|
|
5041
5057
|
|
|
5042
5058
|
def get_all_agile_boards(
|
|
@@ -5056,7 +5072,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5056
5072
|
:param limit:
|
|
5057
5073
|
:return:
|
|
5058
5074
|
"""
|
|
5059
|
-
|
|
5075
|
+
resource = "board"
|
|
5076
|
+
url = self.get_agile_resource_url(resource)
|
|
5060
5077
|
params: dict = {}
|
|
5061
5078
|
if board_name:
|
|
5062
5079
|
params["name"] = board_name
|
|
@@ -5077,7 +5094,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5077
5094
|
:param board_id:
|
|
5078
5095
|
:return:
|
|
5079
5096
|
"""
|
|
5080
|
-
|
|
5097
|
+
resource = f"board/{board_id}"
|
|
5098
|
+
url = self.get_agile_resource_url(resource)
|
|
5081
5099
|
return self.delete(url)
|
|
5082
5100
|
|
|
5083
5101
|
def get_agile_board(self, board_id: T_id) -> T_resp_json:
|
|
@@ -5086,7 +5104,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5086
5104
|
:param board_id:
|
|
5087
5105
|
:return:
|
|
5088
5106
|
"""
|
|
5089
|
-
|
|
5107
|
+
resource = f"board/{board_id}"
|
|
5108
|
+
url = self.get_agile_resource_url(resource)
|
|
5090
5109
|
return self.get(url)
|
|
5091
5110
|
|
|
5092
5111
|
def get_issues_for_backlog(self, board_id: T_id) -> T_resp_json:
|
|
@@ -5099,7 +5118,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5099
5118
|
By default, the returned issues are ordered by rank.
|
|
5100
5119
|
:param board_id: int, str
|
|
5101
5120
|
"""
|
|
5102
|
-
|
|
5121
|
+
resource = f"board/{board_id}/backlog"
|
|
5122
|
+
url = self.get_agile_resource_url(resource)
|
|
5103
5123
|
return self.get(url)
|
|
5104
5124
|
|
|
5105
5125
|
def get_agile_board_configuration(self, board_id: T_id) -> T_resp_json:
|
|
@@ -5126,7 +5146,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5126
5146
|
:param board_id:
|
|
5127
5147
|
:return:
|
|
5128
5148
|
"""
|
|
5129
|
-
|
|
5149
|
+
resource = f"board/{board_id}/configuration"
|
|
5150
|
+
url = self.get_agile_resource_url(resource)
|
|
5130
5151
|
return self.get(url)
|
|
5131
5152
|
|
|
5132
5153
|
def get_issues_for_board(
|
|
@@ -5153,6 +5174,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5153
5174
|
:param expand: OPTIONAL: expand the search result
|
|
5154
5175
|
:return:
|
|
5155
5176
|
"""
|
|
5177
|
+
resource = f"board/{board_id}/issue"
|
|
5178
|
+
url = self.get_agile_resource_url(resource)
|
|
5156
5179
|
params: dict = {}
|
|
5157
5180
|
if start is not None:
|
|
5158
5181
|
params["startAt"] = int(start)
|
|
@@ -5167,7 +5190,6 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5167
5190
|
if expand is not None:
|
|
5168
5191
|
params["expand"] = expand
|
|
5169
5192
|
|
|
5170
|
-
url = f"rest/agile/1.0/board/{board_id}/issue"
|
|
5171
5193
|
return self.get(url, params=params)
|
|
5172
5194
|
|
|
5173
5195
|
# /rest/agile/1.0/board/{boardId}/epic
|
|
@@ -5190,7 +5212,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5190
5212
|
See the 'Pagination' section at the top of this page for more details.
|
|
5191
5213
|
:return:
|
|
5192
5214
|
"""
|
|
5193
|
-
|
|
5215
|
+
resource = f"board/{board_id}/epic"
|
|
5216
|
+
url = self.get_agile_resource_url(resource)
|
|
5194
5217
|
params: dict = {}
|
|
5195
5218
|
if done:
|
|
5196
5219
|
params["done"] = done
|
|
@@ -5236,7 +5259,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5236
5259
|
If you exceed this limit, your results will be truncated.
|
|
5237
5260
|
:return:
|
|
5238
5261
|
"""
|
|
5239
|
-
|
|
5262
|
+
resource = f"board/{board_id}/epic/{epic_id}/issue"
|
|
5263
|
+
url = self.get_agile_resource_url(resource)
|
|
5240
5264
|
params: dict = {}
|
|
5241
5265
|
if jql:
|
|
5242
5266
|
params["jql"] = jql
|
|
@@ -5285,7 +5309,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5285
5309
|
If you exceed this limit, your results will be truncated.
|
|
5286
5310
|
:return:
|
|
5287
5311
|
"""
|
|
5288
|
-
|
|
5312
|
+
resource = f"board/{board_id}/epic/none/issue"
|
|
5313
|
+
url = self.get_agile_resource_url(resource)
|
|
5289
5314
|
params: dict = {}
|
|
5290
5315
|
if jql:
|
|
5291
5316
|
params["jql"] = jql
|
|
@@ -5321,7 +5346,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5321
5346
|
See the 'Pagination' section at the top of this page for more details
|
|
5322
5347
|
:return:
|
|
5323
5348
|
"""
|
|
5324
|
-
|
|
5349
|
+
resource = f"board/{board_id}/project"
|
|
5350
|
+
url = self.get_agile_resource_url(resource)
|
|
5325
5351
|
params: dict = {}
|
|
5326
5352
|
if start:
|
|
5327
5353
|
params["startAt"] = start
|
|
@@ -5336,7 +5362,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5336
5362
|
The user who retrieves the property keys is required to have permissions to view the board.
|
|
5337
5363
|
:param board_id: int, str
|
|
5338
5364
|
"""
|
|
5339
|
-
|
|
5365
|
+
resource = f"board/{board_id}/properties"
|
|
5366
|
+
url = self.get_agile_resource_url(resource)
|
|
5340
5367
|
return self.get(url)
|
|
5341
5368
|
|
|
5342
5369
|
def set_agile_board_property(self, board_id: T_id, property_key: str) -> T_resp_json:
|
|
@@ -5349,7 +5376,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5349
5376
|
:param property_key:
|
|
5350
5377
|
:return:
|
|
5351
5378
|
"""
|
|
5352
|
-
|
|
5379
|
+
resource = f"board/{board_id}/properties/{property_key}"
|
|
5380
|
+
url = self.get_agile_resource_url(resource)
|
|
5353
5381
|
return self.put(url)
|
|
5354
5382
|
|
|
5355
5383
|
def get_agile_board_property(self, board_id: T_id, property_key: str) -> T_resp_json:
|
|
@@ -5360,7 +5388,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5360
5388
|
:param property_key:
|
|
5361
5389
|
:return:
|
|
5362
5390
|
"""
|
|
5363
|
-
|
|
5391
|
+
resource = f"board/{board_id}/properties/{property_key}"
|
|
5392
|
+
url = self.get_agile_resource_url(resource)
|
|
5364
5393
|
return self.get(url)
|
|
5365
5394
|
|
|
5366
5395
|
def delete_agile_board_property(self, board_id: T_id, property_key: str) -> T_resp_json:
|
|
@@ -5371,7 +5400,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5371
5400
|
:param property_key:
|
|
5372
5401
|
:return:
|
|
5373
5402
|
"""
|
|
5374
|
-
|
|
5403
|
+
resource = f"board/{board_id}/properties/{property_key}"
|
|
5404
|
+
url = self.get_agile_resource_url(resource)
|
|
5375
5405
|
return self.delete(url)
|
|
5376
5406
|
|
|
5377
5407
|
# /rest/agile/1.0/board/{boardId}/settings/refined-velocity
|
|
@@ -5381,7 +5411,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5381
5411
|
:param board_id:
|
|
5382
5412
|
:return:
|
|
5383
5413
|
"""
|
|
5384
|
-
|
|
5414
|
+
resource = f"board/{board_id}/settings/refined-velocity"
|
|
5415
|
+
url = self.get_agile_resource_url(resource)
|
|
5385
5416
|
return self.get(url)
|
|
5386
5417
|
|
|
5387
5418
|
def set_agile_board_refined_velocity(self, board_id: T_id, data: dict) -> T_resp_json:
|
|
@@ -5391,7 +5422,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5391
5422
|
:param data:
|
|
5392
5423
|
:return:
|
|
5393
5424
|
"""
|
|
5394
|
-
|
|
5425
|
+
resource = f"board/{board_id}/settings/refined-velocity"
|
|
5426
|
+
url = self.get_agile_resource_url(resource)
|
|
5395
5427
|
return self.put(url, data=data)
|
|
5396
5428
|
|
|
5397
5429
|
# /rest/agile/1.0/board/{boardId}/sprint
|
|
@@ -5414,6 +5446,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5414
5446
|
See the 'Pagination' section at the top of this page for more details.
|
|
5415
5447
|
:return:
|
|
5416
5448
|
"""
|
|
5449
|
+
resource = f"board/{board_id}/sprint"
|
|
5450
|
+
url = self.get_agile_resource_url(resource)
|
|
5417
5451
|
params: dict = {}
|
|
5418
5452
|
if start:
|
|
5419
5453
|
params["startAt"] = start
|
|
@@ -5421,7 +5455,6 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5421
5455
|
params["maxResults"] = limit
|
|
5422
5456
|
if state:
|
|
5423
5457
|
params["state"] = state
|
|
5424
|
-
url = f"rest/agile/1.0/board/{board_id}/sprint"
|
|
5425
5458
|
return self.get(url, params=params)
|
|
5426
5459
|
|
|
5427
5460
|
@deprecated(version="3.42.0", reason="Use get_all_sprints_from_board instead")
|
|
@@ -5472,7 +5505,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5472
5505
|
'jira.search.views.default.max' in your JIRA instance.
|
|
5473
5506
|
If you exceed this limit, your results will be truncated.
|
|
5474
5507
|
"""
|
|
5475
|
-
|
|
5508
|
+
resource = f"board/{board_id}/sprint/{sprint_id}/issue"
|
|
5509
|
+
url = self.get_agile_resource_url(resource)
|
|
5476
5510
|
params: dict = {}
|
|
5477
5511
|
if jql:
|
|
5478
5512
|
params["jql"] = jql
|
|
@@ -5510,6 +5544,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5510
5544
|
See the 'Pagination' section at the top of this page for more details.
|
|
5511
5545
|
:return:
|
|
5512
5546
|
"""
|
|
5547
|
+
resource = f"board/{board_id}/version"
|
|
5548
|
+
url = self.get_agile_resource_url(resource)
|
|
5513
5549
|
params: dict = {}
|
|
5514
5550
|
if released:
|
|
5515
5551
|
params["released"] = released
|
|
@@ -5517,7 +5553,6 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5517
5553
|
params["startAt"] = start
|
|
5518
5554
|
if limit:
|
|
5519
5555
|
params["maxResults"] = limit
|
|
5520
|
-
url = f"rest/agile/1.0/board/{board_id}/version"
|
|
5521
5556
|
return self.get(url, params=params)
|
|
5522
5557
|
|
|
5523
5558
|
def create_sprint(
|
|
@@ -5544,7 +5579,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5544
5579
|
https://docs.atlassian.com/jira-software/REST/8.9.0/#agile/1.0/sprint
|
|
5545
5580
|
isoformat can be created with datetime.datetime.isoformat()
|
|
5546
5581
|
"""
|
|
5547
|
-
|
|
5582
|
+
resource = "sprint"
|
|
5583
|
+
url = self.get_agile_resource_url(resource)
|
|
5548
5584
|
data = dict(name=name, originBoardId=board_id)
|
|
5549
5585
|
if start_date:
|
|
5550
5586
|
data["startDate"] = start_date
|
|
@@ -5580,7 +5616,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5580
5616
|
:param sprint_id:
|
|
5581
5617
|
:return:
|
|
5582
5618
|
"""
|
|
5583
|
-
|
|
5619
|
+
resource = f"sprint/{sprint_id}"
|
|
5620
|
+
url = self.get_agile_resource_url(resource)
|
|
5584
5621
|
return self.get(url)
|
|
5585
5622
|
|
|
5586
5623
|
def rename_sprint(self, sprint_id: T_id, name: str, start_date: str, end_date: str) -> T_resp_json:
|
|
@@ -5592,8 +5629,10 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5592
5629
|
:param end_date:
|
|
5593
5630
|
:return:
|
|
5594
5631
|
"""
|
|
5632
|
+
resource = f"sprint/{sprint_id}"
|
|
5633
|
+
url = self.get_agile_resource_url(resource, legacy_api=True)
|
|
5595
5634
|
return self.put(
|
|
5596
|
-
|
|
5635
|
+
url,
|
|
5597
5636
|
data={"name": name, "startDate": start_date, "endDate": end_date},
|
|
5598
5637
|
)
|
|
5599
5638
|
|
|
@@ -5605,7 +5644,9 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5605
5644
|
:param sprint_id:
|
|
5606
5645
|
:return:
|
|
5607
5646
|
"""
|
|
5608
|
-
|
|
5647
|
+
resource = f"sprint/{sprint_id}"
|
|
5648
|
+
url = self.get_agile_resource_url(resource)
|
|
5649
|
+
return self.delete(url)
|
|
5609
5650
|
|
|
5610
5651
|
def update_partially_sprint(self, sprint_id: T_id, data: dict) -> T_resp_json:
|
|
5611
5652
|
"""
|
|
@@ -5625,7 +5666,9 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5625
5666
|
:param data: { "name": "new name"}
|
|
5626
5667
|
:return:
|
|
5627
5668
|
"""
|
|
5628
|
-
|
|
5669
|
+
resource = f"sprint/{sprint_id}"
|
|
5670
|
+
url = self.get_agile_resource_url(resource)
|
|
5671
|
+
return self.post(url, data=data)
|
|
5629
5672
|
|
|
5630
5673
|
def get_sprint_issues(self, sprint_id: T_id, start: T_id, limit: T_id) -> T_resp_json:
|
|
5631
5674
|
"""
|
|
@@ -5644,12 +5687,13 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5644
5687
|
If you exceed this limit, your results will be truncated.
|
|
5645
5688
|
:return:
|
|
5646
5689
|
"""
|
|
5690
|
+
resource = f"sprint/{sprint_id}/issue"
|
|
5691
|
+
url = self.get_agile_resource_url(resource)
|
|
5647
5692
|
params: dict = {}
|
|
5648
5693
|
if start:
|
|
5649
5694
|
params["startAt"] = start
|
|
5650
5695
|
if limit:
|
|
5651
5696
|
params["maxResults"] = limit
|
|
5652
|
-
url = f"rest/agile/1.0/sprint/{sprint_id}/issue"
|
|
5653
5697
|
return self.get(url, params=params)
|
|
5654
5698
|
|
|
5655
5699
|
def update_rank(self, issues_to_rank: list, rank_before: str, customfield_number: T_id) -> T_resp_json:
|
|
@@ -5660,9 +5704,11 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5660
5704
|
:param customfield_number: The number of the custom field Rank
|
|
5661
5705
|
:return:
|
|
5662
5706
|
"""
|
|
5707
|
+
resource = "issue/rank"
|
|
5708
|
+
url = self.get_agile_resource_url(resource)
|
|
5663
5709
|
|
|
5664
5710
|
return self.put(
|
|
5665
|
-
|
|
5711
|
+
url,
|
|
5666
5712
|
data={
|
|
5667
5713
|
"issues": issues_to_rank,
|
|
5668
5714
|
"rankBeforeIssue": rank_before,
|
|
@@ -5698,7 +5744,8 @@ api-group-workflows/#api-rest-api-2-workflow-search-get)
|
|
|
5698
5744
|
:return: POST request response.
|
|
5699
5745
|
:rtype: dict
|
|
5700
5746
|
"""
|
|
5701
|
-
|
|
5747
|
+
resource = "xboard/issue/flag/flag.json"
|
|
5748
|
+
url = self.get_agile_resource_url(resource, legacy_api=True)
|
|
5702
5749
|
data = {"issueKeys": issue_keys, "flag": flag}
|
|
5703
5750
|
return self.post(url, data)
|
|
5704
5751
|
|
atlassian/request_utils.py
CHANGED
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
from six import PY3
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# Additional log methods
|
|
7
|
-
def logger_has_handlers(logger):
|
|
8
|
-
"""Since Python 2 doesn't provide Logger.hasHandlers(), we have to
|
|
9
|
-
perform the lookup by ourselves."""
|
|
10
|
-
|
|
11
|
-
if PY3:
|
|
12
|
-
return logger.hasHandlers()
|
|
13
|
-
else:
|
|
14
|
-
c = logger
|
|
15
|
-
rv = False
|
|
16
|
-
while c:
|
|
17
|
-
if c.handlers:
|
|
18
|
-
rv = True
|
|
19
|
-
break
|
|
20
|
-
if not c.propagate:
|
|
21
|
-
break
|
|
22
|
-
else:
|
|
23
|
-
c = c.parent
|
|
24
|
-
return rv
|
|
25
|
-
|
|
26
3
|
|
|
27
4
|
def get_default_logger(name):
|
|
28
5
|
"""Get a logger from default logging manager. If no handler
|
|
29
6
|
is associated, add a default NullHandler"""
|
|
30
7
|
|
|
31
8
|
logger = logging.getLogger(name)
|
|
32
|
-
if not
|
|
9
|
+
if not logger.hasHandlers():
|
|
33
10
|
# If logging is not configured in the current project, configure
|
|
34
|
-
# this logger to discard all logs messages. This will
|
|
35
|
-
#
|
|
36
|
-
# and avoid redirecting errors to the default 'lastResort'
|
|
37
|
-
# StreamHandler on Python 3
|
|
11
|
+
# this logger to discard all logs messages. This will avoid
|
|
12
|
+
# redirecting errors to the default 'lastResort' StreamHandler
|
|
38
13
|
logger.addHandler(logging.NullHandler())
|
|
39
14
|
return logger
|
atlassian/rest_client.py
CHANGED
|
@@ -12,6 +12,7 @@ from typing import (
|
|
|
12
12
|
Union,
|
|
13
13
|
overload,
|
|
14
14
|
)
|
|
15
|
+
from urllib.parse import urlencode
|
|
15
16
|
|
|
16
17
|
import requests
|
|
17
18
|
import urllib3
|
|
@@ -27,7 +28,6 @@ except ImportError:
|
|
|
27
28
|
|
|
28
29
|
from requests import HTTPError, Response, Session
|
|
29
30
|
from requests_oauthlib import OAuth1, OAuth2
|
|
30
|
-
from six.moves.urllib.parse import urlencode
|
|
31
31
|
from typing_extensions import Self
|
|
32
32
|
from urllib3.util import Retry
|
|
33
33
|
|
|
@@ -95,6 +95,7 @@ class AtlassianRestAPI(object):
|
|
|
95
95
|
backoff_factor=1.0,
|
|
96
96
|
backoff_jitter=1.0,
|
|
97
97
|
retry_with_header=True,
|
|
98
|
+
header=None,
|
|
98
99
|
):
|
|
99
100
|
"""
|
|
100
101
|
init function for the AtlassianRestAPI object.
|
|
@@ -197,6 +198,8 @@ class AtlassianRestAPI(object):
|
|
|
197
198
|
self._create_kerberos_session(kerberos)
|
|
198
199
|
elif cookies is not None:
|
|
199
200
|
self._session.cookies.update(cookies)
|
|
201
|
+
elif header is not None:
|
|
202
|
+
self._create_header_session(header)
|
|
200
203
|
|
|
201
204
|
def __enter__(self) -> Self:
|
|
202
205
|
return self
|
|
@@ -210,7 +213,10 @@ class AtlassianRestAPI(object):
|
|
|
210
213
|
def _create_token_session(self, token: str) -> None:
|
|
211
214
|
self._update_header("Authorization", f"Bearer {token.strip()}")
|
|
212
215
|
|
|
213
|
-
def
|
|
216
|
+
def _create_header_session(self, header: dict) -> None:
|
|
217
|
+
self._session.headers.update(header)
|
|
218
|
+
|
|
219
|
+
def _create_kerberos_session(self, _):
|
|
214
220
|
from requests_kerberos import OPTIONAL, HTTPKerberosAuth
|
|
215
221
|
|
|
216
222
|
self._session.auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atlassian-python-api
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.4
|
|
4
4
|
Summary: Python Atlassian REST API Wrapper
|
|
5
5
|
Home-page: https://github.com/atlassian-api/atlassian-python-api
|
|
6
6
|
Download-URL: https://github.com/atlassian-api/atlassian-python-api
|
|
@@ -41,7 +41,6 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
|
41
41
|
License-File: LICENSE
|
|
42
42
|
Requires-Dist: deprecated
|
|
43
43
|
Requires-Dist: requests
|
|
44
|
-
Requires-Dist: six
|
|
45
44
|
Requires-Dist: oauthlib
|
|
46
45
|
Requires-Dist: requests_oauthlib
|
|
47
46
|
Requires-Dist: jmespath
|