-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
type t = | ||
{ status : int | ||
; advertisements : Stub.Game.Observable_advertisement.t list (* ; avatars : Yojson.Basic.t list *) | ||
; advertisements : Stub.Game.Observable_advertisement.t list | ||
; members : Stub.Game.Observable_advertisement_member.t list | ||
; tail : Yojson.Basic.t list | ||
} | ||
|
||
let to_json a = | ||
`List ([ `Int a.status; `List (List.map Stub.Game.Observable_advertisement.to_json a.advertisements) ] @ a.tail) | ||
`List | ||
([ `Int a.status | ||
; `List (List.map Stub.Game.Observable_advertisement.to_json a.advertisements) | ||
; `List (List.map Stub.Game.Observable_advertisement_member.to_json a.members) | ||
] | ||
@ a.tail) | ||
;; | ||
|
||
let from_json json = | ||
match json with | ||
| `List (`Int status :: `List items :: tail) -> | ||
{ status; advertisements = List.map Stub.Game.Observable_advertisement.from_json items; tail } | ||
| `List (`Int status :: `List items :: `List members :: tail) -> | ||
{ status | ||
; advertisements = List.map Stub.Game.Observable_advertisement.from_json items | ||
; members = List.map Stub.Game.Observable_advertisement_member.from_json members | ||
; tail | ||
} | ||
| _ -> failwith "Unexpected JSON format for the observable advertisements response" | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
type t = | ||
{ int1 : int | ||
; int2 : int | ||
; platform_id : string | ||
; icon : string | ||
; name : string | ||
; string1 : string | ||
; int3 : int | ||
; int4 : int | ||
; int5 : int | ||
; int6 : int | ||
; int_null : int option | ||
; string2 : string | ||
; int7 : int | ||
; list1 : Yojson.Basic.t list | ||
} | ||
|
||
let from_json json = | ||
match json with | ||
| `List [ int1; int2; platform_id; icon; name; string1; int3; int4; int5; int6; int_null; string2; int7; list1 ] -> | ||
{ int1 = Yojson.Basic.Util.to_int int1 | ||
; int2 = Yojson.Basic.Util.to_int int2 | ||
; platform_id = Yojson.Basic.Util.to_string platform_id | ||
; icon = Yojson.Basic.Util.to_string icon | ||
; name = Yojson.Basic.Util.to_string name | ||
; string1 = Yojson.Basic.Util.to_string string1 | ||
; int3 = Yojson.Basic.Util.to_int int3 | ||
; int4 = Yojson.Basic.Util.to_int int4 | ||
; int5 = Yojson.Basic.Util.to_int int5 | ||
; int6 = Yojson.Basic.Util.to_int int6 | ||
; int_null = Yojson.Basic.Util.to_int_option int_null | ||
; string2 = Yojson.Basic.Util.to_string string2 | ||
; int7 = Yojson.Basic.Util.to_int int7 | ||
; list1 = Yojson.Basic.Util.to_list list1 | ||
} | ||
| _ -> failwith "Unexpected observable advertisement member format" | ||
;; | ||
|
||
let to_json n = | ||
`List | ||
[ `Int n.int1 | ||
; `Int n.int2 | ||
; `String n.platform_id | ||
; `String n.icon | ||
; `String n.name | ||
; `String n.string1 | ||
; `Int n.int3 | ||
; `Int n.int4 | ||
; `Int n.int5 | ||
; `Int n.int6 | ||
; (match n.int_null with Some i -> `Int i | None -> `Null) | ||
; `String n.string2 | ||
; `Int n.int7 | ||
; `List n.list1 | ||
] | ||
;; |
This file was deleted.
Oops, something went wrong.