diff --git a/generated/apis/PushNotificationsApi.ts b/generated/apis/PushNotificationsApi.ts index 0f06c10..46666ee 100644 --- a/generated/apis/PushNotificationsApi.ts +++ b/generated/apis/PushNotificationsApi.ts @@ -19,11 +19,19 @@ import type { BillingBlockedError, ForbiddenError, NoRecipientsError, + NotFoundError, + PushNotificationReplaceRequest, + PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse, SendPushNotification429Response, } from '../models/index'; +export interface ReplacePushNotificationRequest { + notificationId: string; + pushNotificationReplaceRequest: PushNotificationReplaceRequest; +} + export interface SendPushNotificationRequest { pushNotificationRequest: PushNotificationRequest; } @@ -34,7 +42,60 @@ export interface SendPushNotificationRequest { export class PushNotificationsApi extends runtime.BaseAPI { /** - * 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. + * 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 + */ + async replacePushNotificationRaw(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['notificationId'] == null) { + throw new runtime.RequiredError( + 'notificationId', + 'Required parameter "notificationId" was null or undefined when calling replacePushNotification().' + ); + } + + if (requestParameters['pushNotificationReplaceRequest'] == null) { + throw new runtime.RequiredError( + 'pushNotificationReplaceRequest', + 'Required parameter "pushNotificationReplaceRequest" was null or undefined when calling replacePushNotification().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + 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}`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: requestParameters['pushNotificationReplaceRequest'], + }, initOverrides); + + return new runtime.JSONApiResponse(response); + } + + /** + * 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 + */ + async replacePushNotification(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.replacePushNotificationRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * 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. * Send a push notification */ async sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -71,7 +132,7 @@ export class PushNotificationsApi extends runtime.BaseAPI { } /** - * 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. + * 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. * Send a push notification */ async sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { diff --git a/generated/models/index.ts b/generated/models/index.ts index 3af0838..4f748a1 100644 --- a/generated/models/index.ts +++ b/generated/models/index.ts @@ -223,6 +223,24 @@ export interface AppIconBadgeCountUpdateResponse { * @memberof AppIconBadgeCountUpdateResponse */ timestamp: string; + /** + * Number of device tokens targeted. + * @type {number} + * @memberof AppIconBadgeCountUpdateResponse + */ + devices_targeted?: number; + /** + * Number of device tokens deactivated because APNs reported them unregistered. + * @type {number} + * @memberof AppIconBadgeCountUpdateResponse + */ + devices_deactivated?: number; + /** + * Number of targeted device tokens APNs reported as unregistered. + * @type {number} + * @memberof AppIconBadgeCountUpdateResponse + */ + devices_unregistered?: number; } /** * @@ -1074,6 +1092,42 @@ export interface LiveActivityEndResponse { * @memberof LiveActivityEndResponse */ timestamp: string; + /** + * True when the Live Activity had already ended and the request had no effect. + * @type {boolean} + * @memberof LiveActivityEndResponse + */ + ignored?: boolean; + /** + * + * @type {string} + * @memberof LiveActivityEndResponse + */ + message?: string; + /** + * + * @type {string} + * @memberof LiveActivityEndResponse + */ + end_reason?: string | null; + /** + * True when the Live Activity was marked complete without a confirmed APNs end delivery. + * @type {boolean} + * @memberof LiveActivityEndResponse + */ + forced_completion?: boolean; + /** + * + * @type {string} + * @memberof LiveActivityEndResponse + */ + warning?: string; + /** + * Per-device delivery errors when some devices could not be reached. + * @type {Array} + * @memberof LiveActivityEndResponse + */ + errors?: Array; } /** * @@ -1215,6 +1269,24 @@ export interface LiveActivityStartResponse { * @memberof LiveActivityStartResponse */ timestamp: string; + /** + * Present when starting this Live Activity ended an older one to stay within the device limit. + * @type {string} + * @memberof LiveActivityStartResponse + */ + ended_activity_id?: string; + /** + * + * @type {string} + * @memberof LiveActivityStartResponse + */ + message?: string; + /** + * Per-device delivery errors when some devices could not be reached. + * @type {Array} + * @memberof LiveActivityStartResponse + */ + errors?: Array; } /** * Optional payload for ending a managed stream. When omitted, ActivitySmith ends the stream using the latest known state when possible. @@ -1307,6 +1379,36 @@ export interface LiveActivityStreamDeleteResponse { * @memberof LiveActivityStreamDeleteResponse */ timestamp: string; + /** + * True when the stream was already ended and the request had no effect. + * @type {boolean} + * @memberof LiveActivityStreamDeleteResponse + */ + ignored?: boolean; + /** + * + * @type {string} + * @memberof LiveActivityStreamDeleteResponse + */ + message?: string; + /** + * + * @type {boolean} + * @memberof LiveActivityStreamDeleteResponse + */ + forced_completion?: boolean; + /** + * + * @type {string} + * @memberof LiveActivityStreamDeleteResponse + */ + warning?: string; + /** + * Per-device delivery errors when some devices could not be reached. + * @type {Array} + * @memberof LiveActivityStreamDeleteResponse + */ + errors?: Array; } @@ -1384,12 +1486,42 @@ export interface LiveActivityStreamPutResponse { * @memberof LiveActivityStreamPutResponse */ tags?: Array; + /** + * Present on `updated` responses when the current Live Activity has received more than 12 updates and has averaged more than one update every 2 minutes since it started. The update is still sent, but iOS may throttle Live Activities that update this often. + * @type {string} + * @memberof LiveActivityStreamPutResponse + */ + warning?: string; /** * * @type {string} * @memberof LiveActivityStreamPutResponse */ timestamp: string; + /** + * True when the request had no effect. + * @type {boolean} + * @memberof LiveActivityStreamPutResponse + */ + ignored?: boolean; + /** + * + * @type {boolean} + * @memberof LiveActivityStreamPutResponse + */ + remote_push_sent?: boolean; + /** + * + * @type {string} + * @memberof LiveActivityStreamPutResponse + */ + message?: string; + /** + * Per-device delivery errors when some devices could not be reached. + * @type {Array} + * @memberof LiveActivityStreamPutResponse + */ + errors?: Array; } @@ -1539,6 +1671,48 @@ export interface LiveActivityUpdateResponse { * @memberof LiveActivityUpdateResponse */ timestamp: string; + /** + * + * @type {number} + * @memberof LiveActivityUpdateResponse + */ + users_notified?: number; + /** + * + * @type {Array} + * @memberof LiveActivityUpdateResponse + */ + effective_channel_slugs?: Array; + /** + * Optional tags to organize and filter notification history. + * @type {Array} + * @memberof LiveActivityUpdateResponse + */ + tags?: Array; + /** + * Present when the update started a new Live Activity for a managed stream. + * @type {string} + * @memberof LiveActivityUpdateResponse + */ + operation?: string; + /** + * + * @type {string} + * @memberof LiveActivityUpdateResponse + */ + stream_key?: string; + /** + * + * @type {string} + * @memberof LiveActivityUpdateResponse + */ + previous_activity_id?: string; + /** + * Per-device delivery errors when some devices could not be reached. + * @type {Array} + * @memberof LiveActivityUpdateResponse + */ + errors?: Array; } /** * @type LiveActivityValue @@ -1725,6 +1899,129 @@ export const PushNotificationActionType = { } as const; export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType]; +/** + * 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 + * @interface PushNotificationReplaceRequest + */ +export interface PushNotificationReplaceRequest { + [key: string]: any | any; + /** + * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it. + * @type {{ [key: string]: MetadataValue; }} + * @memberof PushNotificationReplaceRequest + */ + metadata?: { [key: string]: MetadataValue; }; + /** + * + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + title: string; + /** + * + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + message?: string; + /** + * + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + subtitle?: string; + /** + * Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon. + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + icon?: string; + /** + * Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`. + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + media?: string; + /** + * Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media. + * @type {string} + * @memberof PushNotificationReplaceRequest + */ + redirection?: string; + /** + * Optional interactive actions shown when users expand the notification. Cannot be combined with `media`. + * @type {Array} + * @memberof PushNotificationReplaceRequest + */ + actions?: Array; + /** + * + * @type {object} + * @memberof PushNotificationReplaceRequest + */ + payload?: object; + /** + * + * @type {number} + * @memberof PushNotificationReplaceRequest + */ + badge?: number; + /** + * Optional tags to organize and filter notification history. + * @type {Array} + * @memberof PushNotificationReplaceRequest + */ + tags?: Array; +} +/** + * Apple APNs acceptance result for the replacement. Acceptance does not confirm device delivery or presentation. + * @export + * @interface PushNotificationReplaceResponse + */ +export interface PushNotificationReplaceResponse { + /** + * True when APNs accepts the replacement for at least one device. + * @type {boolean} + * @memberof PushNotificationReplaceResponse + */ + success: boolean; + /** + * ID of the replaced Push Notification. It stays the same, so you can replace it again. + * @type {string} + * @memberof PushNotificationReplaceResponse + */ + notification_id: string; + /** + * Number of device tokens for which APNs accepted the notification, without confirming on-device delivery. + * @type {number} + * @memberof PushNotificationReplaceResponse + */ + devices_notified?: number; + /** + * + * @type {number} + * @memberof PushNotificationReplaceResponse + */ + users_notified?: number; + /** + * + * @type {Array} + * @memberof PushNotificationReplaceResponse + */ + effective_channel_slugs?: Array; + /** + * Optional tags to organize and filter notification history. + * @type {Array} + * @memberof PushNotificationReplaceResponse + */ + tags?: Array; + /** + * + * @type {string} + * @memberof PushNotificationReplaceResponse + */ + timestamp: string; +} /** * * @export @@ -1829,6 +2126,12 @@ export interface PushNotificationResponse { * @memberof PushNotificationResponse */ success: boolean; + /** + * ID of this Push Notification. Pass it to `PUT /push-notification/{notification_id}` to replace the notification later. + * @type {string} + * @memberof PushNotificationResponse + */ + notification_id?: string; /** * Number of device tokens for which APNs accepted the notification, without confirming on-device delivery. * @type {number} @@ -1859,6 +2162,36 @@ export interface PushNotificationResponse { * @memberof PushNotificationResponse */ timestamp: string; + /** + * Number of device tokens targeted. + * @type {number} + * @memberof PushNotificationResponse + */ + devices_targeted?: number; + /** + * Number of device tokens deactivated because APNs reported them unregistered. + * @type {number} + * @memberof PushNotificationResponse + */ + devices_deactivated?: number; + /** + * Number of targeted device tokens APNs reported as unregistered. + * @type {number} + * @memberof PushNotificationResponse + */ + devices_unregistered?: number; + /** + * True when the request was an integration connection test and no paired devices were available. + * @type {boolean} + * @memberof PushNotificationResponse + */ + credential_test?: boolean; + /** + * + * @type {string} + * @memberof PushNotificationResponse + */ + message?: string; } /** diff --git a/generated/openapi-source.json b/generated/openapi-source.json index a320213..28e1d47 100644 --- a/generated/openapi-source.json +++ b/generated/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "ce15d69eeb25776a3ae395e77d8b907ff7ba0709", + "commit": "dd6757c5defa3d1e6524faef789b6829184fb852", "path": "openapi.json", - "sha256": "b113d50e06d6581707d9472dda6e371b996441f58dceba87a88f79cb96508a7d" + "sha256": "24dae2d064095351d5e5cf800228e64a2d23c40b1e31a9754503081ddf31c5d8" }