fs-gitlab 4.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +270 -0
  3. data/LICENSE.txt +24 -0
  4. data/README.md +260 -0
  5. data/exe/gitlab +11 -0
  6. data/lib/gitlab/api.rb +24 -0
  7. data/lib/gitlab/cli.rb +89 -0
  8. data/lib/gitlab/cli_helpers.rb +243 -0
  9. data/lib/gitlab/client/access_requests.rb +103 -0
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +137 -0
  13. data/lib/gitlab/client/boards.rb +146 -0
  14. data/lib/gitlab/client/branches.rb +135 -0
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +135 -0
  17. data/lib/gitlab/client/builds.rb +108 -0
  18. data/lib/gitlab/client/commits.rb +216 -0
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +34 -0
  21. data/lib/gitlab/client/environments.rb +89 -0
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +60 -0
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +94 -0
  30. data/lib/gitlab/client/groups.rb +358 -0
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +231 -0
  33. data/lib/gitlab/client/jobs.rb +250 -0
  34. data/lib/gitlab/client/keys.rb +29 -0
  35. data/lib/gitlab/client/labels.rb +88 -0
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +265 -0
  39. data/lib/gitlab/client/merge_requests.rb +386 -0
  40. data/lib/gitlab/client/milestones.rb +106 -0
  41. data/lib/gitlab/client/namespaces.rb +22 -0
  42. data/lib/gitlab/client/notes.rb +313 -0
  43. data/lib/gitlab/client/packages.rb +95 -0
  44. data/lib/gitlab/client/pipeline_schedules.rb +147 -0
  45. data/lib/gitlab/client/pipeline_triggers.rb +103 -0
  46. data/lib/gitlab/client/pipelines.rb +105 -0
  47. data/lib/gitlab/client/project_badges.rb +85 -0
  48. data/lib/gitlab/client/project_clusters.rb +83 -0
  49. data/lib/gitlab/client/project_release_links.rb +76 -0
  50. data/lib/gitlab/client/project_releases.rb +79 -0
  51. data/lib/gitlab/client/projects.rb +708 -0
  52. data/lib/gitlab/client/protected_tags.rb +59 -0
  53. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  54. data/lib/gitlab/client/repositories.rb +113 -0
  55. data/lib/gitlab/client/repository_files.rb +131 -0
  56. data/lib/gitlab/client/repository_submodules.rb +27 -0
  57. data/lib/gitlab/client/resource_label_events.rb +82 -0
  58. data/lib/gitlab/client/resource_state_events.rb +57 -0
  59. data/lib/gitlab/client/runners.rb +211 -0
  60. data/lib/gitlab/client/search.rb +66 -0
  61. data/lib/gitlab/client/services.rb +53 -0
  62. data/lib/gitlab/client/sidekiq.rb +39 -0
  63. data/lib/gitlab/client/snippets.rb +95 -0
  64. data/lib/gitlab/client/system_hooks.rb +64 -0
  65. data/lib/gitlab/client/tags.rb +97 -0
  66. data/lib/gitlab/client/templates.rb +100 -0
  67. data/lib/gitlab/client/todos.rb +46 -0
  68. data/lib/gitlab/client/user_snippets.rb +114 -0
  69. data/lib/gitlab/client/users.rb +397 -0
  70. data/lib/gitlab/client/versions.rb +18 -0
  71. data/lib/gitlab/client/wikis.rb +79 -0
  72. data/lib/gitlab/client.rb +95 -0
  73. data/lib/gitlab/configuration.rb +57 -0
  74. data/lib/gitlab/error.rb +170 -0
  75. data/lib/gitlab/file_response.rb +48 -0
  76. data/lib/gitlab/help.rb +94 -0
  77. data/lib/gitlab/objectified_hash.rb +51 -0
  78. data/lib/gitlab/page_links.rb +35 -0
  79. data/lib/gitlab/paginated_response.rb +110 -0
  80. data/lib/gitlab/request.rb +109 -0
  81. data/lib/gitlab/shell.rb +83 -0
  82. data/lib/gitlab/shell_history.rb +57 -0
  83. data/lib/gitlab/version.rb +5 -0
  84. data/lib/gitlab.rb +56 -0
  85. metadata +204 -0
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to pipelines.
5
+ # @see https://docs.gitlab.com/ce/api/pipelines.html
6
+ module Pipelines
7
+ # Gets a list of project pipelines.
8
+ #
9
+ # @example
10
+ # Gitlab.pipelines(5)
11
+ # Gitlab.pipelines(5, { per_page: 10, page: 2 })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def pipelines(project, options = {})
19
+ get("/projects/#{url_encode project}/pipelines", query: options)
20
+ end
21
+
22
+ # Gets a single pipeline.
23
+ #
24
+ # @example
25
+ # Gitlab.pipeline(5, 36)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of a pipeline.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def pipeline(project, id)
31
+ get("/projects/#{url_encode project}/pipelines/#{id}")
32
+ end
33
+
34
+ # Gets a single pipeline's test report.
35
+ #
36
+ # @example
37
+ # Gitlab.pipeline_test_report(5, 36)
38
+ #
39
+ # @param [Integer, String] project The ID or name of a project.
40
+ # @param [Integer] id The ID of a pipeline.
41
+ # @return [Gitlab::ObjectifiedHash]
42
+ def pipeline_test_report(project, id)
43
+ get("/projects/#{url_encode project}/pipelines/#{id}/test_report")
44
+ end
45
+
46
+ # Create a pipeline.
47
+ #
48
+ # @example
49
+ # Gitlab.create_pipeline(5, 'master')
50
+ #
51
+ # @param [Integer, String] project The ID or name of a project.
52
+ # @param [String] ref Reference to commit.
53
+ # @param [Hash] variables Variables passed to pipelines
54
+ # @return [Gitlab::ObjectifiedHash] The pipelines changes.
55
+ def create_pipeline(project, ref, variables = {})
56
+ body = {}
57
+
58
+ # This mapping is necessary, cause the API expects an array with objects (with `key` and `value` keys)
59
+ # See: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline
60
+ body[:variables] = variables.map { |(key, value)| { key: key, value: value } } if variables.any?
61
+
62
+ post(
63
+ "/projects/#{url_encode project}/pipeline",
64
+ query: { ref: ref },
65
+ body: body
66
+ )
67
+ end
68
+
69
+ # Cancels a pipeline.
70
+ #
71
+ # @example
72
+ # Gitlab.cancel_pipeline(5, 1)
73
+ #
74
+ # @param [Integer, String] project The ID or name of a project.
75
+ # @param [Integer] id The ID of a pipeline.
76
+ # @return [Gitlab::ObjectifiedHash] The pipelines changes.
77
+ def cancel_pipeline(project, id)
78
+ post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
79
+ end
80
+
81
+ # Retry a pipeline.
82
+ #
83
+ # @example
84
+ # Gitlab.retry_pipeline(5, 1)
85
+ #
86
+ # @param [Integer, String] project The ID or name of a project.
87
+ # @param [Integer] id The ID of a pipeline.
88
+ # @return [Array<Gitlab::ObjectifiedHash>] The pipelines changes.
89
+ def retry_pipeline(project, id)
90
+ post("/projects/#{url_encode project}/pipelines/#{id}/retry")
91
+ end
92
+
93
+ # Delete a pipeline
94
+ #
95
+ # @example
96
+ # Gitlab.delete_pipeline(5, 1)
97
+ #
98
+ # @param [Integer, String] project The ID or name of a project.
99
+ # @param [Integer] id The ID of a pipeline.
100
+ # @return [void] This API call returns an empty response body.
101
+ def delete_pipeline(project, id)
102
+ delete("/projects/#{url_encode project}/pipelines/#{id}")
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to project badges.
5
+ # @see https://docs.gitlab.com/ee/api/project_badges.html
6
+ module ProjectBadges
7
+ # Gets a list of a projects badges and its group badges.
8
+ #
9
+ # @example
10
+ # Gitlab.project_badges(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] List of all badges of a project
14
+ def project_badges(project)
15
+ get("/projects/#{url_encode project}/badges")
16
+ end
17
+
18
+ # Gets a badge of a project.
19
+ #
20
+ # @example
21
+ # Gitlab.project_badge(5, 42)
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [Integer] badge_id The badge ID.
25
+ # @return [Gitlab::ObjectifiedHash] Information about the requested badge
26
+ def project_badge(project, badge_id)
27
+ get("/projects/#{url_encode project}/badges/#{badge_id}")
28
+ end
29
+
30
+ # Adds a badge to a project.
31
+ #
32
+ # @example
33
+ # Gitlab.add_project_badge(5, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
34
+ #
35
+ # @param [Integer, String] project The ID or name of a project.
36
+ # @param [Hash] options A customizable set of options.
37
+ # @option options [String] :link_url(required) URL of the badge link
38
+ # @option options [String] :image_url(required) URL of the badge image
39
+ # @return [Gitlab::ObjectifiedHash] Information about the added project badge.
40
+ def add_project_badge(project, options = {})
41
+ post("/projects/#{url_encode project}/badges", body: options)
42
+ end
43
+
44
+ # Updates a badge of a project..
45
+ #
46
+ # @example
47
+ # Gitlab.edit_project_badge(5, 1, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
48
+ #
49
+ # @param [Integer, String] project The ID or name of a project.
50
+ # @param [Integer] badge_id The badge ID.
51
+ # @param [Hash] options A customizable set of options.
52
+ # @option options [String] :link_url(optional) URL of the badge link
53
+ # @option options [String] :image_url(optional) URL of the badge image
54
+ # @return [Gitlab::ObjectifiedHash] Information about the updated project badge.
55
+ def edit_project_badge(project, badge_id, options = {})
56
+ put("/projects/#{url_encode project}/badges/#{badge_id}", body: options)
57
+ end
58
+
59
+ # Removes a badge from a project. Only projects badges will be removed by using this endpoint.
60
+ #
61
+ # @example
62
+ # Gitlab.remove_project_badge(5, 42)
63
+ #
64
+ # @param [Integer, String] project The ID or name of a project.
65
+ # @param [Integer] badge_id The badge ID.
66
+ # @return [nil] This API call returns an empty response body.
67
+ def remove_project_badge(project, badge_id)
68
+ delete("/projects/#{url_encode project}/badges/#{badge_id}")
69
+ end
70
+
71
+ # Preview a badge from a project.
72
+ #
73
+ # @example
74
+ # Gitlab.preview_project_badge(3, 'https://abc.com/gitlab/gitlab-ce/commits/master', 'https://shields.io/my/badge1')
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [String] :link_url URL of the badge link
78
+ # @param [String] :image_url URL of the badge image
79
+ # @return [Gitlab::ObjectifiedHash] Returns how the link_url and image_url final URLs would be after resolving the placeholder interpolation.
80
+ def preview_project_badge(project, link_url, image_url)
81
+ query = { link_url: link_url, image_url: image_url }
82
+ get("/projects/#{url_encode project}/badges/render", query: query)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to project clusters.
5
+ # @see https://docs.gitlab.com/ce/api/project_clusters.html
6
+ module ProjectClusters
7
+ # Returns a list of project clusters.
8
+ #
9
+ # @example
10
+ # Gitlab.project_clusters(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] List of all clusters of a project
14
+ def project_clusters(project)
15
+ get("/projects/#{url_encode project}/clusters")
16
+ end
17
+
18
+ # Gets a single project cluster.
19
+ #
20
+ # @example
21
+ # Gitlab.project_cluster(5, 42)
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [Integer] cluster_id The ID of the cluster.
25
+ # @return [Gitlab::ObjectifiedHash] Information about the requested cluster
26
+ def project_cluster(project, cluster_id)
27
+ get("/projects/#{url_encode project}/clusters/#{cluster_id}")
28
+ end
29
+
30
+ # Adds an existing Kubernetes cluster to the project.
31
+ #
32
+ # @example
33
+ # Gitlab.add_project_cluster(5, 'cluster-5', { enabled: false, platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-5-namespace', authorization_type: 'rbac' } })
34
+ # Gitlab.add_project_cluster(5, 'cluster-5', { platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345' } })
35
+ #
36
+ # @param [Integer, String] project The ID or name of a project.
37
+ # @param [String] name The name of the existing cluster.
38
+ # @param [Hash] options A customizable set of options.
39
+ # @option options [Boolean] :enabled(optional) Determines if cluster is active or not, defaults to true
40
+ # @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes
41
+ # @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API
42
+ # @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes
43
+ # @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate
44
+ # @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project
45
+ # @suboption platform_kubernetes_attributes [String] :authorization_type(optional) The cluster authorization type: rbac, abac or unknown_authorization. Defaults to rbac.
46
+ # @return [Gitlab::ObjectifiedHash] Information about the added project cluster.
47
+ def add_project_cluster(project, name, options = {})
48
+ body = { name: name }.merge(options)
49
+ post("/projects/#{url_encode project}/clusters/user", body: body)
50
+ end
51
+
52
+ # Updates an existing project cluster.
53
+ #
54
+ # @example
55
+ # Gitlab.edit_project_cluster(5, 1, { name: 'cluster-6', platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-6-namespace' } })
56
+ #
57
+ # @param [Integer, String] project The ID or name of a project.
58
+ # @param [Integer] cluster_id The ID of the cluster.
59
+ # @param [Hash] options A customizable set of options.
60
+ # @option options [String] :name(optional) The name of the cluster
61
+ # @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes
62
+ # @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API
63
+ # @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes
64
+ # @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate
65
+ # @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project
66
+ # @return [Gitlab::ObjectifiedHash] Information about the updated project cluster.
67
+ def edit_project_cluster(project, cluster_id, options = {})
68
+ put("/projects/#{url_encode project}/clusters/#{cluster_id}", body: options)
69
+ end
70
+
71
+ # Deletes an existing project cluster.
72
+ #
73
+ # @example
74
+ # Gitlab.delete_project_cluster(5, 42)
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [Integer] cluster_id The ID of the cluster.
78
+ # @return [nil] This API call returns an empty response body.
79
+ def delete_project_cluster(project, cluster_id)
80
+ delete("/projects/#{url_encode project}/clusters/#{cluster_id}")
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to project release links.
5
+ # @see https://docs.gitlab.com/ce/api/releases/links.html
6
+ module ProjectReleaseLinks
7
+ # Get assets as links from a Release.
8
+ #
9
+ # @example
10
+ # Gitlab.project_release_links(5, 'v0.3')
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @param [String] tag_name The tag associated with the Release.
14
+ # @return [Array<Gitlab::ObjectifiedHash>] List of assets as links from a Release.
15
+ def project_release_links(project, tag_name)
16
+ get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links")
17
+ end
18
+
19
+ # Get an asset as link from a Release.
20
+ #
21
+ # @example
22
+ # Gitlab.project_release_link(5, 'v0.3', 1)
23
+ #
24
+ # @param [Integer, String] project The ID or name of a project.
25
+ # @param [String] tag_name The tag associated with the Release.
26
+ # @param [Integer] link_id The id of the link.
27
+ # @return [Gitlab::ObjectifiedHash] Information about the release link
28
+ def project_release_link(project, tag_name, link_id)
29
+ get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}")
30
+ end
31
+
32
+ # Create an asset as a link from a Release.
33
+ #
34
+ # @example
35
+ # Gitlab.create_project_release_link(5, 'v0.1', { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' })
36
+ #
37
+ # @param [Integer, String] project The ID or name of a project.
38
+ # @param [String] tag_name The tag associated with the Release.
39
+ # @param [Hash] options A customizable set of options.
40
+ # @option options [String] :name(required) The name of the link.
41
+ # @option options [String] :url(required) The URL of the link.
42
+ # @return [Gitlab::ObjectifiedHash] Information about the created release link.
43
+ def create_project_release_link(project, tag_name, options = {})
44
+ post("/projects/#{url_encode project}/releases/#{tag_name}/assets/links", body: options)
45
+ end
46
+
47
+ # Update an asset as a link from a Release. You have to specify at least one of name or url
48
+ #
49
+ # @example
50
+ # Gitlab.update_project_release_link(5, 'v0.3', 1, { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' })
51
+ #
52
+ # @param [Integer, String] project The ID or name of a project.
53
+ # @param [String] tag_name The tag where the release will be created from.
54
+ # @param [Integer] link_id The id of the link.
55
+ # @param [Hash] options A customizable set of options.
56
+ # @option options [String] :name(optional) The name of the link.
57
+ # @option options [String] :url(optional) The URL of the link.
58
+ # @return [Gitlab::ObjectifiedHash] Information about the updated release link.
59
+ def update_project_release_link(project, tag_name, link_id, options = {})
60
+ put("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}", body: options)
61
+ end
62
+
63
+ # Delete an asset as a link from a Release.
64
+ #
65
+ # @example
66
+ # Gitlab.delete_project_release_link(5, 'v0.3', 1)
67
+ #
68
+ # @param [Integer, String] project The ID or name of a project.
69
+ # @param [String] tag_name The tag where the release will be created from.
70
+ # @param [Integer] link_id The id of the link.
71
+ # @return [Gitlab::ObjectifiedHash] Information about the deleted release link.
72
+ def delete_project_release_link(project, tag_name, link_id)
73
+ delete("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}")
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to project releases.
5
+ # @see https://docs.gitlab.com/ce/api/releases/
6
+ module ProjectReleases
7
+ # Returns Paginated list of a project's releases, sorted by created_at.
8
+ #
9
+ # @example
10
+ # Gitlab.project_releases(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] Paginated list of Releases, sorted by created_at.
14
+ def project_releases(project)
15
+ get("/projects/#{url_encode project}/releases")
16
+ end
17
+
18
+ # Gets a Release by a tag name
19
+ #
20
+ # @example
21
+ # Gitlab.project_release(5, 'v0.1')
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [String] tag_name The tag where the release will be created from..
25
+ # @return [Gitlab::ObjectifiedHash] Information about the release
26
+ def project_release(project, tag_name)
27
+ get("/projects/#{url_encode project}/releases/#{tag_name}")
28
+ end
29
+
30
+ # Creates a Release. You need push access to the repository to create a Release.
31
+ #
32
+ # @example
33
+ # Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release' })
34
+ # Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release', assets: { links: [{ name: 'hoge', url: 'https://google.com' }] } })
35
+ #
36
+ # @param [Integer, String] project The ID or name of a project.
37
+ # @param [Hash] options A customizable set of options.
38
+ # @option options [String] :name(required) The release name.
39
+ # @option options [String] :tag_name(required) The tag where the release will be created from.
40
+ # @option options [String] :description(required) The description of the release. You can use markdown.
41
+ # @option options [String] :ref(optional) If tag_name does not exist, the release will be created from ref. It can be a commit SHA, another tag name, or a branch name.
42
+ # @option options [Hash] :assets(optional) A customizable set of options for release assets
43
+ # @asset assets [Array<link>] :links(optional) An array of assets links as hashes.
44
+ # @link links [Hash] link_elements A combination of a link name and a link url
45
+ # @link_element [String] :name The name of the link.
46
+ # @link_element [String] :url The url of the link.
47
+ # @return [Gitlab::ObjectifiedHash] Information about the created release.
48
+ def create_project_release(project, options = {})
49
+ post("/projects/#{url_encode project}/releases", body: options)
50
+ end
51
+
52
+ # Updates a release.
53
+ #
54
+ # @example
55
+ # Gitlab.update_project_release(5, 'v0.3', { name: 'New Release', description: 'Super nice release' })
56
+ #
57
+ # @param [Integer, String] project The ID or name of a project.
58
+ # @param [String] tag_name The tag where the release will be created from.
59
+ # @param [Hash] options A customizable set of options.
60
+ # @option options [String] :name(optional) The release name.
61
+ # @option options [String] :description(optional) The description of the release. You can use markdown.
62
+ # @return [Gitlab::ObjectifiedHash] Information about the updated release.
63
+ def update_project_release(project, tag_name, options = {})
64
+ put("/projects/#{url_encode project}/releases/#{tag_name}", body: options)
65
+ end
66
+
67
+ # Delete a Release. Deleting a Release will not delete the associated tag.
68
+ #
69
+ # @example
70
+ # Gitlab.delete_project_release(5, 'v0.3')
71
+ #
72
+ # @param [Integer, String] project The ID or name of a project.
73
+ # @param [String] tag_name The tag where the release will be created from.
74
+ # @return [Gitlab::ObjectifiedHash] Information about the deleted release.
75
+ def delete_project_release(project, tag_name)
76
+ delete("/projects/#{url_encode project}/releases/#{tag_name}")
77
+ end
78
+ end
79
+ end