aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/xanzy/go-gitlab/settings.go
diff options
context:
space:
mode:
authorKevin Lyda <kevin@ie.suberic.net>2017-01-22 23:25:20 +0000
committerNiall Sheridan <nsheridan@gmail.com>2017-01-25 00:52:02 +0000
commit17d06d3003a796c76c7c5d8bfb0cab0aeb1bbf8f (patch)
treedef71020382848043027bd870cf6bf6fe86763d9 /vendor/github.com/xanzy/go-gitlab/settings.go
parentf635033e3e953e74d67b76a520c9760786330af5 (diff)
Create a gitlab auth source.
Defaults to public gitlab.com, but easily redirected to self-hosted installation.
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/settings.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/settings.go117
1 files changed, 117 insertions, 0 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/settings.go b/vendor/github.com/xanzy/go-gitlab/settings.go
new file mode 100644
index 0000000..cbb5523
--- /dev/null
+++ b/vendor/github.com/xanzy/go-gitlab/settings.go
@@ -0,0 +1,117 @@
+//
+// Copyright 2015, Sander van Harmelen
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package gitlab
+
+import "time"
+
+// SettingsService handles communication with the application SettingsService
+// related methods of the GitLab API.
+//
+// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
+type SettingsService struct {
+ client *Client
+}
+
+// Settings represents the GitLab application settings.
+//
+// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
+type Settings struct {
+ ID int `json:"id"`
+ DefaultProjectsLimit int `json:"default_projects_limit"`
+ SignupEnabled bool `json:"signup_enabled"`
+ SigninEnabled bool `json:"signin_enabled"`
+ GravatarEnabled bool `json:"gravatar_enabled"`
+ SignInText string `json:"sign_in_text"`
+ CreatedAt *time.Time `json:"created_at"`
+ UpdatedAt *time.Time `json:"updated_at"`
+ HomePageURL string `json:"home_page_url"`
+ DefaultBranchProtection int `json:"default_branch_protection"`
+ TwitterSharingEnabled bool `json:"twitter_sharing_enabled"`
+ RestrictedVisibilityLevels []VisibilityLevelValue `json:"restricted_visibility_levels"`
+ MaxAttachmentSize int `json:"max_attachment_size"`
+ SessionExpireDelay int `json:"session_expire_delay"`
+ DefaultProjectVisibility int `json:"default_project_visibility"`
+ DefaultSnippetVisibility int `json:"default_snippet_visibility"`
+ RestrictedSignupDomains []string `json:"restricted_signup_domains"`
+ UserOauthApplications bool `json:"user_oauth_applications"`
+ AfterSignOutPath string `json:"after_sign_out_path"`
+}
+
+func (s Settings) String() string {
+ return Stringify(s)
+}
+
+// GetSettings gets the current application settings.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/settings.html#get-current-application.settings
+func (s *SettingsService) GetSettings() (*Settings, *Response, error) {
+ req, err := s.client.NewRequest("GET", "application/settings", nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ as := new(Settings)
+ resp, err := s.client.Do(req, as)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return as, resp, err
+}
+
+// UpdateSettingsOptions represents the available UpdateSettings() options.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
+type UpdateSettingsOptions struct {
+ DefaultProjectsLimit *int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
+ SignupEnabled *bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
+ SigninEnabled *bool `url:"signin_enabled,omitempty" json:"signin_enabled,omitempty"`
+ GravatarEnabled *bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,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"`
+ 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 []VisibilityLevelValue `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"`
+ DefaultSnippetVisibility *int `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,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"`
+ AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
+}
+
+// UpdateSettings updates the application settings.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
+func (s *SettingsService) UpdateSettings(opt *UpdateSettingsOptions) (*Settings, *Response, error) {
+ req, err := s.client.NewRequest("PUT", "application/settings", opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ as := new(Settings)
+ resp, err := s.client.Do(req, as)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return as, resp, err
+}