Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for Project badges#507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpocentek merged 1 commit intopython-gitlab:masterfromMiouge1:badges
May 29, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletionsgitlab/v4/objects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1250,6 +1250,18 @@ def enable(self, key_id, **kwargs):
self.gitlab.http_post(path, **kwargs)


class ProjectBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
pass


class ProjectBadgeManager(CRUDMixin, RESTManager):
_path = '/projects/%(project_id)s/badges'
_obj_cls = ProjectBadge
_from_parent_attrs = {'project_id': 'id'}
_create_attrs = (('link_url', 'image_url'), tuple())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It is also possible to update the badge objects, so could you define the_update_attrs variable as well?

_update_attrs = (('link_url', 'image_url'), tuple())


class ProjectEvent(Event):
pass

Expand DownExpand Up@@ -2472,6 +2484,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
_short_print_attr = 'path'
_managers = (
('accessrequests', 'ProjectAccessRequestManager'),
('badges', 'ProjectBadgeManager'),
('boards', 'ProjectBoardManager'),
('branches', 'ProjectBranchManager'),
('jobs', 'ProjectJobManager'),
Expand Down
6 changes: 6 additions & 0 deletionstools/python_test_v4.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -583,6 +583,12 @@
#lists = board.lists.list()
#assert(len(lists) == begin_size - 1)

# project badges
badge_image = 'http://example.com'
badge_link = 'http://example/img.svg'
bp = admin_project.badges.create({'link_url': badge_link, 'image_url': badge_image})
assert(len(admin_project.badges.list()) == 1)

# project wiki
wiki_content = 'Wiki page content'
wp = admin_project.wikis.create({'title': 'wikipage', 'content': wiki_content})
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp