@azure/notification-hubs 1.0.0-beta.3 → 1.0.0-beta.5
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 +15 -20
- package/dist/index.cjs +128 -136
- package/dist/index.cjs.map +1 -1
- package/dist-esm/src/auth/hmacSha256.browser.js +1 -0
- package/dist-esm/src/auth/hmacSha256.browser.js.map +1 -1
- package/dist-esm/src/auth/sasTokenProvider.js +2 -23
- package/dist-esm/src/auth/sasTokenProvider.js.map +1 -1
- package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -1
- package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -1
- package/dist-esm/src/client/deleteInstallation.js.map +1 -1
- package/dist-esm/src/client/deleteRegistration.js.map +1 -1
- package/dist-esm/src/client/internal/_client.js +23 -7
- package/dist-esm/src/client/internal/_client.js.map +1 -1
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -1
- package/dist-esm/src/client/internal/_sendNotificationPayload.js +1 -1
- package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -1
- package/dist-esm/src/client/scheduleBroadcastNotification.js.map +1 -1
- package/dist-esm/src/client/scheduleNotification.js.map +1 -1
- package/dist-esm/src/client/sendBroadcastNotification.js.map +1 -1
- package/dist-esm/src/client/sendDirectNotification.js +1 -2
- package/dist-esm/src/client/sendDirectNotification.js.map +1 -1
- package/dist-esm/src/client/sendNotification.js.map +1 -1
- package/dist-esm/src/client/updateInstallation.js.map +1 -1
- package/dist-esm/src/models/installation.js +1 -1
- package/dist-esm/src/models/installation.js.map +1 -1
- package/dist-esm/src/models/notification.js +1 -1
- package/dist-esm/src/models/notification.js.map +1 -1
- package/dist-esm/src/models/notificationBuilder.js +6 -6
- package/dist-esm/src/models/notificationBuilder.js.map +1 -1
- package/dist-esm/src/models/notificationDetails.js.map +1 -1
- package/dist-esm/src/models/registration.js +3 -39
- package/dist-esm/src/models/registration.js.map +1 -1
- package/dist-esm/src/models/response.js.map +1 -1
- package/dist-esm/src/notificationHubsClient.js +12 -2
- package/dist-esm/src/notificationHubsClient.js.map +1 -1
- package/dist-esm/src/serializers/notificationHubJobSerializer.js +5 -1
- package/dist-esm/src/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist-esm/src/serializers/notificationOutcomeSerializer.js +31 -0
- package/dist-esm/src/serializers/notificationOutcomeSerializer.js.map +1 -0
- package/dist-esm/src/serializers/registrationSerializer.js +5 -29
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/package.json +4 -4
- package/types/3.1/notification-hubs.d.ts +68 -77
- package/types/latest/notification-hubs.d.ts +69 -83
- package/types/latest/tsdoc-metadata.json +1 -1
- package/types/src/auth/hmacSha256.browser.d.ts +1 -0
- package/types/src/auth/hmacSha256.browser.d.ts.map +1 -1
- package/types/src/auth/sasTokenProvider.d.ts +28 -8
- package/types/src/auth/sasTokenProvider.d.ts.map +1 -1
- package/types/src/client/cancelScheduledNotification.d.ts +1 -1
- package/types/src/client/cancelScheduledNotification.d.ts.map +1 -1
- package/types/src/client/createOrUpdateInstallation.d.ts +1 -1
- package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -1
- package/types/src/client/deleteInstallation.d.ts +1 -1
- package/types/src/client/deleteInstallation.d.ts.map +1 -1
- package/types/src/client/deleteRegistration.d.ts +1 -1
- package/types/src/client/deleteRegistration.d.ts.map +1 -1
- package/types/src/client/index.d.ts +0 -1
- package/types/src/client/index.d.ts.map +1 -1
- package/types/src/client/internal/_client.d.ts +8 -8
- package/types/src/client/internal/_client.d.ts.map +1 -1
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts +1 -1
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -1
- package/types/src/client/internal/_sendNotificationPayload.d.ts +1 -1
- package/types/src/client/internal/_sendNotificationPayload.d.ts.map +1 -1
- package/types/src/client/scheduleBroadcastNotification.d.ts +1 -1
- package/types/src/client/scheduleBroadcastNotification.d.ts.map +1 -1
- package/types/src/client/scheduleNotification.d.ts +1 -1
- package/types/src/client/scheduleNotification.d.ts.map +1 -1
- package/types/src/client/sendBroadcastNotification.d.ts +1 -1
- package/types/src/client/sendBroadcastNotification.d.ts.map +1 -1
- package/types/src/client/sendDirectNotification.d.ts +4 -5
- package/types/src/client/sendDirectNotification.d.ts.map +1 -1
- package/types/src/client/sendNotification.d.ts +1 -1
- package/types/src/client/sendNotification.d.ts.map +1 -1
- package/types/src/client/updateInstallation.d.ts +1 -1
- package/types/src/client/updateInstallation.d.ts.map +1 -1
- package/types/src/models/installation.d.ts +3 -3
- package/types/src/models/installation.d.ts.map +1 -1
- package/types/src/models/notification.d.ts +3 -3
- package/types/src/models/notification.d.ts.map +1 -1
- package/types/src/models/notificationBuilder.d.ts +4 -4
- package/types/src/models/notificationBuilder.d.ts.map +1 -1
- package/types/src/models/notificationDetails.d.ts +63 -0
- package/types/src/models/notificationDetails.d.ts.map +1 -1
- package/types/src/models/registration.d.ts +6 -59
- package/types/src/models/registration.d.ts.map +1 -1
- package/types/src/models/response.d.ts +0 -26
- package/types/src/models/response.d.ts.map +1 -1
- package/types/src/notificationHubsClient.d.ts +12 -6
- package/types/src/notificationHubsClient.d.ts.map +1 -1
- package/types/src/serializers/notificationHubJobSerializer.d.ts.map +1 -1
- package/types/src/serializers/notificationOutcomeSerializer.d.ts +3 -0
- package/types/src/serializers/notificationOutcomeSerializer.d.ts.map +1 -0
- package/types/src/serializers/registrationSerializer.d.ts +1 -21
- package/types/src/serializers/registrationSerializer.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAML,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,gCAAgC,EAChC,8BAA8B,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AE,aAAa,CAAC,UAAU,EACrC,WAAW,EAAE,aAAa,CAAC,UAAU,EACrC,cAAc,EAAE,aAAa,CAAC,aAAa,EAC3C,GAAG,EAAE,aAAa,CAAC,GAAG,IACnB,oBAAoB,CACxB,CAAC;IAEF,OAAO,uBAAuB,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AA8BD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,8BAA8B,CAAC;QACpC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmNotification,\n AppleNotification,\n BaiduNotification,\n FirebaseLegacyNotification,\n WindowsNotification,\n createAdmNotification,\n createAppleNotification,\n createBaiduNotification,\n createFirebaseLegacyNotification,\n createWindowsBadgeNotification,\n} from \"./notification.js\";\nimport { isDefined, isString } from \"../utils/utils.js\";\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n launchImage?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n titleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n titleLocArgs?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n subtitleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n subtitleLocArgs?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n locKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n locArgs?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n threadId?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n targetContentId?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n interruptionLevel?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n relevanceScore?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n filterCriteria?: string;\n}\n\nfunction createAppleNativeAlert(\n nativeAlert?: string | AppleAlert\n): Record<string, any> | string | undefined {\n if (!isDefined(nativeAlert)) {\n return undefined;\n }\n\n if (isString(nativeAlert)) {\n return nativeAlert;\n }\n\n const alert: Record<string, any> = {\n title: nativeAlert.title,\n subtitle: nativeAlert.subtitle,\n body: nativeAlert.body,\n \"launch-image\": nativeAlert.launchImage,\n \"title-loc-key\": nativeAlert.titleLocKey,\n \"title-loc-args\": nativeAlert.titleLocArgs,\n \"subtitle-loc-key\": nativeAlert.subtitleLocKey,\n \"subtitle-loc-args\": nativeAlert.subtitleLocArgs,\n \"loc-key\": nativeAlert.locKey,\n \"loc-args\": nativeAlert.locArgs,\n };\n\n return alert;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function buildAppleNativeMessage(\n nativeMessage: AppleNativeMessage,\n additionalProperties?: Record<string, any>\n): AppleNotification {\n const headers: Record<string, string> = {};\n\n const message: Record<string, any> = {\n aps: {\n alert: createAppleNativeAlert(nativeMessage.alert),\n sound: nativeMessage.sound,\n badge: nativeMessage.badge,\n \"thread-id\": nativeMessage.threadId,\n category: nativeMessage.category,\n \"content-available\": nativeMessage.contentAvailable,\n \"mutable-content\": nativeMessage.mutableContent,\n \"target-content-id\": nativeMessage.targetContentId,\n \"interruption-level\": nativeMessage.interruptionLevel,\n \"relevance-score\": nativeMessage.relevanceScore,\n \"filter-criteria\": nativeMessage.filterCriteria,\n },\n ...additionalProperties,\n };\n\n const apnsPriority = nativeMessage?.contentAvailable === 1 ? \"5\" : \"10\";\n headers[\"apns-priority\"] = apnsPriority;\n\n return createAppleNotification({\n body: JSON.stringify(message),\n headers: headers,\n });\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registrationIds?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapseKey?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n timeToLive?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restrictedPackageName?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dryRun?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n clickAction?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n androidChannelId?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n}\n\nfunction buildFirebaseLegacyNativePayload(\n nativeNotification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n const androidMessage = nativeNotification as FirebaseLegacyAndroidNativePayload;\n const appleMessage = nativeNotification as FirebaseLegacyAppleNativePayload;\n\n const notification: Record<string, any> = {\n title: nativeNotification.title,\n body: nativeNotification.body,\n click_action: nativeNotification.clickAction,\n\n // Apple/Android fields\n sound: appleMessage.sound,\n badge: appleMessage.badge,\n subtitle: appleMessage.subtitle,\n body_loc_key: appleMessage.bodyLocKey,\n body_loc_args: appleMessage.bodyLocArgs,\n title_loc_key: appleMessage.bodyLocKey,\n title_loc_args: appleMessage.bodyLocArgs,\n\n // Android/Web fields\n android_channel_id: androidMessage.androidChannelId,\n icon: androidMessage.icon,\n tag: androidMessage.tag,\n color: androidMessage.color,\n };\n\n return notification;\n}\n\n/**\n * Creates a FirebaseLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The FirebaseLegacyNotification to send to Notification Hubs.\n */\nexport function buildFirebaseLegacyNativeMessage(\n nativeMessage: FirebaseLegacyNativeMessage\n): FirebaseLegacyNotification {\n const jsonMessage: Record<string, any> = {\n to: nativeMessage.to,\n registration_ids: nativeMessage.registrationIds,\n condition: nativeMessage.condition,\n collapse_key: nativeMessage.collapseKey,\n priority: nativeMessage.priority,\n content_available: nativeMessage.contentAvailable,\n mutable_content: nativeMessage.mutableContent,\n time_to_live: nativeMessage.timeToLive,\n restricted_package_name: nativeMessage.restrictedPackageName,\n dry_run: nativeMessage.dryRun,\n data: nativeMessage.data,\n notification: buildFirebaseLegacyNativePayload(nativeMessage.notification),\n };\n\n return createFirebaseLegacyNotification({\n body: JSON.stringify(jsonMessage),\n });\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n\n /**\n * The notification's channel id.\n */\n channelId?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n eventTime?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n localOnly?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notificationPriority?: number; // TODO: Enum?\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n defaultSound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number; // TODO: Enum?\n\n /**\n * Sets the number of items this notification represents.\n */\n notificationCount?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\nfunction buildAdmNativeNotification(\n nativeNotification?: AdmNativeNotification\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n return {\n title: nativeNotification.title,\n body: nativeNotification.body,\n icon: nativeNotification.icon,\n color: nativeNotification.color,\n sound: nativeNotification.sound,\n tag: nativeNotification.tag,\n click_action: nativeNotification.clickAction,\n body_loc_key: nativeNotification.bodyLocKey,\n body_loc_args: nativeNotification.bodyLocArgs,\n title_loc_key: nativeNotification.titleLocKey,\n title_loc_args: nativeNotification.titleLocArgs,\n channel_id: nativeNotification.channelId,\n ticker: nativeNotification.ticker,\n sticky: nativeNotification.sticky,\n event_time: nativeNotification.eventTime,\n local_only: nativeNotification.localOnly,\n notification_priority: nativeNotification.notificationPriority,\n default_sound: nativeNotification.defaultSound,\n visibility: nativeNotification.visibility,\n notification_count: nativeNotification.notificationCount,\n image: nativeNotification.image,\n };\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function buildAdmNativeMessage(nativeMessage: AdmNativeMessage): AdmNotification {\n const jsonObj: Record<string, any> = {\n notification: buildAdmNativeNotification(nativeMessage.notification),\n data: nativeMessage.data || {},\n ...nativeMessage,\n };\n\n return createAdmNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notificationBuilderId?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notificationBasicStyle?: number;\n\n /**\n * Baidu Android open type.\n */\n openType?: number;\n\n /**\n * Baidu Android net support option.\n */\n netSupport?: number;\n\n /**\n * Baidu Android user confirm.\n */\n userConfirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkgContent?: string;\n\n /**\n * Baidu Android package version.\n */\n pkgVersion?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n customContent?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @param additionalProperties - Additional properties for Apple Baidu messages.\n * @returns The BaiduNotification to send to Notification Hubs.\n */\nexport function buildBaiduNativeMessage(\n nativeMessage: BaiduNativeMessage,\n additionalProperties?: Record<string, any>\n): BaiduNotification {\n const jsonObj: Record<string, any> = {\n title: nativeMessage.title,\n description: nativeMessage.description,\n notification_builder_id: nativeMessage.notificationBuilderId,\n notification_basic_style: nativeMessage.notificationBasicStyle,\n open_type: nativeMessage.openType,\n net_support: nativeMessage.netSupport,\n user_confirm: nativeMessage.userConfirm,\n url: nativeMessage.url,\n pkg_content: nativeMessage.pkgContent,\n pkg_version: nativeMessage.pkgVersion,\n custom_content: nativeMessage.customContent,\n aps: nativeMessage.aps,\n ...additionalProperties,\n };\n\n return createBaiduNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns A WindowsNotification created with the badge information.\n */\nexport function buildWindowsBadgeNativeMessage(\n nativeMessage: WindowsBadgeNativeMessage\n): WindowsNotification {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return createWindowsBadgeNotification({\n body: stringifyXML(badge, { rootName: \"badge\" }),\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notificationBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAML,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAgK/C,SA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C;IAEF,OAAO,uBAAuB,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AA8BD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,8BAA8B,CAAC;QACpC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AdmNotification,\n AppleNotification,\n BaiduNotification,\n FcmLegacyNotification,\n WindowsNotification,\n createAdmNotification,\n createAppleNotification,\n createBaiduNotification,\n createFcmLegacyNotification,\n createWindowsBadgeNotification,\n} from \"./notification.js\";\nimport { isDefined, isString } from \"../utils/utils.js\";\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n launchImage?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n titleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n titleLocArgs?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n subtitleLocKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n subtitleLocArgs?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n locKey?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n locArgs?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n threadId?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n targetContentId?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n interruptionLevel?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n relevanceScore?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n filterCriteria?: string;\n}\n\nfunction createAppleNativeAlert(\n nativeAlert?: string | AppleAlert\n): Record<string, any> | string | undefined {\n if (!isDefined(nativeAlert)) {\n return undefined;\n }\n\n if (isString(nativeAlert)) {\n return nativeAlert;\n }\n\n const alert: Record<string, any> = {\n title: nativeAlert.title,\n subtitle: nativeAlert.subtitle,\n body: nativeAlert.body,\n \"launch-image\": nativeAlert.launchImage,\n \"title-loc-key\": nativeAlert.titleLocKey,\n \"title-loc-args\": nativeAlert.titleLocArgs,\n \"subtitle-loc-key\": nativeAlert.subtitleLocKey,\n \"subtitle-loc-args\": nativeAlert.subtitleLocArgs,\n \"loc-key\": nativeAlert.locKey,\n \"loc-args\": nativeAlert.locArgs,\n };\n\n return alert;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function buildAppleNativeMessage(\n nativeMessage: AppleNativeMessage,\n additionalProperties?: Record<string, any>\n): AppleNotification {\n const headers: Record<string, string> = {};\n\n const message: Record<string, any> = {\n aps: {\n alert: createAppleNativeAlert(nativeMessage.alert),\n sound: nativeMessage.sound,\n badge: nativeMessage.badge,\n \"thread-id\": nativeMessage.threadId,\n category: nativeMessage.category,\n \"content-available\": nativeMessage.contentAvailable,\n \"mutable-content\": nativeMessage.mutableContent,\n \"target-content-id\": nativeMessage.targetContentId,\n \"interruption-level\": nativeMessage.interruptionLevel,\n \"relevance-score\": nativeMessage.relevanceScore,\n \"filter-criteria\": nativeMessage.filterCriteria,\n },\n ...additionalProperties,\n };\n\n const apnsPriority = nativeMessage?.contentAvailable === 1 ? \"5\" : \"10\";\n headers[\"apns-priority\"] = apnsPriority;\n\n return createAppleNotification({\n body: JSON.stringify(message),\n headers: headers,\n });\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registrationIds?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapseKey?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n contentAvailable?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutableContent?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n timeToLive?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restrictedPackageName?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dryRun?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n clickAction?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n androidChannelId?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n}\n\nfunction buildFcmLegacyNativePayload(\n nativeNotification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n const androidMessage = nativeNotification as FirebaseLegacyAndroidNativePayload;\n const appleMessage = nativeNotification as FirebaseLegacyAppleNativePayload;\n\n const notification: Record<string, any> = {\n title: nativeNotification.title,\n body: nativeNotification.body,\n click_action: nativeNotification.clickAction,\n\n // Apple/Android fields\n sound: appleMessage.sound,\n badge: appleMessage.badge,\n subtitle: appleMessage.subtitle,\n body_loc_key: appleMessage.bodyLocKey,\n body_loc_args: appleMessage.bodyLocArgs,\n title_loc_key: appleMessage.bodyLocKey,\n title_loc_args: appleMessage.bodyLocArgs,\n\n // Android/Web fields\n android_channel_id: androidMessage.androidChannelId,\n icon: androidMessage.icon,\n tag: androidMessage.tag,\n color: androidMessage.color,\n };\n\n return notification;\n}\n\n/**\n * Creates a FcmLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The FcmLegacyNotification to send to Notification Hubs.\n */\nexport function buildFirebaseLegacyNativeMessage(\n nativeMessage: FirebaseLegacyNativeMessage\n): FcmLegacyNotification {\n const jsonMessage: Record<string, any> = {\n to: nativeMessage.to,\n registration_ids: nativeMessage.registrationIds,\n condition: nativeMessage.condition,\n collapse_key: nativeMessage.collapseKey,\n priority: nativeMessage.priority,\n content_available: nativeMessage.contentAvailable,\n mutable_content: nativeMessage.mutableContent,\n time_to_live: nativeMessage.timeToLive,\n restricted_package_name: nativeMessage.restrictedPackageName,\n dry_run: nativeMessage.dryRun,\n data: nativeMessage.data,\n notification: buildFcmLegacyNativePayload(nativeMessage.notification),\n };\n\n return createFcmLegacyNotification({\n body: JSON.stringify(jsonMessage),\n });\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n clickAction?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n bodyLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n bodyLocArgs?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n titleLocKey?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n titleLocArgs?: string[];\n\n /**\n * The notification's channel id.\n */\n channelId?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n eventTime?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n localOnly?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notificationPriority?: number; // TODO: Enum?\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n defaultSound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number; // TODO: Enum?\n\n /**\n * Sets the number of items this notification represents.\n */\n notificationCount?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\nfunction buildAdmNativeNotification(\n nativeNotification?: AdmNativeNotification\n): Record<string, any> | undefined {\n if (!isDefined(nativeNotification)) {\n return undefined;\n }\n\n return {\n title: nativeNotification.title,\n body: nativeNotification.body,\n icon: nativeNotification.icon,\n color: nativeNotification.color,\n sound: nativeNotification.sound,\n tag: nativeNotification.tag,\n click_action: nativeNotification.clickAction,\n body_loc_key: nativeNotification.bodyLocKey,\n body_loc_args: nativeNotification.bodyLocArgs,\n title_loc_key: nativeNotification.titleLocKey,\n title_loc_args: nativeNotification.titleLocArgs,\n channel_id: nativeNotification.channelId,\n ticker: nativeNotification.ticker,\n sticky: nativeNotification.sticky,\n event_time: nativeNotification.eventTime,\n local_only: nativeNotification.localOnly,\n notification_priority: nativeNotification.notificationPriority,\n default_sound: nativeNotification.defaultSound,\n visibility: nativeNotification.visibility,\n notification_count: nativeNotification.notificationCount,\n image: nativeNotification.image,\n };\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function buildAdmNativeMessage(nativeMessage: AdmNativeMessage): AdmNotification {\n const jsonObj: Record<string, any> = {\n notification: buildAdmNativeNotification(nativeMessage.notification),\n data: nativeMessage.data || {},\n ...nativeMessage,\n };\n\n return createAdmNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notificationBuilderId?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notificationBasicStyle?: number;\n\n /**\n * Baidu Android open type.\n */\n openType?: number;\n\n /**\n * Baidu Android net support option.\n */\n netSupport?: number;\n\n /**\n * Baidu Android user confirm.\n */\n userConfirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkgContent?: string;\n\n /**\n * Baidu Android package version.\n */\n pkgVersion?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n customContent?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @param additionalProperties - Additional properties for Apple Baidu messages.\n * @returns The BaiduNotification to send to Notification Hubs.\n */\nexport function buildBaiduNativeMessage(\n nativeMessage: BaiduNativeMessage,\n additionalProperties?: Record<string, any>\n): BaiduNotification {\n const jsonObj: Record<string, any> = {\n title: nativeMessage.title,\n description: nativeMessage.description,\n notification_builder_id: nativeMessage.notificationBuilderId,\n notification_basic_style: nativeMessage.notificationBasicStyle,\n open_type: nativeMessage.openType,\n net_support: nativeMessage.netSupport,\n user_confirm: nativeMessage.userConfirm,\n url: nativeMessage.url,\n pkg_content: nativeMessage.pkgContent,\n pkg_version: nativeMessage.pkgVersion,\n custom_content: nativeMessage.customContent,\n aps: nativeMessage.aps,\n ...additionalProperties,\n };\n\n return createBaiduNotification({\n body: JSON.stringify(jsonObj),\n });\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns A WindowsNotification created with the badge information.\n */\nexport function buildWindowsBadgeNativeMessage(\n nativeMessage: WindowsBadgeNativeMessage\n): WindowsNotification {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return createWindowsBadgeNotification({\n body: stringifyXML(badge, { rootName: \"badge\" }),\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationDetails.js","sourceRoot":"","sources":["../../../src/models/notificationDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the notification outcome states.\n */\nexport type NotificationOutcomeState =\n | \"Enqueued\"\n | \"DetailedStateAvailable\"\n | \"Processing\"\n | \"Completed\"\n | \"Abandoned\"\n | \"Unknown\"\n | \"NoTargetFound\"\n | \"Cancelled\";\n\n/**\n * The per platform count per state.\n */\nexport interface NotificationOutcomeCollectionItem {\n /**\n * The state of the notification.\n */\n state: string;\n\n /**\n * The count of notifications per state.\n */\n count: number;\n}\n\n/**\n * Represents Notification details.\n */\nexport interface NotificationDetails {\n /**\n * The unique notification identifier.\n */\n notificationId?: string;\n\n /**\n * The notification location.\n */\n location?: string;\n\n /**\n * The notification state.\n */\n state?: NotificationOutcomeState;\n\n /**\n * The enqueue time of the notification.\n */\n enqueueTime?: Date;\n\n /**\n * The notification send start time.\n */\n startTime?: Date;\n\n /**\n * The notification send end time.\n */\n endTime?: Date;\n\n /**\n * The notification body.\n */\n notificationBody?: string;\n\n /**\n * The notification tags.\n */\n tags?: string;\n\n /**\n * The notification platforms targeted.\n */\n targetPlatforms?: string;\n\n /**\n * The URL for the platform notification services errors.\n */\n pnsErrorDetailsUrl?: string;\n\n /**\n * APNs outcomes counts per state.\n */\n apnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * WNS outcomes counts per state.\n */\n wnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * FCM outcome counts per state.\n */\n fcmOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * ADM outcome counts per state.\n */\n admOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Baidu outcome counts per state.\n */\n baiduOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Web Push outcome counts per state.\n */\n browserOutcomeCounts?: NotificationOutcomeCollectionItem[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notificationDetails.js","sourceRoot":"","sources":["../../../src/models/notificationDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the notification outcome states.\n */\nexport type NotificationOutcomeState =\n | \"Enqueued\"\n | \"DetailedStateAvailable\"\n | \"Processing\"\n | \"Completed\"\n | \"Abandoned\"\n | \"Unknown\"\n | \"NoTargetFound\"\n | \"Cancelled\";\n\n/**\n * The per platform count per state.\n */\nexport interface NotificationOutcomeCollectionItem {\n /**\n * The state of the notification.\n */\n state: string;\n\n /**\n * The count of notifications per state.\n */\n count: number;\n}\n\n/**\n * Represents Notification details.\n */\nexport interface NotificationDetails {\n /**\n * The unique notification identifier.\n */\n notificationId?: string;\n\n /**\n * The notification location.\n */\n location?: string;\n\n /**\n * The notification state.\n */\n state?: NotificationOutcomeState;\n\n /**\n * The enqueue time of the notification.\n */\n enqueueTime?: Date;\n\n /**\n * The notification send start time.\n */\n startTime?: Date;\n\n /**\n * The notification send end time.\n */\n endTime?: Date;\n\n /**\n * The notification body.\n */\n notificationBody?: string;\n\n /**\n * The notification tags.\n */\n tags?: string;\n\n /**\n * The notification platforms targeted.\n */\n targetPlatforms?: string;\n\n /**\n * The URL for the platform notification services errors.\n */\n pnsErrorDetailsUrl?: string;\n\n /**\n * APNs outcomes counts per state.\n */\n apnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * WNS outcomes counts per state.\n */\n wnsOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * FCM outcome counts per state.\n */\n fcmOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * ADM outcome counts per state.\n */\n admOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Baidu outcome counts per state.\n */\n baiduOutcomeCounts?: NotificationOutcomeCollectionItem[];\n\n /**\n * Web Push outcome counts per state.\n */\n browserOutcomeCounts?: NotificationOutcomeCollectionItem[];\n}\n\n/**\n * Describes a response from the Notification Hubs which includes a tracking ID, correlation ID and location.\n */\nexport interface NotificationHubsResponse {\n /**\n * The Tracking ID of the operation.\n */\n trackingId?: string;\n\n /**\n * The correlation ID of the operation.\n */\n correlationId?: string;\n\n /**\n * The location of the operation.\n */\n location?: string;\n}\n\n/**\n * Represents the result of the registration.\n */\nexport interface RegistrationResult {\n /**\n * The application platform.\n */\n applicationPlatform: string;\n\n /**\n * The PNS handle.\n */\n pnsHandle: string;\n\n /**\n * The registration ID.\n */\n registrationId: string;\n\n /**\n * The outcome of the registration.\n */\n outcome: string;\n}\n\n/**\n * Describes a response from the Notification Hubs service for send operations.\n */\nexport interface NotificationHubsMessageResponse extends NotificationHubsResponse {\n /**\n * The notification ID from the operation. Note this is only available in Standard SKU and above.\n */\n notificationId?: string;\n\n /**\n * The number of devices that successfully received the notification.\n */\n success: number;\n\n /**\n * The number of devices that failed to receive a notification.\n */\n failure: number;\n\n /**\n * The list of notification outcome results for each device registered with the hub, to which this notification was sent.\n */\n results: RegistrationResult[];\n\n /**\n * The state of this notification outcome.\n */\n state: NotificationOutcomeState;\n}\n"]}
|
|
@@ -65,57 +65,21 @@ export function createBrowserTemplateRegistrationDescription(description) {
|
|
|
65
65
|
return Object.assign(Object.assign({}, description), { type: "BrowserTemplate" });
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* Creates a GCM registration description.
|
|
68
|
+
* Creates a Firebase Legacy registration description.
|
|
70
69
|
* @param description - A partial GCM registration description.
|
|
71
70
|
* @returns A created GCM registration description.
|
|
72
71
|
*/
|
|
73
|
-
export function
|
|
72
|
+
export function createFcmLegacyRegistrationDescription(description) {
|
|
74
73
|
return Object.assign(Object.assign({}, description), { type: "Gcm" });
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
|
-
* @deprecated Use createFcmTemplateRegistrationDescription instead.
|
|
78
76
|
* Creates a GCM template registration description.
|
|
79
77
|
* @param description - A partial GCM template registration description.
|
|
80
78
|
* @returns A created GCM template registration description.
|
|
81
79
|
*/
|
|
82
|
-
export function
|
|
80
|
+
export function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
83
81
|
return Object.assign(Object.assign({}, description), { type: "GcmTemplate" });
|
|
84
82
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Creates an FCM registration description.
|
|
87
|
-
* @param description - A partial FCM registration description.
|
|
88
|
-
* @returns A created FCM registration description.
|
|
89
|
-
*/
|
|
90
|
-
export function createFcmRegistrationDescription(description) {
|
|
91
|
-
return Object.assign(Object.assign({}, description), { type: "Fcm" });
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Creates an FCM template registration description.
|
|
95
|
-
* @param description - A partial FCM template registration description.
|
|
96
|
-
* @returns A created FCM template registration description.
|
|
97
|
-
*/
|
|
98
|
-
export function createFcmTemplateRegistrationDescription(description) {
|
|
99
|
-
return Object.assign(Object.assign({}, description), { type: "FcmTemplate" });
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @deprecated Windows Phone is no longer supported.
|
|
103
|
-
* Creates an MPNS registration description.
|
|
104
|
-
* @param description - A partial MPNS registration description.
|
|
105
|
-
* @returns A created MPNS registration description.
|
|
106
|
-
*/
|
|
107
|
-
export function createMpnsRegistrationDescription(description) {
|
|
108
|
-
return Object.assign(Object.assign({}, description), { type: "Mpns" });
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated Windows Phone is no longer supported.
|
|
112
|
-
* Creates an MPNS template registration description.
|
|
113
|
-
* @param description - A partial MPNS template registration description.
|
|
114
|
-
* @returns A created MPNS template registration description.
|
|
115
|
-
*/
|
|
116
|
-
export function createMpnsTemplateRegistrationDescription(description) {
|
|
117
|
-
return Object.assign(Object.assign({}, description), { type: "MpnsTemplate" });
|
|
118
|
-
}
|
|
119
83
|
/**
|
|
120
84
|
* Creates a Windows registration description.
|
|
121
85
|
* @param description - A partial Windows registration description.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwFlC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAAuD;IAEvD,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AA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,IAAI,EAAE,cAAc,IACpB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,uCACK,WAAW,KACd,IAAI,EAAE,SAAS,IACf;AACJ,CAAC;AAmBD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAiE;IAEjE,uCACK,WAAW,KACd,IAAI,EAAE,iBAAiB,IACvB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the types of registration descriptions.\n */\nexport type RegistrationType =\n | \"Adm\"\n | \"AdmTemplate\"\n | \"Apple\"\n | \"AppleTemplate\"\n | \"Baidu\"\n | \"BaiduTemplate\"\n | \"Browser\"\n | \"BrowserTemplate\"\n | \"Gcm\"\n | \"GcmTemplate\"\n | \"Fcm\"\n | \"FcmTemplate\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Windows\"\n | \"WindowsTemplate\";\n\n/**\n * Represents a registration description.\n */\nexport interface RegistrationDescriptionCommon {\n /**\n * The registration ID.\n */\n registrationId?: string;\n\n /**\n * The expiration time of the registration.\n */\n expirationTime?: Date;\n\n /**\n * The ETag associated with this description.\n */\n etag?: string;\n\n /**\n * The tags associated with the registration.\n */\n tags?: string[];\n\n /**\n * A dictionary of push variables associated with property bag.\n */\n pushVariables?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: RegistrationType;\n}\n\n/**\n * Represents the description of a template registration.\n */\nexport interface TemplateRegistrationDescription {\n /**\n * The body template.\n */\n bodyTemplate: string;\n\n /**\n * The name of the template.\n */\n templateName?: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Adm\";\n}\n\n/**\n * Creates an ADM registration description.\n * @param description - A partial ADM registration description.\n * @returns A created ADM registration description.\n */\nexport function createAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n): AdmRegistrationDescription {\n return {\n ...description,\n type: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends Omit<AdmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"AdmTemplate\";\n}\n\n/**\n * Creates an ADM template registration description.\n * @param description - A partial ADM template registration description.\n * @returns A created ADM template registration description.\n */\nexport function createAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n\n /**\n * The type of the registration.\n */\n type: \"Apple\";\n}\n\n/**\n * Creates an Apple registration description.\n * @param description - A partial Apple registration description.\n * @returns A created Apple registration description.\n */\nexport function createAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n): AppleRegistrationDescription {\n return {\n ...description,\n type: \"Apple\",\n };\n}\n\n/**\n * The priority of the Apple push notification.\n */\nexport type ApplePriority = \"10\" | \"5\";\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends Omit<AppleRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: ApplePriority;\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"AppleTemplate\";\n}\n\n/**\n * Creates an Apple template registration description.\n * @param description - A partial Apple template registration description.\n * @returns A created Apple template registration description.\n */\nexport function createAppleTemplateRegistrationDescription(\n description: Omit<AppleTemplateRegistrationDescription, \"type\">\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AppleTemplate\",\n };\n}\n\n/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Baidu user identifier.\n */\n baiduUserId: string;\n\n /**\n * The Baidu channel identifier.\n */\n baiduChannelId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Baidu\";\n}\n\n/**\n * Creates a Baidu registration description.\n * @param description - A partial Baidu registration description.\n * @returns A created Baidu registration description.\n */\nexport function createBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n): BaiduRegistrationDescription {\n return {\n ...description,\n type: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends Omit<BaiduRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BaiduTemplate\";\n}\n\n/**\n * Creates a Baidu template registration description.\n * @param description - A partial Baidu template registration description.\n * @returns A created Baidu template registration description.\n */\nexport function createBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Browser push endpoint.\n */\n endpoint: string;\n\n /**\n * The Browser push P256DH.\n */\n p256dh: string;\n\n /**\n * The Browser push auth secret.\n */\n auth: string;\n\n /**\n * The type of the registration.\n */\n type: \"Browser\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push registration description.\n * @returns A created Web Push registration description.\n */\nexport function createBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n): BrowserRegistrationDescription {\n return {\n ...description,\n type: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends Omit<BrowserRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BrowserTemplate\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push template registration description.\n * @returns A created Web Push template registration description.\n */\nexport function createBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n * @deprecated Use FcmRegistrationDescription instead.\n */\nexport interface GcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Gcm\";\n}\n\n/**\n * @deprecated Use createFcmRegistrationDescription instead.\n * Creates a GCM registration description.\n * @param description - A partial GCM registration description.\n * @returns A created GCM registration description.\n */\nexport function createGcmRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n): GcmRegistrationDescription {\n return {\n ...description,\n type: \"Gcm\",\n };\n}\n\n/**\n * @deprecated Use createFcmTemplateRegistrationDescription instead.\n * Represents Notification Hub template registration description for Google Cloud Messaging.\n * @deprecated Use FcmTemplateRegistrationDescription instead\n */\nexport interface GcmTemplateRegistrationDescription\n extends Omit<GcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"GcmTemplate\";\n}\n\n/**\n * @deprecated Use createFcmTemplateRegistrationDescription instead.\n * Creates a GCM template registration description.\n * @param description - A partial GCM template registration description.\n * @returns A created GCM template registration description.\n */\nexport function createGcmTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Firebase Legacy HTTP API.\n */\nexport interface FcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n fcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Fcm\";\n}\n\n/**\n * Creates an FCM registration description.\n * @param description - A partial FCM registration description.\n * @returns A created FCM registration description.\n */\nexport function createFcmRegistrationDescription(\n description: Omit<FcmRegistrationDescription, \"type\">\n): FcmRegistrationDescription {\n return {\n ...description,\n type: \"Fcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy HTTP API.\n */\nexport interface FcmTemplateRegistrationDescription\n extends Omit<FcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"FcmTemplate\";\n}\n\n/**\n * Creates an FCM template registration description.\n * @param description - A partial FCM template registration description.\n * @returns A created FCM template registration description.\n */\nexport function createFcmTemplateRegistrationDescription(\n description: Omit<FcmTemplateRegistrationDescription, \"type\">\n): FcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"FcmTemplate\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Mpns\";\n}\n\n/**\n * @deprecated Windows Phone is no longer supported.\n * Creates an MPNS registration description.\n * @param description - A partial MPNS registration description.\n * @returns A created MPNS registration description.\n */\nexport function createMpnsRegistrationDescription(\n description: Omit<MpnsRegistrationDescription, \"type\">\n): MpnsRegistrationDescription {\n return {\n ...description,\n type: \"Mpns\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescription\n extends Omit<MpnsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"MpnsTemplate\";\n}\n\n/**\n * @deprecated Windows Phone is no longer supported.\n * Creates an MPNS template registration description.\n * @param description - A partial MPNS template registration description.\n * @returns A created MPNS template registration description.\n */\nexport function createMpnsTemplateRegistrationDescription(\n description: Omit<MpnsTemplateRegistrationDescription, \"type\">\n): MpnsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"MpnsTemplate\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Windows\";\n}\n\n/**\n * Creates a Windows registration description.\n * @param description - A partial Windows registration description.\n * @returns A created Windows registration description.\n */\nexport function createWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n): WindowsRegistrationDescription {\n return {\n ...description,\n type: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends Omit<WindowsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"WindowsTemplate\";\n}\n\n/**\n * Creates a Windows template registration description.\n * @param description - A partial Windows template registration description.\n * @returns A created Windows template registration description.\n */\nexport function createWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"WindowsTemplate\",\n };\n}\n\n/**\n * Describes the types of registration descriptions.\n */\nexport type RegistrationDescription =\n | AdmRegistrationDescription\n | AdmTemplateRegistrationDescription\n | AppleRegistrationDescription\n | AppleTemplateRegistrationDescription\n | BaiduRegistrationDescription\n | BaiduTemplateRegistrationDescription\n | BrowserRegistrationDescription\n | BrowserTemplateRegistrationDescription\n | GcmRegistrationDescription\n | GcmTemplateRegistrationDescription\n | FcmRegistrationDescription\n | FcmTemplateRegistrationDescription\n | MpnsRegistrationDescription\n | MpnsTemplateRegistrationDescription\n | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n"]}
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsFlC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAAuD;IAEvD,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AAkCD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA+D;IAE/D,uCACK,WAAW,KACd,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAAuD;IAEvD,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA+D;IAE/D,uCACK,WAAW,KACd,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC;AA2BD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,uCACK,WAAW,KACd,IAAI,EAAE,SAAS,IACf;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAiE;IAEjE,uCACK,WAAW,KACd,IAAI,EAAE,iBAAiB,IACvB;AACJ,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,sCAAsC,CACpD,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,8CAA8C,CAC5D,WAA6D;IAE7D,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAmDD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,uCACK,WAAW,KACd,IAAI,EAAE,SAAS,IACf;AACJ,CAAC;AAmBD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAiE;IAEjE,uCACK,WAAW,KACd,IAAI,EAAE,iBAAiB,IACvB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents the types of registration descriptions.\n */\nexport type RegistrationType =\n | \"Adm\"\n | \"AdmTemplate\"\n | \"Apple\"\n | \"AppleTemplate\"\n | \"Baidu\"\n | \"BaiduTemplate\"\n | \"Browser\"\n | \"BrowserTemplate\"\n | \"Gcm\"\n | \"GcmTemplate\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Windows\"\n | \"WindowsTemplate\";\n\n/**\n * Represents a registration description.\n */\nexport interface RegistrationDescriptionCommon {\n /**\n * The registration ID.\n */\n registrationId?: string;\n\n /**\n * The expiration time of the registration.\n */\n expirationTime?: Date;\n\n /**\n * The ETag associated with this description.\n */\n etag?: string;\n\n /**\n * The tags associated with the registration.\n */\n tags?: string[];\n\n /**\n * A dictionary of push variables associated with property bag.\n */\n pushVariables?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: RegistrationType;\n}\n\n/**\n * Represents the description of a template registration.\n */\nexport interface TemplateRegistrationDescription {\n /**\n * The body template.\n */\n bodyTemplate: string;\n\n /**\n * The name of the template.\n */\n templateName?: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Adm\";\n}\n\n/**\n * Creates an ADM registration description.\n * @param description - A partial ADM registration description.\n * @returns A created ADM registration description.\n */\nexport function createAdmRegistrationDescription(\n description: Omit<AdmRegistrationDescription, \"type\">\n): AdmRegistrationDescription {\n return {\n ...description,\n type: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends Omit<AdmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"AdmTemplate\";\n}\n\n/**\n * Creates an ADM template registration description.\n * @param description - A partial ADM template registration description.\n * @returns A created ADM template registration description.\n */\nexport function createAdmTemplateRegistrationDescription(\n description: Omit<AdmTemplateRegistrationDescription, \"type\">\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n\n /**\n * The type of the registration.\n */\n type: \"Apple\";\n}\n\n/**\n * Creates an Apple registration description.\n * @param description - A partial Apple registration description.\n * @returns A created Apple registration description.\n */\nexport function createAppleRegistrationDescription(\n description: Omit<AppleRegistrationDescription, \"type\">\n): AppleRegistrationDescription {\n return {\n ...description,\n type: \"Apple\",\n };\n}\n\n/**\n * The priority of the Apple push notification.\n */\nexport type ApplePriority = \"10\" | \"5\";\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends Omit<AppleRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: ApplePriority;\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"AppleTemplate\";\n}\n\n/**\n * Creates an Apple template registration description.\n * @param description - A partial Apple template registration description.\n * @returns A created Apple template registration description.\n */\nexport function createAppleTemplateRegistrationDescription(\n description: Omit<AppleTemplateRegistrationDescription, \"type\">\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n type: \"AppleTemplate\",\n };\n}\n\n/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Baidu user identifier.\n */\n baiduUserId: string;\n\n /**\n * The Baidu channel identifier.\n */\n baiduChannelId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Baidu\";\n}\n\n/**\n * Creates a Baidu registration description.\n * @param description - A partial Baidu registration description.\n * @returns A created Baidu registration description.\n */\nexport function createBaiduRegistrationDescription(\n description: Omit<BaiduRegistrationDescription, \"type\">\n): BaiduRegistrationDescription {\n return {\n ...description,\n type: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends Omit<BaiduRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BaiduTemplate\";\n}\n\n/**\n * Creates a Baidu template registration description.\n * @param description - A partial Baidu template registration description.\n * @returns A created Baidu template registration description.\n */\nexport function createBaiduTemplateRegistrationDescription(\n description: Omit<BaiduTemplateRegistrationDescription, \"type\">\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The Browser push endpoint.\n */\n endpoint: string;\n\n /**\n * The Browser push P256DH.\n */\n p256dh: string;\n\n /**\n * The Browser push auth secret.\n */\n auth: string;\n\n /**\n * The type of the registration.\n */\n type: \"Browser\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push registration description.\n * @returns A created Web Push registration description.\n */\nexport function createBrowserRegistrationDescription(\n description: Omit<BrowserRegistrationDescription, \"type\">\n): BrowserRegistrationDescription {\n return {\n ...description,\n type: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends Omit<BrowserRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"BrowserTemplate\";\n}\n\n/**\n * Creates a Web Push registration description.\n * @param description - A partial Web Push template registration description.\n * @returns A created Web Push template registration description.\n */\nexport function createBrowserTemplateRegistrationDescription(\n description: Omit<BrowserTemplateRegistrationDescription, \"type\">\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n type: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n\n /**\n * The type of the registration.\n */\n type: \"Gcm\";\n}\n\n/**\n * Creates a Firebase Legacy registration description.\n * @param description - A partial GCM registration description.\n * @returns A created GCM registration description.\n */\nexport function createFcmLegacyRegistrationDescription(\n description: Omit<GcmRegistrationDescription, \"type\">\n): GcmRegistrationDescription {\n return {\n ...description,\n type: \"Gcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescription\n extends Omit<GcmRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The type of the registration.\n */\n type: \"GcmTemplate\";\n}\n\n/**\n * Creates a GCM template registration description.\n * @param description - A partial GCM template registration description.\n * @returns A created GCM template registration description.\n */\nexport function createFcmLegacyTemplateRegistrationDescription(\n description: Omit<GcmTemplateRegistrationDescription, \"type\">\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n type: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Mpns\";\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescription\n extends Omit<MpnsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n\n /**\n * The type of the registration.\n */\n type: \"Windows\";\n}\n\n/**\n * Creates a Windows registration description.\n * @param description - A partial Windows registration description.\n * @returns A created Windows registration description.\n */\nexport function createWindowsRegistrationDescription(\n description: Omit<WindowsRegistrationDescription, \"type\">\n): WindowsRegistrationDescription {\n return {\n ...description,\n type: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends Omit<WindowsRegistrationDescription, \"type\">,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n\n /**\n * The type of the registration.\n */\n type: \"WindowsTemplate\";\n}\n\n/**\n * Creates a Windows template registration description.\n * @param description - A partial Windows template registration description.\n * @returns A created Windows template registration description.\n */\nexport function createWindowsTemplateRegistrationDescription(\n description: Omit<WindowsTemplateRegistrationDescription, \"type\">\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n type: \"WindowsTemplate\",\n };\n}\n\n/**\n * Describes the types of registration descriptions.\n */\nexport type RegistrationDescription =\n | AdmRegistrationDescription\n | AdmTemplateRegistrationDescription\n | AppleRegistrationDescription\n | AppleTemplateRegistrationDescription\n | BaiduRegistrationDescription\n | BaiduTemplateRegistrationDescription\n | BrowserRegistrationDescription\n | BrowserTemplateRegistrationDescription\n | GcmRegistrationDescription\n | GcmTemplateRegistrationDescription\n | MpnsRegistrationDescription\n | MpnsTemplateRegistrationDescription\n | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/models/response.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription } from \"./registration.js\";\n\n/**\n * Describes a
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/models/response.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription } from \"./registration.js\";\n\n/**\n * Describes a registration query response with registrations and a continuation token.\n */\nexport interface RegistrationQueryResponse {\n /**\n * The list of registrations.\n */\n registrations: RegistrationDescription[];\n /**\n * A continuation token to get more results.\n */\n continuationToken?: string;\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from "
|
|
|
7
7
|
import { createRegistrationId as createRegistrationIdMethod } from "./client/createRegistrationId.js";
|
|
8
8
|
import { createRegistration as createRegistrationMethod } from "./client/createRegistration.js";
|
|
9
9
|
import { deleteInstallation as deleteInstallationMethod } from "./client/deleteInstallation.js";
|
|
10
|
+
import { deleteRegistration } from "./client/deleteRegistration.js";
|
|
10
11
|
import { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from "./client/getFeedbackContainerUrl.js";
|
|
11
12
|
import { getInstallation as getInstallationMethod } from "./client/getInstallation.js";
|
|
12
13
|
import { getNotificationHubJob as getNotificationHubJobMethod } from "./client/getNotificationHubJob.js";
|
|
@@ -110,6 +111,16 @@ export class NotificationHubsServiceClient {
|
|
|
110
111
|
updateRegistration(registration, options = {}) {
|
|
111
112
|
return updateRegistrationMethod(this._client, registration, options);
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Deletes a registration with the given registration ID.
|
|
116
|
+
* @param context - The Notification Hubs client.
|
|
117
|
+
* @param registrationId - The registration ID of the registration to delete.
|
|
118
|
+
* @param options - The options for delete operations including the ETag
|
|
119
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
120
|
+
*/
|
|
121
|
+
deleteRegistration(registrationId, options = {}) {
|
|
122
|
+
return deleteRegistration(this._client, registrationId, options);
|
|
123
|
+
}
|
|
113
124
|
/**
|
|
114
125
|
* Gets a registration by the given registration ID.
|
|
115
126
|
* @param registrationId - The ID of the registration to get.
|
|
@@ -140,8 +151,7 @@ export class NotificationHubsServiceClient {
|
|
|
140
151
|
* Sends a direct push notification to a device with the given push handle.
|
|
141
152
|
* @param pushHandle - The push handle which is the unique identifier for the device.
|
|
142
153
|
* @param notification - The notification to send to the device.
|
|
143
|
-
* @param options -
|
|
144
|
-
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
154
|
+
* @param options - The options for sending a direct notification.
|
|
145
155
|
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
146
156
|
*/
|
|
147
157
|
sendDirectNotification(pushHandle, notification, options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationHubsClient.js","sourceRoot":"","sources":["../../src/notificationHubsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAiC,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAcvF,OAAO,EAAE,2BAA2B,IAAI,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC3H,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AACxH,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AACxH,OAAO,EAAE,oBAAoB,IAAI,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACtG,OAAO,EAAE,kBAAkB,IAAI,wBAAwB,EAA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C,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;OAQG;IACH,6BAA6B,CAC3B,aAAmB,EACnB,YAA0B,EAC1B,UAA4B,EAAE;QAE9B,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACjG,CAAC;IAED;;;;;OAKG;IACH,2BAA2B,CACzB,cAAsB,EACtB,UAA4B,EAAE;QAE9B,OAAO,iCAAiC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,6BAA6B,CAC3B,cAAsB,EACtB,UAA4B,EAAE;QAE9B,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CACnB,KAAa,EACb,UAA4B,EAAE;QAE9B,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,wBAAwB,CACtB,GAAuB,EACvB,UAA4B,EAAE;QAE9B,OAAO,8BAA8B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Installation, JsonPatch, PushHandle } from \"./models/installation.js\";\nimport { NotificationHubsClientContext, createClientContext } from \"./client/index.js\";\nimport {\n NotificationHubsClientOptions,\n RegistrationQueryLimitOptions,\n RegistrationQueryOptions,\n SendOperationOptions,\n} from \"./models/options.js\";\nimport { NotificationHubsMessageResponse, NotificationHubsResponse } from \"./models/response.js\";\nimport { Notification } from \"./models/notification.js\";\nimport { NotificationDetails } from \"./models/notificationDetails.js\";\nimport { NotificationHubJob } from \"./models/notificationHubJob.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"./models/registration.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./client/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./client/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./client/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./client/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./client/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./client/deleteInstallation.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./client/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./client/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./client/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./client/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./client/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./client/listNotificationHubJobs.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./client/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./client/listRegistrations.js\";\nimport { scheduleBroadcastNotification as scheduleBroadcastNotificationMethod } from \"./client/scheduleBroadcastNotification.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./client/scheduleNotification.js\";\nimport { sendBroadcastNotification as sendBroadcastNotificationMethod } from \"./client/sendBroadcastNotification.js\";\nimport { sendDirectNotification as sendDirectNotificationMethod } from \"./client/sendDirectNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./client/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./client/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./client/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./client/updateRegistration.js\";\n\n/**\n * This represents a client for Azure Notification Hubs to manage installations and send\n * messages to devices.\n */\nexport class NotificationHubsServiceClient {\n private _client: NotificationHubsClientContext;\n\n /**\n * Creates a new instance of the NotificationClient with a connection string, hub name and options.\n * @param connectionString - The Notification Hub Access Policy connection string.\n * @param hubName - The name of the Azure Notification Hub.\n * @param options - Options for configuring the Azure Notification Hubs client.\n */\n constructor(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n ) {\n this._client = createClientContext(connectionString, hubName, options);\n }\n\n /**\n * Creates or overwrites an installation to a Notification Hub.\n * @param installation - The installation to create or overwrite.\n * @param options - Configuration options for the create or update installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n createOrUpdateInstallation(\n installation: Installation,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return createOrUpdateInstallationMethod(this._client, installation, options);\n }\n\n /**\n * Deletes an installation from a Notification Hub.\n * @param installationId - The installation ID of the installation to delete.\n * @param options - Configuration options for the installation delete operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteInstallation(\n installationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param installationId - The ID of the installation to get.\n * @param options - Configuration options for the get installation operation.\n * @returns The installation that matches the installation ID.\n */\n getInstallation(installationId: string, options: OperationOptions = {}): Promise<Installation> {\n return getInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param installationId - The ID of the installation to update.\n * @param patches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n updateInstallation(\n installationId: string,\n patches: JsonPatch[],\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return updateInstallationMethod(this._client, installationId, patches, options);\n }\n\n /**\n * Creates a new registration ID.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\n createRegistrationId(options: OperationOptions = {}): Promise<string> {\n return createRegistrationIdMethod(this._client, options);\n }\n\n /**\n * Creates a new registration. This method generates a registration ID,\n * which you can subsequently use to retrieve, update, and delete this registration.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\n createRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Creates or updates a registration.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\n createOrUpdateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createOrUpdateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Updates an existing registration.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\n updateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return updateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Gets a registration by the given registration ID.\n * @param registrationId - The ID of the registration to get.\n * @param options - The options for getting a registration by ID.\n * @returns A RegistrationDescription that has the given registration ID.\n */\n getRegistration(\n registrationId: string,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return getRegistrationMethod(this._client, registrationId, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given query options.\n * @param options - The options for querying the registrations such as $top and $filter.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n options: RegistrationQueryOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Lists all registrations with the matching tag.\n * @param tag - The tag to query for matching registrations.\n * @param options - The query options such as $top.\n * @returns A paged async iterable containing the matching registrations for the notification hub.\n */\n listRegistrationsByTag(\n tag: string,\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends a direct push notification to a device with the given push handle.\n * @param pushHandle - The push handle which is the unique identifier for the device.\n * @param notification - The notification to send to the device.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendDirectNotification(\n pushHandle: PushHandle,\n notification: Notification,\n options: SendOperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendDirectNotificationMethod(this._client, pushHandle, notification, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n tags: string[] | string,\n notification: Notification,\n options: SendOperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, tags, notification, options);\n }\n\n /**\n * Sends push notifications to all devices on the Notification Hub.\n * @param notification - The notification to send to all devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendBroadcastNotification(\n notification: Notification,\n options: SendOperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendBroadcastNotificationMethod(this._client, notification, options);\n }\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 scheduledTime - The Date to send the push notification.\n * @param tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n tags: string[] | string,\n notification: Notification,\n options: OperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(this._client, scheduledTime, tags, notification, options);\n }\n\n /**\n * Schedules a push notification to all devices registered on the Notification Hub.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleBroadcastNotification(\n scheduledTime: Date,\n notification: Notification,\n options: OperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleBroadcastNotificationMethod(this._client, scheduledTime, notification, options);\n }\n\n /**\n * Cancels the scheduled notification with the given notification ID.\n * @param notificationId - The notification ID from the scheduled notification.\n * @param options - The operation options.\n * @returns A notification hub response with correlation ID and tracking ID.\n */\n cancelScheduledNotification(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return cancelScheduledNotificationMethod(this._client, notificationId, options);\n }\n\n /**\n * Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.\n * The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.\n * @param options - The options for getting the push notification feedback container URL.\n * @returns The URL of the Azure Storage Container containing the feedback data.\n */\n getFeedbackContainerUrl(options: OperationOptions = {}): Promise<string> {\n return getFeedbackContainerUrlMethod(this._client, options);\n }\n\n /**\n * Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed\n * or final results if the Send* has completed. This API can only be called for Standard SKU and above.\n * @param notificationId - The notification ID returned from the send operation.\n * @param options - The operation options.\n * @returns The results of the send operation.\n */\n getNotificationOutcomeDetails(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationDetails> {\n return getNotificationOutcomeDetailsMethod(this._client, notificationId, options);\n }\n\n /**\n * Gets a Notification Hub Job by the ID.\n * @param jobId - The Notification Hub Job ID.\n * @param options - The operation options.\n * @returns The Notification Hub Job with the matching ID.\n */\n getNotificationHubJob(\n jobId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return getNotificationHubJobMethod(this._client, jobId, options);\n }\n\n /**\n * Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.\n * @param job - The notification hub job to submit.\n * @param options - The operation options.\n * @returns The notification hub job details including job ID and status.\n */\n submitNotificationHubJob(\n job: NotificationHubJob,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return submitNotificationHubJobMethod(this._client, job, options);\n }\n\n /**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\n listNotificationHubJobs(options: OperationOptions = {}): Promise<NotificationHubJob[]> {\n return listNotificationHubJobsMethod(this._client, options);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notificationHubsClient.js","sourceRoot":"","sources":["../../src/notificationHubsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAiC,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAavF,OAAO,EAAE,2BAA2B,IAAI,iCAA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BAAqB,CACnB,KAAa,EACb,UAA4B,EAAE;QAE9B,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,wBAAwB,CACtB,GAAuB,EACvB,UAA4B,EAAE;QAE9B,OAAO,8BAA8B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,uBAAuB,CAAC,UAA4B,EAAE;QACpD,OAAO,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Installation, JsonPatch, PushHandle } from \"./models/installation.js\";\nimport {\n NotificationDetails,\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"./models/notificationDetails.js\";\nimport { NotificationHubsClientContext, createClientContext } from \"./client/index.js\";\nimport {\n EntityOperationOptions,\n NotificationHubsClientOptions,\n RegistrationQueryLimitOptions,\n RegistrationQueryOptions,\n SendOperationOptions,\n} from \"./models/options.js\";\nimport { Notification } from \"./models/notification.js\";\nimport { NotificationHubJob } from \"./models/notificationHubJob.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"./models/registration.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./client/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./client/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./client/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./client/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./client/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./client/deleteInstallation.js\";\nimport { deleteRegistration } from \"./client/deleteRegistration.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./client/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./client/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./client/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./client/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./client/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./client/listNotificationHubJobs.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./client/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./client/listRegistrations.js\";\nimport { scheduleBroadcastNotification as scheduleBroadcastNotificationMethod } from \"./client/scheduleBroadcastNotification.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./client/scheduleNotification.js\";\nimport { sendBroadcastNotification as sendBroadcastNotificationMethod } from \"./client/sendBroadcastNotification.js\";\nimport { sendDirectNotification as sendDirectNotificationMethod } from \"./client/sendDirectNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./client/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./client/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./client/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./client/updateRegistration.js\";\n\n/**\n * This represents a client for Azure Notification Hubs to manage installations and send\n * messages to devices.\n */\nexport class NotificationHubsServiceClient {\n private _client: NotificationHubsClientContext;\n\n /**\n * Creates a new instance of the NotificationClient with a connection string, hub name and options.\n * @param connectionString - The Notification Hub Access Policy connection string.\n * @param hubName - The name of the Azure Notification Hub.\n * @param options - Options for configuring the Azure Notification Hubs client.\n */\n constructor(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n ) {\n this._client = createClientContext(connectionString, hubName, options);\n }\n\n /**\n * Creates or overwrites an installation to a Notification Hub.\n * @param installation - The installation to create or overwrite.\n * @param options - Configuration options for the create or update installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n createOrUpdateInstallation(\n installation: Installation,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return createOrUpdateInstallationMethod(this._client, installation, options);\n }\n\n /**\n * Deletes an installation from a Notification Hub.\n * @param installationId - The installation ID of the installation to delete.\n * @param options - Configuration options for the installation delete operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteInstallation(\n installationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param installationId - The ID of the installation to get.\n * @param options - Configuration options for the get installation operation.\n * @returns The installation that matches the installation ID.\n */\n getInstallation(installationId: string, options: OperationOptions = {}): Promise<Installation> {\n return getInstallationMethod(this._client, installationId, options);\n }\n\n /**\n * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param installationId - The ID of the installation to update.\n * @param patches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n updateInstallation(\n installationId: string,\n patches: JsonPatch[],\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return updateInstallationMethod(this._client, installationId, patches, options);\n }\n\n /**\n * Creates a new registration ID.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\n createRegistrationId(options: OperationOptions = {}): Promise<string> {\n return createRegistrationIdMethod(this._client, options);\n }\n\n /**\n * Creates a new registration. This method generates a registration ID,\n * which you can subsequently use to retrieve, update, and delete this registration.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\n createRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Creates or updates a registration.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\n createOrUpdateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return createOrUpdateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Updates an existing registration.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\n updateRegistration(\n registration: RegistrationDescription,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return updateRegistrationMethod(this._client, registration, options);\n }\n\n /**\n * Deletes a registration with the given registration ID.\n * @param context - The Notification Hubs client.\n * @param registrationId - The registration ID of the registration to delete.\n * @param options - The options for delete operations including the ETag\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n deleteRegistration(\n registrationId: string,\n options: EntityOperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return deleteRegistration(this._client, registrationId, options);\n }\n\n /**\n * Gets a registration by the given registration ID.\n * @param registrationId - The ID of the registration to get.\n * @param options - The options for getting a registration by ID.\n * @returns A RegistrationDescription that has the given registration ID.\n */\n getRegistration(\n registrationId: string,\n options: OperationOptions = {}\n ): Promise<RegistrationDescription> {\n return getRegistrationMethod(this._client, registrationId, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given query options.\n * @param options - The options for querying the registrations such as $top and $filter.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n options: RegistrationQueryOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Lists all registrations with the matching tag.\n * @param tag - The tag to query for matching registrations.\n * @param options - The query options such as $top.\n * @returns A paged async iterable containing the matching registrations for the notification hub.\n */\n listRegistrationsByTag(\n tag: string,\n options: RegistrationQueryLimitOptions = {}\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends a direct push notification to a device with the given push handle.\n * @param pushHandle - The push handle which is the unique identifier for the device.\n * @param notification - The notification to send to the device.\n * @param options - The options for sending a direct notification.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendDirectNotification(\n pushHandle: PushHandle,\n notification: Notification,\n options: OperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendDirectNotificationMethod(this._client, pushHandle, notification, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n tags: string[] | string,\n notification: Notification,\n options: SendOperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, tags, notification, options);\n }\n\n /**\n * Sends push notifications to all devices on the Notification Hub.\n * @param notification - The notification to send to all devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendBroadcastNotification(\n notification: Notification,\n options: SendOperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return sendBroadcastNotificationMethod(this._client, notification, options);\n }\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 scheduledTime - The Date to send the push notification.\n * @param tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n tags: string[] | string,\n notification: Notification,\n options: OperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(this._client, scheduledTime, tags, notification, options);\n }\n\n /**\n * Schedules a push notification to all devices registered on the Notification Hub.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleBroadcastNotification(\n scheduledTime: Date,\n notification: Notification,\n options: OperationOptions = {}\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleBroadcastNotificationMethod(this._client, scheduledTime, notification, options);\n }\n\n /**\n * Cancels the scheduled notification with the given notification ID.\n * @param notificationId - The notification ID from the scheduled notification.\n * @param options - The operation options.\n * @returns A notification hub response with correlation ID and tracking ID.\n */\n cancelScheduledNotification(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubsResponse> {\n return cancelScheduledNotificationMethod(this._client, notificationId, options);\n }\n\n /**\n * Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.\n * The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.\n * @param options - The options for getting the push notification feedback container URL.\n * @returns The URL of the Azure Storage Container containing the feedback data.\n */\n getFeedbackContainerUrl(options: OperationOptions = {}): Promise<string> {\n return getFeedbackContainerUrlMethod(this._client, options);\n }\n\n /**\n * Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed\n * or final results if the Send* has completed. This API can only be called for Standard SKU and above.\n * @param notificationId - The notification ID returned from the send operation.\n * @param options - The operation options.\n * @returns The results of the send operation.\n */\n getNotificationOutcomeDetails(\n notificationId: string,\n options: OperationOptions = {}\n ): Promise<NotificationDetails> {\n return getNotificationOutcomeDetailsMethod(this._client, notificationId, options);\n }\n\n /**\n * Gets a Notification Hub Job by the ID.\n * @param jobId - The Notification Hub Job ID.\n * @param options - The operation options.\n * @returns The Notification Hub Job with the matching ID.\n */\n getNotificationHubJob(\n jobId: string,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return getNotificationHubJobMethod(this._client, jobId, options);\n }\n\n /**\n * Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.\n * @param job - The notification hub job to submit.\n * @param options - The operation options.\n * @returns The notification hub job details including job ID and status.\n */\n submitNotificationHubJob(\n job: NotificationHubJob,\n options: OperationOptions = {}\n ): Promise<NotificationHubJob> {\n return submitNotificationHubJobMethod(this._client, job, options);\n }\n\n /**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\n listNotificationHubJobs(options: OperationOptions = {}): Promise<NotificationHubJob[]> {\n return listNotificationHubJobsMethod(this._client, options);\n }\n}\n"]}
|
|
@@ -36,7 +36,11 @@ export async function parseNotificationHubJobEntry(bodyText) {
|
|
|
36
36
|
export async function parseNotificationHubJobFeed(bodyText) {
|
|
37
37
|
const xml = await parseXML(bodyText, { includeRoot: true });
|
|
38
38
|
const results = [];
|
|
39
|
-
|
|
39
|
+
if (!isDefined(xml.feed.entry)) {
|
|
40
|
+
return results;
|
|
41
|
+
}
|
|
42
|
+
const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];
|
|
43
|
+
for (const item of entries) {
|
|
40
44
|
results.push(createNotificationHubJob(item.content.NotificationHubJob));
|
|
41
45
|
}
|
|
42
46
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationHubJobSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationHubJobSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,SAAS,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OA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oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAA6B;QAC3E,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClD,kBAAkB,EAAE,SAAS,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;QAClF,aAAa,EAAE,oBAAoB,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC7D,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACjD,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACnD,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACnD,eAAe;QACf,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationHubJob,\n NotificationHubJobStatus,\n NotificationHubJobType,\n} from \"../models/notificationHubJob.js\";\nimport {\n getDateOrUndefined,\n getFloatOrUndefined,\n getString,\n getStringOrUndefined,\n isDefined,\n} from \"../utils/utils.js\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { serializeToAtomXmlRequest } from \"../utils/xmlUtils.js\";\n\n/**\n * @internal\n * Serializes a NotificationHubJob into an Atom XML entry.\n * @param entry - The NotificationHubJob to turn into an Atom XML entry.\n * @returns An Atom XML entry containing the notification hub job.\n */\nexport function serializeNotificationHubJobEntry(entry: NotificationHubJob): string {\n const job: Record<string, any> = {\n Type: entry.type,\n OutputContainerUri: { __cdata: entry.outputContainerUrl },\n ImportFileUri: isDefined(entry.importFileUrl) ? { __cdata: entry.importFileUrl } : undefined,\n };\n\n const requestObject = serializeToAtomXmlRequest(\"NotificationHubJob\", job);\n\n return stringifyXML(requestObject, { rootName: \"entry\", cdataPropName: \"__cdata\" });\n}\n\n/**\n * Parses an Atom XML of an notification hub job entry.\n * @param bodyText - The incoming Atom XML entry to parse into a notification hub job.\n * @returns A parsed NotificationHubJob.\n */\nexport async function parseNotificationHubJobEntry(bodyText: string): Promise<NotificationHubJob> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const content = xml.entry.content.NotificationHubJob;\n return createNotificationHubJob(content);\n}\n\n/**\n * Parses an Atom XML feed of notification hub jobs.\n * @param bodyText - The incoming Atom XML feed to parse into notification hub jobs.\n * @returns A list of notification hub jobs.\n */\nexport async function parseNotificationHubJobFeed(bodyText: string): Promise<NotificationHubJob[]> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const results: NotificationHubJob[] = [];\n\n if (!isDefined(xml.feed.entry)) {\n return results;\n }\n\n const entries = Array.isArray(xml.feed.entry) ? xml.feed.entry : [xml.feed.entry];\n\n for (const item of entries) {\n results.push(createNotificationHubJob(item.content.NotificationHubJob));\n }\n\n return results;\n}\n\nfunction createInputOutputProperties(content: Record<string, any>): Record<string, string> {\n const props: Record<string, string> = {};\n for (const item of content[\"d3p1:KeyValueOfstringstring\"]) {\n props[item[\"d3p1:Key\"]] = item[\"d3p1:Value\"];\n }\n\n return props;\n}\n\nfunction createNotificationHubJob(content: Record<string, any>): NotificationHubJob {\n let outputProperties: Record<string, string> | undefined;\n if (isDefined(content[\"OutputProperties\"])) {\n outputProperties = createInputOutputProperties(content[\"OutputProperties\"]);\n }\n\n let inputProperties: Record<string, string> | undefined;\n if (isDefined(content[\"InputProperties\"])) {\n inputProperties = createInputOutputProperties(content[\"InputProperties\"]);\n }\n\n return {\n jobId: getStringOrUndefined(content[\"JobId\"]),\n type: getString(content[\"Type\"], \"type\") as NotificationHubJobType,\n status: getStringOrUndefined(content[\"Status\"]) as NotificationHubJobStatus,\n progress: getFloatOrUndefined(content[\"Progress\"]),\n outputContainerUrl: getString(content[\"OutputContainerUri\"], \"outputContainerUrl\"),\n importFileUrl: getStringOrUndefined(content[\"ImportFileUri\"]),\n failure: getStringOrUndefined(content[\"Failure\"]),\n createdAt: getDateOrUndefined(content[\"CreatedAt\"]),\n updatedAt: getDateOrUndefined(content[\"UpdatedAt\"]),\n inputProperties,\n outputProperties,\n };\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getInteger, getString, isDefined } from "../utils/utils.js";
|
|
4
|
+
import { parseXML } from "@azure/core-xml";
|
|
5
|
+
export async function parseNotificationOutcome(bodyText) {
|
|
6
|
+
const xml = await parseXML(bodyText, { includeRoot: true });
|
|
7
|
+
const outcome = xml.NotificationOutcome;
|
|
8
|
+
return {
|
|
9
|
+
success: getInteger(outcome.Success, "Success"),
|
|
10
|
+
failure: getInteger(outcome.Failure, "Failure"),
|
|
11
|
+
results: parseRegistrationResults(outcome.Results.RegistrationResult),
|
|
12
|
+
state: "DetailedStateAvailable",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function parseRegistrationResults(results) {
|
|
16
|
+
const registrationResults = [];
|
|
17
|
+
if (!isDefined(results)) {
|
|
18
|
+
return registrationResults;
|
|
19
|
+
}
|
|
20
|
+
const resultsArray = Array.isArray(results) ? results : [results];
|
|
21
|
+
for (const result of resultsArray) {
|
|
22
|
+
registrationResults.push({
|
|
23
|
+
applicationPlatform: getString(result.ApplicationPlatform, "ApplicationPlatform"),
|
|
24
|
+
registrationId: getString(result.RegistrationId, "RegistrationId"),
|
|
25
|
+
outcome: getString(result.Outcome, "Outcome"),
|
|
26
|
+
pnsHandle: getString(result.PnsHandle, "PnsHandle"),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return registrationResults;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=notificationOutcomeSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationOutcomeSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationOutcomeSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,UAAU,EA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OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationHubsMessageResponse,\n RegistrationResult,\n} from \"../models/notificationDetails.js\";\nimport { getInteger, getString, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\nexport async function parseNotificationOutcome(\n bodyText: string\n): Promise<NotificationHubsMessageResponse> {\n const xml = await parseXML(bodyText, { includeRoot: true });\n const outcome = xml.NotificationOutcome;\n\n return {\n success: getInteger(outcome.Success, \"Success\"),\n failure: getInteger(outcome.Failure, \"Failure\"),\n results: parseRegistrationResults(outcome.Results.RegistrationResult),\n state: \"DetailedStateAvailable\",\n };\n}\n\nfunction parseRegistrationResults(results?: Record<string, any>): RegistrationResult[] {\n const registrationResults: RegistrationResult[] = [];\n\n if (!isDefined(results)) {\n return registrationResults;\n }\n\n const resultsArray = Array.isArray(results) ? results : [results];\n\n for (const result of resultsArray) {\n registrationResults.push({\n applicationPlatform: getString(result.ApplicationPlatform, \"ApplicationPlatform\"),\n registrationId: getString(result.RegistrationId, \"RegistrationId\"),\n outcome: getString(result.Outcome, \"Outcome\"),\n pnsHandle: getString(result.PnsHandle, \"PnsHandle\"),\n });\n }\n\n return registrationResults;\n}\n"]}
|