Commits

camlspotter committed 808369c

objects

  • Participants
  • Parent commits fdf4f75
  • Branches dev

Comments (0)

Files changed (2)

 name="bitbucket"
 version="0.0.0"
 description="Bitbucket API for OCaml"
-requires="tiny_json_conv,spotlib,curl,sexplib"
+requires="tiny_json_conv,spotlib,curl,ocaml_conv"
 archive(byte)="bitbucket.cmo"
 archive(native)="bitbucket.cmx"
 linkopts = ""
 
 open Meta_conv.Types.Result.Open
 
-type 'target mc_leftovers = (string * 'target) list with conv(ocaml)
+type 'target mc_leftovers = (string * 'target) list with conv(json), conv(ocaml)
 
 module Json = struct
   include Json
 
   let format ppf = function
     | `Http (n, _err) -> fprintf ppf "HTTP Error %d@." n
-    | `Json_conv e -> Meta_conv.Types.Error.format (fun _ _ -> ()) ppf e
+    | `Json_conv ((_,v) as e) -> 
+        Format.eprintf "%a@.Error input: %s@." 
+          (Meta_conv.Types.Error.format (fun _ _ -> ())) e
+          (Json.show v)
     | `Json_parse exn -> fprintf ppf "Error at Json parse: %s@." (Printexc.to_string exn)
     | `Other exn -> fprintf ppf "Error: %s@." (Printexc.to_string exn)
 end
 
   (** Commited file *)  
   module File = struct
-    type t = {
+    type t = <
       type_ as "type" : string;
       file : string;
-    } with conv(json), conv(ocaml)
+    > with conv(json), conv(ocaml)
   end
 
   (** Branch info *)    
   module Branch = struct
 
-    type t = {
+    type t = <
       node         : string;
       raw_node     : string;
       author       : string;
       parents      : string list;
       branch       : string;
       unknown      : Json.t mc_leftovers;
-    } with conv(json), conv(ocaml)
+    > with conv(json), conv(ocaml)
 
   end
 
   (** User identity info *)
   module UserID = struct
-    type t = {
+    type t = <
       username     : string;
       display_name : string;
       first_name   : string;
       avatar       : string;
       resource_uri : string;
       user_rest    : Json.t mc_leftovers;
-    } with conv(json), conv(ocaml)
+    > with conv(json), conv(ocaml)
   end
 
   module User = struct
-    type t = {
+    type t = <
       user : UserID.t;
       repositories : Repository.t list;
       rest : Json.t mc_leftovers;
-    } with conv(json), conv(ocaml)
+    > with conv(json), conv(ocaml)
   end
 
   module UserRepo = struct
 
     (** Small version of Repository.t *)  
-    type t = { 
+    type t = <
       owner      : string;
       scm        : Scheme.t;
       slug       : string;
       is_private : bool;
       name       : string
-    }
+    >
 
     and ts = t list with conv(json)
   end
   (* https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/branches *)
   module Branches = struct
 
-    type t = Data.Branch.t mc_fields with conv(json), conv(ocaml)
+    type t = Data.Branch.t mc_leftovers with conv(json), conv(ocaml)
 
     let get ~accountname ~repo_slug = 
       Format.eprintf "%s : %s...@." accountname repo_slug;