diff --git a/CHANGES.md b/CHANGES.md index d9f1d62..eb08a6a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,12 +2,17 @@ ## Added + * `Project.merge_requests`: add parameter `wip` + * `Project.merge_requests`: add parameter `target_branch` + * `Project.merge_requests`: add parameter `per_page` * `Gitlab` module now exposes `Message` exception ## Bug fixes * `gitlab.atd`: add `scheduler_failure` to `failure_reason` * `gitlab.atd`: add `data_integrity_failure` to `failure_reason` + * `gitlab.atd`: make `merge_request.approvals_before_merge` integral + * `gitlab.atd`: make `merge_request.sha` nullable * `gitlab.atd`: add failure reasons: `api_failure`, `missing_dependency_failure`, `runner_unsupported`, `stale_schedule`, `archived_failure`, `unmet_prerequisites`, diff --git a/lib/gitlab.atd b/lib/gitlab.atd index 125d1ad..c96171d 100644 --- a/lib/gitlab.atd +++ b/lib/gitlab.atd @@ -369,7 +369,7 @@ type merge_request = { downvotes: int; author: user_short; assignee: user_short nullable; - approvals_before_merge: string nullable; + approvals_before_merge: int nullable; ?allow_collaboration: bool nullable; ?allow_maintainer_to_push: bool nullable; blocking_discussions_resolved: bool; @@ -384,7 +384,7 @@ type merge_request = { milestone: milestone nullable; merge_when_pipeline_succeeds: bool; merge_status: merge_status; - sha: string; + sha: string nullable; merge_commit_sha: string nullable; squash_commit_sha: string nullable; user_notes_count: int; diff --git a/lib/gitlab_core.ml b/lib/gitlab_core.ml index cc18f44..9d1813d 100644 --- a/lib/gitlab_core.ml +++ b/lib/gitlab_core.ml @@ -1309,11 +1309,24 @@ struct | None -> uri | Some sort -> Uri.add_query_param' uri ("sort", show sort) + let wip_param wip uri = + match wip with + | None -> uri + | Some wip -> + let wip = if wip then "yes" else "no" in + Uri.add_query_param' uri ("wip", wip) + let event_scope_param scope uri = match scope with | None -> uri | Some scope -> Uri.add_query_param' uri ("scope", scope) + let target_branch_param target_branch uri = + match target_branch with + | None -> uri + | Some target_branch -> + Uri.add_query_param' uri ("target_branch", target_branch) + module Event = struct open Lwt @@ -1487,7 +1500,7 @@ struct let merge_requests ?token ?state ?milestone ?labels ?author ?author_username ?my_reaction ?scope ?created_after ?created_before ?updated_after - ?updated_before ?sort ?order_by ~id () = + ?updated_before ?sort ?order_by ?target_branch ?wip ?per_page ~id () = let order_by_param order uri = let show = function | `Created_at -> "created_at" @@ -1510,6 +1523,8 @@ struct |> updated_after_param updated_after |> updated_before_param updated_before |> order_by_param order_by |> sort_param sort + |> target_branch_param target_branch + |> wip_param wip |> per_page_param per_page in API.get_stream ?token ~uri (fun body -> return (Gitlab_j.merge_requests_of_string body)) diff --git a/lib/gitlab_s.mli b/lib/gitlab_s.mli index 59c902f..e8c11e4 100644 --- a/lib/gitlab_s.mli +++ b/lib/gitlab_s.mli @@ -695,6 +695,9 @@ module type Gitlab = sig ?updated_before:string -> ?sort:Gitlab_t.sort -> ?order_by:[ `Created_at | `Title | `Updated_at ] -> + ?target_branch:string -> + ?wip:bool -> + ?per_page:int -> id:int -> unit -> Gitlab_t.merge_request Stream.t