diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-06 19:08:06 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-06 19:08:06 +0300 |
commit | 5db5a9cbd1192d776874a92e0a253c605f3c4417 (patch) | |
tree | 67be95609ce038ec9c2fbdc45fb491bb223c7137 /lib/api/applications.rb | |
parent | a29f0c28fd07ba14f0d0e5fb9c878a2eb117e388 (diff) | |
parent | ba62493009c2360018709b660956a6173f3e1515 (diff) |
Merge branch 'master' into 'zj-wiki-page-versions'
# Conflicts:
# Gemfile
# Gemfile.lock
Diffstat (limited to 'lib/api/applications.rb')
-rw-r--r-- | lib/api/applications.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/api/applications.rb b/lib/api/applications.rb new file mode 100644 index 00000000000..b122cdefe4e --- /dev/null +++ b/lib/api/applications.rb @@ -0,0 +1,27 @@ +module API + # External applications API + class Applications < Grape::API + before { authenticated_as_admin! } + + resource :applications do + desc 'Create a new application' do + detail 'This feature was introduced in GitLab 10.5' + success Entities::ApplicationWithSecret + end + params do + requires :name, type: String, desc: 'Application name' + requires :redirect_uri, type: String, desc: 'Application redirect URI' + requires :scopes, type: String, desc: 'Application scopes' + end + post do + application = Doorkeeper::Application.new(declared_params) + + if application.save + present application, with: Entities::ApplicationWithSecret + else + render_validation_error! application + end + end + end + end +end |