Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/project_templates.rb')
-rw-r--r--lib/api/project_templates.rb27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/api/project_templates.rb b/lib/api/project_templates.rb
index f6e1286d616..8ec67988e39 100644
--- a/lib/api/project_templates.rb
+++ b/lib/api/project_templates.rb
@@ -15,12 +15,18 @@ module API
feature_category :source_code_management
params do
- requires :id, type: String, desc: 'The ID of a project'
+ requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
requires :type, type: String, values: TEMPLATE_TYPES, desc: 'The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses|metrics_dashboard_ymls|issues|merge_requests) of the template'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Get a list of templates available to this project' do
detail 'This endpoint was introduced in GitLab 11.4'
+ is_array true
+ success Entities::TemplatesList
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
end
params do
use :pagination
@@ -33,13 +39,24 @@ module API
desc 'Download a template available to this project' do
detail 'This endpoint was introduced in GitLab 11.4'
+ success Entities::License
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
end
params do
- requires :name, type: String, desc: 'The name of the template'
+ requires :name, type: String,
+ desc: 'The key of the template, as obtained from the collection endpoint.', documentation: { example: 'MIT' }
optional :source_template_project_id, type: Integer,
- desc: 'The project id where a given template is being stored. This is useful when multiple templates from different projects have the same name'
- optional :project, type: String, desc: 'The project name to use when expanding placeholders in the template. Only affects licenses'
- optional :fullname, type: String, desc: 'The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses'
+ desc: 'The project id where a given template is being stored. This is useful when multiple templates from different projects have the same name',
+ documentation: { example: 1 }
+ optional :project, type: String,
+ desc: 'The project name to use when expanding placeholders in the template. Only affects licenses',
+ documentation: { example: 'GitLab' }
+ optional :fullname, type: String,
+ desc: 'The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses',
+ documentation: { example: 'GitLab B.V.' }
end
get ':id/templates/:type/:name', requirements: TEMPLATE_NAMES_ENDPOINT_REQUIREMENTS do