-
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
5 changed files
with
97 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let proxy_steam_request steam_request_url profile_names game domain send = | ||
match profile_names with | ||
| [] -> Lwt.fail_with "Profile names list cannot be empty" | ||
| _ids -> | ||
let base_url = Uri.make ~scheme:"https" ~host:domain ~path:"/community/external/proxysteamuserrequest" () in | ||
let url = | ||
Uri.with_query' | ||
base_url | ||
[ "title", Data.Game.to_str game | ||
; "profile_names", Data.Query.encode_lst_s profile_names | ||
; "request", steam_request_url | ||
] | ||
in | ||
send url | ||
;; |
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,22 @@ | ||
(** [proxy_steam_request] is a function that builds a request to a remote | ||
Steam API proxy service. It constructs the URL with necessary parameters | ||
and utilizes a provided function to send the request and return the | ||
response as parsed JSON. | ||
@param steam_request_url The specific endpoint of the Steam API to be called. | ||
@param profile_names A list of profile names to be included in the request. | ||
@param game The specific game context for the request. | ||
@param domain The domain of the remote API service. | ||
@param send A function that takes a URI and returns a JSON response wrapped | ||
in an Lwt option monad. | ||
@return | ||
Returns a Yojson.Basic.t option wrapped in an Lwt monad, representing | ||
the parsed JSON response, or None if there's an error or no data. *) | ||
val proxy_steam_request | ||
: string | ||
-> string list | ||
-> Data.Game.t | ||
-> string | ||
-> Data.Requester.Json.t | ||
-> Yojson.Basic.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,37 @@ | ||
{ | ||
"result": { | ||
"code": 0, | ||
"message": "SUCCESS" | ||
}, | ||
"avatars": [ | ||
{ | ||
"profile_id": 196240, | ||
"name": "/steam/76561197984749679", | ||
"alias": "GL.TheViper", | ||
"personal_statgroup_id": 200, | ||
"xp": 5606, | ||
"level": 3, | ||
"leaderboardregion_id": 0, | ||
"country": "de" | ||
} | ||
], | ||
"steamResults": { | ||
"response": { | ||
"players": [ | ||
{ | ||
"steamid": "76561197984749679", | ||
"communityvisibilitystate": 1, | ||
"profilestate": 1, | ||
"personaname": "GL.TheViper", | ||
"commentpermission": 2, | ||
"profileurl": "https://steamcommunity.com/id/secrettheviper/", | ||
"avatar": "https://avatars.steamstatic.com/eefa125e4e662af9600355746783166942b8a1ff.jpg", | ||
"avatarmedium": "https://avatars.steamstatic.com/eefa125e4e662af9600355746783166942b8a1ff_medium.jpg", | ||
"avatarfull": "https://avatars.steamstatic.com/eefa125e4e662af9600355746783166942b8a1ff_full.jpg", | ||
"avatarhash": "eefa125e4e662af9600355746783166942b8a1ff", | ||
"personastate": 0 | ||
} | ||
] | ||
} | ||
} | ||
} |
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