datakit-github

Abstraction of the GitHub API, suitable for DataKit clients
Library datakit-github
Module Datakit_github . PR
type t = private {
head : Commit.t;
number : int;
state : [ `Open | `Closed ];
title : string;
base : string;
owner : User.t;
comments : Comment.t array;
}

The type for pull-requests values.

val v : ?state:[ `Open | `Closed ] -> title:string -> ?base:string -> owner:User.t -> comments:Comment.t array -> Commit.t -> int -> t

v c n ~title ~owner is the pull-request n with head commit c, title title and owner owner. If base is not set, use "master". If state is not set, use `Open.

val pp : t Fmt.t

pp is the pretty-printer for pull-request values.

val compare : t -> t -> int

compare compares pull requests.

type id = Repo.t * int

The type for commit ids.

val pp_id : id Fmt.t

pp_id is the pretty-printer for PR ids.

val repo : t -> Repo.t

repo t is t's repostiory.

val id : t -> id

id t is t's ID.

val commit : t -> Commit.t

commit t is t's commit.

val commit_hash : t -> string

commit_hash t is the SHA1 of t's commit.

val number : t -> int

number t is t's number.

val state : t -> [ `Open | `Closed ]

state t is t's state.

val close : t -> t

close t is t with state t set to `Closed.

val state_of_string : string -> [ `Open | `Closed ] option

string_of_state str is Some s if there exists a state s such that state_of_string s is str. Otherwise it is None.

val string_of_state : [ `Open | `Closed ] -> string

state_of_string s is s's string representation.

val title : t -> string

title t is t's title.

val owner : t -> User.t

owner t is t's owner.

val comments : t -> Comment.t array

comments t are t's comments.

val same_id : t -> t -> bool

same_id x y is true if x and y have the same ID.

val compare_id : id -> id -> int

compare_id x y compare the pull-request IDs x and y.

module Set : sig ... end

Sets of pull requests.

module IdSet : SET with type elt = id
module Index : MAP with type key = id

Maps indexed by pull-request IDs.

val index : Set.t -> t Index.t Repo.Map.t

index s indexes s by pull-request IDs.