Skip to content

Commit

Permalink
Make all option struct fields pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen authored and gravis committed Sep 1, 2022
1 parent d174f3a commit a19b426
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 471 deletions.
158 changes: 76 additions & 82 deletions issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,33 +207,31 @@ type LabelDetails struct {
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
type ListIssuesOptions struct {
ListOptions
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AssigneeID *AssigneeIDValue `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
IterationID *int `url:"iteration_id,omitempty" json:"iteration_id,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}

// ListIssues gets all issues created by authenticated user. This function
Expand All @@ -260,33 +258,31 @@ func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...RequestOpt
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
type ListGroupIssuesOptions struct {
ListOptions
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"`

AssigneeID *AssigneeIDValue `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
IterationID *int `url:"iteration_id,omitempty" json:"iteration_id,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}

// ListGroupIssues gets a list of group issues. This function accepts
Expand Down Expand Up @@ -319,34 +315,32 @@ func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOpt
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
type ListProjectIssuesOptions struct {
ListOptions
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AuthorUsername *string `url:"author_username,omitempty" json:"author_username,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AssigneeID *AssigneeIDValue `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
DueDate *string `url:"due_date,omitempty" json:"due_date,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
IterationID *int `url:"iteration_id,omitempty" json:"iteration_id,omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
NotMilestone *[]string `url:"not[milestone],omitempty" json:"not[milestone],omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
NotAuthorID *[]int `url:"not[author_id],omitempty" json:"not[author_id],omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
NotAssigneeID *[]int `url:"not[assignee_id],omitempty" json:"not[assignee_id],omitempty"`
AssigneeUsername *string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
NotMyReactionEmoji *[]string `url:"not[my_reaction_emoji],omitempty" json:"not[my_reaction_emoji],omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
DueDate *string `url:"due_date,omitempty" json:"due_date,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}

// ListProjectIssues gets a list of project issues. This function accepts
Expand Down
14 changes: 7 additions & 7 deletions merge_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ type ListMergeRequestsOptions struct {
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
View *string `url:"view,omitempty" json:"view,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelsDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
WithMergeStatusRecheck *bool `url:"with_merge_status_recheck,omitempty" json:"with_merge_status_recheck,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
Expand Down Expand Up @@ -203,8 +203,8 @@ type ListProjectMergeRequestsOptions struct {
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
View *string `url:"view,omitempty" json:"view,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelsDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
WithMergeStatusRecheck *bool `url:"with_merge_status_recheck,omitempty" json:"with_merge_status_recheck,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
Expand Down Expand Up @@ -258,14 +258,14 @@ func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *Li
// https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests
type ListGroupMergeRequestsOptions struct {
ListOptions
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
View *string `url:"view,omitempty" json:"view,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
NotLabels *Labels `url:"not[labels],comma,omitempty" json:"not[labels],omitempty"`
WithLabelsDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
WithMergeStatusRecheck *bool `url:"with_merge_status_recheck,omitempty" json:"with_merge_status_recheck,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion milestones.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (m Milestone) String() string {
// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
type ListMilestonesOptions struct {
ListOptions
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
IIDs *[]int `url:"iids[],omitempty" json:"iids,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
Expand Down

0 comments on commit a19b426

Please sign in to comment.