aboutsummaryrefslogtreecommitdiff
path: root/lib/models/gen/attachment_j.ml
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2018-12-15 18:02:29 +0000
committerAdelyn Breedlove <[email protected]>2018-12-15 18:02:29 +0000
commit910ce60bba69b961c82e29ff1bb63bf4d3fe5519 (patch)
tree690861418bed15de47e7cf5672d96fdacc9abe5e /lib/models/gen/attachment_j.ml
parentMerge branch 'patch-1' into 'master' (diff)
parentMerging (diff)
downloaddisml-910ce60bba69b961c82e29ff1bb63bf4d3fe5519.tar.xz
disml-910ce60bba69b961c82e29ff1bb63bf4d3fe5519.zip
Merge branch 'dev' into 'master'
Merge first semi-usable state of dev-branch in a while See merge request Mishio595/disml!10
Diffstat (limited to 'lib/models/gen/attachment_j.ml')
-rw-r--r--lib/models/gen/attachment_j.ml456
1 files changed, 456 insertions, 0 deletions
diff --git a/lib/models/gen/attachment_j.ml b/lib/models/gen/attachment_j.ml
new file mode 100644
index 0000000..28f909d
--- /dev/null
+++ b/lib/models/gen/attachment_j.ml
@@ -0,0 +1,456 @@
+(* Auto-generated from "attachment.atd" *)
+[@@@ocaml.warning "-27-32-35-39"]
+
+type snowflake = Snowflake_t.t
+
+type t = Attachment_t.t = {
+ id: snowflake;
+ filename: string;
+ size: int;
+ url: string;
+ proxy_url: string;
+ height: int option;
+ width: int option
+}
+
+let write_snowflake = (
+ Snowflake_j.write_t
+)
+let string_of_snowflake ?(len = 1024) x =
+ let ob = Bi_outbuf.create len in
+ write_snowflake ob x;
+ Bi_outbuf.contents ob
+let read_snowflake = (
+ Snowflake_j.read_t
+)
+let snowflake_of_string s =
+ read_snowflake (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
+let write__1 = (
+ Atdgen_runtime.Oj_run.write_option (
+ Yojson.Safe.write_int
+ )
+)
+let string_of__1 ?(len = 1024) x =
+ let ob = Bi_outbuf.create len in
+ write__1 ob x;
+ Bi_outbuf.contents ob
+let read__1 = (
+ fun p lb ->
+ Yojson.Safe.read_space p lb;
+ match Yojson.Safe.start_any_variant p lb with
+ | `Edgy_bracket -> (
+ match Yojson.Safe.read_ident p lb with
+ | "None" ->
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_gt p lb;
+ (None : _ option)
+ | "Some" ->
+ Atdgen_runtime.Oj_run.read_until_field_value p lb;
+ let x = (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ in
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_gt p lb;
+ (Some x : _ option)
+ | x ->
+ Atdgen_runtime.Oj_run.invalid_variant_tag p x
+ )
+ | `Double_quote -> (
+ match Yojson.Safe.finish_string p lb with
+ | "None" ->
+ (None : _ option)
+ | x ->
+ Atdgen_runtime.Oj_run.invalid_variant_tag p x
+ )
+ | `Square_bracket -> (
+ match Atdgen_runtime.Oj_run.read_string p lb with
+ | "Some" ->
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_comma p lb;
+ Yojson.Safe.read_space p lb;
+ let x = (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ in
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_rbr p lb;
+ (Some x : _ option)
+ | x ->
+ Atdgen_runtime.Oj_run.invalid_variant_tag p x
+ )
+)
+let _1_of_string s =
+ read__1 (Yojson.Safe.init_lexer ()) (Lexing.from_string s)
+let write_t : _ -> t -> _ = (
+ fun ob x ->
+ Bi_outbuf.add_char ob '{';
+ let is_first = ref true in
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"id\":";
+ (
+ write_snowflake
+ )
+ ob x.id;
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"filename\":";
+ (
+ Yojson.Safe.write_string
+ )
+ ob x.filename;
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"size\":";
+ (
+ Yojson.Safe.write_int
+ )
+ ob x.size;
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"url\":";
+ (
+ Yojson.Safe.write_string
+ )
+ ob x.url;
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"proxy_url\":";
+ (
+ Yojson.Safe.write_string
+ )
+ ob x.proxy_url;
+ (match x.height with None -> () | Some x ->
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"height\":";
+ (
+ Yojson.Safe.write_int
+ )
+ ob x;
+ );
+ (match x.width with None -> () | Some x ->
+ if !is_first then
+ is_first := false
+ else
+ Bi_outbuf.add_char ob ',';
+ Bi_outbuf.add_string ob "\"width\":";
+ (
+ Yojson.Safe.write_int
+ )
+ ob x;
+ );
+ Bi_outbuf.add_char ob '}';
+)
+let string_of_t ?(len = 1024) x =
+ let ob = Bi_outbuf.create len in
+ write_t ob x;
+ Bi_outbuf.contents ob
+let read_t = (
+ fun p lb ->
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_lcurl p lb;
+ let field_id = ref (Obj.magic (Sys.opaque_identity 0.0)) in
+ let field_filename = ref (Obj.magic (Sys.opaque_identity 0.0)) in
+ let field_size = ref (Obj.magic (Sys.opaque_identity 0.0)) in
+ let field_url = ref (Obj.magic (Sys.opaque_identity 0.0)) in
+ let field_proxy_url = ref (Obj.magic (Sys.opaque_identity 0.0)) in
+ let field_height = ref (None) in
+ let field_width = ref (None) in
+ let bits0 = ref 0 in
+ try
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_object_end lb;
+ Yojson.Safe.read_space p lb;
+ let f =
+ fun s pos len ->
+ if pos < 0 || len < 0 || pos + len > String.length s then
+ invalid_arg "out-of-bounds substring position or length";
+ match len with
+ | 2 -> (
+ if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then (
+ 0
+ )
+ else (
+ -1
+ )
+ )
+ | 3 -> (
+ if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'l' then (
+ 3
+ )
+ else (
+ -1
+ )
+ )
+ | 4 -> (
+ if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'z' && String.unsafe_get s (pos+3) = 'e' then (
+ 2
+ )
+ else (
+ -1
+ )
+ )
+ | 5 -> (
+ if String.unsafe_get s pos = 'w' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'h' then (
+ 6
+ )
+ else (
+ -1
+ )
+ )
+ | 6 -> (
+ if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 't' then (
+ 5
+ )
+ else (
+ -1
+ )
+ )
+ | 8 -> (
+ if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then (
+ 1
+ )
+ else (
+ -1
+ )
+ )
+ | 9 -> (
+ if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'l' then (
+ 4
+ )
+ else (
+ -1
+ )
+ )
+ | _ -> (
+ -1
+ )
+ in
+ let i = Yojson.Safe.map_ident p f lb in
+ Atdgen_runtime.Oj_run.read_until_field_value p lb;
+ (
+ match i with
+ | 0 ->
+ field_id := (
+ (
+ read_snowflake
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x1;
+ | 1 ->
+ field_filename := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x2;
+ | 2 ->
+ field_size := (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x4;
+ | 3 ->
+ field_url := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x8;
+ | 4 ->
+ field_proxy_url := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x10;
+ | 5 ->
+ if not (Yojson.Safe.read_null_if_possible p lb) then (
+ field_height := (
+ Some (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ )
+ );
+ )
+ | 6 ->
+ if not (Yojson.Safe.read_null_if_possible p lb) then (
+ field_width := (
+ Some (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ )
+ );
+ )
+ | _ -> (
+ Yojson.Safe.skip_json p lb
+ )
+ );
+ while true do
+ Yojson.Safe.read_space p lb;
+ Yojson.Safe.read_object_sep p lb;
+ Yojson.Safe.read_space p lb;
+ let f =
+ fun s pos len ->
+ if pos < 0 || len < 0 || pos + len > String.length s then
+ invalid_arg "out-of-bounds substring position or length";
+ match len with
+ | 2 -> (
+ if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' then (
+ 0
+ )
+ else (
+ -1
+ )
+ )
+ | 3 -> (
+ if String.unsafe_get s pos = 'u' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'l' then (
+ 3
+ )
+ else (
+ -1
+ )
+ )
+ | 4 -> (
+ if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'z' && String.unsafe_get s (pos+3) = 'e' then (
+ 2
+ )
+ else (
+ -1
+ )
+ )
+ | 5 -> (
+ if String.unsafe_get s pos = 'w' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'd' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'h' then (
+ 6
+ )
+ else (
+ -1
+ )
+ )
+ | 6 -> (
+ if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'g' && String.unsafe_get s (pos+4) = 'h' && String.unsafe_get s (pos+5) = 't' then (
+ 5
+ )
+ else (
+ -1
+ )
+ )
+ | 8 -> (
+ if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then (
+ 1
+ )
+ else (
+ -1
+ )
+ )
+ | 9 -> (
+ if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'u' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'l' then (
+ 4
+ )
+ else (
+ -1
+ )
+ )
+ | _ -> (
+ -1
+ )
+ in
+ let i = Yojson.Safe.map_ident p f lb in
+ Atdgen_runtime.Oj_run.read_until_field_value p lb;
+ (
+ match i with
+ | 0 ->
+ field_id := (
+ (
+ read_snowflake
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x1;
+ | 1 ->
+ field_filename := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x2;
+ | 2 ->
+ field_size := (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x4;
+ | 3 ->
+ field_url := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x8;
+ | 4 ->
+ field_proxy_url := (
+ (
+ Atdgen_runtime.Oj_run.read_string
+ ) p lb
+ );
+ bits0 := !bits0 lor 0x10;
+ | 5 ->
+ if not (Yojson.Safe.read_null_if_possible p lb) then (
+ field_height := (
+ Some (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ )
+ );
+ )
+ | 6 ->
+ if not (Yojson.Safe.read_null_if_possible p lb) then (
+ field_width := (
+ Some (
+ (
+ Atdgen_runtime.Oj_run.read_int
+ ) p lb
+ )
+ );
+ )
+ | _ -> (
+ Yojson.Safe.skip_json p lb
+ )
+ );
+ done;
+ assert false;
+ with Yojson.End_of_object -> (
+ if !bits0 <> 0x1f then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "id"; "filename"; "size"; "url"; "proxy_url" |];
+ (
+ {
+ id = !field_id;
+ filename = !field_filename;
+ size = !field_size;
+ url = !field_url;
+ proxy_url = !field_proxy_url;
+ height = !field_height;
+ width = !field_width;
+ }
+ : t)
+ )
+)
+let t_of_string s =
+ read_t (Yojson.Safe.init_lexer ()) (Lexing.from_string s)