@azure/notification-hubs 2.0.0-alpha.20240912.1 → 2.0.0-alpha.20240913.2
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 +6 -6
- package/dist/api/notification-hubs.d.ts +37 -13
- package/dist/browser/api/index.d.ts +2 -0
- package/dist/browser/api/index.d.ts.map +1 -1
- package/dist/browser/api/index.js +2 -0
- package/dist/browser/api/index.js.map +1 -1
- package/dist/browser/api/internal/_scheduleNotification.d.ts +15 -0
- package/dist/browser/api/internal/_scheduleNotification.d.ts.map +1 -0
- package/dist/browser/api/internal/_scheduleNotification.js +31 -0
- package/dist/browser/api/internal/_scheduleNotification.js.map +1 -0
- package/dist/browser/api/internal/_sendNotification.d.ts +13 -0
- package/dist/browser/api/internal/_sendNotification.d.ts.map +1 -0
- package/dist/browser/api/internal/_sendNotification.js +62 -0
- package/dist/browser/api/internal/_sendNotification.js.map +1 -0
- package/dist/browser/api/scheduleBroadcastNotification.d.ts +15 -0
- package/dist/browser/api/scheduleBroadcastNotification.d.ts.map +1 -0
- package/dist/browser/api/scheduleBroadcastNotification.js +16 -0
- package/dist/browser/api/scheduleBroadcastNotification.js.map +1 -0
- package/dist/browser/api/scheduleNotification.d.ts +1 -1
- package/dist/browser/api/scheduleNotification.d.ts.map +1 -1
- package/dist/browser/api/scheduleNotification.js +3 -18
- package/dist/browser/api/scheduleNotification.js.map +1 -1
- package/dist/browser/api/sendBroadcastNotification.d.ts +13 -0
- package/dist/browser/api/sendBroadcastNotification.d.ts.map +1 -0
- package/dist/browser/api/sendBroadcastNotification.js +14 -0
- package/dist/browser/api/sendBroadcastNotification.js.map +1 -0
- package/dist/browser/api/sendNotification.d.ts +1 -1
- package/dist/browser/api/sendNotification.d.ts.map +1 -1
- package/dist/browser/api/sendNotification.js +3 -52
- package/dist/browser/api/sendNotification.js.map +1 -1
- package/dist/browser/models/options.d.ts +13 -10
- package/dist/browser/models/options.d.ts.map +1 -1
- package/dist/browser/models/options.js.map +1 -1
- package/dist/browser/notificationHubsClient.d.ts +19 -3
- package/dist/browser/notificationHubsClient.d.ts.map +1 -1
- package/dist/browser/notificationHubsClient.js +24 -2
- package/dist/browser/notificationHubsClient.js.map +1 -1
- package/dist/browser/utils/optionUtils.d.ts +7 -1
- package/dist/browser/utils/optionUtils.d.ts.map +1 -1
- package/dist/browser/utils/optionUtils.js +8 -0
- package/dist/browser/utils/optionUtils.js.map +1 -1
- package/dist/browser/utils/xmlUtils.js +1 -1
- package/dist/browser/utils/xmlUtils.js.map +1 -1
- package/dist/commonjs/api/index.d.ts +2 -0
- package/dist/commonjs/api/index.d.ts.map +1 -1
- package/dist/commonjs/api/index.js +2 -0
- package/dist/commonjs/api/index.js.map +1 -1
- package/dist/commonjs/api/internal/_scheduleNotification.d.ts +15 -0
- package/dist/commonjs/api/internal/_scheduleNotification.d.ts.map +1 -0
- package/dist/commonjs/api/internal/_scheduleNotification.js +34 -0
- package/dist/commonjs/api/internal/_scheduleNotification.js.map +1 -0
- package/dist/commonjs/api/internal/_sendNotification.d.ts +13 -0
- package/dist/commonjs/api/internal/_sendNotification.d.ts.map +1 -0
- package/dist/commonjs/api/internal/_sendNotification.js +65 -0
- package/dist/commonjs/api/internal/_sendNotification.js.map +1 -0
- package/dist/commonjs/api/scheduleBroadcastNotification.d.ts +15 -0
- package/dist/commonjs/api/scheduleBroadcastNotification.d.ts.map +1 -0
- package/dist/commonjs/api/scheduleBroadcastNotification.js +19 -0
- package/dist/commonjs/api/scheduleBroadcastNotification.js.map +1 -0
- package/dist/commonjs/api/scheduleNotification.d.ts +1 -1
- package/dist/commonjs/api/scheduleNotification.d.ts.map +1 -1
- package/dist/commonjs/api/scheduleNotification.js +3 -18
- package/dist/commonjs/api/scheduleNotification.js.map +1 -1
- package/dist/commonjs/api/sendBroadcastNotification.d.ts +13 -0
- package/dist/commonjs/api/sendBroadcastNotification.d.ts.map +1 -0
- package/dist/commonjs/api/sendBroadcastNotification.js +17 -0
- package/dist/commonjs/api/sendBroadcastNotification.js.map +1 -0
- package/dist/commonjs/api/sendNotification.d.ts +1 -1
- package/dist/commonjs/api/sendNotification.d.ts.map +1 -1
- package/dist/commonjs/api/sendNotification.js +3 -52
- package/dist/commonjs/api/sendNotification.js.map +1 -1
- package/dist/commonjs/models/options.d.ts +13 -10
- package/dist/commonjs/models/options.d.ts.map +1 -1
- package/dist/commonjs/models/options.js.map +1 -1
- package/dist/commonjs/notificationHubsClient.d.ts +19 -3
- package/dist/commonjs/notificationHubsClient.d.ts.map +1 -1
- package/dist/commonjs/notificationHubsClient.js +24 -2
- package/dist/commonjs/notificationHubsClient.js.map +1 -1
- package/dist/commonjs/utils/optionUtils.d.ts +7 -1
- package/dist/commonjs/utils/optionUtils.d.ts.map +1 -1
- package/dist/commonjs/utils/optionUtils.js +9 -0
- package/dist/commonjs/utils/optionUtils.js.map +1 -1
- package/dist/commonjs/utils/xmlUtils.js +1 -1
- package/dist/commonjs/utils/xmlUtils.js.map +1 -1
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/api/index.d.ts.map +1 -1
- package/dist/esm/api/index.js +2 -0
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/internal/_scheduleNotification.d.ts +15 -0
- package/dist/esm/api/internal/_scheduleNotification.d.ts.map +1 -0
- package/dist/esm/api/internal/_scheduleNotification.js +31 -0
- package/dist/esm/api/internal/_scheduleNotification.js.map +1 -0
- package/dist/esm/api/internal/_sendNotification.d.ts +13 -0
- package/dist/esm/api/internal/_sendNotification.d.ts.map +1 -0
- package/dist/esm/api/internal/_sendNotification.js +62 -0
- package/dist/esm/api/internal/_sendNotification.js.map +1 -0
- package/dist/esm/api/scheduleBroadcastNotification.d.ts +15 -0
- package/dist/esm/api/scheduleBroadcastNotification.d.ts.map +1 -0
- package/dist/esm/api/scheduleBroadcastNotification.js +16 -0
- package/dist/esm/api/scheduleBroadcastNotification.js.map +1 -0
- package/dist/esm/api/scheduleNotification.d.ts +1 -1
- package/dist/esm/api/scheduleNotification.d.ts.map +1 -1
- package/dist/esm/api/scheduleNotification.js +3 -18
- package/dist/esm/api/scheduleNotification.js.map +1 -1
- package/dist/esm/api/sendBroadcastNotification.d.ts +13 -0
- package/dist/esm/api/sendBroadcastNotification.d.ts.map +1 -0
- package/dist/esm/api/sendBroadcastNotification.js +14 -0
- package/dist/esm/api/sendBroadcastNotification.js.map +1 -0
- package/dist/esm/api/sendNotification.d.ts +1 -1
- package/dist/esm/api/sendNotification.d.ts.map +1 -1
- package/dist/esm/api/sendNotification.js +3 -52
- package/dist/esm/api/sendNotification.js.map +1 -1
- package/dist/esm/models/options.d.ts +13 -10
- package/dist/esm/models/options.d.ts.map +1 -1
- package/dist/esm/models/options.js.map +1 -1
- package/dist/esm/notificationHubsClient.d.ts +19 -3
- package/dist/esm/notificationHubsClient.d.ts.map +1 -1
- package/dist/esm/notificationHubsClient.js +24 -2
- package/dist/esm/notificationHubsClient.js.map +1 -1
- package/dist/esm/utils/optionUtils.d.ts +7 -1
- package/dist/esm/utils/optionUtils.d.ts.map +1 -1
- package/dist/esm/utils/optionUtils.js +8 -0
- package/dist/esm/utils/optionUtils.js.map +1 -1
- package/dist/esm/utils/xmlUtils.js +1 -1
- package/dist/esm/utils/xmlUtils.js.map +1 -1
- package/dist/models/notification-hubs.d.ts +15 -11
- package/dist/notification-hubs.d.ts +33 -13
- package/dist/react-native/api/index.d.ts +2 -0
- package/dist/react-native/api/index.d.ts.map +1 -1
- package/dist/react-native/api/index.js +2 -0
- package/dist/react-native/api/index.js.map +1 -1
- package/dist/react-native/api/internal/_scheduleNotification.d.ts +15 -0
- package/dist/react-native/api/internal/_scheduleNotification.d.ts.map +1 -0
- package/dist/react-native/api/internal/_scheduleNotification.js +31 -0
- package/dist/react-native/api/internal/_scheduleNotification.js.map +1 -0
- package/dist/react-native/api/internal/_sendNotification.d.ts +13 -0
- package/dist/react-native/api/internal/_sendNotification.d.ts.map +1 -0
- package/dist/react-native/api/internal/_sendNotification.js +62 -0
- package/dist/react-native/api/internal/_sendNotification.js.map +1 -0
- package/dist/react-native/api/scheduleBroadcastNotification.d.ts +15 -0
- package/dist/react-native/api/scheduleBroadcastNotification.d.ts.map +1 -0
- package/dist/react-native/api/scheduleBroadcastNotification.js +16 -0
- package/dist/react-native/api/scheduleBroadcastNotification.js.map +1 -0
- package/dist/react-native/api/scheduleNotification.d.ts +1 -1
- package/dist/react-native/api/scheduleNotification.d.ts.map +1 -1
- package/dist/react-native/api/scheduleNotification.js +3 -18
- package/dist/react-native/api/scheduleNotification.js.map +1 -1
- package/dist/react-native/api/sendBroadcastNotification.d.ts +13 -0
- package/dist/react-native/api/sendBroadcastNotification.d.ts.map +1 -0
- package/dist/react-native/api/sendBroadcastNotification.js +14 -0
- package/dist/react-native/api/sendBroadcastNotification.js.map +1 -0
- package/dist/react-native/api/sendNotification.d.ts +1 -1
- package/dist/react-native/api/sendNotification.d.ts.map +1 -1
- package/dist/react-native/api/sendNotification.js +3 -52
- package/dist/react-native/api/sendNotification.js.map +1 -1
- package/dist/react-native/models/options.d.ts +13 -10
- package/dist/react-native/models/options.d.ts.map +1 -1
- package/dist/react-native/models/options.js.map +1 -1
- package/dist/react-native/notificationHubsClient.d.ts +19 -3
- package/dist/react-native/notificationHubsClient.d.ts.map +1 -1
- package/dist/react-native/notificationHubsClient.js +24 -2
- package/dist/react-native/notificationHubsClient.js.map +1 -1
- package/dist/react-native/utils/optionUtils.d.ts +7 -1
- package/dist/react-native/utils/optionUtils.d.ts.map +1 -1
- package/dist/react-native/utils/optionUtils.js +8 -0
- package/dist/react-native/utils/optionUtils.js.map +1 -1
- package/dist/react-native/utils/xmlUtils.js +1 -1
- package/dist/react-native/utils/xmlUtils.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -383,7 +383,7 @@ const result = await sendNotification(context, notification);
|
|
|
383
383
|
|
|
384
384
|
#### Broadcast Send
|
|
385
385
|
|
|
386
|
-
Notification Hubs can be used to send notifications to all registered devices per platform using broadcast send through the `
|
|
386
|
+
Notification Hubs can be used to send notifications to all registered devices per platform using broadcast send through the `sendBroadcastNotification` method.
|
|
387
387
|
|
|
388
388
|
```typescript
|
|
389
389
|
import {
|
|
@@ -403,7 +403,7 @@ const message = createAppleNotification({
|
|
|
403
403
|
},
|
|
404
404
|
});
|
|
405
405
|
|
|
406
|
-
const result = await client.
|
|
406
|
+
const result = await client.sendBroadcastNotification(message);
|
|
407
407
|
|
|
408
408
|
console.log(`Tracking ID: ${result.trackingId}`);
|
|
409
409
|
console.log(`Correlation ID: ${result.correlationId}`);
|
|
@@ -417,7 +417,7 @@ if (result.notificationId) {
|
|
|
417
417
|
Using the modular approach, the code would be as follows:
|
|
418
418
|
|
|
419
419
|
```typescript
|
|
420
|
-
import { createClientContext,
|
|
420
|
+
import { createClientContext, sendBroadcastNotification } from "@azure/notification-hubs/api";
|
|
421
421
|
import { createAppleNotification } from "@azure/notification-hubs/models";
|
|
422
422
|
|
|
423
423
|
const context = createClientContext(connectionString, hubName);
|
|
@@ -432,7 +432,7 @@ const message = createAppleNotification({
|
|
|
432
432
|
},
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
-
const result = await
|
|
435
|
+
const result = await sendBroadcastNotification(context, message);
|
|
436
436
|
|
|
437
437
|
console.log(`Tracking ID: ${result.trackingId}`);
|
|
438
438
|
console.log(`Correlation ID: ${result.correlationId}`);
|
|
@@ -591,7 +591,7 @@ if (result.notificationId) {
|
|
|
591
591
|
|
|
592
592
|
#### Scheduled Send
|
|
593
593
|
|
|
594
|
-
Push notifications can be scheduled up to seven days in advance with Standard SKU namespaces and above using the `
|
|
594
|
+
Push notifications can be scheduled up to seven days in advance with Standard SKU namespaces and above using the `scheduleNotification` method to send to devices with tags or a general broadcast with `scheduleBroadcastNotification`. This returns a notification ID which can be then used to cancel if necessary via the `cancelScheduledNotification` method.
|
|
595
595
|
|
|
596
596
|
```typescript
|
|
597
597
|
import {
|
|
@@ -671,7 +671,7 @@ We also need to provide polyfill for `TextEncoder` API and async iterator API. P
|
|
|
671
671
|
|
|
672
672
|
Azure Notification Hubs has a complete guide to troubleshooting problems with dropped notifications in the [Diagnose dropped notifications in Azure Notification Hubs Guide](https://docs.microsoft.com/azure/notification-hubs/notification-hubs-push-notification-fixer).
|
|
673
673
|
|
|
674
|
-
[Test send](https://docs.microsoft.com/azure/notification-hubs/notification-hubs-push-notification-fixer#enabletestsend-property) is supported supported in the `sendNotification`
|
|
674
|
+
[Test send](https://docs.microsoft.com/azure/notification-hubs/notification-hubs-push-notification-fixer#enabletestsend-property) is supported supported in the `sendNotification` and `sendBroadcastNotification` methods with the `enableTestSend` option:
|
|
675
675
|
|
|
676
676
|
```typescript
|
|
677
677
|
// Using the client
|
|
@@ -240,6 +240,16 @@ declare interface BaiduTemplateRegistrationDescriptionCommon extends BaiduRegist
|
|
|
240
240
|
*/
|
|
241
241
|
export declare function beginSubmitNotificationHubJob(context: NotificationHubsClientContext, notificationHubJob: NotificationHubJob, polledOperationOptions?: PolledOperationOptions): Promise<NotificationHubJobPoller>;
|
|
242
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Options for sending notifications for test send.
|
|
245
|
+
*/
|
|
246
|
+
declare interface BroadcastSendNotificationOptions extends OperationOptions {
|
|
247
|
+
/**
|
|
248
|
+
* Set to true to enable test send.
|
|
249
|
+
*/
|
|
250
|
+
enableTestSend?: boolean;
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
/**
|
|
244
254
|
* Represents a Browser/Web Push based installation.
|
|
245
255
|
*/
|
|
@@ -1193,6 +1203,17 @@ declare interface RegistrationResult {
|
|
|
1193
1203
|
outcome: string;
|
|
1194
1204
|
}
|
|
1195
1205
|
|
|
1206
|
+
/**
|
|
1207
|
+
* Schedules a push notification to all registered devices.
|
|
1208
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
1209
|
+
* @param context - The Notification Hubs client.
|
|
1210
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
1211
|
+
* @param notification - The notification to send to the matching devices.
|
|
1212
|
+
* @param options - Operation options.
|
|
1213
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1214
|
+
*/
|
|
1215
|
+
export declare function scheduleBroadcastNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options?: OperationOptions): Promise<NotificationHubsMessageResponse>;
|
|
1216
|
+
|
|
1196
1217
|
/**
|
|
1197
1218
|
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
1198
1219
|
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
@@ -1202,19 +1223,27 @@ declare interface RegistrationResult {
|
|
|
1202
1223
|
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
1203
1224
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1204
1225
|
*/
|
|
1205
|
-
export declare function scheduleNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options
|
|
1226
|
+
export declare function scheduleNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options: ScheduleNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
1206
1227
|
|
|
1207
1228
|
/**
|
|
1208
|
-
* Options for sending notifications for both tag based
|
|
1229
|
+
* Options for sending notifications for both tag based scheduled send.
|
|
1209
1230
|
*/
|
|
1210
1231
|
declare interface ScheduleNotificationOptions extends OperationOptions {
|
|
1211
1232
|
/**
|
|
1212
1233
|
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
1213
|
-
* If not set, this results in a broadcast notification to be scheduled.
|
|
1214
1234
|
*/
|
|
1215
|
-
tagExpression
|
|
1235
|
+
tagExpression: string;
|
|
1216
1236
|
}
|
|
1217
1237
|
|
|
1238
|
+
/**
|
|
1239
|
+
* Sends push notifications to all devices with a broadcast send.
|
|
1240
|
+
* @param context - The Notification Hubs client.
|
|
1241
|
+
* @param notification - The notification to send to the matching devices.
|
|
1242
|
+
* @param options - Options for the notification including whether to enable test send.
|
|
1243
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1244
|
+
*/
|
|
1245
|
+
export declare function sendBroadcastNotification(context: NotificationHubsClientContext, notification: Notification, options?: BroadcastSendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
1246
|
+
|
|
1218
1247
|
/**
|
|
1219
1248
|
* Sends push notifications to devices that match the given tags or tag expression.
|
|
1220
1249
|
* @param context - The Notification Hubs client.
|
|
@@ -1222,21 +1251,16 @@ declare interface ScheduleNotificationOptions extends OperationOptions {
|
|
|
1222
1251
|
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
1223
1252
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
1224
1253
|
*/
|
|
1225
|
-
export declare function sendNotification(context: NotificationHubsClientContext, notification: Notification, options
|
|
1254
|
+
export declare function sendNotification(context: NotificationHubsClientContext, notification: Notification, options: DirectSendNotificationOptions | SendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
1226
1255
|
|
|
1227
1256
|
/**
|
|
1228
|
-
* Options for sending notifications for
|
|
1257
|
+
* Options for sending notifications for tag based send.
|
|
1229
1258
|
*/
|
|
1230
|
-
declare interface SendNotificationOptions extends
|
|
1259
|
+
declare interface SendNotificationOptions extends BroadcastSendNotificationOptions {
|
|
1231
1260
|
/**
|
|
1232
1261
|
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
1233
|
-
* If not set, this results in a broadcast notification to be sent.
|
|
1234
|
-
*/
|
|
1235
|
-
tagExpression?: string;
|
|
1236
|
-
/**
|
|
1237
|
-
* Set to true to enable test send.
|
|
1238
1262
|
*/
|
|
1239
|
-
|
|
1263
|
+
tagExpression: string;
|
|
1240
1264
|
}
|
|
1241
1265
|
|
|
1242
1266
|
/**
|
|
@@ -16,7 +16,9 @@ export * from "./listNotificationHubJobs.js";
|
|
|
16
16
|
export * from "./listRegistrations.js";
|
|
17
17
|
export * from "./listRegistrationsByChannel.js";
|
|
18
18
|
export * from "./listRegistrationsByTag.js";
|
|
19
|
+
export * from "./scheduleBroadcastNotification.js";
|
|
19
20
|
export * from "./scheduleNotification.js";
|
|
21
|
+
export * from "./sendBroadcastNotification.js";
|
|
20
22
|
export * from "./sendNotification.js";
|
|
21
23
|
export * from "./submitNotificationHubJob.js";
|
|
22
24
|
export * from "./updateInstallation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -18,7 +18,9 @@ export * from "./listNotificationHubJobs.js";
|
|
|
18
18
|
export * from "./listRegistrations.js";
|
|
19
19
|
export * from "./listRegistrationsByChannel.js";
|
|
20
20
|
export * from "./listRegistrationsByTag.js";
|
|
21
|
+
export * from "./scheduleBroadcastNotification.js";
|
|
21
22
|
export * from "./scheduleNotification.js";
|
|
23
|
+
export * from "./sendBroadcastNotification.js";
|
|
22
24
|
export * from "./sendNotification.js";
|
|
23
25
|
export * from "./submitNotificationHubJob.js";
|
|
24
26
|
export * from "./updateInstallation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./clientContext.js\";\nexport * from \"./beginSubmitNotificationHubJob.js\";\nexport * from \"./cancelScheduledNotification.js\";\nexport * from \"./createOrUpdateInstallation.js\";\nexport * from \"./createOrUpdateRegistration.js\";\nexport * from \"./createRegistration.js\";\nexport * from \"./createRegistrationId.js\";\nexport * from \"./deleteInstallation.js\";\nexport * from \"./deleteRegistration.js\";\nexport * from \"./getFeedbackContainerUrl.js\";\nexport * from \"./getInstallation.js\";\nexport * from \"./getNotificationHubJob.js\";\nexport * from \"./getNotificationOutcomeDetails.js\";\nexport * from \"./getRegistration.js\";\nexport * from \"./listNotificationHubJobs.js\";\nexport * from \"./listRegistrations.js\";\nexport * from \"./listRegistrationsByChannel.js\";\nexport * from \"./listRegistrationsByTag.js\";\nexport * from \"./scheduleNotification.js\";\nexport * from \"./sendNotification.js\";\nexport * from \"./submitNotificationHubJob.js\";\nexport * from \"./updateInstallation.js\";\nexport * from \"./updateRegistration.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./clientContext.js\";\nexport * from \"./beginSubmitNotificationHubJob.js\";\nexport * from \"./cancelScheduledNotification.js\";\nexport * from \"./createOrUpdateInstallation.js\";\nexport * from \"./createOrUpdateRegistration.js\";\nexport * from \"./createRegistration.js\";\nexport * from \"./createRegistrationId.js\";\nexport * from \"./deleteInstallation.js\";\nexport * from \"./deleteRegistration.js\";\nexport * from \"./getFeedbackContainerUrl.js\";\nexport * from \"./getInstallation.js\";\nexport * from \"./getNotificationHubJob.js\";\nexport * from \"./getNotificationOutcomeDetails.js\";\nexport * from \"./getRegistration.js\";\nexport * from \"./listNotificationHubJobs.js\";\nexport * from \"./listRegistrations.js\";\nexport * from \"./listRegistrationsByChannel.js\";\nexport * from \"./listRegistrationsByTag.js\";\nexport * from \"./scheduleBroadcastNotification.js\";\nexport * from \"./scheduleNotification.js\";\nexport * from \"./sendBroadcastNotification.js\";\nexport * from \"./sendNotification.js\";\nexport * from \"./submitNotificationHubJob.js\";\nexport * from \"./updateInstallation.js\";\nexport * from \"./updateRegistration.js\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Notification } from "../../models/notification.js";
|
|
2
|
+
import { NotificationHubsClientContext } from "../index.js";
|
|
3
|
+
import { NotificationHubsMessageResponse } from "../../models/notificationDetails.js";
|
|
4
|
+
import { OperationOptions } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
7
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
10
|
+
* @param notification - The notification to send to the matching devices.
|
|
11
|
+
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
12
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scheduleNotificationInternal(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options: OperationOptions, method: string, tagExpression?: string): Promise<NotificationHubsMessageResponse>;
|
|
15
|
+
//# sourceMappingURL=_scheduleNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_scheduleNotification.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_scheduleNotification.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,IAAI,EACnB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,+BAA+B,CAAC,CA2B1C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createRequest, parseNotificationSendResponse, sendRequest } from "./_client.js";
|
|
4
|
+
import { tracingClient } from "../../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
7
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
10
|
+
* @param notification - The notification to send to the matching devices.
|
|
11
|
+
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
12
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
13
|
+
*/
|
|
14
|
+
export function scheduleNotificationInternal(context, scheduledTime, notification, options, method, tagExpression) {
|
|
15
|
+
return tracingClient.withSpan(`NotificationHubsClientContext.${method}`, options, async (updatedOptions) => {
|
|
16
|
+
const endpoint = context.requestUrl();
|
|
17
|
+
endpoint.pathname += "/schedulednotifications/";
|
|
18
|
+
const headers = await context.createHeaders("scheduleNotification", notification.headers);
|
|
19
|
+
headers.set("ServiceBusNotification-ScheduleTime", scheduledTime.toISOString());
|
|
20
|
+
headers.set("Content-Type", notification.contentType);
|
|
21
|
+
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
22
|
+
if (tagExpression) {
|
|
23
|
+
headers.set("ServiceBusNotification-Tags", tagExpression);
|
|
24
|
+
}
|
|
25
|
+
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
26
|
+
request.body = notification.body;
|
|
27
|
+
const response = await sendRequest(context, request, 201);
|
|
28
|
+
return parseNotificationSendResponse(response);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=_scheduleNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_scheduleNotification.js","sourceRoot":"","sources":["../../../../src/api/internal/_scheduleNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,OAAyB,EACzB,MAAc,EACd,aAAsB;IAEtB,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,MAAM,EAAE,EACzC,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,0BAA0B,CAAC;QAEhD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CACzC,sBAAsB,EACtB,YAAY,CAAC,OAA4B,CAC1C,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,aAAa,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./_client.js\";\nimport { NonNullableRecord } from \"../../utils/utils.js\";\nimport { Notification } from \"../../models/notification.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { NotificationHubsMessageResponse } from \"../../models/notificationDetails.js\";\nimport { tracingClient } from \"../../utils/tracing.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\n\n/**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleNotificationInternal(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: OperationOptions,\n method: string,\n tagExpression?: string,\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${method}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/schedulednotifications/\";\n\n const headers = await context.createHeaders(\n \"scheduleNotification\",\n notification.headers as NonNullableRecord,\n );\n headers.set(\"ServiceBusNotification-ScheduleTime\", scheduledTime.toISOString());\n headers.set(\"Content-Type\", notification.contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n if (tagExpression) {\n headers.set(\"ServiceBusNotification-Tags\", tagExpression);\n }\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = notification.body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n },\n );\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BroadcastSendNotificationOptions, DirectSendNotificationOptions, SendNotificationOptions } from "../../models/options.js";
|
|
2
|
+
import { Notification } from "../../models/notification.js";
|
|
3
|
+
import { NotificationHubsClientContext } from "../index.js";
|
|
4
|
+
import { NotificationHubsMessageResponse } from "../../models/notificationDetails.js";
|
|
5
|
+
/**
|
|
6
|
+
* Sends push notifications to devices that match the given tags or tag expression.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param notification - The notification to send to the matching devices.
|
|
9
|
+
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
10
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sendNotificationInternal(context: NotificationHubsClientContext, notification: Notification, options: DirectSendNotificationOptions | SendNotificationOptions | BroadcastSendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
13
|
+
//# sourceMappingURL=_sendNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_sendNotification.d.ts","sourceRoot":"","sources":["../../../../src/api/internal/_sendNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AASjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAKtF;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,6BAA6B,EACtC,YAAY,EAAE,YAAY,EAC1B,OAAO,EACH,6BAA6B,GAC7B,uBAAuB,GACvB,gCAAgC,GACnC,OAAO,CAAC,+BAA+B,CAAC,CA8D1C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createRequest, parseNotificationSendResponse, sendRequest } from "./_client.js";
|
|
4
|
+
import { isBroadcastSendNotificationOptions, isDirectSendNotificationOptions, isSendNotificationOptions, } from "../../utils/optionUtils.js";
|
|
5
|
+
import { createMultipartDirectNotification } from "../../utils/notificationUtils.js";
|
|
6
|
+
import { randomUUID } from "@azure/core-util";
|
|
7
|
+
import { tracingClient } from "../../utils/tracing.js";
|
|
8
|
+
/**
|
|
9
|
+
* Sends push notifications to devices that match the given tags or tag expression.
|
|
10
|
+
* @param context - The Notification Hubs client.
|
|
11
|
+
* @param notification - The notification to send to the matching devices.
|
|
12
|
+
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
13
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
14
|
+
*/
|
|
15
|
+
export function sendNotificationInternal(context, notification, options) {
|
|
16
|
+
return tracingClient.withSpan(`NotificationHubsClientContext.sendNotification`, options, async (updatedOptions) => {
|
|
17
|
+
const endpoint = context.requestUrl();
|
|
18
|
+
endpoint.pathname += "/messages/";
|
|
19
|
+
// Check if batch direct send
|
|
20
|
+
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
21
|
+
endpoint.pathname += "$batch";
|
|
22
|
+
}
|
|
23
|
+
// Check for test send
|
|
24
|
+
if ((isSendNotificationOptions(options) || isBroadcastSendNotificationOptions(options)) &&
|
|
25
|
+
options.enableTestSend) {
|
|
26
|
+
endpoint.searchParams.append("test", "true");
|
|
27
|
+
}
|
|
28
|
+
const headers = await context.createHeaders("sendNotification", notification.headers);
|
|
29
|
+
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
30
|
+
let body = notification.body;
|
|
31
|
+
let contentType = notification.contentType;
|
|
32
|
+
// Check for direct batch send
|
|
33
|
+
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
34
|
+
endpoint.searchParams.append("direct", "true");
|
|
35
|
+
const boundary = `nh-boundary-${randomUUID()}`;
|
|
36
|
+
contentType = `multipart/mixed; boundary = "${boundary}"`;
|
|
37
|
+
body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);
|
|
38
|
+
}
|
|
39
|
+
else if (isDirectSendNotificationOptions(options)) {
|
|
40
|
+
endpoint.searchParams.append("direct", "true");
|
|
41
|
+
if (notification.platform === "browser") {
|
|
42
|
+
const browserHandle = options.deviceHandle;
|
|
43
|
+
headers.set("ServiceBusNotification-DeviceHandle", browserHandle.endpoint);
|
|
44
|
+
headers.set("Auth", browserHandle.auth);
|
|
45
|
+
headers.set("P256DH", browserHandle.p256dh);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
headers.set("ServiceBusNotification-DeviceHandle", options.deviceHandle);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (isSendNotificationOptions(options)) {
|
|
52
|
+
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
53
|
+
}
|
|
54
|
+
headers.set("Content-Type", contentType);
|
|
55
|
+
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
56
|
+
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
57
|
+
request.body = body;
|
|
58
|
+
const response = await sendRequest(context, request, 201);
|
|
59
|
+
return parseNotificationSendResponse(response);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=_sendNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_sendNotification.js","sourceRoot":"","sources":["../../../../src/api/internal/_sendNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EACL,kCAAkC,EAClC,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAsC,EACtC,YAA0B,EAC1B,OAGoC;IAEpC,OAAO,aAAa,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC;QAElC,6BAA6B;QAC7B,IAAI,+BAA+B,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACpF,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC;QAChC,CAAC;QAED,sBAAsB;QACtB,IACE,CAAC,yBAAyB,CAAC,OAAO,CAAC,IAAI,kCAAkC,CAAC,OAAO,CAAC,CAAC;YACnF,OAAO,CAAC,cAAc,EACtB,CAAC;YACD,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CACzC,kBAAkB,EAClB,YAAY,CAAC,OAA4B,CAC1C,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,IAAI,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAC7B,IAAI,WAAW,GAAW,YAAY,CAAC,WAAW,CAAC;QAEnD,8BAA8B;QAC9B,IAAI,+BAA+B,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACpF,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,eAAe,UAAU,EAAE,EAAE,CAAC;YAC/C,WAAW,GAAG,gCAAgC,QAAQ,GAAG,CAAC;YAC1D,IAAI,GAAG,iCAAiC,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QACzF,CAAC;aAAM,IAAI,+BAA+B,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAE/C,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACxC,MAAM,aAAa,GAAG,OAAO,CAAC,YAAkC,CAAC;gBACjE,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAC3E,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC,YAAsB,CAAC,CAAC;YACrF,CAAC;QACH,CAAC;aAAM,IAAI,yBAAyB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAEpB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n BroadcastSendNotificationOptions,\n DirectSendNotificationOptions,\n SendNotificationOptions,\n} from \"../../models/options.js\";\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./_client.js\";\nimport {\n isBroadcastSendNotificationOptions,\n isDirectSendNotificationOptions,\n isSendNotificationOptions,\n} from \"../../utils/optionUtils.js\";\nimport { BrowserPushChannel } from \"../../models/installation.js\";\nimport { NonNullableRecord } from \"../../utils/utils.js\";\nimport { Notification } from \"../../models/notification.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { NotificationHubsMessageResponse } from \"../../models/notificationDetails.js\";\nimport { createMultipartDirectNotification } from \"../../utils/notificationUtils.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { tracingClient } from \"../../utils/tracing.js\";\n\n/**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param context - The Notification Hubs client.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendNotificationInternal(\n context: NotificationHubsClientContext,\n notification: Notification,\n options:\n | DirectSendNotificationOptions\n | SendNotificationOptions\n | BroadcastSendNotificationOptions,\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.sendNotification`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/messages/\";\n\n // Check if batch direct send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.pathname += \"$batch\";\n }\n\n // Check for test send\n if (\n (isSendNotificationOptions(options) || isBroadcastSendNotificationOptions(options)) &&\n options.enableTestSend\n ) {\n endpoint.searchParams.append(\"test\", \"true\");\n }\n\n const headers = await context.createHeaders(\n \"sendNotification\",\n notification.headers as NonNullableRecord,\n );\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n let body = notification.body;\n let contentType: string = notification.contentType;\n\n // Check for direct batch send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n const boundary = `nh-boundary-${randomUUID()}`;\n contentType = `multipart/mixed; boundary = \"${boundary}\"`;\n body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);\n } else if (isDirectSendNotificationOptions(options)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n\n if (notification.platform === \"browser\") {\n const browserHandle = options.deviceHandle as BrowserPushChannel;\n headers.set(\"ServiceBusNotification-DeviceHandle\", browserHandle.endpoint);\n headers.set(\"Auth\", browserHandle.auth);\n headers.set(\"P256DH\", browserHandle.p256dh);\n } else {\n headers.set(\"ServiceBusNotification-DeviceHandle\", options.deviceHandle as string);\n }\n } else if (isSendNotificationOptions(options)) {\n headers.set(\"ServiceBusNotification-Tags\", options.tagExpression);\n }\n\n headers.set(\"Content-Type\", contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n },\n );\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Notification } from "../models/notification.js";
|
|
2
|
+
import { NotificationHubsClientContext } from "./index.js";
|
|
3
|
+
import { NotificationHubsMessageResponse } from "../models/notificationDetails.js";
|
|
4
|
+
import { OperationOptions } from "@azure-rest/core-client";
|
|
5
|
+
/**
|
|
6
|
+
* Schedules a push notification to all registered devices.
|
|
7
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
10
|
+
* @param notification - The notification to send to the matching devices.
|
|
11
|
+
* @param options - Operation options.
|
|
12
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scheduleBroadcastNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options?: OperationOptions): Promise<NotificationHubsMessageResponse>;
|
|
15
|
+
//# sourceMappingURL=scheduleBroadcastNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleBroadcastNotification.d.ts","sourceRoot":"","sources":["../../../src/api/scheduleBroadcastNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,IAAI,EACnB,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,+BAA+B,CAAC,CAQ1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { scheduleNotificationInternal } from "./internal/_scheduleNotification.js";
|
|
4
|
+
/**
|
|
5
|
+
* Schedules a push notification to all registered devices.
|
|
6
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
9
|
+
* @param notification - The notification to send to the matching devices.
|
|
10
|
+
* @param options - Operation options.
|
|
11
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
12
|
+
*/
|
|
13
|
+
export function scheduleBroadcastNotification(context, scheduledTime, notification, options = {}) {
|
|
14
|
+
return scheduleNotificationInternal(context, scheduledTime, notification, options, "scheduleBroadcastNotification");
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=scheduleBroadcastNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleBroadcastNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleBroadcastNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,4BAA4B,CACjC,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,+BAA+B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure-rest/core-client\";\nimport { scheduleNotificationInternal } from \"./internal/_scheduleNotification.js\";\n\n/**\n * Schedules a push notification to all registered devices.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Operation options.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleBroadcastNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: OperationOptions = {},\n): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationInternal(\n context,\n scheduledTime,\n notification,\n options,\n \"scheduleBroadcastNotification\",\n );\n}\n"]}
|
|
@@ -11,5 +11,5 @@ import { ScheduleNotificationOptions } from "../models/options.js";
|
|
|
11
11
|
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
12
12
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
13
13
|
*/
|
|
14
|
-
export declare function scheduleNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options
|
|
14
|
+
export declare function scheduleNotification(context: NotificationHubsClientContext, scheduledTime: Date, notification: Notification, options: ScheduleNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
15
15
|
//# sourceMappingURL=scheduleNotification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleNotification.d.ts","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduleNotification.d.ts","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGnE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,IAAI,EACnB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,+BAA+B,CAAC,CAS1C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
import { tracingClient } from "../utils/tracing.js";
|
|
3
|
+
import { scheduleNotificationInternal } from "./internal/_scheduleNotification.js";
|
|
5
4
|
/**
|
|
6
5
|
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
7
6
|
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
@@ -11,21 +10,7 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
11
10
|
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
12
11
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
13
12
|
*/
|
|
14
|
-
export function scheduleNotification(context, scheduledTime, notification, options
|
|
15
|
-
return
|
|
16
|
-
const endpoint = context.requestUrl();
|
|
17
|
-
endpoint.pathname += "/schedulednotifications/";
|
|
18
|
-
const headers = await context.createHeaders("scheduleNotification", notification.headers);
|
|
19
|
-
headers.set("ServiceBusNotification-ScheduleTime", scheduledTime.toISOString());
|
|
20
|
-
headers.set("Content-Type", notification.contentType);
|
|
21
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
22
|
-
if (options.tagExpression) {
|
|
23
|
-
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
24
|
-
}
|
|
25
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
26
|
-
request.body = notification.body;
|
|
27
|
-
const response = await sendRequest(context, request, 201);
|
|
28
|
-
return parseNotificationSendResponse(response);
|
|
29
|
-
});
|
|
13
|
+
export function scheduleNotification(context, scheduledTime, notification, options) {
|
|
14
|
+
return scheduleNotificationInternal(context, scheduledTime, notification, options, "scheduleNotification", options.tagExpression);
|
|
30
15
|
}
|
|
31
16
|
//# sourceMappingURL=scheduleNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,OAAoC;IAEpC,OAAO,4BAA4B,CACjC,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,sBAAsB,EACtB,OAAO,CAAC,aAAa,CACtB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { ScheduleNotificationOptions } from \"../models/options.js\";\nimport { scheduleNotificationInternal } from \"./internal/_scheduleNotification.js\";\n\n/**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions,\n): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationInternal(\n context,\n scheduledTime,\n notification,\n options,\n \"scheduleNotification\",\n options.tagExpression,\n );\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BroadcastSendNotificationOptions } from "../models/options.js";
|
|
2
|
+
import { Notification } from "../models/notification.js";
|
|
3
|
+
import { NotificationHubsClientContext } from "./index.js";
|
|
4
|
+
import { NotificationHubsMessageResponse } from "../models/notificationDetails.js";
|
|
5
|
+
/**
|
|
6
|
+
* Sends push notifications to all devices with a broadcast send.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param notification - The notification to send to the matching devices.
|
|
9
|
+
* @param options - Options for the notification including whether to enable test send.
|
|
10
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sendBroadcastNotification(context: NotificationHubsClientContext, notification: Notification, options?: BroadcastSendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
13
|
+
//# sourceMappingURL=sendBroadcastNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendBroadcastNotification.d.ts","sourceRoot":"","sources":["../../../src/api/sendBroadcastNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAGnF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,6BAA6B,EACtC,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,+BAA+B,CAAC,CAE1C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { sendNotificationInternal } from "./internal/_sendNotification.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sends push notifications to all devices with a broadcast send.
|
|
6
|
+
* @param context - The Notification Hubs client.
|
|
7
|
+
* @param notification - The notification to send to the matching devices.
|
|
8
|
+
* @param options - Options for the notification including whether to enable test send.
|
|
9
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
10
|
+
*/
|
|
11
|
+
export function sendBroadcastNotification(context, notification, options = {}) {
|
|
12
|
+
return sendNotificationInternal(context, notification, options);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=sendBroadcastNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendBroadcastNotification.js","sourceRoot":"","sources":["../../../src/api/sendBroadcastNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAsC,EACtC,YAA0B,EAC1B,UAA4C,EAAE;IAE9C,OAAO,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { BroadcastSendNotificationOptions } from \"../models/options.js\";\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { sendNotificationInternal } from \"./internal/_sendNotification.js\";\n\n/**\n * Sends push notifications to all devices with a broadcast send.\n * @param context - The Notification Hubs client.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendBroadcastNotification(\n context: NotificationHubsClientContext,\n notification: Notification,\n options: BroadcastSendNotificationOptions = {},\n): Promise<NotificationHubsMessageResponse> {\n return sendNotificationInternal(context, notification, options);\n}\n"]}
|
|
@@ -9,5 +9,5 @@ import { NotificationHubsMessageResponse } from "../models/notificationDetails.j
|
|
|
9
9
|
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
10
10
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
11
|
*/
|
|
12
|
-
export declare function sendNotification(context: NotificationHubsClientContext, notification: Notification, options
|
|
12
|
+
export declare function sendNotification(context: NotificationHubsClientContext, notification: Notification, options: DirectSendNotificationOptions | SendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
13
13
|
//# sourceMappingURL=sendNotification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAGnF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,6BAA6B,EACtC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,6BAA6B,GAAG,uBAAuB,GAC/D,OAAO,CAAC,+BAA+B,CAAC,CAE1C"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
import { isDirectSendNotificationOptions, isSendNotificationOptions, } from "../utils/optionUtils.js";
|
|
5
|
-
import { createMultipartDirectNotification } from "../utils/notificationUtils.js";
|
|
6
|
-
import { randomUUID } from "@azure/core-util";
|
|
7
|
-
import { tracingClient } from "../utils/tracing.js";
|
|
3
|
+
import { sendNotificationInternal } from "./internal/_sendNotification.js";
|
|
8
4
|
/**
|
|
9
5
|
* Sends push notifications to devices that match the given tags or tag expression.
|
|
10
6
|
* @param context - The Notification Hubs client.
|
|
@@ -12,52 +8,7 @@ import { tracingClient } from "../utils/tracing.js";
|
|
|
12
8
|
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
13
9
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
14
10
|
*/
|
|
15
|
-
export function sendNotification(context, notification, options
|
|
16
|
-
return
|
|
17
|
-
const endpoint = context.requestUrl();
|
|
18
|
-
endpoint.pathname += "/messages/";
|
|
19
|
-
// Check if batch direct send
|
|
20
|
-
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
21
|
-
endpoint.pathname += "$batch";
|
|
22
|
-
}
|
|
23
|
-
// Check for test send
|
|
24
|
-
if (isSendNotificationOptions(options) && options.enableTestSend) {
|
|
25
|
-
endpoint.searchParams.append("test", "true");
|
|
26
|
-
}
|
|
27
|
-
const headers = await context.createHeaders("sendNotification", notification.headers);
|
|
28
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
29
|
-
let body = notification.body;
|
|
30
|
-
let contentType = notification.contentType;
|
|
31
|
-
// Check for direct batch send
|
|
32
|
-
if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {
|
|
33
|
-
endpoint.searchParams.append("direct", "true");
|
|
34
|
-
const boundary = `nh-boundary-${randomUUID()}`;
|
|
35
|
-
contentType = `multipart/mixed; boundary = "${boundary}"`;
|
|
36
|
-
body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);
|
|
37
|
-
}
|
|
38
|
-
else if (isDirectSendNotificationOptions(options)) {
|
|
39
|
-
endpoint.searchParams.append("direct", "true");
|
|
40
|
-
if (notification.platform === "browser") {
|
|
41
|
-
const browserHandle = options.deviceHandle;
|
|
42
|
-
headers.set("ServiceBusNotification-DeviceHandle", browserHandle.endpoint);
|
|
43
|
-
headers.set("Auth", browserHandle.auth);
|
|
44
|
-
headers.set("P256DH", browserHandle.p256dh);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
headers.set("ServiceBusNotification-DeviceHandle", options.deviceHandle);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else if (isSendNotificationOptions(options)) {
|
|
51
|
-
if (options.tagExpression) {
|
|
52
|
-
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
headers.set("Content-Type", contentType);
|
|
56
|
-
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
57
|
-
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
58
|
-
request.body = body;
|
|
59
|
-
const response = await sendRequest(context, request, 201);
|
|
60
|
-
return parseNotificationSendResponse(response);
|
|
61
|
-
});
|
|
11
|
+
export function sendNotification(context, notification, options) {
|
|
12
|
+
return sendNotificationInternal(context, notification, options);
|
|
62
13
|
}
|
|
63
14
|
//# sourceMappingURL=sendNotification.js.map
|