Skip to content

Commit adff447

Browse files
Gonchik TsymzhitovGonchik Tsymzhitov
Gonchik Tsymzhitov
authored and
Gonchik Tsymzhitov
committed
Add some annoucement banner
1 parent 011b5fc commit adff447

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ python:
77
- "3.6"
88
- "3.7"
99
- "3.8"
10-
- "3.9"
10+
- "3.9-dev"
1111

1212
matrix:
1313
allow_failures:

atlassian/bitbucket.py

+40
Original file line numberDiff line numberDiff line change
@@ -2181,3 +2181,43 @@ def get_associated_build_statuses(self, commit):
21812181
url = '/rest/build-status/2.0/commits/{commitId}'.format(commitId=commit)
21822182

21832183
return self.get(url)
2184+
2185+
def get_announcement_banner(self):
2186+
"""
2187+
Gets the announcement banner, if one exists and is available to the user
2188+
:return:
2189+
"""
2190+
if not self.cloud:
2191+
url = "rest/api/1.0/admin/banner"
2192+
else:
2193+
url = "rest/api/2.0/admin/banner"
2194+
return self.get(url)
2195+
2196+
def set_announcement_banner(self, body):
2197+
"""
2198+
Sets the announcement banner with the provided JSON.
2199+
Only users authenticated as Admins may call this resource
2200+
:param body
2201+
{
2202+
"id": "https://docs.atlassian.com/jira/REST/schema/rest-announcement-banner#",
2203+
"title": "Rest Announcement Banner",
2204+
"type": "object"
2205+
}
2206+
:return:
2207+
"""
2208+
if not self.cloud:
2209+
url = "rest/api/1.0/admin/banner"
2210+
else:
2211+
url = "rest/api/2.0/admin/banner"
2212+
return self.put(url, data=body)
2213+
2214+
def delete_announcement_banner(self):
2215+
"""
2216+
Gets the announcement banner, if one exists and is available to the user
2217+
:return:
2218+
"""
2219+
if not self.cloud:
2220+
url = "rest/api/1.0/admin/banner"
2221+
else:
2222+
url = "rest/api/2.0/admin/banner"
2223+
return self.delete(url)

0 commit comments

Comments
 (0)