# Releases

## Project releases

### Reference

- v4 API:

  - `gitlab.v4.objects.ProjectRelease`

  - `gitlab.v4.objects.ProjectReleaseManager`

  - `gitlab.v4.objects.Project.releases`

- Gitlab API: https://docs.gitlab.com/ee/api/releases/index.html

### Examples

Get a list of releases from a project:

    release = project.releases.list()

Get a single release:

    release = project.releases.get('v1.2.3')

Edit a release:

    release.name = "Demo Release"
    release.description = "release notes go here"
    release.save()

Create a release for a project tag:

    release = project.releases.create({'name':'Demo Release', 'tag_name':'v1.2.3', 'description':'release notes go here'})

Delete a release:

    # via its tag name from project attributes
    release = project.releases.delete('v1.2.3')

    # delete object directly
    release.delete()

## Project release links

### Reference

- v4 API:

  - `gitlab.v4.objects.ProjectReleaseLink`

  - `gitlab.v4.objects.ProjectReleaseLinkManager`

  - `gitlab.v4.objects.ProjectRelease.links`

- Gitlab API: https://docs.gitlab.com/ee/api/releases/links.html

### Examples

Get a list of releases from a project:

    links = release.links.list()

Get a single release link:

    link = release.links.get(1)

Create a release link for a release:

    link = release.links.create({"url": "https://example.com/asset", "name": "asset"})

Delete a release link:

    # via its ID from release attributes
    release.links.delete(1)

    # delete object directly
    link.delete()