BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9c3b24ed
Commit
9c3b24ed
authored
Oct 13, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grapify tags API
parent
36dafbbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
49 deletions
+45
-49
tags.rb
lib/api/tags.rb
+45
-49
No files found.
lib/api/tags.rb
View file @
9c3b24ed
...
...
@@ -4,25 +4,24 @@ module API
before
{
authenticate!
}
before
{
authorize!
:download_code
,
user_project
}
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
resource
:projects
do
# Get a project repository tags
#
# Parameters:
# id (required) - The ID of a project
# Example Request:
# GET /projects/:id/repository/tags
desc
'Get a project repository tags'
do
success
Entities
::
RepoTag
end
get
":id/repository/tags"
do
present
user_project
.
repository
.
tags
.
sort_by
(
&
:name
).
reverse
,
with:
Entities
::
RepoTag
,
project:
user_project
end
# Get a single repository tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# Example Request:
# GET /projects/:id/repository/tags/:tag_name
desc
'Get a single repository tag'
do
success
Entities
::
RepoTag
end
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
end
get
":id/repository/tags/:tag_name"
,
requirements:
{
tag_name:
/.+/
}
do
tag
=
user_project
.
repository
.
find_tag
(
params
[
:tag_name
])
not_found!
(
'Tag'
)
unless
tag
...
...
@@ -30,20 +29,21 @@ module API
present
tag
,
with:
Entities
::
RepoTag
,
project:
user_project
end
# Create tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# ref (required) - Create tag from commit sha or branch
# message (optional) - Specifying a message creates an annotated tag.
# Example Request:
# POST /projects/:id/repository/tags
desc
'Create a new repository tag'
do
success
Entities
::
RepoTag
end
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
requires
:ref
,
type:
String
,
desc:
'The commit sha or branch name'
optional
:message
,
type:
String
,
desc:
'Specifying a message creates an annotated tag'
optional
:release_description
,
type:
String
,
desc:
'Specifying release notes stored in the GitLab database'
end
post
':id/repository/tags'
do
authorize_push_project
message
=
params
[
:message
]
||
nil
create_params
=
declared
(
params
)
result
=
CreateTagService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
],
params
[
:ref
],
message
,
params
[
:release_description
])
execute
(
create_params
[
:tag_name
],
create_params
[
:ref
],
create_params
[
:message
],
create_
params
[
:release_description
])
if
result
[
:status
]
==
:success
present
result
[
:tag
],
...
...
@@ -54,15 +54,13 @@ module API
end
end
# Delete tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# Example Request:
# DELETE /projects/:id/repository/tags/:tag
desc
'Delete a repository tag'
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
end
delete
":id/repository/tags/:tag_name"
,
requirements:
{
tag_name:
/.+/
}
do
authorize_push_project
result
=
DeleteTagService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
])
...
...
@@ -75,17 +73,16 @@ module API
end
end
# Add release notes to tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# description (required) - Release notes with markdown support
# Example Request:
# POST /projects/:id/repository/tags/:tag_name/release
desc
'Add a release note to a tag'
do
success
Entities
::
Release
end
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
requires
:description
,
type:
String
,
desc:
'Release notes with markdown support'
end
post
':id/repository/tags/:tag_name/release'
,
requirements:
{
tag_name:
/.+/
}
do
authorize_push_project
required_attributes!
[
:description
]
result
=
CreateReleaseService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
],
params
[
:description
])
...
...
@@ -96,17 +93,16 @@ module API
end
end
# Updates a release notes of a tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# description (required) - Release notes with markdown support
# Example Request:
# PUT /projects/:id/repository/tags/:tag_name/release
desc
"Update a tag's release note"
do
success
Entities
::
Release
end
params
do
requires
:tag_name
,
type:
String
,
desc:
'The name of the tag'
requires
:description
,
type:
String
,
desc:
'Release notes with markdown support'
end
put
':id/repository/tags/:tag_name/release'
,
requirements:
{
tag_name:
/.+/
}
do
authorize_push_project
required_attributes!
[
:description
]
result
=
UpdateReleaseService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
],
params
[
:description
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment