Up

module Github_s

: sig

GitHub APIv3 client library

#
module type Github = sig
#
module Monad : sig

All API requests are bound through this monad. The run function will unpack an API response into an Lwt thread that will hold the ultimate response.

#
type 'a t
#
val bind : 'a t -> ('a -> 'b t) -> 'b t
#
val return : 'a -> 'a t
#
val run : 'a t -> 'a Lwt.t
#
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
end
#
module Scope : sig

Authorization scopes; http://developer.github.com/v3/oauth/

#
val string_of_scope : Github_t.scope -> string
#
val scope_of_string : string -> Github_t.scope option
#
val string_of_scopes : Github_t.scope list -> string
#
val scopes_of_string : string -> Github_t.scope list
#
val all : Github_t.scope list
end
#
module Token : sig

Access token to the API, usually obtained via a user oAuth

#
type t
#
val of_code : client_id:string -> client_secret:string -> code:string -> unit -> t option Lwt.t
#
val create : ?scopes:Github_t.scope list -> ?note:string -> ?note_url:string -> ?client_id:string -> ?client_secret:string -> user:string -> pass:string -> unit -> Github_t.auth Monad.t
#
val get_all : user:string -> pass:string -> unit -> Github_t.auths Monad.t
#
val get : user:string -> pass:string -> id:int -> unit -> Github_t.auth Monad.t
#
val delete : user:string -> pass:string -> id:int -> unit -> unit Monad.t
#
val of_auth : Github_t.auth -> t
#
val of_string : string -> t
#
val to_string : t -> string
end
#
module API : sig

Generic API accessor function, not normally used directly, but useful in case you wish to call an API call that isn't wrapped in the rest of the library (i.e. most of them at the moment!)

