Loading integrations.go +170 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,36 @@ type ( // https://docs.gitlab.com/api/group_integrations/#get-jira-settings GetGroupJiraSettings(gid any, options ...RequestOptionFunc) (*Integration, *Response, error) // GetGroupDiscordSettings gets the Discord integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#discord GetGroupDiscordSettings(gid any, options ...RequestOptionFunc) (*DiscordIntegration, *Response, error) // GetGroupTelegramSettings gets the Telegram integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#telegram GetGroupTelegramSettings(gid any, options ...RequestOptionFunc) (*TelegramIntegration, *Response, error) // GetGroupMattermostSettings gets the Mattermost integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#mattermost-notifications GetGroupMattermostSettings(gid any, options ...RequestOptionFunc) (*MattermostIntegration, *Response, error) // GetGroupMatrixSettings gets the Matrix integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#matrix-notifications GetGroupMatrixSettings(gid any, options ...RequestOptionFunc) (*MatrixIntegration, *Response, error) // GetGroupGoogleChatSettings gets the Google Chat integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#google-chat GetGroupGoogleChatSettings(gid any, options ...RequestOptionFunc) (*GoogleChatIntegration, *Response, error) // GetGroupMattermostIntegration retrieves the Mattermost integration for a group. // // GitLab API docs: Loading Loading @@ -165,6 +195,101 @@ type Integration struct { Inherited bool `json:"inherited"` } // DiscordIntegration represents the Discord integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#discord type DiscordIntegration struct { Integration Properties DiscordIntegrationProperties `json:"properties"` } // DiscordIntegrationProperties represents Discord specific properties. type DiscordIntegrationProperties struct { NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // TelegramIntegration represents the Telegram integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#telegram type TelegramIntegration struct { Integration Properties TelegramIntegrationProperties `json:"properties"` } // TelegramIntegrationProperties represents Telegram specific properties. type TelegramIntegrationProperties struct { Hostname string `json:"hostname,omitempty"` Room string `json:"room,omitempty"` Thread string `json:"thread,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // MattermostIntegration represents the Mattermost integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#mattermost-notifications type MattermostIntegration struct { Integration Properties MattermostIntegrationProperties `json:"properties"` } // MattermostIntegrationProperties represents Mattermost specific properties. type MattermostIntegrationProperties struct { Username string `json:"username,omitempty"` Channel string `json:"channel,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` LabelsToBeNotified string `json:"labels_to_be_notified,omitempty"` LabelsToBeNotifiedBehavior string `json:"labels_to_be_notified_behavior,omitempty"` PushChannel string `json:"push_channel,omitempty"` IssueChannel string `json:"issue_channel,omitempty"` ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"` MergeRequestChannel string `json:"merge_request_channel,omitempty"` NoteChannel string `json:"note_channel,omitempty"` ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"` TagPushChannel string `json:"tag_push_channel,omitempty"` PipelineChannel string `json:"pipeline_channel,omitempty"` WikiPageChannel string `json:"wiki_page_channel,omitempty"` DeploymentChannel string `json:"deployment_channel,omitempty"` IncidentChannel string `json:"incident_channel,omitempty"` } // MatrixIntegration represents the Matrix integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#matrix-notifications type MatrixIntegration struct { Integration Properties MatrixIntegrationProperties `json:"properties"` } // MatrixIntegrationProperties represents Matrix specific properties. type MatrixIntegrationProperties struct { Hostname string `json:"hostname,omitempty"` Room string `json:"room,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // GoogleChatIntegration represents the Google Chat integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#google-chat type GoogleChatIntegration struct { Integration Properties GoogleChatIntegrationProperties `json:"properties"` } // GoogleChatIntegrationProperties represents Google Chat specific properties. type GoogleChatIntegrationProperties struct { NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // ListActiveIntegrationsOptions represents the available // ListActiveIntegrations() options. // Loading Loading @@ -329,3 +454,48 @@ func (s *IntegrationsService) GetGroupJiraSettings(gid any, options ...RequestOp withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupDiscordSettings(gid any, options ...RequestOptionFunc) (*DiscordIntegration, *Response, error) { return do[*DiscordIntegration]( s.client, withPath("groups/%s/integrations/discord", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupTelegramSettings(gid any, options ...RequestOptionFunc) (*TelegramIntegration, *Response, error) { return do[*TelegramIntegration]( s.client, withPath("groups/%s/integrations/telegram", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupMattermostSettings(gid any, options ...RequestOptionFunc) (*MattermostIntegration, *Response, error) { return do[*MattermostIntegration]( s.client, withPath("groups/%s/integrations/mattermost", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupMatrixSettings(gid any, options ...RequestOptionFunc) (*MatrixIntegration, *Response, error) { return do[*MatrixIntegration]( s.client, withPath("groups/%s/integrations/matrix", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupGoogleChatSettings(gid any, options ...RequestOptionFunc) (*GoogleChatIntegration, *Response, error) { return do[*GoogleChatIntegration]( s.client, withPath("groups/%s/integrations/hangouts-chat", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } integrations_test.go +120 −0 Original line number Diff line number Diff line Loading @@ -546,3 +546,123 @@ func TestGetGroupJiraSettings(t *testing.T) { } assert.Equal(t, want, integration) } func TestGetGroupDiscordSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/discord", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "DiscordNotifications", "slug": "discord", "created_at": "2023-01-01T00:00:00.000Z", "updated_at": "2023-01-02T00:00:00.000Z", "properties": { "branches_to_be_notified": "default", "notify_only_broken_pipelines": true } }`) }) integration, resp, err := client.Integrations.GetGroupDiscordSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) assert.True(t, integration.Properties.NotifyOnlyBrokenPipelines) } func TestGetGroupTelegramSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/telegram", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Telegram", "slug": "telegram", "properties": { "room": "-1001", "branches_to_be_notified": "default" } }`) }) integration, resp, err := client.Integrations.GetGroupTelegramSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "-1001", integration.Properties.Room) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) } func TestGetGroupMattermostSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/mattermost", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Mattermost", "slug": "mattermost", "properties": { "username": "gitlab_bot", "channel": "town-square" } }`) }) integration, resp, err := client.Integrations.GetGroupMattermostSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "gitlab_bot", integration.Properties.Username) assert.Equal(t, "town-square", integration.Properties.Channel) } func TestGetGroupMatrixSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/matrix", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Matrix", "slug": "matrix", "properties": { "room": "!abc:matrix.org", "hostname": "https://matrix.org" } }`) }) integration, resp, err := client.Integrations.GetGroupMatrixSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "!abc:matrix.org", integration.Properties.Room) assert.Equal(t, "https://matrix.org", integration.Properties.Hostname) } func TestGetGroupGoogleChatSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/hangouts-chat", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Google Chat", "slug": "hangouts-chat", "properties": { "branches_to_be_notified": "default" } }`) }) integration, resp, err := client.Integrations.GetGroupGoogleChatSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) } testing/integrations_mock.go +225 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,96 @@ func (c *MockIntegrationsServiceInterfaceDisableGroupMicrosoftTeamsNotifications return c } // GetGroupDiscordSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupDiscordSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupDiscordSettings", varargs...) ret0, _ := ret[0].(*gitlab.DiscordIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupDiscordSettings indicates an expected call of GetGroupDiscordSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupDiscordSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupDiscordSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupDiscordSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) Return(arg0 *gitlab.DiscordIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupGoogleChatSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupGoogleChatSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupGoogleChatSettings", varargs...) ret0, _ := ret[0].(*gitlab.GoogleChatIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupGoogleChatSettings indicates an expected call of GetGroupGoogleChatSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupGoogleChatSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupGoogleChatSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupGoogleChatSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) Return(arg0 *gitlab.GoogleChatIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupHarborSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupHarborSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.Integration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -349,6 +439,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupJiraSettingsCall) DoAndReturn(f return c } // GetGroupMatrixSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMatrixSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupMatrixSettings", varargs...) ret0, _ := ret[0].(*gitlab.MatrixIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupMatrixSettings indicates an expected call of GetGroupMatrixSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupMatrixSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMatrixSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupMatrixSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) Return(arg0 *gitlab.MatrixIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupMattermostIntegration mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostIntegration(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GroupMattermostIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -394,6 +529,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupMattermostIntegrationCall) DoAn return c } // GetGroupMattermostSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupMattermostSettings", varargs...) ret0, _ := ret[0].(*gitlab.MattermostIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupMattermostSettings indicates an expected call of GetGroupMattermostSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupMattermostSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMattermostSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupMattermostSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) Return(arg0 *gitlab.MattermostIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupMattermostSlashCommandsIntegration mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostSlashCommandsIntegration(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GroupMattermostSlashCommandsIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -484,6 +664,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupMicrosoftTeamsNotificationsCall return c } // GetGroupTelegramSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupTelegramSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupTelegramSettings", varargs...) ret0, _ := ret[0].(*gitlab.TelegramIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupTelegramSettings indicates an expected call of GetGroupTelegramSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupTelegramSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupTelegramSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupTelegramSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) Return(arg0 *gitlab.TelegramIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // ListActiveGroupIntegrations mocks base method. func (m *MockIntegrationsServiceInterface) ListActiveGroupIntegrations(gid any, opt *gitlab.ListActiveIntegrationsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Integration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading
integrations.go +170 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,36 @@ type ( // https://docs.gitlab.com/api/group_integrations/#get-jira-settings GetGroupJiraSettings(gid any, options ...RequestOptionFunc) (*Integration, *Response, error) // GetGroupDiscordSettings gets the Discord integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#discord GetGroupDiscordSettings(gid any, options ...RequestOptionFunc) (*DiscordIntegration, *Response, error) // GetGroupTelegramSettings gets the Telegram integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#telegram GetGroupTelegramSettings(gid any, options ...RequestOptionFunc) (*TelegramIntegration, *Response, error) // GetGroupMattermostSettings gets the Mattermost integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#mattermost-notifications GetGroupMattermostSettings(gid any, options ...RequestOptionFunc) (*MattermostIntegration, *Response, error) // GetGroupMatrixSettings gets the Matrix integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#matrix-notifications GetGroupMatrixSettings(gid any, options ...RequestOptionFunc) (*MatrixIntegration, *Response, error) // GetGroupGoogleChatSettings gets the Google Chat integration settings for a group. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#google-chat GetGroupGoogleChatSettings(gid any, options ...RequestOptionFunc) (*GoogleChatIntegration, *Response, error) // GetGroupMattermostIntegration retrieves the Mattermost integration for a group. // // GitLab API docs: Loading Loading @@ -165,6 +195,101 @@ type Integration struct { Inherited bool `json:"inherited"` } // DiscordIntegration represents the Discord integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#discord type DiscordIntegration struct { Integration Properties DiscordIntegrationProperties `json:"properties"` } // DiscordIntegrationProperties represents Discord specific properties. type DiscordIntegrationProperties struct { NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // TelegramIntegration represents the Telegram integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#telegram type TelegramIntegration struct { Integration Properties TelegramIntegrationProperties `json:"properties"` } // TelegramIntegrationProperties represents Telegram specific properties. type TelegramIntegrationProperties struct { Hostname string `json:"hostname,omitempty"` Room string `json:"room,omitempty"` Thread string `json:"thread,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // MattermostIntegration represents the Mattermost integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#mattermost-notifications type MattermostIntegration struct { Integration Properties MattermostIntegrationProperties `json:"properties"` } // MattermostIntegrationProperties represents Mattermost specific properties. type MattermostIntegrationProperties struct { Username string `json:"username,omitempty"` Channel string `json:"channel,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` LabelsToBeNotified string `json:"labels_to_be_notified,omitempty"` LabelsToBeNotifiedBehavior string `json:"labels_to_be_notified_behavior,omitempty"` PushChannel string `json:"push_channel,omitempty"` IssueChannel string `json:"issue_channel,omitempty"` ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"` MergeRequestChannel string `json:"merge_request_channel,omitempty"` NoteChannel string `json:"note_channel,omitempty"` ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"` TagPushChannel string `json:"tag_push_channel,omitempty"` PipelineChannel string `json:"pipeline_channel,omitempty"` WikiPageChannel string `json:"wiki_page_channel,omitempty"` DeploymentChannel string `json:"deployment_channel,omitempty"` IncidentChannel string `json:"incident_channel,omitempty"` } // MatrixIntegration represents the Matrix integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#matrix-notifications type MatrixIntegration struct { Integration Properties MatrixIntegrationProperties `json:"properties"` } // MatrixIntegrationProperties represents Matrix specific properties. type MatrixIntegrationProperties struct { Hostname string `json:"hostname,omitempty"` Room string `json:"room,omitempty"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // GoogleChatIntegration represents the Google Chat integration settings. // // GitLab API docs: // https://docs.gitlab.com/api/group_integrations/#google-chat type GoogleChatIntegration struct { Integration Properties GoogleChatIntegrationProperties `json:"properties"` } // GoogleChatIntegrationProperties represents Google Chat specific properties. type GoogleChatIntegrationProperties struct { NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines,omitempty"` BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` } // ListActiveIntegrationsOptions represents the available // ListActiveIntegrations() options. // Loading Loading @@ -329,3 +454,48 @@ func (s *IntegrationsService) GetGroupJiraSettings(gid any, options ...RequestOp withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupDiscordSettings(gid any, options ...RequestOptionFunc) (*DiscordIntegration, *Response, error) { return do[*DiscordIntegration]( s.client, withPath("groups/%s/integrations/discord", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupTelegramSettings(gid any, options ...RequestOptionFunc) (*TelegramIntegration, *Response, error) { return do[*TelegramIntegration]( s.client, withPath("groups/%s/integrations/telegram", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupMattermostSettings(gid any, options ...RequestOptionFunc) (*MattermostIntegration, *Response, error) { return do[*MattermostIntegration]( s.client, withPath("groups/%s/integrations/mattermost", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupMatrixSettings(gid any, options ...RequestOptionFunc) (*MatrixIntegration, *Response, error) { return do[*MatrixIntegration]( s.client, withPath("groups/%s/integrations/matrix", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) } func (s *IntegrationsService) GetGroupGoogleChatSettings(gid any, options ...RequestOptionFunc) (*GoogleChatIntegration, *Response, error) { return do[*GoogleChatIntegration]( s.client, withPath("groups/%s/integrations/hangouts-chat", GroupID{gid}), withMethod(http.MethodGet), withRequestOpts(options...), ) }
integrations_test.go +120 −0 Original line number Diff line number Diff line Loading @@ -546,3 +546,123 @@ func TestGetGroupJiraSettings(t *testing.T) { } assert.Equal(t, want, integration) } func TestGetGroupDiscordSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/discord", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "DiscordNotifications", "slug": "discord", "created_at": "2023-01-01T00:00:00.000Z", "updated_at": "2023-01-02T00:00:00.000Z", "properties": { "branches_to_be_notified": "default", "notify_only_broken_pipelines": true } }`) }) integration, resp, err := client.Integrations.GetGroupDiscordSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) assert.True(t, integration.Properties.NotifyOnlyBrokenPipelines) } func TestGetGroupTelegramSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/telegram", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Telegram", "slug": "telegram", "properties": { "room": "-1001", "branches_to_be_notified": "default" } }`) }) integration, resp, err := client.Integrations.GetGroupTelegramSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "-1001", integration.Properties.Room) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) } func TestGetGroupMattermostSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/mattermost", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Mattermost", "slug": "mattermost", "properties": { "username": "gitlab_bot", "channel": "town-square" } }`) }) integration, resp, err := client.Integrations.GetGroupMattermostSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "gitlab_bot", integration.Properties.Username) assert.Equal(t, "town-square", integration.Properties.Channel) } func TestGetGroupMatrixSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/matrix", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Matrix", "slug": "matrix", "properties": { "room": "!abc:matrix.org", "hostname": "https://matrix.org" } }`) }) integration, resp, err := client.Integrations.GetGroupMatrixSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "!abc:matrix.org", integration.Properties.Room) assert.Equal(t, "https://matrix.org", integration.Properties.Hostname) } func TestGetGroupGoogleChatSettings(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/integrations/hangouts-chat", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{ "id": 1, "title": "Google Chat", "slug": "hangouts-chat", "properties": { "branches_to_be_notified": "default" } }`) }) integration, resp, err := client.Integrations.GetGroupGoogleChatSettings(1) assert.NoError(t, err) assert.NotNil(t, resp) assert.Equal(t, "default", integration.Properties.BranchesToBeNotified) }
testing/integrations_mock.go +225 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,96 @@ func (c *MockIntegrationsServiceInterfaceDisableGroupMicrosoftTeamsNotifications return c } // GetGroupDiscordSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupDiscordSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupDiscordSettings", varargs...) ret0, _ := ret[0].(*gitlab.DiscordIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupDiscordSettings indicates an expected call of GetGroupDiscordSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupDiscordSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupDiscordSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupDiscordSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) Return(arg0 *gitlab.DiscordIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.DiscordIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupDiscordSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupGoogleChatSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupGoogleChatSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupGoogleChatSettings", varargs...) ret0, _ := ret[0].(*gitlab.GoogleChatIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupGoogleChatSettings indicates an expected call of GetGroupGoogleChatSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupGoogleChatSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupGoogleChatSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupGoogleChatSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) Return(arg0 *gitlab.GoogleChatIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.GoogleChatIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupGoogleChatSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupHarborSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupHarborSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.Integration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -349,6 +439,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupJiraSettingsCall) DoAndReturn(f return c } // GetGroupMatrixSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMatrixSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupMatrixSettings", varargs...) ret0, _ := ret[0].(*gitlab.MatrixIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupMatrixSettings indicates an expected call of GetGroupMatrixSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupMatrixSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMatrixSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupMatrixSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) Return(arg0 *gitlab.MatrixIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MatrixIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMatrixSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupMattermostIntegration mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostIntegration(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GroupMattermostIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -394,6 +529,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupMattermostIntegrationCall) DoAn return c } // GetGroupMattermostSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupMattermostSettings", varargs...) ret0, _ := ret[0].(*gitlab.MattermostIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupMattermostSettings indicates an expected call of GetGroupMattermostSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupMattermostSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMattermostSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupMattermostSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) Return(arg0 *gitlab.MattermostIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.MattermostIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupMattermostSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // GetGroupMattermostSlashCommandsIntegration mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupMattermostSlashCommandsIntegration(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.GroupMattermostSlashCommandsIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading Loading @@ -484,6 +664,51 @@ func (c *MockIntegrationsServiceInterfaceGetGroupMicrosoftTeamsNotificationsCall return c } // GetGroupTelegramSettings mocks base method. func (m *MockIntegrationsServiceInterface) GetGroupTelegramSettings(gid any, options ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error) { m.ctrl.T.Helper() varargs := []any{gid} for _, a := range options { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetGroupTelegramSettings", varargs...) ret0, _ := ret[0].(*gitlab.TelegramIntegration) ret1, _ := ret[1].(*gitlab.Response) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } // GetGroupTelegramSettings indicates an expected call of GetGroupTelegramSettings. func (mr *MockIntegrationsServiceInterfaceMockRecorder) GetGroupTelegramSettings(gid any, options ...any) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { mr.mock.ctrl.T.Helper() varargs := append([]any{gid}, options...) call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupTelegramSettings", reflect.TypeOf((*MockIntegrationsServiceInterface)(nil).GetGroupTelegramSettings), varargs...) return &MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall{Call: call} } // MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall wrap *gomock.Call type MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) Return(arg0 *gitlab.TelegramIntegration, arg1 *gitlab.Response, arg2 error) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.Return(arg0, arg1, arg2) return c } // Do rewrite *gomock.Call.Do func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) Do(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn func (c *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall) DoAndReturn(f func(any, ...gitlab.RequestOptionFunc) (*gitlab.TelegramIntegration, *gitlab.Response, error)) *MockIntegrationsServiceInterfaceGetGroupTelegramSettingsCall { c.Call = c.Call.DoAndReturn(f) return c } // ListActiveGroupIntegrations mocks base method. func (m *MockIntegrationsServiceInterface) ListActiveGroupIntegrations(gid any, opt *gitlab.ListActiveIntegrationsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Integration, *gitlab.Response, error) { m.ctrl.T.Helper() Loading