activitysmith 0.1.0 → 0.1.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/README.md CHANGED
@@ -1,42 +1,70 @@
1
- # activitysmith
1
+ # ActivitySmith Node.js Library
2
2
 
3
- Official ActivitySmith Node.js SDK (OpenAPI generated).
3
+ The ActivitySmith Node library provides convenient access to the ActivitySmith API from server-side JavaScript and TypeScript applications.
4
4
 
5
- ## Install
5
+ ## Documentation
6
+
7
+ See [API reference](https://activitysmith.com/docs/api-reference/introduction)
8
+
9
+ ## Installation
6
10
 
7
11
  ```sh
8
- npm i activitysmith
12
+ npm install activitysmith
9
13
  ```
10
14
 
11
- ## Usage (ESM)
15
+ ## Usage
16
+
17
+ ESM:
12
18
 
13
19
  ```ts
14
- import { Configuration, LiveActivitiesApi, NotificationsApi } from "activitysmith";
20
+ import ActivitySmith from "activitysmith";
15
21
 
16
- const config = new Configuration({
17
- accessToken: process.env.ACTIVITYSMITH_API_KEY,
22
+ const client = new ActivitySmith({
23
+ apiKey: process.env.ACTIVITYSMITH_API_KEY,
18
24
  });
19
25
 
20
- const live = new LiveActivitiesApi(config);
21
- await live.startLiveActivity({
22
- liveActivityStartRequest: {
23
- // See LiveActivityStartRequest type for fields
26
+ // Push Notifications
27
+ await client.notifications.sendPushNotification({
28
+ pushNotificationRequest: {
29
+ // See PushNotificationRequest for fields
24
30
  },
25
31
  });
26
32
 
27
- const notifications = new NotificationsApi(config);
28
- await notifications.sendPushNotification({
29
- pushNotificationRequest: {
30
- // See PushNotificationRequest type for fields
33
+ // Live Activities
34
+ await client.liveActivities.startLiveActivity({
35
+ liveActivityStartRequest: {
36
+ // See LiveActivityStartRequest for fields
31
37
  },
32
38
  });
33
39
  ```
34
40
 
35
- ## Configuration
41
+ CommonJS:
42
+
43
+ ```js
44
+ const ActivitySmith = require("activitysmith");
45
+
46
+ const client = new ActivitySmith({
47
+ apiKey: process.env.ACTIVITYSMITH_API_KEY,
48
+ });
49
+ ```
50
+
51
+ ## API Surface
52
+
53
+ The client exposes grouped resources:
54
+
55
+ - `client.liveActivities`
56
+ - `client.notifications`
57
+
58
+ Each method is fully typed. Request and response types are included in the type definitions.
59
+
60
+ ## TypeScript Support
61
+
62
+ This package is written in TypeScript and ships with type definitions out of the box.
63
+
64
+ ## Requirements
36
65
 
37
- - Default base URL: `https://activitysmith.com/api`
38
- - Override with `new Configuration({ basePath: "..." })`
66
+ - Node.js 18 or newer
39
67
 
40
- ## Types
68
+ ## License
41
69
 
42
- All request/response types are exported from the package.
70
+ MIT
@@ -15,7 +15,6 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.LiveActivitiesApi = void 0;
17
17
  const runtime = require("../runtime");
18
- const index_1 = require("../models/index");
19
18
  /**
20
19
  *
21
20
  */
@@ -33,7 +32,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
33
32
  headerParameters['Content-Type'] = 'application/json';
34
33
  if (this.configuration && this.configuration.accessToken) {
35
34
  const token = this.configuration.accessToken;
36
- const tokenString = await token("bearerAuth", []);
35
+ const tokenString = await token("apiKeyAuth", []);
37
36
  if (tokenString) {
38
37
  headerParameters["Authorization"] = `Bearer ${tokenString}`;
39
38
  }
@@ -43,9 +42,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
43
42
  method: 'POST',
44
43
  headers: headerParameters,
45
44
  query: queryParameters,
46
- body: (0, index_1.LiveActivityEndRequestToJSON)(requestParameters['liveActivityEndRequest']),
45
+ body: requestParameters['liveActivityEndRequest'],
47
46
  }, initOverrides);
