activitysmith-cli 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +22 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Command-line interface for ActivitySmith. Send push notifications, start, update and end live activities directly from your terminal.",
5
5
  "keywords": [
6
6
  "activitysmith",
package/src/cli.js CHANGED
@@ -2,15 +2,19 @@
2
2
 
3
3
  import { Command, InvalidArgumentError } from "commander";
4
4
  import ActivitySmith from "activitysmith";
5
+ import { createRequire } from "module";
5
6
  import { readFile } from "fs/promises";
6
7
  import { resolve } from "path";
7
8
 
9
+ const require = createRequire(import.meta.url);
10
+ const { version } = require("../package.json");
11
+
8
12
  const program = new Command();
9
13
 
10
14
  program
11
15
  .name("activitysmith-cli")
12
16
  .description("CLI for ActivitySmith API")
13
- .version("0.1.1")
17
+ .version(version)
14
18
  .option(
15
19
  "--api-key <key>",
16
20
  "ActivitySmith API key (defaults to ACTIVITYSMITH_API_KEY)"
@@ -374,12 +378,12 @@ program
374
378
  const apiKey = requireApiKey(globalOptions);
375
379
  const client = createClient(apiKey);
376
380
 
377
- const response = await client.notifications.send({
378
- ...withTargetChannels(
381
+ const response = await client.notifications.sendPushNotification({
382
+ pushNotificationRequest: withTargetChannels(
379
383
  {
380
- title: options.title,
381
- message: options.message,
382
- subtitle: options.subtitle,
384
+ title: options.title,
385
+ message: options.message,
386
+ subtitle: options.subtitle,
383
387
  },
384
388
  options.channels
385
389
  ),
@@ -421,12 +425,12 @@ addContentStateOptions(
421
425
  const client = createClient(apiKey);
422
426
  const contentState = await loadContentState(options);
423
427
 
424
- const response = await client.liveActivities.start(
425
- withTargetChannels(
428
+ const response = await client.liveActivities.startLiveActivity({
429
+ liveActivityStartRequest: withTargetChannels(
426
430
  toApiLiveActivityStartRequest(contentState),
427
431
  options.channels
428
- )
429
- );
432
+ ),
433
+ });
430
434
 
431
435
  const activityId = response?.activityId ?? response?.activity_id;
432
436
  outputResult(response, globalOptions, [
@@ -452,12 +456,12 @@ addContentStateOptions(
452
456
  const client = createClient(apiKey);
453
457
  const contentState = await loadContentState(options);
454
458
 
455
- const response = await client.liveActivities.update(
456
- toApiLiveActivityUpdateRequest(
459
+ const response = await client.liveActivities.updateLiveActivity({
460
+ liveActivityUpdateRequest: toApiLiveActivityUpdateRequest(
457
461
  options.activityId,
458
462
  contentState
459
- )
460
- );
463
+ ),
464
+ });
461
465
 
462
466
  outputResult(response, globalOptions, [
463
467
  "Live Activity updated.",
@@ -482,12 +486,12 @@ addContentStateOptions(
482
486
  const client = createClient(apiKey);
483
487
  const contentState = await loadContentState(options);
484
488
 
485
- const response = await client.liveActivities.end(
486
- toApiLiveActivityEndRequest(
489
+ const response = await client.liveActivities.endLiveActivity({
490
+ liveActivityEndRequest: toApiLiveActivityEndRequest(
487
491
  options.activityId,
488
492
  contentState
489
- )
490
- );
493
+ ),
494
+ });
491
495
 
492
496
  outputResult(response, globalOptions, [
493
497
  "Live Activity ended.",