Skip to content

Commit d2ead66

Browse files
committed
Consolidated platforms into array
1 parent 2a1f725 commit d2ead66

File tree

4 files changed

+31
-60
lines changed

4 files changed

+31
-60
lines changed

README.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,13 @@ The language to use when fetching game properties. Properties such as the game d
6969
</details>
7070

7171
<details>
72-
<summary><code>fetchConsole</code></summary>
72+
<summary><code>platformsToFetch</code></summary>
7373

74-
Whether or not to fetch games available for console Game Pass.
74+
Which platforms to fetch games for, any of "console", "pc" and "eaPlay".
7575

7676
| Type | Default value | Possible values | Required |
7777
| --- | --- | --- | --- |
78-
| `boolean` | `true` | `true` or `false` | No (but at least one of `fetchConsole`, `fetchPC` or `fetchEAPlay`). |
79-
</details>
80-
81-
<details>
82-
<summary><code>fetchPC</code></summary>
83-
84-
Whether or not to fetch games available for PC Game Pass.
85-
86-
| Type | Default value | Possible values | Required |
87-
| --- | --- | --- | --- |
88-
| `boolean` | `true` | `true` or `false` | No (but at least one of `fetchConsole`, `fetchPC` or `fetchEAPlay`). |
89-
</details>
90-
91-
<details>
92-
<summary><code>fetchEAPlay</code></summary>
93-
94-
Whether or not to fetch games available through EA Play.
95-
96-
| Type | Default value | Possible values | Required |
97-
| --- | --- | --- | --- |
98-
| `boolean` | `true` | `true` or `false` | No (but at least one of `fetchConsole`, `fetchPC` or `fetchEAPlay`). |
78+
| `array` | `["console", "pc", "eaPlay"]` | `"console"`, `"pc"`, `"eaPlay"` | Yes, at least one platform. |
9979
</details>
10080

10181
<details>

config.default.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"US"
55
],
66
"language": "en-us",
7-
"fetchConsole": true,
8-
"fetchPC": true,
9-
"fetchEAPlay": true,
7+
"platformsToFetch": [
8+
"console",
9+
"pc",
10+
"eaPlay"
11+
],
1012
"outputFormat": "array",
1113
"treatEmptyStringsAsNull": true,
1214
"keepCompleteProperties": false,

config.schema.json

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -325,20 +325,25 @@
325325
"ar-sa"
326326
]
327327
},
328-
"fetchConsole": {
329-
"description": "Whether or not to fetch games available for console Game Pass.",
330-
"type": "boolean",
331-
"default": true
332-
},
333-
"fetchPC": {
334-
"description": "Whether or not to fetch games available for PC Game Pass.",
335-
"type": "boolean",
336-
"default": true
337-
},
338-
"fetchEAPlay": {
339-
"description": "Whether or not to fetch games available through EA Play.",
340-
"type": "boolean",
341-
"default": true
328+
"platformsToFetch": {
329+
"description": "Which platforms to fetch games for, any of \"console\", \"pc\" and \"eaPlay\".",
330+
"type": "array",
331+
"default": [
332+
"console",
333+
"pc",
334+
"eaPlay"
335+
],
336+
"items": {
337+
"type": "string",
338+
"enum": [
339+
"console",
340+
"pc",
341+
"eaPlay"
342+
]
343+
},
344+
"minItems": 1,
345+
"additionalItems": false,
346+
"uniqueItems": true
342347
},
343348
"outputFormat": {
344349
"description": "What kind of format the resulting JSON should use for the cleaned game properties.",
@@ -661,26 +666,10 @@
661666
"minProperties": 1
662667
}
663668
},
664-
"anyOf": [
665-
{
666-
"required": [
667-
"fetchConsole"
668-
]
669-
},
670-
{
671-
"required": [
672-
"fetchPC"
673-
]
674-
},
675-
{
676-
"required": [
677-
"fetchEAPlay"
678-
]
679-
}
680-
],
681669
"required": [
682670
"markets",
683671
"language",
672+
"platformsToFetch",
684673
"outputFormat",
685674
"includedProperties"
686675
],

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ async function main() {
6262
// Fetch Game Pass game ID's and properties for each pass type and market specified in the configuration
6363
// We do this in parallel to speed up the process
6464
for (const market of CONFIG.markets) {
65-
if (CONFIG.fetchConsole) {
65+
if (CONFIG.platformsToFetch.includes("console")) {
6666
const consoleFormattedProperties = runScriptForPassTypeAndMarket("console", market);
6767
}
68-
if (CONFIG.fetchPC) {
68+
if (CONFIG.platformsToFetch.includes("pc")) {
6969
const pcFormattedProperties = runScriptForPassTypeAndMarket("pc", market);
7070
}
71-
if (CONFIG.fetchEAPlay) {
71+
if (CONFIG.platformsToFetch.includes("eaPlay")) {
7272
const eaPlayFormattedProperties = runScriptForPassTypeAndMarket("eaPlay", market);
7373
}
7474
}

0 commit comments

Comments
 (0)