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
b3ebd74a
Commit
b3ebd74a
authored
Feb 14, 2018
by
Jonarod
Committed by
Sander van Harmelen
Feb 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pages_domains API (#329)
parent
710fdc06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
0 deletions
+183
-0
gitlab.go
gitlab.go
+2
-0
pages_domains.go
pages_domains.go
+179
-0
projects.go
projects.go
+2
-0
No files found.
gitlab.go
View file @
b3ebd74a
...
...
@@ -255,6 +255,7 @@ type Client struct {
Namespaces
*
NamespacesService
Notes
*
NotesService
NotificationSettings
*
NotificationSettingsService
PagesDomains
*
PagesDomainsService
Pipelines
*
PipelinesService
PipelineTriggers
*
PipelineTriggersService
Projects
*
ProjectsService
...
...
@@ -335,6 +336,7 @@ func newClient(httpClient *http.Client, tokenType tokenType, token string) *Clie
c
.
Namespaces
=
&
NamespacesService
{
client
:
c
}
c
.
Notes
=
&
NotesService
{
client
:
c
}
c
.
NotificationSettings
=
&
NotificationSettingsService
{
client
:
c
}
c
.
PagesDomains
=
&
PagesDomainsService
{
client
:
c
}
c
.
Pipelines
=
&
PipelinesService
{
client
:
c
}
c
.
PipelineTriggers
=
&
PipelineTriggersService
{
client
:
c
}
c
.
Projects
=
&
ProjectsService
{
client
:
c
}
...
...
pages_domains.go
0 → 100644
View file @
b3ebd74a
package
gitlab
import
(
"fmt"
"net/url"
"time"
)
// PagesDomainsService handles Pages domains.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pages_domains.html
type
PagesDomainsService
struct
{
client
*
Client
}
type
Cert
struct
{
Expired
bool
`json:"expired"`
Expiration
*
time
.
Time
`json:"expiration"`
}
// PageDomain represents a pages domain.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pages_domains.html
type
PagesDomain
struct
{
Domain
string
`json:"domain"`
URL
string
`json:"url"`
ProjectID
int
`json:"project_id"`
Certificate
*
Cert
`json:"certificate"`
}
// ListPagesDomainsOptions represents the available ListPagesDomains() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pages_domais.html#list-pages-domains
type
ListPagesDomainsOptions
struct
{
ListOptions
}
// ListPagesDomains gets a list of project Domains.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
func
(
s
*
PagesDomainsService
)
ListPagesDomains
(
pid
interface
{},
opt
*
ListPagesDomainsOptions
,
options
...
OptionFunc
)
([]
*
PagesDomain
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pages/domains"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
var
pt
[]
*
PagesDomain
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
pt
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
pt
,
resp
,
err
}
// GetPagesDomains gets a specific Pages Domains for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/Pages_Domainss.html#get-Domains-details
func
(
s
*
PagesDomainsService
)
GetPagesDomains
(
pid
interface
{},
Domains
int
,
options
...
OptionFunc
)
(
*
PagesDomain
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pages/domains/%d"
,
url
.
QueryEscape
(
project
),
Domains
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
pt
:=
new
(
PagesDomain
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
pt
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
pt
,
resp
,
err
}
// AddPagesDomainOptions represents the available AddPagesDomain() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
type
AddPagesDomainOptions
struct
{
Domain
*
string
`url:"domain,omitempty" json:"domain,omitempty"`
Certificate
*
string
`url:"certifiate,omitempty" json:"certifiate,omitempty"`
Key
*
string
`url:"key,omitempty" json:"key,omitempty"`
}
// AddPagesDomain adds a pages domain to a specified project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
func
(
s
*
PagesDomainsService
)
AddPagesDomain
(
pid
interface
{},
opt
*
AddPagesDomainOptions
,
options
...
OptionFunc
)
(
*
PagesDomain
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pages/domains"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
pt
:=
new
(
PagesDomain
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
pt
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
pt
,
resp
,
err
}
// EditPagesDomainOptions represents the available EditPagesDomain() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
type
EditPagesDomainOptions
struct
{
ID
*
int
`url:"id,omitempty" json:"id,omitempty"`
Domain
*
string
`url:"domain,omitempty" json:"domain,omitempty"`
Cerificate
*
string
`url:"certifiate" json:"certifiate"`
Key
*
string
`url:"key" json:"key"`
}
// EditPagesDomain edits a domain for a specified project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
func
(
s
*
PagesDomainsService
)
EditPagesDomain
(
pid
interface
{},
trigger
int
,
opt
*
EditPagesDomainOptions
,
options
...
OptionFunc
)
(
*
PagesDomain
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pages/domains/%d"
,
url
.
QueryEscape
(
project
),
trigger
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
pt
:=
new
(
PagesDomain
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
pt
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
pt
,
resp
,
err
}
// DeletePagesDomain removes a domain from a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipeline_triggers.html#remove-a-project-trigger
func
(
s
*
PagesDomainsService
)
DeletePagesDomain
(
pid
interface
{},
trigger
int
,
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pages/domains/%d"
,
url
.
QueryEscape
(
project
),
trigger
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
err
}
return
s
.
client
.
Do
(
req
,
nil
)
}
projects.go
View file @
b3ebd74a
...
...
@@ -65,6 +65,8 @@ type Project struct {
LastActivityAt
*
time
.
Time
`json:"last_activity_at,omitempty"`
CreatorID
int
`json:"creator_id"`
Namespace
*
ProjectNamespace
`json:"namespace"`
ImportStatus
string
`json:"import_status"`
ImportError
string
`json:"import_error"`
Permissions
*
Permissions
`json:"permissions"`
Archived
bool
`json:"archived"`
AvatarURL
string
`json:"avatar_url"`
...
...
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