Skip to content

Commit

Permalink
Implement managers to get access to resources
Browse files Browse the repository at this point in the history
This changes the 'default' API, using managers is the recommended way to
get/list/create objects. Additional operations will be implemented in
followup patchs.

Old methods are deprecated and will disappear in a while.
  • Loading branch information
Gauvain Pocentek committed Jan 3, 2016
1 parent e5246bf commit 46f74e8
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 26 deletions.
29 changes: 29 additions & 0 deletions gitlab/__init__.py
Expand Up @@ -78,6 +78,35 @@ def __init__(self, url, private_token=None,
#: (Passed to requests-library)
self.ssl_verify = ssl_verify

self.user_keys = UserKeyManager(self)
self.users = UserManager(self)
self.group_members = GroupMemberManager(self)
self.groups = GroupManager(self)
self.hooks = HookManager(self)
self.issues = IssueManager(self)
self.project_branches = ProjectBranchManager(self)
self.project_commits = ProjectCommitManager(self)
self.project_keys = ProjectKeyManager(self)
self.project_events = ProjectEventManager(self)
self.project_hooks = ProjectHookManager(self)
self.project_issue_notes = ProjectIssueNoteManager(self)
self.project_issues = ProjectIssueManager(self)
self.project_members = ProjectMemberManager(self)
self.project_notes = ProjectNoteManager(self)
self.project_tags = ProjectTagManager(self)
self.project_mergerequest_notes = ProjectMergeRequestNoteManager(self)
self.project_mergerequests = ProjectMergeRequestManager(self)
self.project_milestones = ProjectMilestoneManager(self)
self.project_labels = ProjectLabelManager(self)
self.project_files = ProjectFileManager(self)
self.project_snippet_notes = ProjectSnippetNoteManager(self)
self.project_snippets = ProjectSnippetManager(self)
self.user_projects = UserProjectManager(self)
self.projects = ProjectManager(self)
self.team_members = TeamMemberManager(self)
self.team_projects = TeamProjectManager(self)
self.teams = TeamManager(self)

@staticmethod
def from_config(gitlab_id=None, config_files=None):
config = gitlab.config.GitlabConfigParser(gitlab_id=gitlab_id,
Expand Down
1 change: 1 addition & 0 deletions gitlab/exceptions.py
Expand Up @@ -15,6 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


class GitlabError(Exception):
def __init__(self, error_message="", response_code=None,
response_body=None):
Expand Down

0 comments on commit 46f74e8

Please sign in to comment.