-
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
15 changed files
with
192 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,4 @@ ifneq (,$(wildcard ./.env)) | |
export | ||
endif | ||
|
||
x: | ||
set | ||
|
||
include make/ocaml/main.mk |
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 +1,11 @@ | ||
(** Community event endpoints | ||
Represents all endpoints in [/community/CommunityEvent/*] | ||
- [GET /community/CommunityEvent/getAvailableCommunityEvents] | ||
(explain the concept of a community event here) *) | ||
|
||
(** [get g d s] retrieves a list of currently available community events in the | ||
game [g] on domain [d]. The request is sent with the method [s]. *) | ||
|
||
val get : Data.Game.t -> string -> Data.Requester.Json.t -> Models.Response.Community.Community_event.t option Lwt.t |
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 +1,14 @@ | ||
(** Community news endpoints | ||
Represents all endpoints in [/community/news/*] | ||
- [GET /community/news/getNews] | ||
News are collections of text with an associated (optional) image. | ||
News items are valid only until their expirytime is exceeded. | ||
Although some news items have expired they may still be present | ||
in the response.*) | ||
|
||
(** [get g d s] retrieves a list of currently available news in the | ||
game [g] on domain [d]. The request is sent with the method [s]. *) | ||
|
||
val get : Data.Game.t -> string -> Data.Requester.Json.t -> Models.Response.Community.News.t option Lwt.t |
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,29 @@ | ||
open Lwt.Syntax | ||
open Data.Sort | ||
|
||
let find_observable ?(start = 1) ?(count = 100) ?(sort = Descending) game domain send = | ||
let should_descend = match sort with Ascending -> 0 | Descending -> 1 in | ||
let base_url = Uri.make ~scheme:"https" ~host:domain ~path:"/game/advertisement/findObservableAdvertisements" () in | ||
let url = | ||
Uri.with_query' | ||
base_url | ||
[ "title", Data.Game.to_str game | ||
; "start", string_of_int start | ||
; "count", string_of_int count | ||
; "desc", string_of_int should_descend | ||
; "sortOrder", string_of_int should_descend | ||
; "dataChecksum", "0" | ||
; "modDLLFile", "INVALID" | ||
; "modName", "INVALID" | ||
; "modVersion", "INVALID" | ||
; "modDLLChecksum", "0" | ||
; "dataChecksum", "-888" | ||
; "appBinaryChecksum", "113358" | ||
; "versionFlags", "56950784" | ||
] | ||
in | ||
let* json = send url in | ||
match json with | ||
| Some j -> Lwt.return @@ Some (Models.Response.Game.Observable_advertisements.from_json j) | ||
| None -> Lwt.return None | ||
;; |
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
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,3 @@ | ||
type t = | ||
| Ascending | ||
| Descending |
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
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
open Relic_sdk | ||
open Test_state.Game | ||
open Lwt.Syntax | ||
|
||
let test_get_observable_advertisements test_state _ () = | ||
let open Data.Sort in | ||
let endpoint_asc = Api.Game.Advertisement.find_observable ~sort:Ascending ~count:2 in | ||
let endpoint_dsc = Api.Game.Advertisement.find_observable ~sort:Descending ~count:2 in | ||
let* lobbies_asc = Client.get endpoint_asc test_state.client in | ||
let* lobbies_dsc = Client.get endpoint_dsc test_state.client in | ||
match lobbies_asc, lobbies_dsc with | ||
| Some a, Some d -> | ||
let* _ = Lwt_io.printf "Yepge %d\n" (List.length a.advertisements) in | ||
let id_asc = (List.hd a.advertisements).match_id in | ||
let id_dsc = (List.hd d.advertisements).match_id in | ||
Alcotest.(check int) "Different match IDs" id_asc id_dsc; | ||
if id_asc = id_dsc | ||
then Lwt.fail_with "Expected different advertisement IDs in ascending and descending order" | ||
else Lwt.return_unit | ||
| _ -> Lwt.fail_with "No 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
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