diff options
| author | Adelyn Breedlove <[email protected]> | 2018-12-21 16:22:49 +0000 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2018-12-21 16:22:49 +0000 |
| commit | c23f6b323a7231cd2caee6520dc709799508c87e (patch) | |
| tree | 4c238d53d2cbd9362f04044351582dd5f5e56d79 /lib/models/gen/channel_j.ml | |
| parent | Merge branch 'dev' into 'master' (diff) | |
| parent | Update README (diff) | |
| download | disml-c23f6b323a7231cd2caee6520dc709799508c87e.tar.xz disml-c23f6b323a7231cd2caee6520dc709799508c87e.zip | |
Merge branch 'dev' into 'master'
Merge work from dev
See merge request Mishio595/disml!11
Diffstat (limited to 'lib/models/gen/channel_j.ml')
| -rw-r--r-- | lib/models/gen/channel_j.ml | 1136 |
1 files changed, 0 insertions, 1136 deletions
diff --git a/lib/models/gen/channel_j.ml b/lib/models/gen/channel_j.ml deleted file mode 100644 index 7369230..0000000 --- a/lib/models/gen/channel_j.ml +++ /dev/null @@ -1,1136 +0,0 @@ -(* Auto-generated from "channel.atd" *) -[@@@ocaml.warning "-27-32-35-39"] - -type user = User_t.t - -type snowflake = Snowflake_t.t - -type t = Channel_t.t = { - id: snowflake; - kind: int; - guild_id: snowflake option; - position: int option; - name: string option; - topic: string option; - nsfw: bool option; - bitrate: int option; - user_limit: int option; - recipients: user list option; - icon: string option; - owner_id: snowflake option; - application_id: snowflake option; - parent_id: snowflake option -} - -let write_user = ( - User_j.write_t -) -let string_of_user ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write_user ob x; - Bi_outbuf.contents ob -let read_user = ( - User_j.read_t -) -let user_of_string s = - read_user (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -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__5 = ( - Atdgen_runtime.Oj_run.write_list ( - write_user - ) -) -let string_of__5 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__5 ob x; - Bi_outbuf.contents ob -let read__5 = ( - Atdgen_runtime.Oj_run.read_list ( - read_user - ) -) -let _5_of_string s = - read__5 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__6 = ( - Atdgen_runtime.Oj_run.write_option ( - write__5 - ) -) -let string_of__6 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__6 ob x; - Bi_outbuf.contents ob -let read__6 = ( - 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 = ( - read__5 - ) 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 = ( - read__5 - ) 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 _6_of_string s = - read__6 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__4 = ( - Atdgen_runtime.Oj_run.write_option ( - Yojson.Safe.write_bool - ) -) -let string_of__4 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__4 ob x; - Bi_outbuf.contents ob -let read__4 = ( - 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_bool - ) 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_bool - ) 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 _4_of_string s = - read__4 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__3 = ( - Atdgen_runtime.Oj_run.write_option ( - Yojson.Safe.write_string - ) -) -let string_of__3 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__3 ob x; - Bi_outbuf.contents ob -let read__3 = ( - 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_string - ) 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_string - ) 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 _3_of_string s = - read__3 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__2 = ( - Atdgen_runtime.Oj_run.write_option ( - Yojson.Safe.write_int - ) -) -let string_of__2 ?(len = 1024) x = - let ob = Bi_outbuf.create len in - write__2 ob x; - Bi_outbuf.contents ob -let read__2 = ( - 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 _2_of_string s = - read__2 (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__1 = ( - Atdgen_runtime.Oj_run.write_option ( - write_snowflake - ) -) -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 = ( - read_snowflake - ) 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 = ( - read_snowflake - ) 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 "\"type\":"; - ( - Yojson.Safe.write_int - ) - ob x.kind; - (match x.guild_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"guild_id\":"; - ( - write_snowflake - ) - ob x; - ); - (match x.position with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"position\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); - (match x.name with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"name\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.topic with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"topic\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.nsfw with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"nsfw\":"; - ( - Yojson.Safe.write_bool - ) - ob x; - ); - (match x.bitrate with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"bitrate\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); - (match x.user_limit with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"user_limit\":"; - ( - Yojson.Safe.write_int - ) - ob x; - ); - (match x.recipients with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"recipients\":"; - ( - write__5 - ) - ob x; - ); - (match x.icon with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"icon\":"; - ( - Yojson.Safe.write_string - ) - ob x; - ); - (match x.owner_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"owner_id\":"; - ( - write_snowflake - ) - ob x; - ); - (match x.application_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"application_id\":"; - ( - write_snowflake - ) - ob x; - ); - (match x.parent_id with None -> () | Some x -> - if !is_first then - is_first := false - else - Bi_outbuf.add_char ob ','; - Bi_outbuf.add_string ob "\"parent_id\":"; - ( - write_snowflake - ) - 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_kind = ref (Obj.magic (Sys.opaque_identity 0.0)) in - let field_guild_id = ref (None) in - let field_position = ref (None) in - let field_name = ref (None) in - let field_topic = ref (None) in - let field_nsfw = ref (None) in - let field_bitrate = ref (None) in - let field_user_limit = ref (None) in - let field_recipients = ref (None) in - let field_icon = ref (None) in - let field_owner_id = ref (None) in - let field_application_id = ref (None) in - let field_parent_id = 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 - ) - ) - | 4 -> ( - match String.unsafe_get s pos with - | 'i' -> ( - if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'n' then ( - 10 - ) - else ( - -1 - ) - ) - | 'n' -> ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'w' then ( - 6 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' then ( - 5 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' then ( - 7 - ) - else ( - -1 - ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 2 - ) - else ( - -1 - ) - ) - | 'o' -> ( - if String.unsafe_get s (pos+1) = 'w' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 11 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( - 13 - ) - else ( - -1 - ) - ) - | 10 -> ( - match String.unsafe_get s pos with - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 'u' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'd' then ( - 12 - ) - 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_kind := ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ); - bits0 := !bits0 lor 0x2; - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_guild_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_position := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_topic := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_nsfw := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_bitrate := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_user_limit := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_recipients := ( - Some ( - ( - read__5 - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_icon := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 11 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_owner_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 12 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_application_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_parent_id := ( - Some ( - ( - read_snowflake - ) 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 - ) - ) - | 4 -> ( - match String.unsafe_get s pos with - | 'i' -> ( - if String.unsafe_get s (pos+1) = 'c' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'n' then ( - 10 - ) - else ( - -1 - ) - ) - | 'n' -> ( - match String.unsafe_get s (pos+1) with - | 'a' -> ( - if String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | 's' -> ( - if String.unsafe_get s (pos+2) = 'f' && String.unsafe_get s (pos+3) = 'w' then ( - 6 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+1) = 'y' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'c' then ( - 5 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'b' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'e' then ( - 7 - ) - else ( - -1 - ) - ) - | 8 -> ( - match String.unsafe_get s pos with - | 'g' -> ( - if String.unsafe_get s (pos+1) = 'u' && String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'd' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 2 - ) - else ( - -1 - ) - ) - | 'o' -> ( - if String.unsafe_get s (pos+1) = 'w' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = '_' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' then ( - 11 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 's' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'r' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = '_' && String.unsafe_get s (pos+7) = 'i' && String.unsafe_get s (pos+8) = 'd' then ( - 13 - ) - else ( - -1 - ) - ) - | 10 -> ( - match String.unsafe_get s pos with - | 'r' -> ( - if String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'e' && String.unsafe_get s (pos+7) = 'n' && String.unsafe_get s (pos+8) = 't' && String.unsafe_get s (pos+9) = 's' then ( - 9 - ) - else ( - -1 - ) - ) - | 'u' -> ( - if String.unsafe_get s (pos+1) = 's' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'l' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'm' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 't' then ( - 8 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - | 14 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'p' && String.unsafe_get s (pos+3) = 'l' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'c' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 't' && String.unsafe_get s (pos+8) = 'i' && String.unsafe_get s (pos+9) = 'o' && String.unsafe_get s (pos+10) = 'n' && String.unsafe_get s (pos+11) = '_' && String.unsafe_get s (pos+12) = 'i' && String.unsafe_get s (pos+13) = 'd' then ( - 12 - ) - 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_kind := ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ); - bits0 := !bits0 lor 0x2; - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_guild_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 3 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_position := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 4 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 5 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_topic := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 6 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_nsfw := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - ) - ); - ) - | 7 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_bitrate := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 8 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_user_limit := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - ) - | 9 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_recipients := ( - Some ( - ( - read__5 - ) p lb - ) - ); - ) - | 10 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_icon := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - ) - | 11 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_owner_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 12 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_application_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | 13 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_parent_id := ( - Some ( - ( - read_snowflake - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - if !bits0 <> 0x3 then Atdgen_runtime.Oj_run.missing_fields p [| !bits0 |] [| "id"; "kind" |]; - ( - { - id = !field_id; - kind = !field_kind; - guild_id = !field_guild_id; - position = !field_position; - name = !field_name; - topic = !field_topic; - nsfw = !field_nsfw; - bitrate = !field_bitrate; - user_limit = !field_user_limit; - recipients = !field_recipients; - icon = !field_icon; - owner_id = !field_owner_id; - application_id = !field_application_id; - parent_id = !field_parent_id; - } - : t) - ) -) -let t_of_string s = - read_t (Yojson.Safe.init_lexer ()) (Lexing.from_string s) |