From b038e425420eabbc29e92be72731ca0641c7d9da Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 5 Oct 2022 13:58:42 -0400 Subject: [PATCH] WIP: Retrieve data from mediawiki for tools --- getWikiAssets.py | 6 ++++ src/ToolsLabelText.vue | 68 ++++++++++++++++++++++++++++++++++++++++++ src/mediawiki.d.ts | 36 ++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 getWikiAssets.py create mode 100644 src/ToolsLabelText.vue create mode 100644 src/mediawiki.d.ts diff --git a/getWikiAssets.py b/getWikiAssets.py new file mode 100644 index 0000000..8cab713 --- /dev/null +++ b/getWikiAssets.py @@ -0,0 +1,6 @@ +import requests + +r = requests.get('https://wiki.claremontmakerspace.org/api.php?action=askargs&conditions=Asset Tag::%2B&printouts=Asset Tag|Requires Certification|Has Reservation URL&format=json&api_version=2') + +with open('wiki-tools.json', 'w') as f: + f.write(r.text) diff --git a/src/ToolsLabelText.vue b/src/ToolsLabelText.vue new file mode 100644 index 0000000..11a1f9b --- /dev/null +++ b/src/ToolsLabelText.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/mediawiki.d.ts b/src/mediawiki.d.ts new file mode 100644 index 0000000..ce6ba44 --- /dev/null +++ b/src/mediawiki.d.ts @@ -0,0 +1,36 @@ +export interface PrintRequest { + label: string; + key: string; + redi: string; + typeid: string; + mode: number; +} + +export interface PageValue { + fulltext: string; + fullurl: string; + namespace: number; + exists: string; // TODO: might be '0'|'1' + displaytitle: string; +} + +// TODO: more prop types exist +export type PropValue = string | PageValue; + +export interface AskResult { + printouts: { + [prop: string]: PropValue[]; + }; + fulltext: string; + fullurl: string; + namespace: number; + exists: string; // TODO: might be '0'|'1' + displaytitle: string; +} + +export interface apiAsk { + query: { + printrequests: PrintRequest[]; + results: { [name: string]: AskResult }; + }; +}