Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also consolidate project/group badges tests, and add some docs Fixes #469
- Loading branch information
Gauvain Pocentek
committed
May 29, 2018
1 parent
01a41ef
commit 9412a5d
Showing
6 changed files
with
115 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
###### | ||
Badges | ||
###### | ||
|
||
Badges can be associated with groups and projects. | ||
|
||
Reference | ||
--------- | ||
|
||
* v4 API: | ||
|
||
+ :class:`gitlab.v4.objects.GroupBadge` | ||
+ :class:`gitlab.v4.objects.GroupBadgeManager` | ||
+ :attr:`gitlab.v4.objects.Group.badges` | ||
+ :class:`gitlab.v4.objects.ProjectBadge` | ||
+ :class:`gitlab.v4.objects.ProjectBadgeManager` | ||
+ :attr:`gitlab.v4.objects.Project.badges` | ||
|
||
* GitLab API: | ||
|
||
+ https://docs.gitlab.com/ce/api/group_badges.html | ||
+ https://docs.gitlab.com/ce/api/project_badges.html | ||
|
||
Examples | ||
-------- | ||
|
||
List badges:: | ||
|
||
badges = group_or_project.badges.list() | ||
|
||
Get ad badge:: | ||
|
||
badge = group_or_project.badges.get(badge_id) | ||
|
||
Create a badge:: | ||
|
||
badge = group_or_project.badges.create({'link_url': link, 'image_url': image_link}) | ||
|
||
Update a badge:: | ||
|
||
badge.image_link = new_link | ||
badge.save() | ||
|
||
Delete a badge:: | ||
|
||
badge.delete() | ||
|
||
Render a badge (preview the generate URLs):: | ||
|
||
output = group_or_project.badges.render(link, image_link) | ||
print(output['rendered_link_url']) | ||
print(output['rendered_image_url']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters