activitysmith 1.14.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 a logo or avatar 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
 
@@ -594,12 +594,14 @@ String metric values work too.
594
594
  await activitysmith.metrics.update("prod.status", "healthy");
595
595
  ```
596
596
 
597
- ## App Icon Badge Count
597
+ ## App Icon Badge
598
598
 
599
- ![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)
600
600
 
601
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.
602
602
 
603
+ App Icon Badge requires Push Notifications enabled. On your iPhone, open Settings > ActivitySmith > Notifications and turn on Allow Notifications.
604
+
603
605
  ### Set or update the badge value
604
606
 
605
607
  ```js
@@ -669,7 +671,7 @@ await activitysmith.liveActivities.update({
669
671
 
670
672
  ## Channels
671
673
 
672
- 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.
673
675
 
674
676
  ```js
675
677
  await activitysmith.notifications.send({
@@ -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,10 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { PushNotificationReplaceRequest, PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse } from '../models/index';
13
+ import type { PushNotificationDismissResponse, PushNotificationReplaceRequest, PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse } from '../models/index';
14
+ export interface DismissPushNotificationRequest {
15
+ notificationId: string;
16
+ }
14
17
  export interface ReplacePushNotificationRequest {
15
18
  notificationId: string;
16
19
  pushNotificationReplaceRequest: PushNotificationReplaceRequest;
@@ -22,6 +25,16 @@ export interface SendPushNotificationRequest {
22
25
  *
23
26
  */
24
27
  export declare class PushNotificationsApi extends runtime.BaseAPI {
28
+ /**
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>;
25
38
  /**
26
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.
27
40
  * Replace a push notification
@@ -19,6 +19,39 @@ const runtime = require("../runtime");
19
19
  *
20
20
  */
21
21
  class PushNotificationsApi extends runtime.BaseAPI {
22
+ /**
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
+ }
22
55
  /**
23
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.
24
57
  * Replace a push notification
@@ -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);
@@ -1,3 +1,140 @@
1
+ /**
2
+ * An iPhone or iPad paired to the account, one entry per device and owner.
3
+ * @export
4
+ * @interface AccountDevice
5
+ */
6
+ export interface AccountDevice {
7
+ /**
8
+ * Email of the account member who paired the device.
9
+ * @type {string}
10
+ * @memberof AccountDevice
11
+ */
12
+ user_email: string;
13
+ /**
14
+ * Device ID. Use it to assign the device to Channels.
15
+ * @type {string}
16
+ * @memberof AccountDevice
17
+ */
18
+ device_id: string;
19
+ /**
20
+ * Device platform, such as ios. iPhones and iPads both report ios; use system_name to tell them apart.
21
+ * @type {string}
22
+ * @memberof AccountDevice
23
+ */
24
+ device_type: string | null;
25
+ /**
26
+ * True when the device can receive Push Notifications or Live Activities.
27
+ * @type {boolean}
28
+ * @memberof AccountDevice
29
+ */
30
+ is_active: boolean;
31
+ /**
32
+ * Whether each delivery token is active, keyed by token type (push, start_live_activity).
33
+ * @type {{ [key: string]: boolean; }}
34
+ * @memberof AccountDevice
35
+ */
36
+ token_status: {
37
+ [key: string]: boolean;
38
+ };
39
+ /**
40
+ * ActivitySmith app version on the device.
41
+ * @type {string}
42
+ * @memberof AccountDevice
43
+ */
44
+ app_version: string | null;
45
+ /**
46
+ * Device name set on the device.
47
+ * @type {string}
48
+ * @memberof AccountDevice
49
+ */
50
+ device_name: string | null;
51
+ /**
52
+ * Operating system name, such as iOS or iPadOS.
53
+ * @type {string}
54
+ * @memberof AccountDevice
55
+ */
56
+ system_name: string | null;
57
+ /**
58
+ * Operating system version.
59
+ * @type {string}
60
+ * @memberof AccountDevice
61
+ */
62
+ system_version: string | null;
63
+ /**
64
+ * When the device was first paired.
65
+ * @type {string}
66
+ * @memberof AccountDevice
67
+ */
68
+ created_at: string | null;
69
+ /**
70
+ * When the device last updated its pairing.
71
+ * @type {string}
72
+ * @memberof AccountDevice
73
+ */
74
+ updated_at: string | null;
75
+ }
76
+ /**
77
+ *
78
+ * @export
79
+ * @interface AccountDeviceListResponse
80
+ */
81
+ export interface AccountDeviceListResponse {
82
+ /**
83
+ *
84
+ * @type {Array<AccountDevice>}
85
+ * @memberof AccountDeviceListResponse
86
+ */
87
+ devices: Array<AccountDevice>;
88
+ /**
89
+ *
90
+ * @type {AccountDeviceListResponseMeta}
91
+ * @memberof AccountDeviceListResponse
92
+ */
93
+ meta: AccountDeviceListResponseMeta;
94
+ }
95
+ /**
96
+ *
97
+ * @export
98
+ * @interface AccountDeviceListResponseMeta
99
+ */
100
+ export interface AccountDeviceListResponseMeta {
101
+ /**
102
+ * Devices matching the filter.
103
+ * @type {number}
104
+ * @memberof AccountDeviceListResponseMeta
105
+ */
106
+ total: number;
107
+ /**
108
+ *
109
+ * @type {number}
110
+ * @memberof AccountDeviceListResponseMeta
111
+ */
112
+ limit: number;
113
+ /**
114
+ *
115
+ * @type {number}
116
+ * @memberof AccountDeviceListResponseMeta
117
+ */
118
+ offset: number;
119
+ /**
120
+ *
121
+ * @type {boolean}
122
+ * @memberof AccountDeviceListResponseMeta
123
+ */
124
+ has_more: boolean;
125
+ /**
126
+ * Offset for the next page, or null on the last page.
127
+ * @type {number}
128
+ * @memberof AccountDeviceListResponseMeta
129
+ */
130
+ next_offset: number | null;
131
+ /**
132
+ *
133
+ * @type {boolean}
134
+ * @memberof AccountDeviceListResponseMeta
135
+ */
136
+ include_inactive: boolean;
137
+ }
1
138
  /**
2
139
  *
3
140
  * @export
@@ -178,7 +315,7 @@ export interface AppIconBadgeCountUpdateResponse {
178
315
  */
179
316
  badge: number;
180
317
  /**
181
- * Number of devices whose App Icon Badge Count was updated.
318
+ * Number of devices whose App Icon Badge was updated.
182
319
  * @type {number}
183
320
  * @memberof AppIconBadgeCountUpdateResponse
184
321
  */
@@ -1371,7 +1508,13 @@ export interface LiveActivityStreamDeleteResponse {
1371
1508
  */
1372
1509
  forced_completion?: boolean;
1373
1510
  /**
1374
- *
1511
+ * Present when the stream had a current Live Activity. True when the end was sent to at least one device, or queued for a device that has not registered yet. False when no device received it, so the Live Activity may stay on the Lock Screen until iOS removes it or someone dismisses it.
1512
+ * @type {boolean}
1513
+ * @memberof LiveActivityStreamDeleteResponse
1514
+ */
1515
+ delivered?: boolean;
1516
+ /**
1517
+ * Explains why the end may not have removed the Live Activity, for example because iOS had already ended a Live Activity that started more than 8 hours ago.
1375
1518
  * @type {string}
1376
1519
  * @memberof LiveActivityStreamDeleteResponse
1377
1520
  */
@@ -1706,6 +1849,98 @@ export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof t
1706
1849
  * @export
1707
1850
  */
1708
1851
  export type MetadataValue = boolean | number | string;
1852
+ /**
1853
+ *
1854
+ * @export
1855
+ * @interface Metric
1856
+ */
1857
+ export interface Metric {
1858
+ /**
1859
+ *
1860
+ * @type {string}
1861
+ * @memberof Metric
1862
+ */
1863
+ public_id: string;
1864
+ /**
1865
+ *
1866
+ * @type {string}
1867
+ * @memberof Metric
1868
+ */
1869
+ key: string;
1870
+ /**
1871
+ *
1872
+ * @type {string}
1873
+ * @memberof Metric
1874
+ */
1875
+ label: string;
1876
+ /**
1877
+ *
1878
+ * @type {string}
1879
+ * @memberof Metric
1880
+ */
1881
+ format: MetricFormatEnum;
1882
+ /**
1883
+ *
1884
+ * @type {string}
1885
+ * @memberof Metric
1886
+ */
1887
+ currency_code: string | null;
1888
+ /**
1889
+ *
1890
+ * @type {string}
1891
+ * @memberof Metric
1892
+ */
1893
+ unit: string | null;
1894
+ /**
1895
+ *
1896
+ * @type {string}
1897
+ * @memberof Metric
1898
+ */
1899
+ unit_spacing: MetricUnitSpacingEnum;
1900
+ /**
1901
+ *
1902
+ * @type {any}
1903
+ * @memberof Metric
1904
+ */
1905
+ latest_value: any | null;
1906
+ /**
1907
+ *
1908
+ * @type {string}
1909
+ * @memberof Metric
1910
+ */
1911
+ latest_value_at: string | null;
1912
+ /**
1913
+ *
1914
+ * @type {string}
1915
+ * @memberof Metric
1916
+ */
1917
+ created_at: string;
1918
+ /**
1919
+ *
1920
+ * @type {string}
1921
+ * @memberof Metric
1922
+ */
1923
+ updated_at: string;
1924
+ }
1925
+ /**
1926
+ * @export
1927
+ */
1928
+ export declare const MetricFormatEnum: {
1929
+ readonly Number: "number";
1930
+ readonly Currency: "currency";
1931
+ readonly Percent: "percent";
1932
+ readonly Unit: "unit";
1933
+ readonly String: "string";
1934
+ };
1935
+ export type MetricFormatEnum = typeof MetricFormatEnum[keyof typeof MetricFormatEnum];
1936
+ /**
1937
+ * @export
1938
+ */
1939
+ export declare const MetricUnitSpacingEnum: {
1940
+ readonly None: "none";
1941
+ readonly Space: "space";
1942
+ };
1943
+ export type MetricUnitSpacingEnum = typeof MetricUnitSpacingEnum[keyof typeof MetricUnitSpacingEnum];
1709
1944
  /**
1710
1945
  *
1711
1946
  * @export
@@ -1725,6 +1960,75 @@ export interface MetricError {
1725
1960
  */
1726
1961
  message?: string;
1727
1962
  }
1963
+ /**
1964
+ *
1965
+ * @export
1966
+ * @interface MetricResponse
1967
+ */
1968
+ export interface MetricResponse {
1969
+ /**
1970
+ *
1971
+ * @type {Metric}
1972
+ * @memberof MetricResponse
1973
+ */
1974
+ metric: Metric;
1975
+ }
1976
+ /**
1977
+ * Metric definition. Omitted fields keep their current values, or use defaults for a new metric: a label made from the key and the number format.
1978
+ * @export
1979
+ * @interface MetricUpsertRequest
1980
+ */
1981
+ export interface MetricUpsertRequest {
1982
+ /**
1983
+ * Name shown on the widget.
1984
+ * @type {string}
1985
+ * @memberof MetricUpsertRequest
1986
+ */
1987
+ label?: string;
1988
+ /**
1989
+ * How widgets display the value: number (1,234), currency (requires currency_code), percent (send 99.9 to show 99.9%), unit (a number with a unit suffix, such as 120 ms), or string (text up to 64 characters). Defaults to number for a new metric.
1990
+ * @type {string}
1991
+ * @memberof MetricUpsertRequest
1992
+ */
1993
+ format?: MetricUpsertRequestFormatEnum;
1994
+ /**
1995
+ * 3-letter ISO 4217 currency code, such as USD. Required for the currency format.
1996
+ * @type {string}
1997
+ * @memberof MetricUpsertRequest
1998
+ */
1999
+ currency_code?: string;
2000
+ /**
2001
+ * Unit suffix for the unit format, such as ms or GB.
2002
+ * @type {string}
2003
+ * @memberof MetricUpsertRequest
2004
+ */
2005
+ unit?: string;
2006
+ /**
2007
+ * For the unit format: none shows 120ms, space shows 120 ms.
2008
+ * @type {string}
2009
+ * @memberof MetricUpsertRequest
2010
+ */
2011
+ unit_spacing?: MetricUpsertRequestUnitSpacingEnum;
2012
+ }
2013
+ /**
2014
+ * @export
2015
+ */
2016
+ export declare const MetricUpsertRequestFormatEnum: {
2017
+ readonly Number: "number";
2018
+ readonly Currency: "currency";
2019
+ readonly Percent: "percent";
2020
+ readonly Unit: "unit";
2021
+ readonly String: "string";
2022
+ };
2023
+ export type MetricUpsertRequestFormatEnum = typeof MetricUpsertRequestFormatEnum[keyof typeof MetricUpsertRequestFormatEnum];
2024
+ /**
2025
+ * @export
2026
+ */
2027
+ export declare const MetricUpsertRequestUnitSpacingEnum: {
2028
+ readonly None: "none";
2029
+ readonly Space: "space";
2030
+ };
2031
+ export type MetricUpsertRequestUnitSpacingEnum = typeof MetricUpsertRequestUnitSpacingEnum[keyof typeof MetricUpsertRequestUnitSpacingEnum];
1728
2032
  /**
1729
2033
  * Latest metric value to display in widgets.
1730
2034
  * @export
@@ -1762,6 +2066,12 @@ export interface MetricValueUpdateResponse {
1762
2066
  * @memberof MetricValueUpdateResponse
1763
2067
  */
1764
2068
  success: boolean;
2069
+ /**
2070
+ * true when this request created the metric because no metric used the key yet.
2071
+ * @type {boolean}
2072
+ * @memberof MetricValueUpdateResponse
2073
+ */
2074
+ created?: boolean;
1765
2075
  }
1766
2076
  /**
1767
2077
  *
@@ -1775,12 +2085,24 @@ export interface NoRecipientsError {
1775
2085
  * @memberof NoRecipientsError
1776
2086
  */
1777
2087
  error: string;
2088
+ /**
2089
+ * Machine-readable reason. no_paired_devices: the account has no active paired iOS devices; pair an iPhone with the ActivitySmith app. no_recipients_found: devices are paired, but none matched the targeted channels. Treat unknown values as a generic no-delivery error.
2090
+ * @type {string}
2091
+ * @memberof NoRecipientsError
2092
+ */
2093
+ code?: string;
1778
2094
  /**
1779
2095
  *
1780
2096
  * @type {string}
1781
2097
  * @memberof NoRecipientsError
1782
2098
  */
1783
2099
  message: string;
2100
+ /**
2101
+ * ActivitySmith App Store link. Present when code is no_paired_devices.
2102
+ * @type {string}
2103
+ * @memberof NoRecipientsError
2104
+ */
2105
+ app_store_url?: string;
1784
2106
  /**
1785
2107
  *
1786
2108
  * @type {Array<string>}
@@ -1864,6 +2186,31 @@ export declare const PushNotificationActionType: {
1864
2186
  readonly Webhook: "webhook";
1865
2187
  };
1866
2188
  export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType];
2189
+ /**
2190
+ * Dismissal result. Devices clear the notification after this response, so it does not confirm that any device has cleared it.
2191
+ * @export
2192
+ * @interface PushNotificationDismissResponse
2193
+ */
2194
+ export interface PushNotificationDismissResponse {
2195
+ /**
2196
+ * True when the dismissal is recorded.
2197
+ * @type {boolean}
2198
+ * @memberof PushNotificationDismissResponse
2199
+ */
2200
+ success: boolean;
2201
+ /**
2202
+ * ID of the dismissed Push Notification.
2203
+ * @type {string}
2204
+ * @memberof PushNotificationDismissResponse
2205
+ */
2206
+ notification_id: string;
2207
+ /**
2208
+ * When the notification was first dismissed. Repeat calls return the same time.
2209
+ * @type {string}
2210
+ * @memberof PushNotificationDismissResponse
2211
+ */
2212
+ dismissed_at: string;
2213
+ }
1867
2214
  /**
1868
2215
  * Replacement content. title, subtitle, message, redirection, media, icon, actions, and payload fully replace the original values. Omit metadata or tags to keep the stored values; send {} or [] to clear them.
1869
2216
  * @export
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.PushInterruptionLevel = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.BillingBlockedErrorErrorEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
3
+ exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.PushInterruptionLevel = exports.MetricUpsertRequestUnitSpacingEnum = exports.MetricUpsertRequestFormatEnum = exports.MetricUnitSpacingEnum = exports.MetricFormatEnum = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.BillingBlockedErrorErrorEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -250,6 +250,40 @@ exports.LiveActivityWebhookMethod = {
250
250
  Get: 'GET',
251
251
  Post: 'POST'
252
252
  };
253
+ /**
254
+ * @export
255
+ */
256
+ exports.MetricFormatEnum = {
257
+ Number: 'number',
258
+ Currency: 'currency',
259
+ Percent: 'percent',
260
+ Unit: 'unit',
261
+ String: 'string'
262
+ };
263
+ /**
264
+ * @export
265
+ */
266
+ exports.MetricUnitSpacingEnum = {
267
+ None: 'none',
268
+ Space: 'space'
269
+ };
270
+ /**
271
+ * @export
272
+ */
273
+ exports.MetricUpsertRequestFormatEnum = {
274
+ Number: 'number',
275
+ Currency: 'currency',
276
+ Percent: 'percent',
277
+ Unit: 'unit',
278
+ String: 'string'
279
+ };
280
+ /**
281
+ * @export
282
+ */
283
+ exports.MetricUpsertRequestUnitSpacingEnum = {
284
+ None: 'none',
285
+ Space: 'space'
286
+ };
253
287
  /**
254
288
  * How urgently iOS presents the notification. `passive` arrives quietly in the notification list without sound or lighting up the screen. `active` is normal delivery and the default when omitted. `time-sensitive` can break through Focus and Scheduled Summary when the user allows Time Sensitive Notifications for ActivitySmith.
255
289
  * @export
@@ -1,4 +1,4 @@
1
- import { AppIconBadgesApi, LiveActivitiesApi, MetricsApi, PushNotificationsApi } from "../generated/index";
1
+ import { AppIconBadgesApi, DevicesApi, LiveActivitiesApi, MetricsApi, PushNotificationsApi } from "../generated/index";
2
2
  export interface ActivitySmithOptions {
3
3
  apiKey: string;
4
4
  sdk?: {
@@ -12,6 +12,7 @@ type PushRawParameters = Parameters<PushNotificationsApi["sendPushNotificationRa
12
12
  type SendInitOverrides = Parameters<PushNotificationsApi["sendPushNotification"]>[1];
13
13
  type PushReplaceRequestBody = Parameters<PushNotificationsApi["replacePushNotification"]>[0]["pushNotificationReplaceRequest"];
14
14
  type PushReplaceParameters = Parameters<PushNotificationsApi["replacePushNotification"]>[0];
15
+ type PushDismissParameters = Parameters<PushNotificationsApi["dismissPushNotification"]>[0];
15
16
  type StartRequestBody = Parameters<LiveActivitiesApi["startLiveActivity"]>[0]["liveActivityStartRequest"];
16
17
  type UpdateRequestBody = Parameters<LiveActivitiesApi["updateLiveActivity"]>[0]["liveActivityUpdateRequest"];
17
18
  type EndRequestBody = Parameters<LiveActivitiesApi["endLiveActivity"]>[0]["liveActivityEndRequest"];
@@ -24,6 +25,11 @@ type MetricUpdateRequestBody = MetricUpdateParameters["metricValueUpdateRequest"
24
25
  type MetricValue = MetricUpdateRequestBody["value"];
25
26
  type MetricUpdateOptions = Omit<MetricUpdateRequestBody, "value">;
26
27
  type MetricInitOverrides = Parameters<MetricsApi["updateMetricValue"]>[1];
28
+ type MetricUpsertParameters = Parameters<MetricsApi["upsertMetric"]>[0];
29
+ type MetricUpsertRawParameters = Parameters<MetricsApi["upsertMetricRaw"]>[0];
30
+ type MetricDefinition = NonNullable<MetricUpsertParameters["metricUpsertRequest"]>;
31
+ type DeviceListParameters = NonNullable<Parameters<DevicesApi["listAccountDevices"]>[0]>;
32
+ type DeviceListInitOverrides = Parameters<DevicesApi["listAccountDevices"]>[1];
27
33
  type AppIconBadgeInitOverrides = Parameters<AppIconBadgesApi["updateAppIconBadgeCount"]>[1];
28
34
  type PushSendRequest = PushRequestBody & {
29
35
  channels?: string[];
@@ -31,6 +37,14 @@ type PushSendRequest = PushRequestBody & {
31
37
  export type BadgeCountOptions = {
32
38
  channels?: string[];
33
39
  };
40
+ export type DeviceListOptions = {
41
+ /** Maximum number of devices to return. */
42
+ limit?: number;
43
+ /** Number of devices to skip, for paging. */
44
+ offset?: number;
45
+ /** Include devices that can no longer receive Push Notifications or Live Activities. */
46
+ includeInactive?: boolean;
47
+ };
34
48
  declare const LiveActivityTypes: {
35
49
  readonly segmentedProgress: "segmented_progress";
36
50
  readonly progress: "progress";
@@ -96,6 +110,12 @@ export declare class NotificationsResource {
96
110
  * The replacement takes the original's place on the Lock Screen and in history.
97
111
  */
98
112
  replace(notificationId: string, request: PushReplaceRequestBody, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
113
+ /**
114
+ * Clears a sent Push Notification from the Lock Screen and Notification Center,
115
+ * using the notification_id returned by send(). Notification history keeps it.
116
+ */
117
+ dismiss(notificationId: string, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationDismissResponse>;
118
+ dismissPushNotification(requestParameters: PushDismissParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationDismissResponse>;
99
119
  replacePushNotification(requestParameters: PushReplaceParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
100
120
  sendPushNotification(requestParameters: PushSendParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
101
121
  sendPushNotificationRaw(requestParameters: PushRawParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").PushNotificationResponse>>;
@@ -132,9 +152,26 @@ export declare class MetricsResource {
132
152
  private readonly api;
133
153
  constructor(api: MetricsApi);
134
154
  update(key: string, valueOrRequest: MetricValue | MetricUpdateRequestBody, options?: MetricUpdateOptions, initOverrides?: MetricInitOverrides): Promise<import("../generated/models").MetricValueUpdateResponse>;
155
+ /**
156
+ * Creates the metric, or updates the fields sent for an existing one.
157
+ * Omitted fields keep their current values, so it is safe to call on every start.
158
+ */
159
+ create(key: string, definition?: MetricDefinition, initOverrides?: MetricInitOverrides): Promise<import("../generated/models").MetricResponse>;
160
+ upsertMetric(requestParameters: MetricUpsertParameters, initOverrides?: MetricInitOverrides): Promise<import("../generated/models").MetricResponse>;
161
+ upsertMetricRaw(requestParameters: MetricUpsertRawParameters, initOverrides?: MetricInitOverrides): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").MetricResponse>>;
135
162
  updateMetricValue(requestParameters: MetricUpdateParameters, initOverrides?: MetricInitOverrides): Promise<import("../generated/models").MetricValueUpdateResponse>;
136
163
  updateMetricValueRaw(requestParameters: MetricRawParameters, initOverrides?: MetricInitOverrides): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").MetricValueUpdateResponse>>;
137
164
  }
165
+ export declare class DevicesResource {
166
+ private readonly api;
167
+ constructor(api: DevicesApi);
168
+ /**
169
+ * Lists the iPhones and iPads paired to the account, active devices first.
170
+ * Pass includeInactive to also list devices that can no longer receive deliveries.
171
+ */
172
+ list(options?: DeviceListOptions, initOverrides?: DeviceListInitOverrides): Promise<import("../generated/models").AccountDeviceListResponse>;
173
+ listAccountDevices(requestParameters?: DeviceListParameters, initOverrides?: DeviceListInitOverrides): Promise<import("../generated/models").AccountDeviceListResponse>;
174
+ }
138
175
  export declare class ActivitySmith {
139
176
  static readonly liveActivityTypes: {
140
177
  readonly segmentedProgress: "segmented_progress";
@@ -157,6 +194,7 @@ export declare class ActivitySmith {
157
194
  readonly notifications: NotificationsResource;
158
195
  readonly liveActivities: LiveActivitiesResource;
159
196
  readonly metrics: MetricsResource;
197
+ readonly devices: DevicesResource;
160
198
  private readonly appIconBadgesApi;
161
199
  constructor(opts: ActivitySmithOptions);
162
200
  badgeCount(badge: number, options?: BadgeCountOptions, initOverrides?: AppIconBadgeInitOverrides): Promise<import("../generated/models").AppIconBadgeCountUpdateResponse>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
3
+ exports.ActivitySmith = exports.DevicesResource = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
4
4
  const index_1 = require("../generated/index");
5
- const SDK_VERSION = "1.14.0";
5
+ const SDK_VERSION = "1.15.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
7
  const DEFAULT_SDK_NAME = "node";
8
8
  const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
@@ -105,6 +105,17 @@ class NotificationsResource {
105
105
  assertValidPushRequest(request);
106
106
  return this.api.replacePushNotification({ notificationId, pushNotificationReplaceRequest: request }, initOverrides);
107
107
  }
108
+ /**
109
+ * Clears a sent Push Notification from the Lock Screen and Notification Center,
110
+ * using the notification_id returned by send(). Notification history keeps it.
111
+ */
112
+ dismiss(notificationId, initOverrides) {
113
+ return this.api.dismissPushNotification({ notificationId }, initOverrides);
114
+ }
115
+ // Generated-style alias.
116
+ dismissPushNotification(requestParameters, initOverrides) {
117
+ return this.api.dismissPushNotification(requestParameters, initOverrides);
118
+ }
108
119
  // Generated-style alias.
109
120
  replacePushNotification(requestParameters, initOverrides) {
110
121
  assertValidPushRequest(requestParameters.pushNotificationReplaceRequest);
@@ -195,7 +206,23 @@ class MetricsResource {
195
206
  metricValueUpdateRequest: toMetricUpdateRequest(valueOrRequest, options),
196
207
  }, initOverrides);
197
208
  }
209
+ /**
210
+ * Creates the metric, or updates the fields sent for an existing one.
211
+ * Omitted fields keep their current values, so it is safe to call on every start.
212
+ */
213
+ create(key, definition, initOverrides) {
214
+ return this.api.upsertMetric({
215
+ key,
216
+ ...(definition ? { metricUpsertRequest: definition } : {}),
217
+ }, initOverrides);
218
+ }
198
219
  // Backward-compatible generated-style aliases.
220
+ upsertMetric(requestParameters, initOverrides) {
221
+ return this.api.upsertMetric(requestParameters, initOverrides);
222
+ }
223
+ upsertMetricRaw(requestParameters, initOverrides) {
224
+ return this.api.upsertMetricRaw(requestParameters, initOverrides);
225
+ }
199
226
  updateMetricValue(requestParameters, initOverrides) {
200
227
  return this.api.updateMetricValue(requestParameters, initOverrides);
201
228
  }
@@ -204,6 +231,27 @@ class MetricsResource {
204
231
  }
205
232
  }
206
233
  exports.MetricsResource = MetricsResource;
234
+ class DevicesResource {
235
+ constructor(api) {
236
+ this.api = api;
237
+ }
238
+ /**
239
+ * Lists the iPhones and iPads paired to the account, active devices first.
240
+ * Pass includeInactive to also list devices that can no longer receive deliveries.
241
+ */
242
+ list(options = {}, initOverrides) {
243
+ return this.api.listAccountDevices(compactObject({
244
+ limit: options.limit,
245
+ offset: options.offset,
246
+ includeInactive: options.includeInactive,
247
+ }), initOverrides);
248
+ }
249
+ // Generated-style alias.
250
+ listAccountDevices(requestParameters = {}, initOverrides) {
251
+ return this.api.listAccountDevices(requestParameters, initOverrides);
252
+ }
253
+ }
254
+ exports.DevicesResource = DevicesResource;
207
255
  class ActivitySmith {
208
256
  constructor(opts) {
209
257
  if (!opts?.apiKey) {
@@ -219,6 +267,7 @@ class ActivitySmith {
219
267
  this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
220
268
  this.liveActivities = new LiveActivitiesResource(new index_1.LiveActivitiesApi(config));
221
269
  this.metrics = new MetricsResource(new index_1.MetricsApi(config));
270
+ this.devices = new DevicesResource(new index_1.DevicesApi(config));
222
271
  this.appIconBadgesApi = new index_1.AppIconBadgesApi(config);
223
272
  }
224
273
  badgeCount(badge, options = {}, initOverrides) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",