# Badges

Badges can be associated with groups and projects.

## Reference

- v4 API:

  - `gitlab.v4.objects.GroupBadge`

  - `gitlab.v4.objects.GroupBadgeManager`

  - `gitlab.v4.objects.Group.badges`

  - `gitlab.v4.objects.ProjectBadge`

  - `gitlab.v4.objects.ProjectBadgeManager`

  - `gitlab.v4.objects.Project.badges`

- GitLab API:

  - https://docs.gitlab.com/api/group_badges

  - https://docs.gitlab.com/api/project_badges

## Examples

List badges:

    badges = group_or_project.badges.list(get_all=True)

Get a 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_url = new_image_url
    badge.link_url = new_link_url
    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'])