diff --git a/go.mod b/go.mod index 5b33aee..07fd399 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/sj14/review-bot require ( github.com/google/go-github/v25 v25.1.3 github.com/stretchr/testify v1.8.4 - github.com/xanzy/go-gitlab v0.95.2 + github.com/xanzy/go-gitlab v0.96.0 golang.org/x/oauth2 v0.16.0 ) diff --git a/go.sum b/go.sum index 13a040d..17a8a68 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xanzy/go-gitlab v0.95.2 h1:4p0IirHqEp5f0baK/aQqr4TR57IsD+8e4fuyAA1yi88= -github.com/xanzy/go-gitlab v0.95.2/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= +github.com/xanzy/go-gitlab v0.96.0 h1:LGkZ+wSNMRtHIBaYE4Hq3dZVjprwHv3Y1+rhKU3WETs= +github.com/xanzy/go-gitlab v0.96.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= diff --git a/vendor/github.com/xanzy/go-gitlab/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go index a0e2f88..eecccc4 100644 --- a/vendor/github.com/xanzy/go-gitlab/issues.go +++ b/vendor/github.com/xanzy/go-gitlab/issues.go @@ -511,6 +511,38 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Reque return s.client.Do(req, nil) } +// ReorderIssueOptions represents the available ReorderIssue() options. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#reorder-an-issue +type ReorderIssueOptions struct { + MoveAfterID *int `url:"move_after_id,omitempty" json:"move_after_id,omitempty"` + MoveBeforeID *int `url:"move_before_id,omitempty" json:"move_before_id,omitempty"` +} + +// ReorderIssue reorders an issue. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#reorder-an-issue +func (s *IssuesService) ReorderIssue(pid interface{}, issue int, opt *ReorderIssueOptions, options ...RequestOptionFunc) (*Issue, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/issues/%d/reorder", PathEscape(project), issue) + + req, err := s.client.NewRequest(http.MethodPut, u, opt, options) + if err != nil { + return nil, nil, err + } + + i := new(Issue) + resp, err := s.client.Do(req, i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + // MoveIssueOptions represents the available MoveIssue() options. // // GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#move-an-issue diff --git a/vendor/github.com/xanzy/go-gitlab/notes.go b/vendor/github.com/xanzy/go-gitlab/notes.go index 5e80f14..0c57ae2 100644 --- a/vendor/github.com/xanzy/go-gitlab/notes.go +++ b/vendor/github.com/xanzy/go-gitlab/notes.go @@ -50,15 +50,18 @@ type Note struct { WebURL string `json:"web_url"` } `json:"author"` System bool `json:"system"` - ExpiresAt *time.Time `json:"expires_at"` - UpdatedAt *time.Time `json:"updated_at"` CreatedAt *time.Time `json:"created_at"` - NoteableID int `json:"noteable_id"` - NoteableType string `json:"noteable_type"` + UpdatedAt *time.Time `json:"updated_at"` + ExpiresAt *time.Time `json:"expires_at"` CommitID string `json:"commit_id"` Position *NotePosition `json:"position"` + NoteableID int `json:"noteable_id"` + NoteableType string `json:"noteable_type"` + ProjectID int `json:"project_id"` + NoteableIID int `json:"noteable_iid"` Resolvable bool `json:"resolvable"` Resolved bool `json:"resolved"` + ResolvedAt *time.Time `json:"resolved_at"` ResolvedBy struct { ID int `json:"id"` Username string `json:"username"` @@ -68,8 +71,8 @@ type Note struct { AvatarURL string `json:"avatar_url"` WebURL string `json:"web_url"` } `json:"resolved_by"` - ResolvedAt *time.Time `json:"resolved_at"` - NoteableIID int `json:"noteable_iid"` + Confidential bool `json:"confidential"` + Internal bool `json:"internal"` } // NotePosition represents the position attributes of a note. diff --git a/vendor/github.com/xanzy/go-gitlab/project_variables.go b/vendor/github.com/xanzy/go-gitlab/project_variables.go index 2a16f5a..e75c746 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_variables.go +++ b/vendor/github.com/xanzy/go-gitlab/project_variables.go @@ -43,6 +43,7 @@ type ProjectVariable struct { Masked bool `json:"masked"` Raw bool `json:"raw"` EnvironmentScope string `json:"environment_scope"` + Description string `json:"description"` } func (v ProjectVariable) String() string { @@ -128,11 +129,12 @@ func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, opt * type CreateProjectVariableOptions struct { Key *string `url:"key,omitempty" json:"key,omitempty"` Value *string `url:"value,omitempty" json:"value,omitempty"` - VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` - Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` Masked *bool `url:"masked,omitempty" json:"masked,omitempty"` + Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` Raw *bool `url:"raw,omitempty" json:"raw,omitempty"` - EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` + VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` } // CreateVariable creates a new project variable. @@ -167,12 +169,13 @@ func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreatePro // https://docs.gitlab.com/ee/api/project_level_variables.html#update-a-variable type UpdateProjectVariableOptions struct { Value *string `url:"value,omitempty" json:"value,omitempty"` - VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` - Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` - Masked *bool `url:"masked,omitempty" json:"masked,omitempty"` - Raw *bool `url:"raw,omitempty" json:"raw,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` Filter *VariableFilter `url:"filter,omitempty" json:"filter,omitempty"` + Masked *bool `url:"masked,omitempty" json:"masked,omitempty"` + Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` + Raw *bool `url:"raw,omitempty" json:"raw,omitempty"` + VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` } // UpdateVariable updates a project's variable. diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go index 9bf0689..2d46685 100644 --- a/vendor/github.com/xanzy/go-gitlab/projects.go +++ b/vendor/github.com/xanzy/go-gitlab/projects.go @@ -165,6 +165,7 @@ type Project struct { SecurityAndComplianceEnabled bool `json:"security_and_compliance_enabled"` SecurityAndComplianceAccessLevel AccessControlValue `json:"security_and_compliance_access_level"` MergeRequestDefaultTargetSelf bool `json:"mr_default_target_self"` + ModelExperimentsAccessLevel AccessControlValue `json:"model_experiments_access_level"` // Deprecated: Use EmailsEnabled instead EmailsDisabled bool `json:"emails_disabled"` @@ -636,6 +637,7 @@ type CreateProjectOptions struct { MergeTrainsEnabled *bool `url:"merge_trains_enabled,omitempty" json:"merge_trains_enabled,omitempty"` Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"` MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` + ModelExperimentsAccessLevel *AccessControlValue `url:"model_experiments_access_level,omitempty" json:"model_experiments_access_level,omitempty"` Name *string `url:"name,omitempty" json:"name,omitempty"` NamespaceID *int `url:"namespace_id,omitempty" json:"namespace_id,omitempty"` OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` @@ -866,6 +868,7 @@ type EditProjectOptions struct { MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"` MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"` MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"` + ModelExperimentsAccessLevel *AccessControlValue `url:"model_experiments_access_level,omitempty" json:"model_experiments_access_level,omitempty"` Name *string `url:"name,omitempty" json:"name,omitempty"` OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` diff --git a/vendor/github.com/xanzy/go-gitlab/services.go b/vendor/github.com/xanzy/go-gitlab/services.go index 0313ecc..f3c2c8d 100644 --- a/vendor/github.com/xanzy/go-gitlab/services.go +++ b/vendor/github.com/xanzy/go-gitlab/services.go @@ -1166,6 +1166,97 @@ type SetMattermostServiceOptions struct { WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` } +// MattermostSlashCommandsService represents Mattermost slash commands settings. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#mattermost-slash-commands +type MattermostSlashCommandsService struct { + Service + Properties *MattermostSlashCommandsProperties `json:"properties"` +} + +// MattermostSlashCommandsProperties represents Mattermost slash commands specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#mattermost-slash-commands +type MattermostSlashCommandsProperties struct { + Token string `json:"token"` + Username string `json:"username,omitempty"` +} + +// GetMattermostSlashCommandsService gets Slack Mattermost commands service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#get-mattermost-slash-command-integration-settings +func (s *ServicesService) GetMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*MattermostSlashCommandsService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(MattermostSlashCommandsService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, nil +} + +// SetMattermostSlashCommandsServiceOptions represents the available SetSlackSlashCommandsService() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#get-mattermost-slash-command-integration-settings +type SetMattermostSlashCommandsServiceOptions struct { + Token *string `url:"token,omitempty" json:"token,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` +} + +// SetMattermostSlashCommandsService sets Mattermost slash commands service for a project +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#createedit-mattermost-slash-command-integration +func (s *ServicesService) SetMattermostSlashCommandsService(pid interface{}, opt *SetMattermostSlashCommandsServiceOptions, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + + req, err := s.client.NewRequest(http.MethodPut, u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteMattermostSlashCommandsService deletes Mattermost slash commands service for project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#disable-mattermost-slash-command-integration +func (s *ServicesService) DeleteMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // SetMattermostService sets Mattermost service for a project. // // GitLab API docs: @@ -1725,41 +1816,42 @@ func (s *ServicesService) DeleteSlackSlashCommandsService(pid interface{}, optio return s.client.Do(req, nil) } -// MattermostSlashCommandsService represents Mattermost slash commands settings. +// TelegramService represents Telegram service settings. // -// GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#mattermost-slash-commands -type MattermostSlashCommandsService struct { +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/integrations.html#telegram +type TelegramService struct { Service - Properties *MattermostSlashCommandsProperties `json:"properties"` + Properties *TelegramServiceProperties `json:"properties"` } -// MattermostSlashCommandsProperties represents Mattermost slash commands specific properties. +// TelegramServiceProperties represents Telegram specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#mattermost-slash-commands -type MattermostSlashCommandsProperties struct { - Token string `json:"token"` - Username string `json:"username,omitempty"` +// https://docs.gitlab.com/ee/api/integrations.html#set-up-telegram +type TelegramServiceProperties struct { + Room string `json:"room"` + NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines"` + BranchesToBeNotified string `json:"branches_to_be_notified"` } -// GetMattermostSlashCommandsService gets Slack Mattermost commands service settings for a project. +// GetTelegramService gets MicrosoftTeams service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#get-mattermost-slash-command-integration-settings -func (s *ServicesService) GetMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*MattermostSlashCommandsService, *Response, error) { +// https://docs.gitlab.com/ee/api/integrations.html#get-telegram-settings +func (s *ServicesService) GetTelegramService(pid interface{}, options ...RequestOptionFunc) (*TelegramService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project)) req, err := s.client.NewRequest(http.MethodGet, u, nil, options) if err != nil { return nil, nil, err } - svc := new(MattermostSlashCommandsService) + svc := new(TelegramService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -1768,26 +1860,37 @@ func (s *ServicesService) GetMattermostSlashCommandsService(pid interface{}, opt return svc, resp, nil } -// SetMattermostSlashCommandsServiceOptions represents the available SetSlackSlashCommandsService() +// SetTelegramServiceOptions represents the available SetTelegramService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#get-mattermost-slash-command-integration-settings -type SetMattermostSlashCommandsServiceOptions struct { - Token *string `url:"token,omitempty" json:"token,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` +// https://docs.gitlab.com/ee/api/integrations.html#set-up-telegram +type SetTelegramServiceOptions struct { + Token *string `url:"token,omitempty" json:"token,omitempty"` + Room *string `url:"room,omitempty" json:"room,omitempty"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` + BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` } -// SetMattermostSlashCommandsService sets Mattermost slash commands service for a project +// SetTelegramService sets Telegram service for a project // // GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#createedit-mattermost-slash-command-integration -func (s *ServicesService) SetMattermostSlashCommandsService(pid interface{}, opt *SetMattermostSlashCommandsServiceOptions, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/integrations.html#set-up-telegram +func (s *ServicesService) SetTelegramService(pid interface{}, opt *SetTelegramServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project)) req, err := s.client.NewRequest(http.MethodPut, u, opt, options) if err != nil { @@ -1797,16 +1900,16 @@ func (s *ServicesService) SetMattermostSlashCommandsService(pid interface{}, opt return s.client.Do(req, nil) } -// DeleteMattermostSlashCommandsService deletes Mattermost slash commands service for project. +// DeleteTelegramService deletes Telegram service for project. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/integrations.html#disable-mattermost-slash-command-integration -func (s *ServicesService) DeleteMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/integrations.html#disable-telegram +func (s *ServicesService) DeleteTelegramService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project)) + u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project)) req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index efc32f4..1f724b9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -23,7 +23,7 @@ github.com/pmezard/go-difflib/difflib ## explicit; go 1.20 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/xanzy/go-gitlab v0.95.2 +# github.com/xanzy/go-gitlab v0.96.0 ## explicit; go 1.19 github.com/xanzy/go-gitlab # golang.org/x/net v0.20.0