Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.15.0

Adds Push Notification dismissal. Pass a `notification_id` to `notifications.dismiss` to clear a Push Notification you already sent from the Lock Screen and Notification Center. History keeps it. Also adds `metrics.create` to create a Lock Screen Widget metric and set its label and format, such as currency or percent, and `devices.list` to list the iPhones and iPads paired to your account.

## 1.14.0

Adds the ability to replace a Push Notification you already sent with a new one.
Expand Down
82 changes: 82 additions & 0 deletions generated/apis/DevicesApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* tslint:disable */
/* eslint-disable */
/**
* ActivitySmith API
* Send push notifications and Live Activities to your own devices via a single API key.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import * as runtime from '../runtime';
import type {
AccountDeviceListResponse,
ForbiddenError,
RateLimitError,
} from '../models/index';

export interface ListAccountDevicesRequest {
limit?: number;
offset?: number;
includeInactive?: boolean;
}

/**
*
*/
export class DevicesApi extends runtime.BaseAPI {

/**
* 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.
* List paired devices
*/
async listAccountDevicesRaw(requestParameters: ListAccountDevicesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountDeviceListResponse>> {
const queryParameters: any = {};

if (requestParameters['limit'] != null) {
queryParameters['limit'] = requestParameters['limit'];
}

if (requestParameters['offset'] != null) {
queryParameters['offset'] = requestParameters['offset'];
}

if (requestParameters['includeInactive'] != null) {
queryParameters['include_inactive'] = requestParameters['includeInactive'];
}

const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("apiKeyAuth", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/account/devices`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response);
}

/**
* 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.
* List paired devices
*/
async listAccountDevices(requestParameters: ListAccountDevicesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountDeviceListResponse> {
const response = await this.listAccountDevicesRaw(requestParameters, initOverrides);
return await response.value();
}

}
4 changes: 2 additions & 2 deletions generated/apis/LiveActivitiesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface UpdateLiveActivityRequest {
export class LiveActivitiesApi extends runtime.BaseAPI {

/**
* 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.
* 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.
* End a Live Activity (legacy manual lifecycle)
*/
async endLiveActivityRaw(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityEndResponse>> {
Expand Down Expand Up @@ -99,7 +99,7 @@ export class LiveActivitiesApi extends runtime.BaseAPI {
}

/**
* 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.
* 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.
* End a Live Activity (legacy manual lifecycle)
*/
async endLiveActivity(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityEndResponse> {
Expand Down
48 changes: 48 additions & 0 deletions generated/apis/PushNotificationsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ import type {
ForbiddenError,
NoRecipientsError,
NotFoundError,
PushNotificationDismissResponse,
PushNotificationReplaceRequest,
PushNotificationReplaceResponse,
PushNotificationRequest,
PushNotificationResponse,
SendPushNotification429Response,
} from '../models/index';

export interface DismissPushNotificationRequest {
notificationId: string;
}

export interface ReplacePushNotificationRequest {
notificationId: string;
pushNotificationReplaceRequest: PushNotificationReplaceRequest;
Expand All @@ -41,6 +46,49 @@ export interface SendPushNotificationRequest {
*/
export class PushNotificationsApi extends runtime.BaseAPI {

/**
* 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.
* Dismiss a push notification
*/
async dismissPushNotificationRaw(requestParameters: DismissPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationDismissResponse>> {
if (requestParameters['notificationId'] == null) {
throw new runtime.RequiredError(
'notificationId',
'Required parameter "notificationId" was null or undefined when calling dismissPushNotification().'
);
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("apiKeyAuth", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/push-notification/{notification_id}/dismiss`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response);
}

/**
* 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.
* Dismiss a push notification
*/
async dismissPushNotification(requestParameters: DismissPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationDismissResponse> {
const response = await this.dismissPushNotificationRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* 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.
* Replace a push notification
Expand Down
1 change: 1 addition & 0 deletions generated/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* tslint:disable */
/* eslint-disable */
export * from './AppIconBadgesApi';
export * from './DevicesApi';
export * from './LiveActivitiesApi';
export * from './MetricsApi';
export * from './PushNotificationsApi';
160 changes: 160 additions & 0 deletions generated/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,140 @@
/* tslint:disable */
/* eslint-disable */
/**
* An iPhone or iPad paired to the account, one entry per device and owner.
* @export
* @interface AccountDevice
*/
export interface AccountDevice {
/**
* Email of the account member who paired the device.
* @type {string}
* @memberof AccountDevice
*/
user_email: string;
/**
* Device ID. Use it to assign the device to Channels.
* @type {string}
* @memberof AccountDevice
*/
device_id: string;
/**
* Device platform, such as ios. iPhones and iPads both report ios; use system_name to tell them apart.
* @type {string}
* @memberof AccountDevice
*/
device_type: string | null;
/**
* True when the device can receive Push Notifications or Live Activities.
* @type {boolean}
* @memberof AccountDevice
*/
is_active: boolean;
/**
* Whether each delivery token is active, keyed by token type (push, start_live_activity).
* @type {{ [key: string]: boolean; }}
* @memberof AccountDevice
*/
token_status: { [key: string]: boolean; };
/**
* ActivitySmith app version on the device.
* @type {string}
* @memberof AccountDevice
*/
app_version: string | null;
/**
* Device name set on the device.
* @type {string}
* @memberof AccountDevice
*/
device_name: string | null;
/**
* Operating system name, such as iOS or iPadOS.
* @type {string}
* @memberof AccountDevice
*/
system_name: string | null;
/**
* Operating system version.
* @type {string}
* @memberof AccountDevice
*/
system_version: string | null;
/**
* When the device was first paired.
* @type {string}
* @memberof AccountDevice
*/
created_at: string | null;
/**
* When the device last updated its pairing.
* @type {string}
* @memberof AccountDevice
*/
updated_at: string | null;
}
/**
*
* @export
* @interface AccountDeviceListResponse
*/
export interface AccountDeviceListResponse {
/**
*
* @type {Array<AccountDevice>}
* @memberof AccountDeviceListResponse
*/
devices: Array<AccountDevice>;
/**
*
* @type {AccountDeviceListResponseMeta}
* @memberof AccountDeviceListResponse
*/
meta: AccountDeviceListResponseMeta;
}
/**
*
* @export
* @interface AccountDeviceListResponseMeta
*/
export interface AccountDeviceListResponseMeta {
/**
* Devices matching the filter.
* @type {number}
* @memberof AccountDeviceListResponseMeta
*/
total: number;
/**
*
* @type {number}
* @memberof AccountDeviceListResponseMeta
*/
limit: number;
/**
*
* @type {number}
* @memberof AccountDeviceListResponseMeta
*/
offset: number;
/**
*
* @type {boolean}
* @memberof AccountDeviceListResponseMeta
*/
has_more: boolean;
/**
* Offset for the next page, or null on the last page.
* @type {number}
* @memberof AccountDeviceListResponseMeta
*/
next_offset: number | null;
/**
*
* @type {boolean}
* @memberof AccountDeviceListResponseMeta
*/
include_inactive: boolean;
}
/**
*
* @export
Expand Down Expand Up @@ -2092,6 +2227,31 @@ export const PushNotificationActionType = {
} as const;
export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType];

/**
* Dismissal result. Devices clear the notification after this response, so it does not confirm that any device has cleared it.
* @export
* @interface PushNotificationDismissResponse
*/
export interface PushNotificationDismissResponse {
/**
* True when the dismissal is recorded.
* @type {boolean}
* @memberof PushNotificationDismissResponse
*/
success: boolean;
/**
* ID of the dismissed Push Notification.
* @type {string}
* @memberof PushNotificationDismissResponse
*/
notification_id: string;
/**
* When the notification was first dismissed. Repeat calls return the same time.
* @type {string}
* @memberof PushNotificationDismissResponse
*/
dismissed_at: string;
}
/**
* 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.
* @export
Expand Down
4 changes: 2 additions & 2 deletions generated/openapi-source.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"repository": "ActivitySmithHQ/activitysmith-backend",
"commit": "7bf9c3d88459fe3f122810979a45da0a1e6fd2d6",
"commit": "278d980633d4b1fc735ca96948fdd8ff8fd27642",
"path": "openapi.json",
"sha256": "6987f90b106e28a0ab8058f43309e7a9f045c7c54d27ce90bbdd5966c3f99f7a"
"sha256": "0dbbba13bf497eceea4de0759943481a6e085cdf9a9a5445a60cf2b27457de40"
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "activitysmith",
"version": "1.14.0",
"version": "1.15.0",
"description": "Official ActivitySmith Node.js SDK",
"keywords": [
"activitysmith",
Expand Down
Loading
Loading