48
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LiveActivityEndResponseFromJSON)(jsonValue));
47
+ return new runtime.JSONApiResponse(response);
49
48
  }
50
49
  /**
51
50
  * Ends a Live Activity and archives its lifecycle.
@@ -68,7 +67,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
68
67
  headerParameters['Content-Type'] = 'application/json';
69
68
  if (this.configuration && this.configuration.accessToken) {
70
69
  const token = this.configuration.accessToken;
71
- const tokenString = await token("bearerAuth", []);
70
+ const tokenString = await token("apiKeyAuth", []);
72
71
  if (tokenString) {
73
72
  headerParameters["Authorization"] = `Bearer ${tokenString}`;
74
73
  }
@@ -78,9 +77,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
78
77
  method: 'POST',
79
78
  headers: headerParameters,
80
79
  query: queryParameters,
81
- body: (0, index_1.LiveActivityStartRequestToJSON)(requestParameters['liveActivityStartRequest']),
80
+ body: requestParameters['liveActivityStartRequest'],
82
81
  }, initOverrides);
83
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LiveActivityStartResponseFromJSON)(jsonValue));
82
+ return new runtime.JSONApiResponse(response);
84
83
  }
85
84
  /**
86
85
  * Starts a Live Activity on all registered devices and returns an activity_id.
@@ -103,7 +102,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
103
102
  headerParameters['Content-Type'] = 'application/json';
104
103
  if (this.configuration && this.configuration.accessToken) {
105
104
  const token = this.configuration.accessToken;
106
- const tokenString = await token("bearerAuth", []);
105
+ const tokenString = await token("apiKeyAuth", []);
107
106
  if (tokenString) {
108
107
  headerParameters["Authorization"] = `Bearer ${tokenString}`;
109
108
  }
@@ -113,9 +112,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
113
112
  method: 'POST',
114
113
  headers: headerParameters,
115
114
  query: queryParameters,
116
- body: (0, index_1.LiveActivityUpdateRequestToJSON)(requestParameters['liveActivityUpdateRequest']),
115
+ body: requestParameters['liveActivityUpdateRequest'],
117
116
  }, initOverrides);
118
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LiveActivityUpdateResponseFromJSON)(jsonValue));
117
+ return new runtime.JSONApiResponse(response);
119
118
  }
120
119
  /**
121
120
  * Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ActivitySmith API
3
+ * Send push notifications and Live Activities to your own devices via a single API key.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { PushNotificationRequest, PushNotificationResponse } from '../models/index';
14
+ export interface SendPushNotificationRequest {
15
+ pushNotificationRequest: PushNotificationRequest;
16
+ }
17
+ /**
18
+ *
19
+ */
20
+ export declare class PushNotificationsApi extends runtime.BaseAPI {
21
+ /**
22
+ * Sends a push notification to every paired device in your account.
23
+ * Send a push notification
24
+ */
25
+ sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
26
+ /**
27
+ * Sends a push notification to every paired device in your account.
28
+ * Send a push notification
29
+ */
30
+ sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
31
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * ActivitySmith API
6
+ * Send push notifications and Live Activities to your own devices via a single API key.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.PushNotificationsApi = void 0;
17
+ const runtime = require("../runtime");
18
+ /**
19
+ *
20
+ */
21
+ class PushNotificationsApi extends runtime.BaseAPI {
22
+ /**
23
+ * Sends a push notification to every paired device in your account.
24
+ * Send a push notification
25
+ */
26
+ async sendPushNotificationRaw(requestParameters, initOverrides) {
27
+ if (requestParameters['pushNotificationRequest'] == null) {
28
+ throw new runtime.RequiredError('pushNotificationRequest', 'Required parameter "pushNotificationRequest" was null or undefined when calling sendPushNotification().');
29
+ }
30
+ const queryParameters = {};
31
+ const headerParameters = {};
32
+ headerParameters['Content-Type'] = 'application/json';
33
+ if (this.configuration && this.configuration.accessToken) {
34
+ const token = this.configuration.accessToken;
35
+ const tokenString = await token("apiKeyAuth", []);
36
+ if (tokenString) {
37
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
38
+ }
39
+ }
40
+ const response = await this.request({
41
+ path: `/push-notification`,
42
+ method: 'POST',
43
+ headers: headerParameters,
44
+ query: queryParameters,
45
+ body: requestParameters['pushNotificationRequest'],
46
+ }, initOverrides);
47
+ return new runtime.JSONApiResponse(response);
48
+ }
49
+ /**
50
+ * Sends a push notification to every paired device in your account.
51
+ * Send a push notification
52
+ */
53
+ async sendPushNotification(requestParameters, initOverrides) {
54
+ const response = await this.sendPushNotificationRaw(requestParameters, initOverrides);
55
+ return await response.value();
56
+ }
57
+ }
58
+ exports.PushNotificationsApi = PushNotificationsApi;
@@ -1,2 +1,2 @@
1
1
  export * from './LiveActivitiesApi';
2
- export * from './NotificationsApi';
2
+ export * from './PushNotificationsApi';
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* tslint:disable */
18
18
  /* eslint-disable */
19
19
  __exportStar(require("./LiveActivitiesApi"), exports);
20
- __exportStar(require("./NotificationsApi"), exports);
20
+ __exportStar(require("./PushNotificationsApi"), exports);
@@ -1,14 +1,512 @@
1
- export * from './ContentStateEnd';
2
- export * from './ContentStateStart';
3
- export * from './ContentStateUpdate';
4
- export * from './LiveActivityEndRequest';
5
- export * from './LiveActivityEndResponse';
6
- export * from './LiveActivityLimitError';
7
- export * from './LiveActivityStartRequest';
8
- export * from './LiveActivityStartResponse';
9
- export * from './LiveActivityUpdateRequest';
10
- export * from './LiveActivityUpdateResponse';
11
- export * from './PushNotificationRequest';
12
- export * from './PushNotificationResponse';
13
- export * from './RateLimitError';
14
- export * from './SendPushNotification429Response';
1
+ /**
2
+ * End payload. Required fields are title and current_step. number_of_steps is optional.
3
+ * @export
4
+ * @interface ContentStateEnd
5
+ */
6
+ export interface ContentStateEnd {
7
+ /**
8
+ *
9
+ * @type {string}
10
+ * @memberof ContentStateEnd
11
+ */
12
+ title: string;
13
+ /**
14
+ *
15
+ * @type {string}
16
+ * @memberof ContentStateEnd
17
+ */
18
+ subtitle?: string;
19
+ /**
20
+ *
21
+ * @type {number}
22
+ * @memberof ContentStateEnd
23
+ */
24
+ number_of_steps?: number;
25
+ /**
26
+ *
27
+ * @type {number}
28
+ * @memberof ContentStateEnd
29
+ */
30
+ current_step: number;
31
+ /**
32
+ * Optional. Accent color for the Live Activity. Defaults to blue.
33
+ * @type {string}
34
+ * @memberof ContentStateEnd
35
+ */
36
+ color?: ContentStateEndColorEnum;
37
+ /**
38
+ * Optional. Overrides color for the current step.
39
+ * @type {string}
40
+ * @memberof ContentStateEnd
41
+ */
42
+ step_color?: ContentStateEndStepColorEnum;
43
+ /**
44
+ * Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max.
45
+ * @type {number}
46
+ * @memberof ContentStateEnd
47
+ */
48
+ auto_dismiss_minutes?: number;
49
+ }
50
+ /**
51
+ * @export
52
+ */
53
+ export declare const ContentStateEndColorEnum: {
54
+ readonly Lime: "lime";
55
+ readonly Green: "green";
56
+ readonly Cyan: "cyan";
57
+ readonly Blue: "blue";
58
+ readonly Purple: "purple";
59
+ readonly Magenta: "magenta";
60
+ readonly Red: "red";
61
+ readonly Orange: "orange";
62
+ readonly Yellow: "yellow";
63
+ };
64
+ export type ContentStateEndColorEnum = typeof ContentStateEndColorEnum[keyof typeof ContentStateEndColorEnum];
65
+ /**
66
+ * @export
67
+ */
68
+ export declare const ContentStateEndStepColorEnum: {
69
+ readonly Lime: "lime";
70
+ readonly Green: "green";
71
+ readonly Cyan: "cyan";
72
+ readonly Blue: "blue";
73
+ readonly Purple: "purple";
74
+ readonly Magenta: "magenta";
75
+ readonly Red: "red";
76
+ readonly Orange: "orange";
77
+ readonly Yellow: "yellow";
78
+ };
79
+ export type ContentStateEndStepColorEnum = typeof ContentStateEndStepColorEnum[keyof typeof ContentStateEndStepColorEnum];
80
+ /**
81
+ * Start payload requires title, number_of_steps, current_step, and type.
82
+ * @export
83
+ * @interface ContentStateStart
84
+ */
85
+ export interface ContentStateStart {
86
+ /**
87
+ *
88
+ * @type {string}
89
+ * @memberof ContentStateStart
90
+ */
91
+ title: string;
92
+ /**
93
+ *
94
+ * @type {string}
95
+ * @memberof ContentStateStart
96
+ */
97
+ subtitle?: string;
98
+ /**
99
+ *
100
+ * @type {number}
101
+ * @memberof ContentStateStart
102
+ */
103
+ number_of_steps: number;
104
+ /**
105
+ *
106
+ * @type {number}
107
+ * @memberof ContentStateStart
108
+ */
109
+ current_step: number;
110
+ /**
111
+ *
112
+ * @type {string}
113
+ * @memberof ContentStateStart
114
+ */
115
+ type: ContentStateStartTypeEnum;
116
+ /**
117
+ * Optional. Accent color for the Live Activity. Defaults to blue.
118
+ * @type {string}
119
+ * @memberof ContentStateStart
120
+ */
121
+ color?: ContentStateStartColorEnum;
122
+ /**
123
+ * Optional. Overrides color for the current step.
124
+ * @type {string}
125
+ * @memberof ContentStateStart
126
+ */
127
+ step_color?: ContentStateStartStepColorEnum;
128
+ }
129
+ /**
130
+ * @export
131
+ */
132
+ export declare const ContentStateStartTypeEnum: {
133
+ readonly SegmentedProgress: "segmented_progress";
134
+ };
135
+ export type ContentStateStartTypeEnum = typeof ContentStateStartTypeEnum[keyof typeof ContentStateStartTypeEnum];
136
+ /**
137
+ * @export
138
+ */
139
+ export declare const ContentStateStartColorEnum: {
140
+ readonly Lime: "lime";
141
+ readonly Green: "green";
142
+ readonly Cyan: "cyan";
143
+ readonly Blue: "blue";
144
+ readonly Purple: "purple";
145
+ readonly Magenta: "magenta";
146
+ readonly Red: "red";
147
+ readonly Orange: "orange";
148
+ readonly Yellow: "yellow";
149
+ };
150
+ export type ContentStateStartColorEnum = typeof ContentStateStartColorEnum[keyof typeof ContentStateStartColorEnum];
151
+ /**
152
+ * @export
153
+ */
154
+ export declare const ContentStateStartStepColorEnum: {
155
+ readonly Lime: "lime";
156
+ readonly Green: "green";
157
+ readonly Cyan: "cyan";
158
+ readonly Blue: "blue";
159
+ readonly Purple: "purple";
160
+ readonly Magenta: "magenta";
161
+ readonly Red: "red";
162
+ readonly Orange: "orange";
163
+ readonly Yellow: "yellow";
164
+ };
165
+ export type ContentStateStartStepColorEnum = typeof ContentStateStartStepColorEnum[keyof typeof ContentStateStartStepColorEnum];
166
+ /**
167
+ * Update payload. Required fields are title and current_step. number_of_steps is optional.
168
+ * @export
169
+ * @interface ContentStateUpdate
170
+ */
171
+ export interface ContentStateUpdate {
172
+ /**
173
+ *
174
+ * @type {string}
175
+ * @memberof ContentStateUpdate
176
+ */
177
+ title: string;
178
+ /**
179
+ *
180
+ * @type {string}
181
+ * @memberof ContentStateUpdate
182
+ */
183
+ subtitle?: string;
184
+ /**
185
+ *
186
+ * @type {number}
187
+ * @memberof ContentStateUpdate
188
+ */
189
+ number_of_steps?: number;
190
+ /**
191
+ *
192
+ * @type {number}
193
+ * @memberof ContentStateUpdate
194
+ */
195
+ current_step: number;
196
+ /**
197
+ * Optional. Accent color for the Live Activity. Defaults to blue.
198
+ * @type {string}
199
+ * @memberof ContentStateUpdate
200
+ */
201
+ color?: ContentStateUpdateColorEnum;
202
+ /**
203
+ * Optional. Overrides color for the current step.
204
+ * @type {string}
205
+ * @memberof ContentStateUpdate
206
+ */
207
+ step_color?: ContentStateUpdateStepColorEnum;
208
+ }
209
+ /**
210
+ * @export
211
+ */
212
+ export declare const ContentStateUpdateColorEnum: {
213
+ readonly Lime: "lime";
214
+ readonly Green: "green";
215
+ readonly Cyan: "cyan";
216
+ readonly Blue: "blue";
217
+ readonly Purple: "purple";
218
+ readonly Magenta: "magenta";
219
+ readonly Red: "red";
220
+ readonly Orange: "orange";
221
+ readonly Yellow: "yellow";
222
+ };
223
+ export type ContentStateUpdateColorEnum = typeof ContentStateUpdateColorEnum[keyof typeof ContentStateUpdateColorEnum];
224
+ /**
225
+ * @export
226
+ */
227
+ export declare const ContentStateUpdateStepColorEnum: {
228
+ readonly Lime: "lime";
229
+ readonly Green: "green";
230
+ readonly Cyan: "cyan";
231
+ readonly Blue: "blue";
232
+ readonly Purple: "purple";
233
+ readonly Magenta: "magenta";
234
+ readonly Red: "red";
235
+ readonly Orange: "orange";
236
+ readonly Yellow: "yellow";
237
+ };
238
+ export type ContentStateUpdateStepColorEnum = typeof ContentStateUpdateStepColorEnum[keyof typeof ContentStateUpdateStepColorEnum];
239
+ /**
240
+ *
241
+ * @export
242
+ * @interface LiveActivityEndRequest
243
+ */
244
+ export interface LiveActivityEndRequest {
245
+ /**
246
+ *
247
+ * @type {string}
248
+ * @memberof LiveActivityEndRequest
249
+ */
250
+ activity_id: string;
251
+ /**
252
+ *
253
+ * @type {ContentStateEnd}
254
+ * @memberof LiveActivityEndRequest
255
+ */
256
+ content_state: ContentStateEnd;
257
+ }
258
+ /**
259
+ *
260
+ * @export
261
+ * @interface LiveActivityEndResponse
262
+ */
263
+ export interface LiveActivityEndResponse {
264
+ /**
265
+ *
266
+ * @type {boolean}
267
+ * @memberof LiveActivityEndResponse
268
+ */
269
+ success: boolean;
270
+ /**
271
+ *
272
+ * @type {string}
273
+ * @memberof LiveActivityEndResponse
274
+ */
275
+ activity_id: string;
276
+ /**
277
+ *
278
+ * @type {number}
279
+ * @memberof LiveActivityEndResponse
280
+ */
281
+ devices_queued?: number;
282
+ /**
283
+ *
284
+ * @type {number}
285
+ * @memberof LiveActivityEndResponse
286
+ */
287
+ devices_notified?: number;
288
+ /**
289
+ *
290
+ * @type {string}
291
+ * @memberof LiveActivityEndResponse
292
+ */
293
+ timestamp: string;
294
+ }
295
+ /**
296
+ *
297
+ * @export
298
+ * @interface LiveActivityLimitError
299
+ */
300
+ export interface LiveActivityLimitError {
301
+ /**
302
+ *
303
+ * @type {string}
304
+ * @memberof LiveActivityLimitError
305
+ */
306
+ error: string;
307
+ /**
308
+ *
309
+ * @type {string}
310
+ * @memberof LiveActivityLimitError
311
+ */
312
+ message: string;
313
+ /**
314
+ *
315
+ * @type {number}
316
+ * @memberof LiveActivityLimitError
317
+ */
318
+ limit: number;
319
+ /**
320
+ * Current number of active Live Activities.
321
+ * @type {number}
322
+ * @memberof LiveActivityLimitError
323
+ */
324
+ active: number;
325
+ }
326
+ /**
327
+ *
328
+ * @export
329
+ * @interface LiveActivityStartRequest
330
+ */
331
+ export interface LiveActivityStartRequest {
332
+ /**
333
+ *
334
+ * @type {ContentStateStart}
335
+ * @memberof LiveActivityStartRequest
336
+ */
337
+ content_state: ContentStateStart;
338
+ }
339
+ /**
340
+ *
341
+ * @export
342
+ * @interface LiveActivityStartResponse
343
+ */
344
+ export interface LiveActivityStartResponse {
345
+ /**
346
+ *
347
+ * @type {boolean}
348
+ * @memberof LiveActivityStartResponse
349
+ */
350
+ success: boolean;
351
+ /**
352
+ *
353
+ * @type {number}
354
+ * @memberof LiveActivityStartResponse
355
+ */
356
+ devices_notified?: number;
357
+ /**
358
+ *
359
+ * @type {number}
360
+ * @memberof LiveActivityStartResponse
361
+ */
362
+ users_notified?: number;
363
+ /**
364
+ *
365
+ * @type {string}
366
+ * @memberof LiveActivityStartResponse
367
+ */
368
+ activity_id: string;
369
+ /**
370
+ *
371
+ * @type {string}
372
+ * @memberof LiveActivityStartResponse
373
+ */
374
+ timestamp: string;
375
+ }
376
+ /**
377
+ *
378
+ * @export
379
+ * @interface LiveActivityUpdateRequest
380
+ */
381
+ export interface LiveActivityUpdateRequest {
382
+ /**
383
+ *
384
+ * @type {string}
385
+ * @memberof LiveActivityUpdateRequest
386
+ */
387
+ activity_id: string;
388
+ /**
389
+ *
390
+ * @type {ContentStateUpdate}
391
+ * @memberof LiveActivityUpdateRequest
392
+ */
393
+ content_state: ContentStateUpdate;
394
+ }
395
+ /**
396
+ *
397
+ * @export
398
+ * @interface LiveActivityUpdateResponse
399
+ */
400
+ export interface LiveActivityUpdateResponse {
401
+ /**
402
+ *
403
+ * @type {boolean}
404
+ * @memberof LiveActivityUpdateResponse
405
+ */
406
+ success: boolean;
407
+ /**
408
+ *
409
+ * @type {string}
410
+ * @memberof LiveActivityUpdateResponse
411
+ */
412
+ activity_id: string;
413
+ /**
414
+ *
415
+ * @type {number}
416
+ * @memberof LiveActivityUpdateResponse
417
+ */
418
+ devices_queued?: number;
419
+ /**
420
+ *
421
+ * @type {number}
422
+ * @memberof LiveActivityUpdateResponse
423
+ */
424
+ devices_notified?: number;
425
+ /**
426
+ *
427
+ * @type {string}
428
+ * @memberof LiveActivityUpdateResponse
429
+ */
430
+ timestamp: string;
431
+ }
432
+ /**
433
+ *
434
+ * @export
435
+ * @interface PushNotificationRequest
436
+ */
437
+ export interface PushNotificationRequest {
438
+ /**
439
+ *
440
+ * @type {string}
441
+ * @memberof PushNotificationRequest
442
+ */
443
+ title: string;
444
+ /**
445
+ *
446
+ * @type {string}
447
+ * @memberof PushNotificationRequest
448
+ */
449
+ message?: string;
450
+ /**
451
+ *
452
+ * @type {string}
453
+ * @memberof PushNotificationRequest
454
+ */
455
+ subtitle?: string;
456
+ }
457
+ /**
458
+ *
459
+ * @export
460
+ * @interface PushNotificationResponse
461
+ */
462
+ export interface PushNotificationResponse {
463
+ /**
464
+ *
465
+ * @type {boolean}
466
+ * @memberof PushNotificationResponse
467
+ */
468
+ success: boolean;
469
+ /**
470
+ *
471
+ * @type {number}
472
+ * @memberof PushNotificationResponse
473
+ */
474
+ devices_notified?: number;
475
+ /**
476
+ *
477
+ * @type {number}
478
+ * @memberof PushNotificationResponse
479
+ */
480
+ users_notified?: number;
481
+ /**
482
+ *
483
+ * @type {string}
484
+ * @memberof PushNotificationResponse
485
+ */
486
+ timestamp: string;
487
+ }
488
+ /**
489
+ *
490
+ * @export
491
+ * @interface RateLimitError
492
+ */
493
+ export interface RateLimitError {
494
+ /**
495
+ *
496
+ * @type {string}
497
+ * @memberof RateLimitError
498
+ */
499
+ error: string;
500
+ /**
501
+ *
502
+ * @type {string}
503
+ * @memberof RateLimitError
504
+ */
505
+ message: string;
506
+ }
507
+ /**
508
+ * @type SendPushNotification429Response
509
+ *
510
+ * @export
511
+ */
512
+ export type SendPushNotification429Response = LiveActivityLimitError | RateLimitError;
@@ -1,32 +1,93 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- /* tslint:disable */
18
- /* eslint-disable */
19
- __exportStar(require("./ContentStateEnd"), exports);
20
- __exportStar(require("./ContentStateStart"), exports);
21
- __exportStar(require("./ContentStateUpdate"), exports);
22
- __exportStar(require("./LiveActivityEndRequest"), exports);
23
- __exportStar(require("./LiveActivityEndResponse"), exports);
24
- __exportStar(require("./LiveActivityLimitError"), exports);
25
- __exportStar(require("./LiveActivityStartRequest"), exports);
26
- __exportStar(require("./LiveActivityStartResponse"), exports);
27
- __exportStar(require("./LiveActivityUpdateRequest"), exports);
28
- __exportStar(require("./LiveActivityUpdateResponse"), exports);
29
- __exportStar(require("./PushNotificationRequest"), exports);
30
- __exportStar(require("./PushNotificationResponse"), exports);
31
- __exportStar(require("./RateLimitError"), exports);
32
- __exportStar(require("./SendPushNotification429Response"), exports);
3
+ exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = void 0;
4
+ /**
5
+ * @export
6
+ */
7
+ exports.ContentStateEndColorEnum = {
8
+ Lime: 'lime',
9
+ Green: 'green',
10
+ Cyan: 'cyan',
11
+ Blue: 'blue',
12
+ Purple: 'purple',
13
+ Magenta: 'magenta',
14
+ Red: 'red',
15
+ Orange: 'orange',
16
+ Yellow: 'yellow'
17
+ };
18
+ /**
19
+ * @export
20
+ */
21
+ exports.ContentStateEndStepColorEnum = {
22
+ Lime: 'lime',
23
+ Green: 'green',
24
+ Cyan: 'cyan',
25
+ Blue: 'blue',
26
+ Purple: 'purple',
27
+ Magenta: 'magenta',
28
+ Red: 'red',
29
+ Orange: 'orange',
30
+ Yellow: 'yellow'
31
+ };
32
+ /**
33
+ * @export
34
+ */
35
+ exports.ContentStateStartTypeEnum = {
36
+ SegmentedProgress: 'segmented_progress'
37
+ };
38
+ /**
39
+ * @export
40
+ */
41
+ exports.ContentStateStartColorEnum = {
42
+ Lime: 'lime',
43
+ Green: 'green',
44
+ Cyan: 'cyan',
45
+ Blue: 'blue',
46
+ Purple: 'purple',
47
+ Magenta: 'magenta',
48
+ Red: 'red',
49
+ Orange: 'orange',
50
+ Yellow: 'yellow'
51
+ };
52
+ /**
53
+ * @export
54
+ */
55
+ exports.ContentStateStartStepColorEnum = {
56
+ Lime: 'lime',
57
+ Green: 'green',
58
+ Cyan: 'cyan',
59
+ Blue: 'blue',
60
+ Purple: 'purple',
61
+ Magenta: 'magenta',
62
+ Red: 'red',
63
+ Orange: 'orange',
64
+ Yellow: 'yellow'
65
+ };
66
+ /**
67
+ * @export
68
+ */
69
+ exports.ContentStateUpdateColorEnum = {
70
+ Lime: 'lime',
71
+ Green: 'green',
72
+ Cyan: 'cyan',
73
+ Blue: 'blue',
74
+ Purple: 'purple',
75
+ Magenta: 'magenta',
76
+ Red: 'red',
77
+ Orange: 'orange',
78
+ Yellow: 'yellow'
79
+ };
80
+ /**
81
+ * @export
82
+ */
83
+ exports.ContentStateUpdateStepColorEnum = {
84
+ Lime: 'lime',
85
+ Green: 'green',
86
+ Cyan: 'cyan',
87
+ Blue: 'blue',
88
+ Purple: 'purple',
89
+ Magenta: 'magenta',
90
+ Red: 'red',
91
+ Orange: 'orange',
92
+ Yellow: 'yellow'
93
+ };
@@ -123,7 +123,6 @@ export interface RequestOpts {
123
123
  body?: HTTPBody;
124
124
  }
125
125
  export declare function querystring(params: HTTPQuery, prefix?: string): string;
126
- export declare function mapValues(data: any, fn: (item: any) => any): {};
127
126
  export declare function canConsumeForm(consumes: Consume[]): boolean;
128
127
  export interface Consume {
129
128
  contentType: string;
@@ -15,7 +15,6 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
17
17
  exports.querystring = querystring;
18
- exports.mapValues = mapValues;
19
18
  exports.canConsumeForm = canConsumeForm;
20
19
  exports.BASE_PATH = "https://activitysmith.com/api".replace(/\/+$/, "");
21
20
  class Configuration {
@@ -277,9 +276,6 @@ function querystringSingleKey(key, value, keyPrefix = '') {
277
276
  }
278
277
  return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
279
278
  }
280
- function mapValues(data, fn) {
281
- return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
282
- }
283
279
  function canConsumeForm(consumes) {
284
280
  for (const consume of consumes) {
285
281
  if ('multipart/form-data' === consume.contentType) {
@@ -0,0 +1,9 @@
1
+ import { PushNotificationsApi, LiveActivitiesApi } from "../generated/index";
2
+ export interface ActivitySmithOptions {
3
+ apiKey: string;
4
+ }
5
+ export declare class ActivitySmith {
6
+ readonly notifications: PushNotificationsApi;
7
+ readonly liveActivities: LiveActivitiesApi;
8
+ constructor(opts: ActivitySmithOptions);
9
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivitySmith = void 0;
4
+ const index_1 = require("../generated/index");
5
+ class ActivitySmith {
6
+ constructor(opts) {
7
+ if (!opts?.apiKey) {
8
+ throw new Error("ActivitySmith: apiKey is required");
9
+ }
10
+ // basePath omitted on purpose — it will use the default from the generated runtime
11
+ const config = new index_1.Configuration({
12
+ accessToken: opts.apiKey,
13
+ });
14
+ this.notifications = new index_1.PushNotificationsApi(config);
15
+ this.liveActivities = new index_1.LiveActivitiesApi(config);
16
+ }
17
+ }
18
+ exports.ActivitySmith = ActivitySmith;
@@ -0,0 +1,2 @@
1
+ import { ActivitySmith } from "./ActivitySmith";
2
+ export = ActivitySmith;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Public exports live here.
3
+ const ActivitySmith_1 = require("./ActivitySmith");
4
+ module.exports = ActivitySmith_1.ActivitySmith;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",
@@ -9,17 +9,17 @@
9
9
  "api"
10
10
  ],
11
11
  "homepage": "https://github.com/ActivitySmithHQ/activitysmith-node",
12
- "main": "dist/generated/index.js",
13
- "types": "dist/generated/index.d.ts",
12
+ "main": "dist/src/index.js",
13
+ "types": "dist/src/index.d.ts",
14
14
  "exports": {
15
15
  ".": {
16
- "types": "./dist/generated/index.d.ts",
17
- "import": "./dist/generated/index.js",
18
- "require": "./dist/generated/index.js",
19
- "default": "./dist/generated/index.js"
16
+ "types": "./dist/src/index.d.ts",
17
+ "require": "./dist/src/index.js",
18
+ "default": "./dist/src/index.js"
20
19
  }
21
20
  },
22
21
  "files": [
22
+ "dist/src",
23
23
  "dist/generated",
24
24
  "README.md",
25
25
  "LICENSE"
@@ -29,7 +29,8 @@
29
29
  "node": ">=18"
30
30
  },
31
31
  "scripts": {
32
- "build": "tsc -p tsconfig.generated.json",
32
+ "clean": "tsc -b --clean",
33
+ "build": "npm run clean && tsc -b",
33
34
  "prepublishOnly": "npm run build",
34
35
  "test": "npm run build && vitest run"
35
36
  },