diff --git a/enterprise_users.go b/enterprise_users.go index cd1886d7d89085872bcf2afd13fc8610b2a99815..03771bc0a4ffd34eba65e200756419d3b0c57d28 100644 --- a/enterprise_users.go +++ b/enterprise_users.go @@ -22,9 +22,29 @@ import ( type ( EnterpriseUsersServiceInterface interface { + // ListEnterpriseUsers lists all enterprise users for a given top-level group. + // + // GitLab API docs: + // https://docs.gitlab.com/api/group_enterprise_users/#list-all-enterprise-users ListEnterpriseUsers(gid any, opt *ListEnterpriseUsersOptions, options ...RequestOptionFunc) ([]*User, *Response, error) + + // GetEnterpriseUser gets details on a specified enterprise user. + // + // GitLab API docs: + // https://docs.gitlab.com/api/group_enterprise_users/#get-details-on-an-enterprise-user GetEnterpriseUser(gid any, uid int, options ...RequestOptionFunc) (*User, *Response, error) + + // Disable2FAForEnterpriseUser disables two-factor authentication (2FA) for a + // specified enterprise user. + // + // GitLab API docs: + // https://docs.gitlab.com/api/group_enterprise_users/#disable-two-factor-authentication-for-an-enterprise-user Disable2FAForEnterpriseUser(gid any, uid int, options ...RequestOptionFunc) (*Response, error) + + // DeleteEnterpriseUser deletes an specified enterprise user. + // + // GitLab API docs: + // https://docs.gitlab.com/api/group_enterprise_users/#delete-an-enterprise-user DeleteEnterpriseUser(gid any, uid int, deleteOptions *DeleteEnterpriseUserOptions, options ...RequestOptionFunc) (*Response, error) } @@ -55,10 +75,6 @@ type ListEnterpriseUsersOptions struct { TwoFactor string `url:"two_factor,omitempty" json:"two_factor,omitempty"` } -// ListEnterpriseUsers lists all enterprise users for a given top-level group. -// -// GitLab API docs: -// https://docs.gitlab.com/api/group_enterprise_users/#list-all-enterprise-users func (s *EnterpriseUsersService) ListEnterpriseUsers(gid any, opt *ListEnterpriseUsersOptions, options ...RequestOptionFunc) ([]*User, *Response, error) { group, err := parseID(gid) if err != nil { @@ -80,10 +96,6 @@ func (s *EnterpriseUsersService) ListEnterpriseUsers(gid any, opt *ListEnterpris return users, resp, nil } -// GetEnterpriseUser gets details on a specified enterprise user. -// -// GitLab API docs: -// https://docs.gitlab.com/api/group_enterprise_users/#get-details-on-an-enterprise-user func (s *EnterpriseUsersService) GetEnterpriseUser(gid any, uid int, options ...RequestOptionFunc) (*User, *Response, error) { group, err := parseID(gid) if err != nil { @@ -105,11 +117,6 @@ func (s *EnterpriseUsersService) GetEnterpriseUser(gid any, uid int, options ... return user, resp, nil } -// Disable2FAForEnterpriseUser disables two-factor authentication (2FA) for a -// specified enterprise user. -// -// GitLab API docs: -// https://docs.gitlab.com/api/group_enterprise_users/#disable-two-factor-authentication-for-an-enterprise-user func (s *EnterpriseUsersService) Disable2FAForEnterpriseUser(gid any, uid int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { @@ -133,10 +140,6 @@ type DeleteEnterpriseUserOptions struct { HardDelete *bool `url:"hard_delete,omitempty" json:"hard_delete,omitempty"` } -// DeleteEnterpriseUser deletes an specified enterprise user. -// -// GitLab API docs: -// https://docs.gitlab.com/api/group_enterprise_users/#delete-an-enterprise-user func (s *EnterpriseUsersService) DeleteEnterpriseUser(gid any, uid int, opt *DeleteEnterpriseUserOptions, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { diff --git a/environments.go b/environments.go index 9d8f9fedc6e45bd051bfe0f83d7f4d65404bde7e..7d5936c2c081e80e57c5a87868576abefb79fa52 100644 --- a/environments.go +++ b/environments.go @@ -25,11 +25,43 @@ import ( type ( // EnvironmentsServiceInterface defines all the API methods for the EnvironmentsService EnvironmentsServiceInterface interface { + // ListEnvironments gets a list of environments from a project, sorted by name + // alphabetically. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#list-environments ListEnvironments(pid any, opts *ListEnvironmentsOptions, options ...RequestOptionFunc) ([]*Environment, *Response, error) + + // GetEnvironment gets a specific environment from a project. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#get-a-specific-environment GetEnvironment(pid any, environment int, options ...RequestOptionFunc) (*Environment, *Response, error) + + // CreateEnvironment adds an environment to a project. This method is idempotent + // and can be called multiple times with the same parameters. Creating an environment + // that already exists does not affect the existing association. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#create-a-new-environment CreateEnvironment(pid any, opt *CreateEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) + + // EditEnvironment updates a project team environment to a specified access level. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#update-an-existing-environment EditEnvironment(pid any, environment int, opt *EditEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) + + // DeleteEnvironment removes an environment from a project team. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#delete-an-environment DeleteEnvironment(pid any, environment int, options ...RequestOptionFunc) (*Response, error) + + // StopEnvironment stops an environment within a specific project. + // + // GitLab API docs: + // https://docs.gitlab.com/api/environments/#stop-an-environment StopEnvironment(pid any, environmentID int, opt *StopEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) } @@ -81,11 +113,6 @@ type ListEnvironmentsOptions struct { States *string `url:"states,omitempty" json:"states,omitempty"` } -// ListEnvironments gets a list of environments from a project, sorted by name -// alphabetically. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#list-environments func (s *EnvironmentsService) ListEnvironments(pid any, opts *ListEnvironmentsOptions, options ...RequestOptionFunc) ([]*Environment, *Response, error) { project, err := parseID(pid) if err != nil { @@ -107,10 +134,6 @@ func (s *EnvironmentsService) ListEnvironments(pid any, opts *ListEnvironmentsOp return envs, resp, nil } -// GetEnvironment gets a specific environment from a project. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#get-a-specific-environment func (s *EnvironmentsService) GetEnvironment(pid any, environment int, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { @@ -147,12 +170,6 @@ type CreateEnvironmentOptions struct { AutoStopSetting *string `url:"auto_stop_setting,omitempty" json:"auto_stop_setting,omitempty"` } -// CreateEnvironment adds an environment to a project. This method is idempotent -// and can be called multiple times with the same parameters. Creating an environment -// that already exists does not affect the existing association. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#create-a-new-environment func (s *EnvironmentsService) CreateEnvironment(pid any, opt *CreateEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { @@ -189,10 +206,6 @@ type EditEnvironmentOptions struct { AutoStopSetting *string `url:"auto_stop_setting,omitempty" json:"auto_stop_setting,omitempty"` } -// EditEnvironment updates a project team environment to a specified access level.. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#update-an-existing-environment func (s *EnvironmentsService) EditEnvironment(pid any, environment int, opt *EditEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { @@ -214,10 +227,6 @@ func (s *EnvironmentsService) EditEnvironment(pid any, environment int, opt *Edi return env, resp, nil } -// DeleteEnvironment removes an environment from a project team. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#delete-an-environment func (s *EnvironmentsService) DeleteEnvironment(pid any, environment int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { @@ -241,10 +250,6 @@ type StopEnvironmentOptions struct { Force *bool `url:"force,omitempty" json:"force,omitempty"` } -// StopEnvironment stops an environment within a specific project. -// -// GitLab API docs: -// https://docs.gitlab.com/api/environments/#stop-an-environment func (s *EnvironmentsService) StopEnvironment(pid any, environmentID int, opt *StopEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { diff --git a/epic_issues.go b/epic_issues.go index 625d86c11c286da2312d009f78397ee07a758085..2a191b3e7cd52e61bf55c3610ec97476e24cdac3 100644 --- a/epic_issues.go +++ b/epic_issues.go @@ -26,12 +26,32 @@ type ( // Will be removed in v5 of the API, use Work Items API instead EpicIssuesServiceInterface interface { // Will be removed in v5 of the API, use Work Items API instead + // ListEpicIssues get a list of epic issues. + // + // GitLab API docs: + // https://docs.gitlab.com/api/epic_issues/#list-issues-for-an-epic ListEpicIssues(gid any, epic int, opt *ListOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) + + // AssignEpicIssue assigns an existing issue to an epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API Docs: + // https://docs.gitlab.com/api/epic_issues/#assign-an-issue-to-the-epic AssignEpicIssue(gid any, epic, issue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) + + // RemoveEpicIssue removes an issue from an epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API Docs: + // https://docs.gitlab.com/api/epic_issues/#remove-an-issue-from-the-epic RemoveEpicIssue(gid any, epic, epicIssue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) + + // UpdateEpicIssueAssignmentOptions describes the UpdateEpicIssueAssignment() + // options. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API Docs: + // https://docs.gitlab.com/api/epic_issues/#update-epic---issue-association UpdateEpicIssueAssignment(gid any, epic, epicIssue int, opt *UpdateEpicIssueAssignmentOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) } @@ -59,11 +79,6 @@ type EpicIssueAssignment struct { Issue *Issue `json:"issue"` } -// ListEpicIssues get a list of epic issues. -// Will be removed in v5 of the API, use Work Items API instead -// -// Gitlab API docs: -// https://docs.gitlab.com/api/epic_issues/#list-issues-for-an-epic func (s *EpicIssuesService) ListEpicIssues(gid any, epic int, opt *ListOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { group, err := parseID(gid) if err != nil { @@ -85,11 +100,6 @@ func (s *EpicIssuesService) ListEpicIssues(gid any, epic int, opt *ListOptions, return is, resp, nil } -// AssignEpicIssue assigns an existing issue to an epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// Gitlab API Docs: -// https://docs.gitlab.com/api/epic_issues/#assign-an-issue-to-the-epic func (s *EpicIssuesService) AssignEpicIssue(gid any, epic, issue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) { group, err := parseID(gid) if err != nil { @@ -111,11 +121,6 @@ func (s *EpicIssuesService) AssignEpicIssue(gid any, epic, issue int, options .. return a, resp, nil } -// RemoveEpicIssue removes an issue from an epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// Gitlab API Docs: -// https://docs.gitlab.com/api/epic_issues/#remove-an-issue-from-the-epic func (s *EpicIssuesService) RemoveEpicIssue(gid any, epic, epicIssue int, options ...RequestOptionFunc) (*EpicIssueAssignment, *Response, error) { group, err := parseID(gid) if err != nil { @@ -137,12 +142,6 @@ func (s *EpicIssuesService) RemoveEpicIssue(gid any, epic, epicIssue int, option return a, resp, nil } -// UpdateEpicIssueAssignmentOptions describes the UpdateEpicIssueAssignment() -// options. -// Will be removed in v5 of the API, use Work Items API instead -// -// Gitlab API Docs: -// https://docs.gitlab.com/api/epic_issues/#update-epic---issue-association type UpdateEpicIssueAssignmentOptions struct { *ListOptions MoveBeforeID *int `url:"move_before_id,omitempty" json:"move_before_id,omitempty"` diff --git a/epics.go b/epics.go index fa3f6b614951502c2e667b300aa7c037c9cb93e5..ca194b587b2ab5cba1b6e4ffc465c4f51ba61f66 100644 --- a/epics.go +++ b/epics.go @@ -26,17 +26,42 @@ type ( // EpicsServiceInterface defines all the API methods for the EpicsService // Will be removed in v5 of the API, use Work Items API instead EpicsServiceInterface interface { + // ListGroupEpics gets a list of group epics. This function accepts pagination + // parameters page and per_page to return the list of group epics. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epics/#list-epics-for-a-group ListGroupEpics(gid any, opt *ListGroupEpicsOptions, options ...RequestOptionFunc) ([]*Epic, *Response, error) + + // GetEpic gets a single group epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epics/#single-epic GetEpic(gid any, epic int, options ...RequestOptionFunc) (*Epic, *Response, error) + + // GetEpicLinks gets all child epics of an epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epic_links/ GetEpicLinks(gid any, epic int, options ...RequestOptionFunc) ([]*Epic, *Response, error) + + // CreateEpic creates a new group epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epics/#new-epic CreateEpic(gid any, opt *CreateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) + + // UpdateEpic updates an existing group epic. This function is also used + // to mark an epic as closed. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epics/#update-epic UpdateEpic(gid any, epic int, opt *UpdateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) + + // DeleteEpic deletes a single group epic. // Will be removed in v5 of the API, use Work Items API instead + // + // GitLab API docs: https://docs.gitlab.com/api/epics/#delete-epic DeleteEpic(gid any, epic int, options ...RequestOptionFunc) (*Response, error) } @@ -126,11 +151,6 @@ type ListGroupEpicsOptions struct { MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"` } -// ListGroupEpics gets a list of group epics. This function accepts pagination -// parameters page and per_page to return the list of group epics. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epics/#list-epics-for-a-group func (s *EpicsService) ListGroupEpics(gid any, opt *ListGroupEpicsOptions, options ...RequestOptionFunc) ([]*Epic, *Response, error) { group, err := parseID(gid) if err != nil { @@ -152,10 +172,6 @@ func (s *EpicsService) ListGroupEpics(gid any, opt *ListGroupEpicsOptions, optio return es, resp, nil } -// GetEpic gets a single group epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epics/#single-epic func (s *EpicsService) GetEpic(gid any, epic int, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { @@ -177,10 +193,6 @@ func (s *EpicsService) GetEpic(gid any, epic int, options ...RequestOptionFunc) return e, resp, nil } -// GetEpicLinks gets all child epics of an epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epic_links/ func (s *EpicsService) GetEpicLinks(gid any, epic int, options ...RequestOptionFunc) ([]*Epic, *Response, error) { group, err := parseID(gid) if err != nil { @@ -220,10 +232,6 @@ type CreateEpicOptions struct { ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"` } -// CreateEpic creates a new group epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epics/#new-epic func (s *EpicsService) CreateEpic(gid any, opt *CreateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { @@ -266,11 +274,6 @@ type UpdateEpicOptions struct { Color *string `url:"color,omitempty" json:"color,omitempty"` } -// UpdateEpic updates an existing group epic. This function is also used -// to mark an epic as closed. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epics/#update-epic func (s *EpicsService) UpdateEpic(gid any, epic int, opt *UpdateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { @@ -292,10 +295,6 @@ func (s *EpicsService) UpdateEpic(gid any, epic int, opt *UpdateEpicOptions, opt return e, resp, nil } -// DeleteEpic deletes a single group epic. -// Will be removed in v5 of the API, use Work Items API instead -// -// GitLab API docs: https://docs.gitlab.com/api/epics/#delete-epic func (s *EpicsService) DeleteEpic(gid any, epic int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil {