Commit df6c9365 authored by Sander van Harmelen's avatar Sander van Harmelen

Update `VisibilityLevel` to just `Visibility` (#176)

parent 0d95cf7f
...@@ -87,7 +87,7 @@ func main() { ...@@ -87,7 +87,7 @@ func main() {
Description: gitlab.String("Just a test project to play with"), Description: gitlab.String("Just a test project to play with"),
MergeRequestsEnabled: gitlab.Bool(true), MergeRequestsEnabled: gitlab.Bool(true),
SnippetsEnabled: gitlab.Bool(true), SnippetsEnabled: gitlab.Bool(true),
VisibilityLevel: gitlab.VisibilityLevel(gitlab.PublicVisibility), Visibility: gitlab.VisibilityLevel(gitlab.PublicVisibility),
} }
project, _, err := git.Projects.CreateProject(p) project, _, err := git.Projects.CreateProject(p)
if err != nil { if err != nil {
...@@ -99,7 +99,7 @@ func main() { ...@@ -99,7 +99,7 @@ func main() {
Title: gitlab.String("Dummy Snippet"), Title: gitlab.String("Dummy Snippet"),
FileName: gitlab.String("snippet.go"), FileName: gitlab.String("snippet.go"),
Code: gitlab.String("package main...."), Code: gitlab.String("package main...."),
VisibilityLevel: gitlab.VisibilityLevel(gitlab.PublicVisibility), Visibility: gitlab.VisibilityLevel(gitlab.PublicVisibility),
} }
_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s) _, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
if err != nil { if err != nil {
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ func projectExample() { ...@@ -15,7 +15,7 @@ func projectExample() {
Description: gitlab.String("Just a test project to play with"), Description: gitlab.String("Just a test project to play with"),
MergeRequestsEnabled: gitlab.Bool(true), MergeRequestsEnabled: gitlab.Bool(true),
SnippetsEnabled: gitlab.Bool(true), SnippetsEnabled: gitlab.Bool(true),
VisibilityLevel: gitlab.VisibilityLevel(gitlab.PublicVisibility), Visibility: gitlab.Visibility(gitlab.PublicVisibility),
} }
project, _, err := git.Projects.CreateProject(p) project, _, err := git.Projects.CreateProject(p)
if err != nil { if err != nil {
...@@ -24,10 +24,10 @@ func projectExample() { ...@@ -24,10 +24,10 @@ func projectExample() {
// Add a new snippet // Add a new snippet
s := &gitlab.CreateSnippetOptions{ s := &gitlab.CreateSnippetOptions{
Title: gitlab.String("Dummy Snippet"), Title: gitlab.String("Dummy Snippet"),
FileName: gitlab.String("snippet.go"), FileName: gitlab.String("snippet.go"),
Code: gitlab.String("package main...."), Code: gitlab.String("package main...."),
VisibilityLevel: gitlab.VisibilityLevel(gitlab.PublicVisibility), Visibility: gitlab.Visibility(gitlab.PublicVisibility),
} }
_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s) _, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
if err != nil { if err != nil {
......
...@@ -127,18 +127,18 @@ var notificationLevelTypes = map[string]NotificationLevelValue{ ...@@ -127,18 +127,18 @@ var notificationLevelTypes = map[string]NotificationLevelValue{
"custom": CustomNotificationLevel, "custom": CustomNotificationLevel,
} }
// VisibilityLevelValue represents a visibility level within GitLab. // VisibilityValue represents a visibility level within GitLab.
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/ // GitLab API docs: https://docs.gitlab.com/ce/api/
type VisibilityLevelValue string type VisibilityValue string
// List of available visibility levels // List of available visibility levels
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/ // GitLab API docs: https://docs.gitlab.com/ce/api/
const ( const (
PrivateVisibility VisibilityLevelValue = "private" PrivateVisibility VisibilityValue = "private"
InternalVisibility VisibilityLevelValue = "internal" InternalVisibility VisibilityValue = "internal"
PublicVisibility VisibilityLevelValue = "public" PublicVisibility VisibilityValue = "public"
) )
// A Client manages communication with the GitLab API. // A Client manages communication with the GitLab API.
...@@ -602,10 +602,10 @@ func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { ...@@ -602,10 +602,10 @@ func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue {
return p return p
} }
// VisibilityLevel is a helper routine that allocates a new VisibilityLevelValue // Visibility is a helper routine that allocates a new VisibilityValue
// to store v and returns a pointer to it. // to store v and returns a pointer to it.
func VisibilityLevel(v VisibilityLevelValue) *VisibilityLevelValue { func Visibility(v VisibilityValue) *VisibilityValue {
p := new(VisibilityLevelValue) p := new(VisibilityValue)
*p = v *p = v
return p return p
} }
...@@ -34,19 +34,19 @@ type GroupsService struct { ...@@ -34,19 +34,19 @@ type GroupsService struct {
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
type Group struct { type Group struct {
ID int `json:"id"` ID int `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Path string `json:"path"` Path string `json:"path"`
Description string `json:"description"` Description string `json:"description"`
AvatarURL string `json:"avatar_url"` AvatarURL string `json:"avatar_url"`
FullName string `json:"full_name"` FullName string `json:"full_name"`
FullPath string `json:"full_path"` FullPath string `json:"full_path"`
LFSEnabled bool `json:"lfs_enabled"` LFSEnabled bool `json:"lfs_enabled"`
Projects []*Project `json:"projects"` Projects []*Project `json:"projects"`
Statistics *StorageStatistics `json:"statistics"` Statistics *StorageStatistics `json:"statistics"`
RequestAccessEnabled bool `json:"request_access_enabled"` RequestAccessEnabled bool `json:"request_access_enabled"`
Visibility *VisibilityLevelValue `json:"visibility"` Visibility *VisibilityValue `json:"visibility"`
WebURL string `json:"web_url"` WebURL string `json:"web_url"`
} }
// ListGroupsOptions represents the available ListGroups() options. // ListGroupsOptions represents the available ListGroups() options.
...@@ -109,12 +109,12 @@ func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group ...@@ -109,12 +109,12 @@ func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
type CreateGroupOptions struct { type CreateGroupOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"` Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"` Path *string `url:"path,omitempty" json:"path,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"` Description *string `url:"description,omitempty" json:"description,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
VisibilityLevel *VisibilityLevelValue `url:"visibility,omitempty" json:"visibility,omitempty"` Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
} }
// CreateGroup creates a new project group. Available only for users who can // CreateGroup creates a new project group. Available only for users who can
......
...@@ -119,10 +119,10 @@ func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, option ...@@ -119,10 +119,10 @@ func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, option
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/project_snippets.md#create-new-snippet // https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/project_snippets.md#create-new-snippet
type CreateSnippetOptions struct { type CreateSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"` Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"` FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code *string `url:"code,omitempty" json:"code,omitempty"` Code *string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel *VisibilityLevelValue `url:"visibility,omitempty" json:"visibility,omitempty"` Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
} }
// CreateSnippet creates a new project snippet. The user must have permission // CreateSnippet creates a new project snippet. The user must have permission
...@@ -156,10 +156,10 @@ func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateSnipp ...@@ -156,10 +156,10 @@ func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateSnipp
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/project_snippets.md#update-snippet // https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/project_snippets.md#update-snippet
type UpdateSnippetOptions struct { type UpdateSnippetOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"` Title *string `url:"title,omitempty" json:"title,omitempty"`
FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"` FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code *string `url:"code,omitempty" json:"code,omitempty"` Code *string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel *VisibilityLevelValue `url:"visibility,omitempty" json:"visibility,omitempty"` Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
} }
// UpdateSnippet updates an existing project snippet. The user must have // UpdateSnippet updates an existing project snippet. The user must have
......
This diff is collapsed.
...@@ -33,7 +33,7 @@ func TestListProjects(t *testing.T) { ...@@ -33,7 +33,7 @@ func TestListProjects(t *testing.T) {
Sort: String("asc"), Sort: String("asc"),
Search: String("query"), Search: String("query"),
Simple: Bool(true), Simple: Bool(true),
Visibility: VisibilityLevel(PublicVisibility), Visibility: Visibility(PublicVisibility),
} }
projects, _, err := client.Projects.ListProjects(opt) projects, _, err := client.Projects.ListProjects(opt)
...@@ -75,7 +75,7 @@ func TestListOwnedProjects(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestListOwnedProjects(t *testing.T) {
Search: String("query"), Search: String("query"),
Simple: Bool(true), Simple: Bool(true),
Owned: Bool(true), Owned: Bool(true),
Visibility: VisibilityLevel(PublicVisibility), Visibility: Visibility(PublicVisibility),
} }
projects, _, err := client.Projects.ListProjects(opt) projects, _, err := client.Projects.ListProjects(opt)
...@@ -117,7 +117,7 @@ func TestListStarredProjects(t *testing.T) { ...@@ -117,7 +117,7 @@ func TestListStarredProjects(t *testing.T) {
Search: String("query"), Search: String("query"),
Simple: Bool(true), Simple: Bool(true),
Starred: Bool(true), Starred: Bool(true),
Visibility: VisibilityLevel(PublicVisibility), Visibility: Visibility(PublicVisibility),
} }
projects, _, err := client.Projects.ListProjects(opt) projects, _, err := client.Projects.ListProjects(opt)
......
...@@ -32,25 +32,25 @@ type SettingsService struct { ...@@ -32,25 +32,25 @@ type SettingsService struct {
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/settings.md // https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/settings.md
type Settings struct { type Settings struct {
ID int `json:"id"` ID int `json:"id"`
DefaultProjectsLimit int `json:"default_projects_limit"` DefaultProjectsLimit int `json:"default_projects_limit"`
SignupEnabled bool `json:"signup_enabled"` SignupEnabled bool `json:"signup_enabled"`
SigninEnabled bool `json:"signin_enabled"` SigninEnabled bool `json:"signin_enabled"`
GravatarEnabled bool `json:"gravatar_enabled"` GravatarEnabled bool `json:"gravatar_enabled"`
SignInText string `json:"sign_in_text"` SignInText string `json:"sign_in_text"`
CreatedAt *time.Time `json:"created_at"` CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"` UpdatedAt *time.Time `json:"updated_at"`
HomePageURL string `json:"home_page_url"` HomePageURL string `json:"home_page_url"`
DefaultBranchProtection int `json:"default_branch_protection"` DefaultBranchProtection int `json:"default_branch_protection"`
TwitterSharingEnabled bool `json:"twitter_sharing_enabled"` TwitterSharingEnabled bool `json:"twitter_sharing_enabled"`
RestrictedVisibilityLevels []VisibilityLevelValue `json:"restricted_visibility_levels"` RestrictedVisibilityLevels []VisibilityValue `json:"restricted_visibility_levels"`
MaxAttachmentSize int `json:"max_attachment_size"` MaxAttachmentSize int `json:"max_attachment_size"`
SessionExpireDelay int `json:"session_expire_delay"` SessionExpireDelay int `json:"session_expire_delay"`
DefaultProjectVisibility int `json:"default_project_visibility"` DefaultProjectVisibility int `json:"default_project_visibility"`
DefaultSnippetVisibility int `json:"default_snippet_visibility"` DefaultSnippetVisibility int `json:"default_snippet_visibility"`
RestrictedSignupDomains []string `json:"restricted_signup_domains"` RestrictedSignupDomains []string `json:"restricted_signup_domains"`
UserOauthApplications bool `json:"user_oauth_applications"` UserOauthApplications bool `json:"user_oauth_applications"`
AfterSignOutPath string `json:"after_sign_out_path"` AfterSignOutPath string `json:"after_sign_out_path"`
} }
func (s Settings) String() string { func (s Settings) String() string {
...@@ -81,22 +81,22 @@ func (s *SettingsService) GetSettings(options ...OptionFunc) (*Settings, *Respon ...@@ -81,22 +81,22 @@ func (s *SettingsService) GetSettings(options ...OptionFunc) (*Settings, *Respon
// GitLab API docs: // GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/settings.md#change-application.settings // https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/settings.md#change-application.settings
type UpdateSettingsOptions struct { type UpdateSettingsOptions struct {
DefaultProjectsLimit *int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"` DefaultProjectsLimit *int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
SignupEnabled *bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"` SignupEnabled *bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
SigninEnabled *bool `url:"signin_enabled,omitempty" json:"signin_enabled,omitempty"` SigninEnabled *bool `url:"signin_enabled,omitempty" json:"signin_enabled,omitempty"`
GravatarEnabled *bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"` GravatarEnabled *bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"`
SignInText *string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"` SignInText *string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"`
HomePageURL *string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"` HomePageURL *string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
DefaultBranchProtection *int `url:"default_branch_protection,omitempty" json:"default_branch_protection,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"` TwitterSharingEnabled *bool `url:"twitter_sharing_enabled,omitempty" json:"twitter_sharing_enabled,omitempty"`
RestrictedVisibilityLevels []VisibilityLevelValue `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"` MaxAttachmentSize *int `url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
SessionExpireDelay *int `url:"session_expire_delay,omitempty" json:"session_expire_delay,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"` DefaultProjectVisibility *int `url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
DefaultSnippetVisibility *int `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"` DefaultSnippetVisibility *int `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"`
RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty" json:"restricted_signup_domains,omitempty"` RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty" json:"restricted_signup_domains,omitempty"`
UserOauthApplications *bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"` UserOauthApplications *bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"`
AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"` AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
} }
// UpdateSettings updates the application settings. // UpdateSettings updates the application settings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment