Source

ocaml-bitbucket / api.ml

Diff from to

File api.ml

   type t = Hg(:"hg":) | Git(:"git":) with conv(json), sexp
 end
 
-module User = struct
-
-  module Repositories = struct
-
-    type repo = { 
-      owner      : string;
-      scm        : Scheme.t;
-      slug       : string;
-      is_private : bool;
-      name       : string
-    } 
-
-    and resp = repo list with conv(json)
-
-    let get ~user ~password = 
-      resp_of_json (Json.parse (Curl.get_string (fun h ->
-        h#set_url "https://api.bitbucket.org/1.0/user/repositories/";
-        h#set_userpwd (Printf.sprintf "%s:%s" user password))))
-  end
-
-  type user = {
-    username     : string;
-    first_name   : string;
-    last_name    : string;
-    is_team      : bool;
-    avatar       : string;
-    resource_uri : string
-  } with conv(json), sexp
+(** repositories Endpoint *)
+module Repositories = struct
 
   module Repository = struct
     type t = {
       no_public_forks   : bool;
       resource_uri      : string;
       fork_of           : t option;
-  
-      repo_rest (: Rest_in_raw :) : Json.t fields;
+      mq_of             : t option;
+      creator           : string option;
     } with conv(json), sexp
   end
 
+
+end
+
+(** user Endpoint *)
+module User = struct
+
+  type user = {
+    username     : string;
+    first_name   : string;
+    last_name    : string;
+    is_team      : bool;
+    avatar       : string;
+    resource_uri : string
+  } with conv(json), sexp
+
   type resp = {
     user : user;
-    repositories : Repository.t list;
+    repositories : Repositories.Repository.t list;
   } with conv(json), sexp
 
   let get ~user ~password = 
       prerr_endline s;
       raise e
 
+  module Repositories = struct
+
+    type repo = { 
+      owner      : string;
+      scm        : Scheme.t;
+      slug       : string;
+      is_private : bool;
+      name       : string
+    } 
+
+    and resp = repo list with conv(json)
+
+    let get ~user ~password = 
+      resp_of_json (Json.parse (Curl.get_string (fun h ->
+        h#set_url "https://api.bitbucket.org/1.0/user/repositories/";
+        h#set_userpwd (Printf.sprintf "%s:%s" user password))))
+  end
+
 end