#
val get : ?expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> (string -> 'a Lwt.t) -> 'a Monad.t
#
val post : expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> (string -> 'a Lwt.t) -> 'a Monad.t
#
val delete : ?expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> (string -> 'a Lwt.t) -> 'a Monad.t
#
val patch : expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> (string -> 'a Lwt.t) -> 'a Monad.t
#
val put : expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> (string -> 'a Lwt.t) -> 'a Monad.t
#
val set_user_agent : string -> unit Monad.t
#
val set_token : Token.t -> unit Monad.t
end
#
module URI : sig

Useful URI generation functions, normally for displaying on a web-page. The [root:authorize] function is the entry URL for your users, and the [root:token] is the URI used to convert the result into a concrete access token.

#
val authorizations : Uri.t
#
val authorize : ?scopes:Github_t.scope list -> ?redirect_uri:Uri.t -> client_id:string -> unit -> Uri.t
#
val issue_comments : user:string -> repo:string -> issue_number:int -> Uri.t
#
val issue_comment : user:string -> repo:string -> comment_id:int -> Uri.t
#
val token : client_id:string -> client_secret:string -> code:string -> unit -> Uri.t
#
val repo_issues : user:string -> repo:string -> Uri.t
#
val repo_issue : user:string -> repo:string -> issue_number:int -> Uri.t
#
val repo_pulls : user:string -> repo:string -> Uri.t
#
val repo_milestones : user:string -> repo:string -> Uri.t
#
val milestone : user:string -> repo:string -> num:int -> Uri.t
end
#
module User : sig
#
val current_info : token:Token.t -> unit -> Github_t.user_info Monad.t

Return the currently logged in user

#
val info : ?token:Token.t -> login:string -> unit -> Github_t.user_info Monad.t
#
val repos : user:string -> ?page:int -> unit -> Github_t.repos Monad.t
end
#
module Filter : sig
#
type state = [
| `Open
| `Closed
]
#
type milestone_sort = [
| `Due_date
| `Completeness
]
#
type issue_sort = [
| `Created
| `Updated
| `Comments
]
#
type direction = [
| `Asc
| `Desc
]
#
type milestone = [
| `Any
| `None
| `Num of int
]
#
type user = [
| `Any
| `None
| `Login of string
]
end
#
module Pull : sig
#
val for_repo : ?state:Filter.state -> ?token:Token.t -> ?page:int -> user:string -> repo:string -> unit -> Github_t.pulls Monad.t
#
val get : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.pull Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> pull:Github_t.new_pull -> unit -> Github_t.pull Monad.t
#
val create_from_issue : ?token:Token.t -> user:string -> repo:string -> pull_issue:Github_t.new_pull_issue -> unit -> Github_t.pull Monad.t
#
val update : ?token:Token.t -> user:string -> repo:string -> update_pull:Github_t.update_pull -> num:int -> unit -> Github_t.pull Monad.t
#
val list_commits : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.commits Monad.t
#
val list_files : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.files Monad.t
#
val is_merged : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> bool Monad.t
#
val merge : ?token:Token.t -> user:string -> repo:string -> num:int -> ?merge_commit_message:string -> unit -> Github_t.merge Monad.t
end
#
module Milestone : sig
#
val for_repo : ?state:Filter.state -> ?sort:Filter.milestone_sort -> ?direction:Filter.direction -> ?page:int -> ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.milestones Monad.t
#
val get : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.milestone Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> milestone:Github_t.new_milestone -> unit -> Github_t.milestone Monad.t
#
val delete : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> unit Monad.t
#
val update : ?token:Token.t -> user:string -> repo:string -> milestone:Github_t.update_milestone -> num:int -> unit -> Github_t.milestone Monad.t
end
#
module Release : sig
#
val for_repo : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.releases Monad.t
#
val get : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.release Monad.t
#
val get_by_tag_name : ?token:Token.t -> user:string -> repo:string -> tag:string -> unit -> Github_t.release Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> release:Github_t.new_release -> unit -> Github_t.release Monad.t
#
val delete : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> unit Monad.t
#
val update : ?token:Token.t -> user:string -> repo:string -> release:Github_t.update_release -> num:int -> unit -> Github_t.release Monad.t
#
val upload_asset : ?token:Token.t -> user:string -> repo:string -> id:int -> filename:string -> content_type:string -> body:string -> unit -> unit Monad.t
end
#
module Deploy_key : sig
#
val for_repo : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.deploy_keys Monad.t
#
val get : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.deploy_key Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> new_key:Github_t.new_deploy_key -> unit -> Github_t.deploy_key Monad.t
#
val delete : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> unit Monad.t
end
#
module Issue : sig
#
val for_repo : ?token:Token.t -> ?creator:string -> ?mentioned:string -> ?labels:string list -> ?milestone:Filter.milestone -> ?state:Filter.state -> ?sort:Filter.issue_sort -> ?direction:Filter.direction -> ?page:int -> ?assignee:Filter.user -> user:string -> repo:string -> unit -> Github_t.issues Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> issue:Github_t.new_issue -> unit -> Github_t.issue Monad.t
#
val update : ?token:Token.t -> user:string -> repo:string -> issue_number:int -> issue:Github_t.new_issue -> unit -> Github_t.issue Monad.t
#
val comments : ?token:Token.t -> user:string -> repo:string -> issue_number:int -> unit -> Github_t.issue_comments Monad.t
#
val create_comment : ?token:Token.t -> user:string -> repo:string -> issue_number:int -> body:string -> unit -> Github_t.issue_comment Monad.t
end
#
module Status : sig
#
val for_sha : ?token:Token.t -> user:string -> repo:string -> sha:string -> unit -> Github_t.statuses Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> sha:string -> status:Github_t.new_status -> unit -> Github_t.status Monad.t
end
#
module Hook : sig
#
val for_repo : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.hooks Monad.t
#
val get : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> Github_t.hook Monad.t
#
val create : ?token:Token.t -> user:string -> repo:string -> hook:Github_t.new_hook -> unit -> Github_t.hook Monad.t
#
val update : ?token:Token.t -> user:string -> repo:string -> num:int -> hook:Github_t.update_hook -> unit -> Github_t.hook Monad.t
#
val delete : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> unit Monad.t
#
val test : ?token:Token.t -> user:string -> repo:string -> num:int -> unit -> unit Monad.t
end
#
module Repo : sig
#
val info : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.repo Monad.t
#
val tags : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.repo_tags Monad.t
#
val branches : ?token:Token.t -> user:string -> repo:string -> unit -> Github_t.repo_branches Monad.t
#
val refs : ?token:Token.t -> ?ty:string -> user:string -> repo:string -> unit -> Github_t.git_refs Monad.t
#
val commit : ?token:Token.t -> user:string -> repo:string -> sha:string -> unit -> Github_t.commit Monad.t
end
#
module Git_obj : sig
#
val obj_type_to_string : Github_t.obj_type -> string
#
val split_ref : string -> string * string

Split a ref like "refs/tags/foo/bar" into ("tags","foo/bar")

end
#
module Tag : sig
#
val tag : ?token:Token.t -> user:string -> repo:string -> sha:string -> unit -> Github_t.tag Monad.t
#
val get_tags_and_times : ?token:Token.t -> user:string -> repo:string -> unit -> (string * string) list Monad.t
end
#
module Gist : sig
#
val list_users : ?since:string -> ?token:Token.t -> user:string -> unit -> Github_t.gists Monad.t
#
val list : ?since:string -> ?token:Token.t -> unit -> Github_t.gists Monad.t
#
val list_all_public : ?since:string -> ?token:Token.t -> unit -> Github_t.gists Monad.t
#
val list_starred : ?since:string -> token:Token.t -> unit -> Github_t.gists Monad.t
#
val get : ?token:Token.t -> id:string -> unit -> Github_t.gist Monad.t
#
val create : token:Token.t -> contents:Github_t.gist_create -> unit -> Github_t.gist Monad.t
#
val edit : token:Token.t -> id:string -> contents:Github_t.gist_edits -> unit -> Github_t.gist Monad.t
#
val commits : ?token:Token.t -> id:string -> unit -> Github_t.gist_history_list Monad.t
#
val star : token:Token.t -> id:string -> unit -> unit Monad.t
#
val unstar : token:Token.t -> id:string -> unit -> unit Monad.t
#
val fork : token:Token.t -> id:string -> unit -> Github_t.gist Monad.t
#
val list_forks : ?token:Token.t -> id:string -> unit -> Github_t.gist_forks Monad.t
#
val delete : token:Token.t -> id:string -> unit -> unit Monad.t
end
#
module Organization : sig
#
val teams : ?token:Token.t -> org:string -> unit -> Github_t.teams Monad.t
end
#
module Team : sig
#
val info : ?token:Token.t -> id:int -> unit -> Github_t.team_info Monad.t
#
val repos : ?token:Token.t -> id:int -> unit -> Github_t.repos Monad.t
end
#
val log_active : bool Pervasives.ref

log_active activates debug messages

set by default when the environment variable GITHUB_DEBUG is set to 1

end
end