From 23837aa2f03db36020abb78d890c4303633ca5e2 Mon Sep 17 00:00:00 2001 From: shoshin Date: Sun, 19 Mar 2023 18:51:22 -0500 Subject: Add: some sketching of steam api stuff --- arclade.asd | 13 ++++++++++++- arclade.lisp | 4 +++- steam.lisp | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 steam.lisp diff --git a/arclade.asd b/arclade.asd index ea8ce77..e0ce1bd 100644 --- a/arclade.asd +++ b/arclade.asd @@ -6,6 +6,17 @@ :license "AGPL" :version "0.0.1" :serial t - :depends-on (#:lazybones #:bknr.datastore #:derrida #:jonathan #:spinneret #:swank #:testiere #:lazybones-hunchentoot #:ironclad #:defclass-std) + :depends-on + (#:bknr.datastore + #:defclass-std + #:derrida + #:drakma + #:ironclad + #:jonathan + #:lazybones-hunchentoot + #:spinneret + #:swank + #:testiere + #:lazybones) :components ((:file "package") (:file "arclade"))) diff --git a/arclade.lisp b/arclade.lisp index f87772a..e7ce65c 100644 --- a/arclade.lisp +++ b/arclade.lisp @@ -10,7 +10,9 @@ ((datastore-directory :ir :std (local-store-path)) (swank-port :std nil :doc "If set, swank is started on this port.") (host :std "0.0.0.0") - (port :ir :std 8888))) + (port :ir :std 8888) + (steam-key :ia :std "") + (steam-user-id :ia :std ""))) (defun config-from-file (path) "PATH should be a path to a file containing a PLIST suitable for diff --git a/steam.lisp b/steam.lisp new file mode 100644 index 0000000..5828b22 --- /dev/null +++ b/steam.lisp @@ -0,0 +1,22 @@ +(defvar steam-host "api.steampowered.com") + +(defun set-steam-key (key) + (setf (steam-key *config*) key)) + +(defun set-steam-id (id) + (setf (steam-user-id *config*) id)) + +(defun steam-query-key () + (format nil "key=~a" (steam-key *config*))) + +(defun steam-query-user () + (format nil "steamid=~a" (steam-user-id *config*))) + +(defun steam-games-uri () + (quri:make-uri-http + :host steam-host + :path "IPlayerService/GetOwnedGames/v0001/" + :query (format nil "~a&~a" (steam-query-key) (steam-query-user)))) + +(defun steam-games () + (drakma:http-request (quri:render-uri (steam-games-uri)))) -- cgit v1.2.3