API: add project snippets listing
This commit is contained in:
parent
ad5b5d1e51
commit
61f12da3a5
4 changed files with 29 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
master
|
master
|
||||||
|
- [API] add project snippets list
|
||||||
- [API] allow to authorize using private token in HTTP header
|
- [API] allow to authorize using private token in HTTP header
|
||||||
- [API] add user creation
|
- [API] add user creation
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
## List snippets
|
## List snippets
|
||||||
|
|
||||||
Not implemented.
|
Get a list of project snippets.
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /projects/:id/snippets
|
||||||
|
```
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
+ `id` (required) - The ID or code name of a project
|
||||||
|
|
||||||
## Single snippet
|
## Single snippet
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,16 @@ module Gitlab
|
||||||
present CommitDecorator.decorate(commits), with: Entities::RepoCommit
|
present CommitDecorator.decorate(commits), with: Entities::RepoCommit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get a project snippets
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# id (required) - The ID or code name of a project
|
||||||
|
# Example Request:
|
||||||
|
# GET /projects/:id/snippets
|
||||||
|
get ":id/snippets" do
|
||||||
|
present paginate(user_project.snippets), with: Entities::ProjectSnippet
|
||||||
|
end
|
||||||
|
|
||||||
# Get a project snippet
|
# Get a project snippet
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
|
|
|
@ -220,6 +220,15 @@ describe Gitlab::API do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "GET /projects/:id/snippets" do
|
||||||
|
it "should return a project snippet" do
|
||||||
|
get api("/projects/#{project.code}/snippets", user)
|
||||||
|
response.status.should == 200
|
||||||
|
json_response.should be_an Array
|
||||||
|
json_response.first['title'].should == snippet.title
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "GET /projects/:id/snippets/:snippet_id" do
|
describe "GET /projects/:id/snippets/:snippet_id" do
|
||||||
it "should return a project snippet" do
|
it "should return a project snippet" do
|
||||||
get api("/projects/#{project.code}/snippets/#{snippet.id}", user)
|
get api("/projects/#{project.code}/snippets/#{snippet.id}", user)
|
||||||
|
|
Loading…
Reference in a new issue