Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
b4f7417b
Commit
b4f7417b
authored
Sep 11, 2018
by
lillilli
Committed by
Sander van Harmelen
Sep 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Gitlab CI YML templates API (#467)
parent
3c183b7d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
3 deletions
+75
-3
README.md
README.md
+3
-3
ci_yml_templates.go
ci_yml_templates.go
+70
-0
gitlab.go
gitlab.go
+2
-0
No files found.
README.md
View file @
b4f7417b
...
@@ -36,9 +36,9 @@ to add new and/or missing endpoints. Currently the following services are suppor
...
@@ -36,9 +36,9 @@ to add new and/or missing endpoints. Currently the following services are suppor
-
[
x
]
Feature flags
-
[
x
]
Feature flags
-
[
]
Geo Nodes
-
[
]
Geo Nodes
-
[
x
]
Gitignores templates
-
[
x
]
Gitignores templates
-
[
]
GitLab CI Config templates
-
[
x
]
GitLab CI Config templates
-
[
x
]
Groups
-
[
x
]
Groups
-
[
]
Group Access Requests
-
[
x
]
Group Access Requests
-
[
x
]
Group Members
-
[
x
]
Group Members
-
[
x
]
Issues
-
[
x
]
Issues
-
[
x
]
Issue Boards
-
[
x
]
Issue Boards
...
@@ -50,7 +50,7 @@ to add new and/or missing endpoints. Currently the following services are suppor
...
@@ -50,7 +50,7 @@ to add new and/or missing endpoints. Currently the following services are suppor
-
[
x
]
Merge Requests
-
[
x
]
Merge Requests
-
[
x
]
Merge Request Approvals
-
[
x
]
Merge Request Approvals
-
[
x
]
Project Milestones
-
[
x
]
Project Milestones
-
[
]
Group Milestones
-
[
x
]
Group Milestones
-
[
x
]
Namespaces
-
[
x
]
Namespaces
-
[
x
]
Notes (comments)
-
[
x
]
Notes (comments)
-
[
]
Discussions (threaded comments)
-
[
]
Discussions (threaded comments)
...
...
ci_yml_templates.go
0 → 100644
View file @
b4f7417b
package
gitlab
import
(
"fmt"
"net/url"
)
// CIYMLTemplatesService handles communication with the gitlab
// CI YML templates related methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
type
CIYMLTemplatesService
struct
{
client
*
Client
}
// CIYMLTemplate represents a GitLab CI YML template.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
type
CIYMLTemplate
struct
{
Name
string
`json:"name"`
Content
string
`json:"content"`
}
// ListCIYMLTemplatesOptions represents the available ListAllTemplates() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
type
ListCIYMLTemplatesOptions
ListOptions
// ListAllTemplates get all GitLab CI YML templates.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#list-gitlab-ci-yml-templates
func
(
s
*
CIYMLTemplatesService
)
ListAllTemplates
(
opt
*
ListCIYMLTemplatesOptions
,
options
...
OptionFunc
)
([]
*
CIYMLTemplate
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"templates/gitlab_ci_ymls"
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
var
cts
[]
*
CIYMLTemplate
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
cts
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
cts
,
resp
,
err
}
// GetTemplate get a single GitLab CI YML template.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#single-gitlab-ci-yml-template
func
(
s
*
CIYMLTemplatesService
)
GetTemplate
(
key
string
,
options
...
OptionFunc
)
(
*
CIYMLTemplate
,
*
Response
,
error
)
{
u
:=
fmt
.
Sprintf
(
"templates/gitlab_ci_ymls/%s"
,
url
.
QueryEscape
(
key
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
ct
:=
new
(
CIYMLTemplate
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
ct
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
ct
,
resp
,
err
}
gitlab.go
View file @
b4f7417b
...
@@ -278,6 +278,7 @@ type Client struct {
...
@@ -278,6 +278,7 @@ type Client struct {
Branches
*
BranchesService
Branches
*
BranchesService
BuildVariables
*
BuildVariablesService
BuildVariables
*
BuildVariablesService
BroadcastMessage
*
BroadcastMessagesService
BroadcastMessage
*
BroadcastMessagesService
CIYMLTemplate
*
CIYMLTemplatesService
Commits
*
CommitsService
Commits
*
CommitsService
CustomAttribute
*
CustomAttributesService
CustomAttribute
*
CustomAttributesService
DeployKeys
*
DeployKeysService
DeployKeys
*
DeployKeysService
...
@@ -415,6 +416,7 @@ func newClient(httpClient *http.Client) *Client {
...
@@ -415,6 +416,7 @@ func newClient(httpClient *http.Client) *Client {
c
.
Branches
=
&
BranchesService
{
client
:
c
}
c
.
Branches
=
&
BranchesService
{
client
:
c
}
c
.
BuildVariables
=
&
BuildVariablesService
{
client
:
c
}
c
.
BuildVariables
=
&
BuildVariablesService
{
client
:
c
}
c
.
BroadcastMessage
=
&
BroadcastMessagesService
{
client
:
c
}
c
.
BroadcastMessage
=
&
BroadcastMessagesService
{
client
:
c
}
c
.
CIYMLTemplate
=
&
CIYMLTemplatesService
{
client
:
c
}
c
.
Commits
=
&
CommitsService
{
client
:
c
}
c
.
Commits
=
&
CommitsService
{
client
:
c
}
c
.
CustomAttribute
=
&
CustomAttributesService
{
client
:
c
}
c
.
CustomAttribute
=
&
CustomAttributesService
{
client
:
c
}
c
.
DeployKeys
=
&
DeployKeysService
{
client
:
c
}
c
.
DeployKeys
=
&
DeployKeysService
{
client
:
c
}
...
...
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