-
Notifications
You must be signed in to change notification settings - Fork 709
Expand file tree
/
Copy path__init__.py
More file actions
46 lines (39 loc) · 1.57 KB
/
__init__.py
File metadata and controls
46 lines (39 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# coding=utf-8
from .base import BitbucketServerBase
from .globalPermissions import Groups, Users
from .projects import Projects
class Server(BitbucketServerBase):
"""
Class implementing parts of the REST API described in
https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-rest.html
"""
def __init__(self, url, *args, **kwargs):
kwargs["cloud"] = False
kwargs["api_root"] = "rest/api"
kwargs["api_version"] = "1.0"
url = url.strip("/") + f"/{kwargs['api_root']}/{kwargs['api_version']}"
super(Server, self).__init__(url, *args, **kwargs)
self.__projects = Projects(self._sub_url("projects"), **self._new_session_args)
self.__groups = Groups(self._sub_url("admin/permissions/groups"), **self._new_session_args)
self.__users = Users(self._sub_url("admin/permissions/users"), **self._new_session_args)
@property
def groups(self):
"""
Property to access the global groups
Reference: https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-rest.html#idp62
"""
return self.__groups
@property
def users(self):
"""
Property to access the global users
Reference: https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-rest.html#idp68
"""
return self.__users
@property
def projects(self):
"""
Property to access the projects
Reference: https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-rest.html#idp147
"""
return self.__projects