@azure/notification-hubs 2.0.0-alpha.20240912.1 → 2.0.0-alpha.20240916.1
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/tsdoc-metadata.json +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
|
@@ -653,6 +653,16 @@ export declare interface BaiduTemplateRegistrationDescription extends BaiduTempl
|
|
|
653
653
|
export declare interface BaiduTemplateRegistrationDescriptionCommon extends BaiduRegistrationDescriptionCommon, TemplateRegistrationDescription {
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Options for sending notifications for test send.
|
|
658
|
+
*/
|
|
659
|
+
export declare interface BroadcastSendNotificationOptions extends OperationOptions {
|
|
660
|
+
/**
|
|
661
|
+
* Set to true to enable test send.
|
|
662
|
+
*/
|
|
663
|
+
enableTestSend?: boolean;
|
|
664
|
+
}
|
|
665
|
+
|
|
656
666
|
/**
|
|
657
667
|
* Represents a Browser/Web Push based installation.
|
|
658
668
|
*/
|
|
@@ -2307,13 +2317,29 @@ export declare class NotificationHubsClient {
|
|
|
2307
2317
|
* @returns A paged async iterable containing the matching registrations for the notification hub.
|
|
2308
2318
|
*/
|
|
2309
2319
|
listRegistrationsByTag(tag: string, options?: RegistrationQueryLimitOptions): PagedAsyncIterableIterator<RegistrationDescription>;
|
|
2320
|
+
/**
|
|
2321
|
+
* Sends push notifications to devices all devices.
|
|
2322
|
+
* @param notification - The notification to send to all devices.
|
|
2323
|
+
* @param options - Options for the notification including whether to enable test send.
|
|
2324
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2325
|
+
*/
|
|
2326
|
+
sendBroadcastNotification(notification: Notification, options?: BroadcastSendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
2310
2327
|
/**
|
|
2311
2328
|
* Sends push notifications to devices that match the given tags or tag expression.
|
|
2312
2329
|
* @param notification - The notification to send to the matching devices.
|
|
2313
2330
|
* @param options - Options for the notification including tags, device handles and whether to enable test send.
|
|
2314
2331
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2315
2332
|
*/
|
|
2316
|
-
sendNotification(notification: Notification, options
|
|
2333
|
+
sendNotification(notification: Notification, options: DirectSendNotificationOptions | SendNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
2334
|
+
/**
|
|
2335
|
+
* Schedules a push notification to all devices at the specified time.
|
|
2336
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
2337
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
2338
|
+
* @param notification - The notification to send to the matching devices.
|
|
2339
|
+
* @param options - The operation options.
|
|
2340
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2341
|
+
*/
|
|
2342
|
+
scheduleBroadcastNotification(scheduledTime: Date, notification: Notification, options?: OperationOptions): Promise<NotificationHubsMessageResponse>;
|
|
2317
2343
|
/**
|
|
2318
2344
|
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
2319
2345
|
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
@@ -2322,7 +2348,7 @@ export declare class NotificationHubsClient {
|
|
|
2322
2348
|
* @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.
|
|
2323
2349
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
2324
2350
|
*/
|
|
2325
|
-
scheduleNotification(scheduledTime: Date, notification: Notification, options
|
|
2351
|
+
scheduleNotification(scheduledTime: Date, notification: Notification, options: ScheduleNotificationOptions): Promise<NotificationHubsMessageResponse>;
|
|
2326
2352
|
/**
|
|
2327
2353
|
* Cancels the scheduled notification with the given notification ID.
|
|
2328
2354
|
* @param notificationId - The notification ID from the scheduled notification.
|
|
@@ -2556,29 +2582,23 @@ export declare interface RegistrationResult {
|
|
|
2556
2582
|
export declare type RegistrationType = "Adm" | "AdmTemplate" | "Apple" | "AppleTemplate" | "Baidu" | "BaiduTemplate" | "Browser" | "BrowserTemplate" | "Gcm" | "GcmTemplate" | "FcmV1" | "FcmV1Template" | "Mpns" | "MpnsTemplate" | "Xiaomi" | "XiaomiTemplate" | "Windows" | "WindowsTemplate";
|
|
2557
2583
|
|
|
2558
2584
|
/**
|
|
2559
|
-
* Options for sending notifications for both tag based
|
|
2585
|
+
* Options for sending notifications for both tag based scheduled send.
|
|
2560
2586
|
*/
|
|
2561
2587
|
export declare interface ScheduleNotificationOptions extends OperationOptions {
|
|
2562
2588
|
/**
|
|
2563
2589
|
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
2564
|
-
* If not set, this results in a broadcast notification to be scheduled.
|
|
2565
2590
|
*/
|
|
2566
|
-
tagExpression
|
|
2591
|
+
tagExpression: string;
|
|
2567
2592
|
}
|
|
2568
2593
|
|
|
2569
2594
|
/**
|
|
2570
|
-
* Options for sending notifications for
|
|
2595
|
+
* Options for sending notifications for tag based send.
|
|
2571
2596
|
*/
|
|
2572
|
-
export declare interface SendNotificationOptions extends
|
|
2597
|
+
export declare interface SendNotificationOptions extends BroadcastSendNotificationOptions {
|
|
2573
2598
|
/**
|
|
2574
2599
|
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
2575
|
-
* If not set, this results in a broadcast notification to be sent.
|
|
2576
2600
|
*/
|
|
2577
|
-
tagExpression
|
|
2578
|
-
/**
|
|
2579
|
-
* Set to true to enable test send.
|
|
2580
|
-
*/
|
|
2581
|
-
enableTestSend?: boolean;
|
|
2601
|
+
tagExpression: string;
|
|
2582
2602
|
}
|
|
2583
2603
|
|
|
2584
2604
|
/**
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAsC,EACtC,YAA0B,EAC1B,OAAgE;IAEhE,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 { DirectSendNotificationOptions, SendNotificationOptions } 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 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 sendNotification(\n context: NotificationHubsClientContext,\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions,\n): Promise<NotificationHubsMessageResponse> {\n return sendNotificationInternal(context, notification, options);\n}\n"]}
|
|
@@ -15,29 +15,32 @@ export interface PolledOperationOptions extends OperationOptions {
|
|
|
15
15
|
updateIntervalInMs?: number;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Options for sending notifications for both tag based
|
|
18
|
+
* Options for sending notifications for both tag based scheduled send.
|
|
19
19
|
*/
|
|
20
20
|
export interface ScheduleNotificationOptions extends OperationOptions {
|
|
21
21
|
/**
|
|
22
22
|
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
23
|
-
* If not set, this results in a broadcast notification to be scheduled.
|
|
24
23
|
*/
|
|
25
|
-
tagExpression
|
|
24
|
+
tagExpression: string;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
|
-
* Options for sending notifications for
|
|
27
|
+
* Options for sending notifications for test send.
|
|
29
28
|
*/
|
|
30
|
-
export interface
|
|
31
|
-
/**
|
|
32
|
-
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
33
|
-
* If not set, this results in a broadcast notification to be sent.
|
|
34
|
-
*/
|
|
35
|
-
tagExpression?: string;
|
|
29
|
+
export interface BroadcastSendNotificationOptions extends OperationOptions {
|
|
36
30
|
/**
|
|
37
31
|
* Set to true to enable test send.
|
|
38
32
|
*/
|
|
39
33
|
enableTestSend?: boolean;
|
|
40
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Options for sending notifications for tag based send.
|
|
37
|
+
*/
|
|
38
|
+
export interface SendNotificationOptions extends BroadcastSendNotificationOptions {
|
|
39
|
+
/**
|
|
40
|
+
* A tag expression used to target devices. Use the `createTagExpression` function to create a tag expression from an array of tags.
|
|
41
|
+
*/
|
|
42
|
+
tagExpression: string;
|
|
43
|
+
}
|
|
41
44
|
/**
|
|
42
45
|
* Options for sending notifications to individual devices.
|
|
43
46
|
*/
|