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
df6c9365
Commit
df6c9365
authored
May 18, 2017
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update `VisibilityLevel` to just `Visibility` (#176)
parent
0d95cf7f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
35 deletions
+47
-35
README.md
README.md
+2
-2
events.go
events.go
+10
-10
projects.go
examples/projects.go
+2
-2
gitlab.go
gitlab.go
+8
-8
groups.go
groups.go
+2
-2
project_snippets.go
project_snippets.go
+2
-2
projects.go
projects.go
+16
-4
projects_test.go
projects_test.go
+3
-3
settings.go
settings.go
+2
-2
No files found.
README.md
View file @
df6c9365
...
...
@@ -87,7 +87,7 @@ func main() {
Description
:
gitlab
.
String
(
"Just a test project to play with"
),
MergeRequestsEnabled
:
gitlab
.
Bool
(
true
),
SnippetsEnabled
:
gitlab
.
Bool
(
true
),
Visibility
Level
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
Visibility
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
}
project
,
_
,
err
:=
git
.
Projects
.
CreateProject
(
p
)
if
err
!=
nil
{
...
...
@@ -99,7 +99,7 @@ func main() {
Title
:
gitlab
.
String
(
"Dummy Snippet"
),
FileName
:
gitlab
.
String
(
"snippet.go"
),
Code
:
gitlab
.
String
(
"package main...."
),
Visibility
Level
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
Visibility
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
}
_
,
_
,
err
=
git
.
ProjectSnippets
.
CreateSnippet
(
project
.
ID
,
s
)
if
err
!=
nil
{
...
...
events.go
View file @
df6c9365
...
...
@@ -47,7 +47,7 @@ type PushEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
Commits
[]
*
Commit
`json:"commits"`
...
...
@@ -82,7 +82,7 @@ type TagEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
Commits
[]
*
Commit
`json:"commits"`
...
...
@@ -110,7 +110,7 @@ type IssueEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
ObjectAttributes
struct
{
...
...
@@ -159,7 +159,7 @@ type CommitCommentEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
ObjectAttributes
struct
{
...
...
@@ -211,7 +211,7 @@ type MergeCommentEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
ObjectAttributes
struct
{
...
...
@@ -255,7 +255,7 @@ type IssueCommentEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
ObjectAttributes
struct
{
...
...
@@ -299,7 +299,7 @@ type SnippetCommentEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Repository
*
Repository
`json:"repository"`
ObjectAttributes
struct
{
...
...
@@ -342,7 +342,7 @@ type MergeEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
ObjectAttributes
struct
{
ID
int
`json:"id"`
...
...
@@ -425,7 +425,7 @@ type WikiPageEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Wiki
struct
{
WebURL
string
`json:"web_url"`
...
...
@@ -482,7 +482,7 @@ type PipelineEvent struct {
SSHURL
string
`json:"ssh_url"`
HTTPURL
string
`json:"http_url"`
WebURL
string
`json:"web_url"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
}
`json:"project"`
Commit
struct
{
ID
string
`json:"id"`
...
...
examples/projects.go
View file @
df6c9365
...
...
@@ -15,7 +15,7 @@ func projectExample() {
Description
:
gitlab
.
String
(
"Just a test project to play with"
),
MergeRequestsEnabled
:
gitlab
.
Bool
(
true
),
SnippetsEnabled
:
gitlab
.
Bool
(
true
),
Visibility
Level
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
Visibility
:
gitlab
.
Visibility
(
gitlab
.
PublicVisibility
),
}
project
,
_
,
err
:=
git
.
Projects
.
CreateProject
(
p
)
if
err
!=
nil
{
...
...
@@ -27,7 +27,7 @@ func projectExample() {
Title
:
gitlab
.
String
(
"Dummy Snippet"
),
FileName
:
gitlab
.
String
(
"snippet.go"
),
Code
:
gitlab
.
String
(
"package main...."
),
Visibility
Level
:
gitlab
.
VisibilityLevel
(
gitlab
.
PublicVisibility
),
Visibility
:
gitlab
.
Visibility
(
gitlab
.
PublicVisibility
),
}
_
,
_
,
err
=
git
.
ProjectSnippets
.
CreateSnippet
(
project
.
ID
,
s
)
if
err
!=
nil
{
...
...
gitlab.go
View file @
df6c9365
...
...
@@ -127,18 +127,18 @@ var notificationLevelTypes = map[string]NotificationLevelValue{
"custom"
:
CustomNotificationLevel
,
}
// Visibility
Level
Value represents a visibility level within GitLab.
// VisibilityValue represents a visibility level within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/
type
Visibility
Level
Value
string
type
VisibilityValue
string
// List of available visibility levels
//
// GitLab API docs: https://docs.gitlab.com/ce/api/
const
(
PrivateVisibility
Visibility
Level
Value
=
"private"
InternalVisibility
Visibility
Level
Value
=
"internal"
PublicVisibility
Visibility
Level
Value
=
"public"
PrivateVisibility
VisibilityValue
=
"private"
InternalVisibility
VisibilityValue
=
"internal"
PublicVisibility
VisibilityValue
=
"public"
)
// A Client manages communication with the GitLab API.
...
...
@@ -602,10 +602,10 @@ func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue {
return
p
}
// Visibility
Level is a helper routine that allocates a new VisibilityLevel
Value
// Visibility
is a helper routine that allocates a new Visibility
Value
// to store v and returns a pointer to it.
func
Visibility
Level
(
v
VisibilityLevelValue
)
*
VisibilityLevel
Value
{
p
:=
new
(
Visibility
Level
Value
)
func
Visibility
(
v
VisibilityValue
)
*
Visibility
Value
{
p
:=
new
(
VisibilityValue
)
*
p
=
v
return
p
}
groups.go
View file @
df6c9365
...
...
@@ -45,7 +45,7 @@ type Group struct {
Projects
[]
*
Project
`json:"projects"`
Statistics
*
StorageStatistics
`json:"statistics"`
RequestAccessEnabled
bool
`json:"request_access_enabled"`
Visibility
*
Visibility
LevelValue
`json:"visibility"`
Visibility
*
Visibility
Value
`json:"visibility"`
WebURL
string
`json:"web_url"`
}
...
...
@@ -114,7 +114,7 @@ type CreateGroupOptions struct {
Description
*
string
`url:"description,omitempty" json:"description,omitempty"`
LFSEnabled
*
bool
`url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled
*
bool
`url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
Visibility
Level
*
VisibilityLevel
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
Visibility
*
Visibility
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
}
// CreateGroup creates a new project group. Available only for users who can
...
...
project_snippets.go
View file @
df6c9365
...
...
@@ -122,7 +122,7 @@ type CreateSnippetOptions struct {
Title
*
string
`url:"title,omitempty" json:"title,omitempty"`
FileName
*
string
`url:"file_name,omitempty" json:"file_name,omitempty"`
Code
*
string
`url:"code,omitempty" json:"code,omitempty"`
Visibility
Level
*
VisibilityLevel
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
Visibility
*
Visibility
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
}
// CreateSnippet creates a new project snippet. The user must have permission
...
...
@@ -159,7 +159,7 @@ type UpdateSnippetOptions struct {
Title
*
string
`url:"title,omitempty" json:"title,omitempty"`
FileName
*
string
`url:"file_name,omitempty" json:"file_name,omitempty"`
Code
*
string
`url:"code,omitempty" json:"code,omitempty"`
Visibility
Level
*
VisibilityLevel
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
Visibility
*
Visibility
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
}
// UpdateSnippet updates an existing project snippet. The user must have
...
...
projects.go
View file @
df6c9365
...
...
@@ -38,7 +38,7 @@ type Project struct {
Description
string
`json:"description"`
DefaultBranch
string
`json:"default_branch"`
Public
bool
`json:"public"`
Visibility
Level
VisibilityLevelValue
`json:"visibility"`
Visibility
VisibilityValue
`json:"visibility"`
SSHURLToRepo
string
`json:"ssh_url_to_repo"`
HTTPURLToRepo
string
`json:"http_url_to_repo"`
WebURL
string
`json:"web_url"`
...
...
@@ -72,6 +72,7 @@ type Project struct {
OnlyAllowMergeIfAllDiscussionsAreResolved
bool
`json:"only_allow_merge_if_all_discussions_are_resolved"`
LFSEnabled
bool
`json:"lfs_enabled"`
RequestAccessEnabled
bool
`json:"request_access_enabled"`
ForkedFromProject
*
ForkParent
`json:"forked_from_project"`
SharedWithGroups
[]
struct
{
GroupID
int
`json:"group_id"`
GroupName
string
`json:"group_name"`
...
...
@@ -89,7 +90,7 @@ type Repository struct {
GitSSHURL
string
`json:"git_ssh_url"`
GitHTTPURL
string
`json:"git_http_url"`
Namespace
string
`json:"namespace"`
Visibility
Level
VisibilityLevel
Value
`json:"visibility"`
Visibility
Visibility
Value
`json:"visibility"`
PathWithNamespace
string
`json:"path_with_namespace"`
DefaultBranch
string
`json:"default_branch"`
Homepage
string
`json:"homepage"`
...
...
@@ -141,6 +142,17 @@ type GroupAccess struct {
NotificationLevel
NotificationLevelValue
`json:"notification_level"`
}
// ForkParent represents the parent project when this is a fork.
type
ForkParent
struct
{
HTTPURLToRepo
string
`json:"http_url_to_repo"`
ID
int
`json:"id"`
Name
string
`json:"name"`
NameWithNamespace
string
`json:"name_with_namespace"`
Path
string
`json:"path"`
PathWithNamespace
string
`json:"path_with_namespace"`
WebURL
string
`json:"web_url"`
}
func
(
s
Project
)
String
()
string
{
return
Stringify
(
s
)
}
...
...
@@ -159,7 +171,7 @@ type ListProjectsOptions struct {
Membership
*
bool
`url:"membership,omitempty" json:"membership,omitempty"`
Starred
*
bool
`url:"starred,omitempty" json:"starred,omitempty"`
Statistics
*
bool
`url:"statistics,omitempty" json:"statistics,omitempty"`
Visibility
*
Visibility
Level
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
Visibility
*
VisibilityValue
`url:"visibility,omitempty" json:"visibility,omitempty"`
}
// ListProjects gets a list of projects accessible by the authenticated user.
...
...
@@ -285,7 +297,7 @@ type CreateProjectOptions struct {
SnippetsEnabled
*
bool
`url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
ContainerRegistryEnabled
*
bool
`url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
SharedRunnersEnabled
*
bool
`url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
Visibility
*
Visibility
Level
Value
`url:"visibility,omitempty" json:"visibility,omitempty"`
Visibility
*
VisibilityValue
`url:"visibility,omitempty" json:"visibility,omitempty"`
ImportURL
*
string
`url:"import_url,omitempty" json:"import_url,omitempty"`
PublicJobs
*
bool
`url:"public_jobs,omitempty" json:"public_jobs,omitempty"`
OnlyAllowMergeIfPipelineSucceeds
*
bool
`url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
...
...
projects_test.go
View file @
df6c9365
...
...
@@ -33,7 +33,7 @@ func TestListProjects(t *testing.T) {
Sort
:
String
(
"asc"
),
Search
:
String
(
"query"
),
Simple
:
Bool
(
true
),
Visibility
:
Visibility
Level
(
PublicVisibility
),
Visibility
:
Visibility
(
PublicVisibility
),
}
projects
,
_
,
err
:=
client
.
Projects
.
ListProjects
(
opt
)
...
...
@@ -75,7 +75,7 @@ func TestListOwnedProjects(t *testing.T) {
Search
:
String
(
"query"
),
Simple
:
Bool
(
true
),
Owned
:
Bool
(
true
),
Visibility
:
Visibility
Level
(
PublicVisibility
),
Visibility
:
Visibility
(
PublicVisibility
),
}
projects
,
_
,
err
:=
client
.
Projects
.
ListProjects
(
opt
)
...
...
@@ -117,7 +117,7 @@ func TestListStarredProjects(t *testing.T) {
Search
:
String
(
"query"
),
Simple
:
Bool
(
true
),
Starred
:
Bool
(
true
),
Visibility
:
Visibility
Level
(
PublicVisibility
),
Visibility
:
Visibility
(
PublicVisibility
),
}
projects
,
_
,
err
:=
client
.
Projects
.
ListProjects
(
opt
)
...
...
settings.go
View file @
df6c9365
...
...
@@ -43,7 +43,7 @@ type Settings struct {
HomePageURL
string
`json:"home_page_url"`
DefaultBranchProtection
int
`json:"default_branch_protection"`
TwitterSharingEnabled
bool
`json:"twitter_sharing_enabled"`
RestrictedVisibilityLevels
[]
Visibility
Level
Value
`json:"restricted_visibility_levels"`
RestrictedVisibilityLevels
[]
VisibilityValue
`json:"restricted_visibility_levels"`
MaxAttachmentSize
int
`json:"max_attachment_size"`
SessionExpireDelay
int
`json:"session_expire_delay"`
DefaultProjectVisibility
int
`json:"default_project_visibility"`
...
...
@@ -89,7 +89,7 @@ type UpdateSettingsOptions struct {
HomePageURL
*
string
`url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
DefaultBranchProtection
*
int
`url:"default_branch_protection,omitempty" json:"default_branch_protection,omitempty"`
TwitterSharingEnabled
*
bool
`url:"twitter_sharing_enabled,omitempty" json:"twitter_sharing_enabled,omitempty"`
RestrictedVisibilityLevels
[]
Visibility
Level
Value
`url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
RestrictedVisibilityLevels
[]
VisibilityValue
`url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
MaxAttachmentSize
*
int
`url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
SessionExpireDelay
*
int
`url:"session_expire_delay,omitempty" json:"session_expire_delay,omitempty"`
DefaultProjectVisibility
*
int
`url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
...
...
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