activitysmith 1.13.0 → 1.15.0

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
@@ -42,13 +42,13 @@ await activitysmith.notifications.send({
42
42
 
43
43
  ![Push Notifications with custom icons](https://cdn.activitysmith.com/features/push-notifications-with-custom-icons.png)
44
44
 
45
- Set `icon` to a publicly accessible HTTPS image URL to show an avatar or service logo alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit `subtitle` from the notification.
45
+ Set `icon` to a publicly accessible HTTPS image URL to show a logo or avatar alongside a smaller ActivitySmith app icon. Host the image anywhere, such as on your own website or CDN. With a custom icon, iOS may omit `subtitle` from the notification.
46
46
 
47
47
  ```js
48
48
  await activitysmith.notifications.send({
49
49
  title: "MRR just crossed $10,000 🎉",
50
50
  message: "Up 18% this month from 31 new subscriptions.",
51
- icon: "https://cdn.activitysmith.com/integrations/icons/stripe.png",
51
+ icon: "https://example.com/icons/stripe.png",
52
52
  });
53
53
  ```
54
54
 
@@ -190,6 +190,24 @@ await activitysmith.notifications.send({
190
190
  });
191
191
  ```
192
192
 
193
+ ### Replace a Push Notification
194
+
195
+ Every send returns a `notification_id`. Pass it to `replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original.
196
+
197
+ Omit `metadata` or `tags` to keep their stored values.
198
+
199
+ ```js
200
+ const sent = await activitysmith.notifications.send({
201
+ title: "🚨 checkout-api is down",
202
+ message: "500 errors on 62% of requests.",
203
+ });
204
+
205
+ await activitysmith.notifications.replace(sent.notification_id, {
206
+ title: "✅ checkout-api recovered",
207
+ message: "Error rate is back to normal. Incident resolved.",
208
+ });
209
+ ```
210
+
193
211
  ## Live Activities
194
212
 
195
213
  Choose the Live Activity type that matches what you want to show:
@@ -226,6 +244,9 @@ Choose the Live Activity type that matches what you want to show:
226
244
 
227
245
  Use a stable `streamKey` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `streamKey` update it.
228
246
 
247
+ > [!WARNING]
248
+ > iOS limits how often a Live Activity can update. Short bursts that end, like deployment steps, are fine. If one Live Activity keeps updating more often than every couple of minutes, iOS throttles it until the budget refills, roughly an hour, even though the API still returns `200`. [Learn more](https://activitysmith.com/docs/live-activity-stream#update-frequency-and-ios-limits)
249
+
229
250
  #### Value
230
251
 
231
252
  ![Value Live Activity stream example](https://cdn.activitysmith.com/features/value-live-activity.png)
@@ -573,12 +594,14 @@ String metric values work too.
573
594
  await activitysmith.metrics.update("prod.status", "healthy");
574
595
  ```
575
596
 
576
- ## App Icon Badge Count
597
+ ## App Icon Badge
577
598
 
578
- ![ActivitySmith app icon with an App Icon Badge Count](https://cdn.activitysmith.com/features/badge-count.png)
599
+ ![ActivitySmith app icon with an App Icon Badge](https://cdn.activitysmith.com/features/badge-count.png)
579
600
 
580
601
  Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
581
602
 
603
+ App Icon Badge requires Push Notifications enabled. On your iPhone, open Settings > ActivitySmith > Notifications and turn on Allow Notifications.
604
+
582
605
  ### Set or update the badge value
583
606
 
584
607
  ```js
@@ -648,7 +671,7 @@ await activitysmith.liveActivities.update({
648
671
 
649
672
  ## Channels
650
673
 
651
- Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge Count updates. Omit it for account-wide delivery.
674
+ Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge updates. Omit it for account-wide delivery.
652
675
 
653
676
  ```js
654
677
  await activitysmith.notifications.send({
@@ -689,7 +712,3 @@ try {
689
712
  ### [NPM Package](https://www.npmjs.com/package/activitysmith)
690
713
 
691
714
  Install the ActivitySmith Node.js SDK from npm
692
-
693
- ### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-node)
694
-
695
- View the Node.js SDK source on GitHub
@@ -19,13 +19,13 @@ export interface UpdateAppIconBadgeCountRequest {
19
19
  */
20
20
  export declare class AppIconBadgesApi extends runtime.BaseAPI {
21
21
  /**
22
- * Shows a number on the ActivitySmith app icon.
23
- * Set App Icon Badge Count
22
+ * Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
23
+ * Set App Icon Badge
24
24
  */
25
25
  updateAppIconBadgeCountRaw(requestParameters: UpdateAppIconBadgeCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AppIconBadgeCountUpdateResponse>>;
26
26
  /**
27
- * Shows a number on the ActivitySmith app icon.
28
- * Set App Icon Badge Count
27
+ * Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
28
+ * Set App Icon Badge
29
29
  */
30
30
  updateAppIconBadgeCount(requestParameters: UpdateAppIconBadgeCountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AppIconBadgeCountUpdateResponse>;
31
31
  }
@@ -20,8 +20,8 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class AppIconBadgesApi extends runtime.BaseAPI {
22
22
  /**
23
- * Shows a number on the ActivitySmith app icon.
24
- * Set App Icon Badge Count
23
+ * Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
24
+ * Set App Icon Badge
25
25
  */
26
26
  async updateAppIconBadgeCountRaw(requestParameters, initOverrides) {
27
27
  if (requestParameters['appIconBadgeCountUpdateRequest'] == null) {
@@ -47,8 +47,8 @@ class AppIconBadgesApi extends runtime.BaseAPI {
47
47
  return new runtime.JSONApiResponse(response);
48
48
  }
49
49
  /**
50
- * Shows a number on the ActivitySmith app icon.
51
- * Set App Icon Badge Count
50
+ * Shows a number on the ActivitySmith app icon. Requires Push Notifications enabled for ActivitySmith on the device.
51
+ * Set App Icon Badge
52
52
  */
53
53
  async updateAppIconBadgeCount(requestParameters, initOverrides) {
54
54
  const response = await this.updateAppIconBadgeCountRaw(requestParameters, initOverrides);
@@ -0,0 +1,33 @@
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 { AccountDeviceListResponse } from '../models/index';
14
+ export interface ListAccountDevicesRequest {
15
+ limit?: number;
16
+ offset?: number;
17
+ includeInactive?: boolean;
18
+ }
19
+ /**
20
+ *
21
+ */
22
+ export declare class DevicesApi extends runtime.BaseAPI {
23
+ /**
24
+ * Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
25
+ * List paired devices
26
+ */
27
+ listAccountDevicesRaw(requestParameters: ListAccountDevicesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountDeviceListResponse>>;
28
+ /**
29
+ * Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
30
+ * List paired devices
31
+ */
32
+ listAccountDevices(requestParameters?: ListAccountDevicesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountDeviceListResponse>;
33
+ }
@@ -0,0 +1,62 @@
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.DevicesApi = void 0;
17
+ const runtime = require("../runtime");
18
+ /**
19
+ *
20
+ */
21
+ class DevicesApi extends runtime.BaseAPI {
22
+ /**
23
+ * Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
24
+ * List paired devices
25
+ */
26
+ async listAccountDevicesRaw(requestParameters, initOverrides) {
27
+ const queryParameters = {};
28
+ if (requestParameters['limit'] != null) {
29
+ queryParameters['limit'] = requestParameters['limit'];
30
+ }
31
+ if (requestParameters['offset'] != null) {
32
+ queryParameters['offset'] = requestParameters['offset'];
33
+ }
34
+ if (requestParameters['includeInactive'] != null) {
35
+ queryParameters['include_inactive'] = requestParameters['includeInactive'];
36
+ }
37
+ const headerParameters = {};
38
+ if (this.configuration && this.configuration.accessToken) {
39
+ const token = this.configuration.accessToken;
40
+ const tokenString = await token("apiKeyAuth", []);
41
+ if (tokenString) {
42
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
43
+ }
44
+ }
45
+ const response = await this.request({
46
+ path: `/account/devices`,
47
+ method: 'GET',
48
+ headers: headerParameters,
49
+ query: queryParameters,
50
+ }, initOverrides);
51
+ return new runtime.JSONApiResponse(response);
52
+ }
53
+ /**
54
+ * Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices.
55
+ * List paired devices
56
+ */
57
+ async listAccountDevices(requestParameters = {}, initOverrides) {
58
+ const response = await this.listAccountDevicesRaw(requestParameters, initOverrides);
59
+ return await response.value();
60
+ }
61
+ }
62
+ exports.DevicesApi = DevicesApi;
@@ -33,12 +33,12 @@ export interface UpdateLiveActivityRequest {
33
33
  */
34
34
  export declare class LiveActivitiesApi extends runtime.BaseAPI {
35
35
  /**
36
- * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
36
+ * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
37
37
  * End a Live Activity (legacy manual lifecycle)
38
38
  */
39
39
  endLiveActivityRaw(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityEndResponse>>;
40
40
  /**
41
- * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
41
+ * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
42
42
  * End a Live Activity (legacy manual lifecycle)
43
43
  */
44
44
  endLiveActivity(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityEndResponse>;
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class LiveActivitiesApi extends runtime.BaseAPI {
22
22
  /**
23
- * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
23
+ * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
24
24
  * End a Live Activity (legacy manual lifecycle)
25
25
  */
26
26
  async endLiveActivityRaw(requestParameters, initOverrides) {
@@ -47,7 +47,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
47
47
  return new runtime.JSONApiResponse(response);
48
48
  }
49
49
  /**
50
- * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities.
50
+ * Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe.
51
51
  * End a Live Activity (legacy manual lifecycle)
52
52
  */
53
53
  async endLiveActivity(requestParameters, initOverrides) {
@@ -10,23 +10,37 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { MetricValueUpdateRequest, MetricValueUpdateResponse } from '../models/index';
13
+ import type { MetricResponse, MetricUpsertRequest, MetricValueUpdateRequest, MetricValueUpdateResponse } from '../models/index';
14
14
  export interface UpdateMetricValueRequest {
15
15
  key: string;
16
16
  metricValueUpdateRequest: MetricValueUpdateRequest;
17
17
  }
18
+ export interface UpsertMetricRequest {
19
+ key: string;
20
+ metricUpsertRequest?: MetricUpsertRequest;
21
+ }
18
22
  /**
19
23
  *
20
24
  */
21
25
  export declare class MetricsApi extends runtime.BaseAPI {
22
26
  /**
23
- * Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
27
+ * Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
24
28
  * Update a widget metric value
25
29
  */
26
30
  updateMetricValueRaw(requestParameters: UpdateMetricValueRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricValueUpdateResponse>>;
27
31
  /**
28
- * Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
32
+ * Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
29
33
  * Update a widget metric value
30
34
  */
31
35
  updateMetricValue(requestParameters: UpdateMetricValueRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricValueUpdateResponse>;
36
+ /**
37
+ * Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
38
+ * Create or update a widget metric
39
+ */
40
+ upsertMetricRaw(requestParameters: UpsertMetricRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricResponse>>;
41
+ /**
42
+ * Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
43
+ * Create or update a widget metric
44
+ */
45
+ upsertMetric(requestParameters: UpsertMetricRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricResponse>;
32
46
  }
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class MetricsApi extends runtime.BaseAPI {
22
22
  /**
23
- * Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
23
+ * Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
24
24
  * Update a widget metric value
25
25
  */
26
26
  async updateMetricValueRaw(requestParameters, initOverrides) {
@@ -50,12 +50,47 @@ class MetricsApi extends runtime.BaseAPI {
50
50
  return new runtime.JSONApiResponse(response);
51
51
  }
52
52
  /**
53
- * Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
53
+ * Updates the latest value for a metric displayed in ActivitySmith widgets. If no metric uses the key yet, the first value creates one: the label comes from the key, numeric values get the number format, and text values get the string format. To choose a currency, percent, or unit format, create the metric first with PUT /metrics/{key} or in the web app. A deleted metric is not recreated by new values; the request returns 404 with code metric_deleted. Each account can have up to 100 metrics created through the API. Metric updates have an independent 300-requests-per-minute account allowance. They do not consume the Push Notification, badge, or Live Activity allowances.
54
54
  * Update a widget metric value
55
55
  */
56
56
  async updateMetricValue(requestParameters, initOverrides) {
57
57
  const response = await this.updateMetricValueRaw(requestParameters, initOverrides);
58
58
  return await response.value();
59
59
  }
60
+ /**
61
+ * Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
62
+ * Create or update a widget metric
63
+ */
64
+ async upsertMetricRaw(requestParameters, initOverrides) {
65
+ if (requestParameters['key'] == null) {
66
+ throw new runtime.RequiredError('key', 'Required parameter "key" was null or undefined when calling upsertMetric().');
67
+ }
68
+ const queryParameters = {};
69
+ const headerParameters = {};
70
+ headerParameters['Content-Type'] = 'application/json';
71
+ if (this.configuration && this.configuration.accessToken) {
72
+ const token = this.configuration.accessToken;
73
+ const tokenString = await token("apiKeyAuth", []);
74
+ if (tokenString) {
75
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
76
+ }
77
+ }
78
+ const response = await this.request({
79
+ path: `/metrics/{key}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
80
+ method: 'PUT',
81
+ headers: headerParameters,
82
+ query: queryParameters,
83
+ body: requestParameters['metricUpsertRequest'],
84
+ }, initOverrides);
85
+ return new runtime.JSONApiResponse(response);
86
+ }
87
+ /**
88
+ * Creates a metric for widgets, or updates the fields sent for an existing metric. Omitted fields keep their current values, so repeating the same request does not change the metric. Changing between the string format and a numeric format clears the latest value. Shares the metric account allowance of 300 requests per minute and is not a billable metric update.
89
+ * Create or update a widget metric
90
+ */
91
+ async upsertMetric(requestParameters, initOverrides) {
92
+ const response = await this.upsertMetricRaw(requestParameters, initOverrides);
93
+ return await response.value();
94
+ }
60
95
  }
61
96
  exports.MetricsApi = MetricsApi;
@@ -10,7 +10,14 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { PushNotificationRequest, PushNotificationResponse } from '../models/index';
13
+ import type { PushNotificationDismissResponse, PushNotificationReplaceRequest, PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse } from '../models/index';
14
+ export interface DismissPushNotificationRequest {
15
+ notificationId: string;
16
+ }
17
+ export interface ReplacePushNotificationRequest {
18
+ notificationId: string;
19
+ pushNotificationReplaceRequest: PushNotificationReplaceRequest;
20
+ }
14
21
  export interface SendPushNotificationRequest {
15
22
  pushNotificationRequest: PushNotificationRequest;
16
23
  }
@@ -19,12 +26,32 @@ export interface SendPushNotificationRequest {
19
26
  */
20
27
  export declare class PushNotificationsApi extends runtime.BaseAPI {
21
28
  /**
22
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
29
+ * Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the `notification_id` from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \"Push Notification dismissed\" in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
30
+ * Dismiss a push notification
31
+ */
32
+ dismissPushNotificationRaw(requestParameters: DismissPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationDismissResponse>>;
33
+ /**
34
+ * Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the `notification_id` from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \"Push Notification dismissed\" in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
35
+ * Dismiss a push notification
36
+ */
37
+ dismissPushNotification(requestParameters: DismissPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationDismissResponse>;
38
+ /**
39
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
40
+ * Replace a push notification
41
+ */
42
+ replacePushNotificationRaw(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationReplaceResponse>>;
43
+ /**
44
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
45
+ * Replace a push notification
46
+ */
47
+ replacePushNotification(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationReplaceResponse>;
48
+ /**
49
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
23
50
  * Send a push notification
24
51
  */
25
52
  sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
26
53
  /**
27
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
54
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
28
55
  * Send a push notification
29
56
  */
30
57
  sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
@@ -20,7 +20,78 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class PushNotificationsApi extends runtime.BaseAPI {
22
22
  /**
23
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
23
+ * Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the `notification_id` from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \"Push Notification dismissed\" in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
24
+ * Dismiss a push notification
25
+ */
26
+ async dismissPushNotificationRaw(requestParameters, initOverrides) {
27
+ if (requestParameters['notificationId'] == null) {
28
+ throw new runtime.RequiredError('notificationId', 'Required parameter "notificationId" was null or undefined when calling dismissPushNotification().');
29
+ }
30
+ const queryParameters = {};
31
+ const headerParameters = {};
32
+ if (this.configuration && this.configuration.accessToken) {
33
+ const token = this.configuration.accessToken;
34
+ const tokenString = await token("apiKeyAuth", []);
35
+ if (tokenString) {
36
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
37
+ }
38
+ }
39
+ const response = await this.request({
40
+ path: `/push-notification/{notification_id}/dismiss`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))),
41
+ method: 'POST',
42
+ headers: headerParameters,
43
+ query: queryParameters,
44
+ }, initOverrides);
45
+ return new runtime.JSONApiResponse(response);
46
+ }
47
+ /**
48
+ * Clears a Push Notification you already sent from the Lock Screen and Notification Center on every device it was sent to, using the `notification_id` from the send response. Notification history keeps it. Devices clear the notification in the background, which can take a moment or wait until the ActivitySmith app next opens. A successful response means the dismissal was recorded, not that every device has cleared it yet. Devices running an ActivitySmith app version before 1.17.0 show a silent notification titled \"Push Notification dismissed\" in its place until the user clears it. Calling this again for the same notification returns the same response and sends nothing. A dismissed notification cannot be replaced.
49
+ * Dismiss a push notification
50
+ */
51
+ async dismissPushNotification(requestParameters, initOverrides) {
52
+ const response = await this.dismissPushNotificationRaw(requestParameters, initOverrides);
53
+ return await response.value();
54
+ }
55
+ /**
56
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
57
+ * Replace a push notification
58
+ */
59
+ async replacePushNotificationRaw(requestParameters, initOverrides) {
60
+ if (requestParameters['notificationId'] == null) {
61
+ throw new runtime.RequiredError('notificationId', 'Required parameter "notificationId" was null or undefined when calling replacePushNotification().');
62
+ }
63
+ if (requestParameters['pushNotificationReplaceRequest'] == null) {
64
+ throw new runtime.RequiredError('pushNotificationReplaceRequest', 'Required parameter "pushNotificationReplaceRequest" was null or undefined when calling replacePushNotification().');
65
+ }
66
+ const queryParameters = {};
67
+ const headerParameters = {};
68
+ headerParameters['Content-Type'] = 'application/json';
69
+ if (this.configuration && this.configuration.accessToken) {
70
+ const token = this.configuration.accessToken;
71
+ const tokenString = await token("apiKeyAuth", []);
72
+ if (tokenString) {
73
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
74
+ }
75
+ }
76
+ const response = await this.request({
77
+ path: `/push-notification/{notification_id}`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))),
78
+ method: 'PUT',
79
+ headers: headerParameters,
80
+ query: queryParameters,
81
+ body: requestParameters['pushNotificationReplaceRequest'],
82
+ }, initOverrides);
83
+ return new runtime.JSONApiResponse(response);
84
+ }
85
+ /**
86
+ * Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
87
+ * Replace a push notification
88
+ */
89
+ async replacePushNotification(requestParameters, initOverrides) {
90
+ const response = await this.replacePushNotificationRaw(requestParameters, initOverrides);
91
+ return await response.value();
92
+ }
93
+ /**
94
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
24
95
  * Send a push notification
25
96
  */
26
97
  async sendPushNotificationRaw(requestParameters, initOverrides) {
@@ -47,7 +118,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
47
118
  return new runtime.JSONApiResponse(response);
48
119
  }
49
120
  /**
50
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
121
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
51
122
  * Send a push notification
52
123
  */
53
124
  async sendPushNotification(requestParameters, initOverrides) {
@@ -1,4 +1,5 @@
1
1
  export * from './AppIconBadgesApi';
2
+ export * from './DevicesApi';
2
3
  export * from './LiveActivitiesApi';
3
4
  export * from './MetricsApi';
4
5
  export * from './PushNotificationsApi';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* tslint:disable */
18
18
  /* eslint-disable */
19
19
  __exportStar(require("./AppIconBadgesApi"), exports);
20
+ __exportStar(require("./DevicesApi"), exports);
20
21
  __exportStar(require("./LiveActivitiesApi"), exports);
21
22
  __exportStar(require("./MetricsApi"), exports);
22
23
  __exportStar(require("./PushNotificationsApi"), exports);