gamealgo-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +3 -2
- package/dist/commands/marketing.js +13 -5
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -177,8 +177,9 @@ export class GameAlgoAdminClient {
|
|
|
177
177
|
const params = new URLSearchParams({ environment, platform });
|
|
178
178
|
return await this.get(`/admin/v1/games/${encodeURIComponent(await this.gameId())}/integration/plan?${params.toString()}`);
|
|
179
179
|
}
|
|
180
|
-
async getAdjustMarketing() {
|
|
181
|
-
|
|
180
|
+
async getAdjustMarketing(platform) {
|
|
181
|
+
const query = platform ? `?platform=${encodeURIComponent(platform)}` : "";
|
|
182
|
+
return await this.get(`/admin/v1/games/${encodeURIComponent(await this.gameId())}/marketing/adjust${query}`);
|
|
182
183
|
}
|
|
183
184
|
async putAdjustMarketing(body) {
|
|
184
185
|
return await this.put(`/admin/v1/games/${encodeURIComponent(await this.gameId())}/marketing/adjust`, body);
|
|
@@ -10,19 +10,23 @@ export async function handleMarketing(client, args, global) {
|
|
|
10
10
|
throw new Error("usage: gamealgo marketing adjust <get|configure|sync>");
|
|
11
11
|
const sub = args.shift();
|
|
12
12
|
if (sub === "get" || sub === "status") {
|
|
13
|
-
|
|
13
|
+
const flags = parseFlags(args);
|
|
14
|
+
const platform = optionalString(flags.platform);
|
|
15
|
+
if (platform && platform !== "ios" && platform !== "android")
|
|
16
|
+
throw new Error("--platform must be ios or android");
|
|
17
|
+
await printResult(await client.getAdjustMarketing(platform), global);
|
|
14
18
|
return;
|
|
15
19
|
}
|
|
16
20
|
if (sub === "configure" || sub === "set") {
|
|
17
21
|
const flags = parseFlags(args);
|
|
18
|
-
const
|
|
22
|
+
const platform = optionalString(flags.platform);
|
|
23
|
+
if (platform !== "ios" && platform !== "android")
|
|
24
|
+
throw new Error("--platform is required and must be ios or android");
|
|
25
|
+
const current = await client.getAdjustMarketing(platform);
|
|
19
26
|
const existing = current.integration || {};
|
|
20
27
|
const appToken = optionalString(flags["app-token"] || flags.appToken || existing.appToken);
|
|
21
|
-
const platform = optionalString(flags.platform || existing.platform) || "ios";
|
|
22
28
|
if (!appToken)
|
|
23
29
|
throw new Error("--app-token is required");
|
|
24
|
-
if (platform !== "ios" && platform !== "android")
|
|
25
|
-
throw new Error("--platform must be ios or android");
|
|
26
30
|
const body = {
|
|
27
31
|
appToken,
|
|
28
32
|
appName: optionalString(flags["app-name"] || flags.appName || existing.appName) || "",
|
|
@@ -50,7 +54,11 @@ export async function handleMarketing(client, args, global) {
|
|
|
50
54
|
const stopProgress = startProgress("Syncing Adjust marketing spend", timeoutMs);
|
|
51
55
|
let response;
|
|
52
56
|
try {
|
|
57
|
+
const platform = optionalString(flags.platform);
|
|
58
|
+
if (platform && platform !== "ios" && platform !== "android")
|
|
59
|
+
throw new Error("--platform must be ios or android");
|
|
53
60
|
response = await client.syncAdjustMarketing({
|
|
61
|
+
...(platform ? { platform } : {}),
|
|
54
62
|
startDate: optionalString(flags.from || flags.start || flags.startDate),
|
|
55
63
|
endDate: optionalString(flags.to || flags.end || flags.endDate),
|
|
56
64
|
}, { timeoutMs });
|