Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Add the Draft parameter for merge request structs
Browse files Browse the repository at this point in the history
Currently, in GitLab 14.4.0 the `draft` url parameter is not implemented -
and I'm still unsure whether it should be? You still filter for non-draft
merge requests with `wip=yes`. If GitLab ever removes the `wip` url param
and replaces it with `draft` the typing of this field becomes a difficult
question I think, might be wrong here.

This should be backwards compatible due to the `omitempty` being in both the
`Draft` and `WIP` fields of the merge request structs.

Also adjusted the tests to use `Draft:` instead of `WIP:`. It might be worth
considering having tests for both but that would raise questions on which
behaviour to expect - the removed `WIP:` not working or until it is still in
supported versions to maintain backwards compatibility.
  • Loading branch information
Philipp Böschen committed Nov 1, 2021
1 parent ca2e8cc commit ae78b1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions merge_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ type ListMergeRequestsOptions struct {
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
Draft *bool `url:"draft,omitempty" json:"draft,omitempty"`
WIP *string `url:"wip,omitempty" json:"wip,omitempty"`
}

Expand Down Expand Up @@ -219,6 +220,7 @@ type ListGroupMergeRequestsOptions struct {
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
In *string `url:"in,omitempty" json:"in,omitempty"`
Draft *bool `url:"draft,omitempty" json:"draft,omitempty"`
WIP *string `url:"wip,omitempty" json:"wip,omitempty"`
}

Expand Down Expand Up @@ -278,6 +280,7 @@ type ListProjectMergeRequestsOptions struct {
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`
Draft *bool `url:"draft,omitempty" json:"draft,omitempty"`
WIP *string `url:"wip,omitempty" json:"wip,omitempty"`
}

Expand Down
Loading

0 comments on commit ae78b1e

Please sign in to comment.