Skip to content

Commit

Permalink
Prepare for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruhlmann committed Apr 12, 2024
1 parent 75a20d9 commit f2e170e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/authentication/session.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type t =
{ id : string
; last_update : int
}

let minutes_before_expiration = 45
3 changes: 2 additions & 1 deletion lib/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ open Lwt.Syntax
type t =
{ domain : string
; game : Data.Game.t
; session : Authentication.Session.t option
}

let create domain game = { domain; game }
let create domain game = { domain; game; session = None }

let get_json (url : Uri.t) =
let* resp, body = Cohttp_lwt_unix.Client.get url in
Expand Down
1 change: 1 addition & 0 deletions lib/data/game.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ type t =
| Age4

let to_str = function Age1 -> "age1" | Age2 -> "age2" | Age3 -> "age3" | Age4 -> "age4"
let to_app_id = function Age1 -> 1017900 | Age2 -> 813780 | Age3 -> 933110 | Age4 -> 1466860
2 changes: 2 additions & 0 deletions lib/data/game.mli
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ type t =

(** [to_str g] converts a game [g] into its string representation for use in the relic-link API *)
val to_str : t -> string
(** [to_str g] converts a game [g] into its steam app id *)
val to_app_id : t -> int

0 comments on commit f2e170e

Please sign in to comment.