@azure/notification-hubs 1.0.0-alpha.20220804.8
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/LICENSE +21 -0
- package/README.md +749 -0
- package/dist/index.js +2235 -0
- package/dist/index.js.map +1 -0
- package/dist-esm/src/client/cancelScheduledNotification.js +23 -0
- package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -0
- package/dist-esm/src/client/createOrUpdateInstallation.js +24 -0
- package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -0
- package/dist-esm/src/client/createOrUpdateRegistration.js +17 -0
- package/dist-esm/src/client/createOrUpdateRegistration.js.map +1 -0
- package/dist-esm/src/client/createRegistration.js +24 -0
- package/dist-esm/src/client/createRegistration.js.map +1 -0
- package/dist-esm/src/client/createRegistrationId.js +26 -0
- package/dist-esm/src/client/createRegistrationId.js.map +1 -0
- package/dist-esm/src/client/deleteInstallation.js +22 -0
- package/dist-esm/src/client/deleteInstallation.js.map +1 -0
- package/dist-esm/src/client/deleteRegistration.js +25 -0
- package/dist-esm/src/client/deleteRegistration.js.map +1 -0
- package/dist-esm/src/client/getFeedbackContainerUrl.js +23 -0
- package/dist-esm/src/client/getFeedbackContainerUrl.js.map +1 -0
- package/dist-esm/src/client/getInstallation.js +23 -0
- package/dist-esm/src/client/getInstallation.js.map +1 -0
- package/dist-esm/src/client/getNotificationHubJob.js +24 -0
- package/dist-esm/src/client/getNotificationHubJob.js.map +1 -0
- package/dist-esm/src/client/getNotificationOutcomeDetails.js +24 -0
- package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +1 -0
- package/dist-esm/src/client/getRegistration.js +24 -0
- package/dist-esm/src/client/getRegistration.js.map +1 -0
- package/dist-esm/src/client/index.js +44 -0
- package/dist-esm/src/client/index.js.map +1 -0
- package/dist-esm/src/client/internal/_client.js +75 -0
- package/dist-esm/src/client/internal/_client.js.map +1 -0
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js +31 -0
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js +37 -0
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -0
- package/dist-esm/src/client/internal/_sendNotificationPayload.js +51 -0
- package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -0
- package/dist-esm/src/client/listNotificationHubJobs.js +23 -0
- package/dist-esm/src/client/listNotificationHubJobs.js.map +1 -0
- package/dist-esm/src/client/listRegistrations.js +89 -0
- package/dist-esm/src/client/listRegistrations.js.map +1 -0
- package/dist-esm/src/client/listRegistrationsByTag.js +87 -0
- package/dist-esm/src/client/listRegistrationsByTag.js.map +1 -0
- package/dist-esm/src/client/scheduleBroadcastNotification.js +17 -0
- package/dist-esm/src/client/scheduleBroadcastNotification.js.map +1 -0
- package/dist-esm/src/client/scheduleNotification.js +18 -0
- package/dist-esm/src/client/scheduleNotification.js.map +1 -0
- package/dist-esm/src/client/sendBroadcastNotification.js +15 -0
- package/dist-esm/src/client/sendBroadcastNotification.js.map +1 -0
- package/dist-esm/src/client/sendDirectNotification.js +16 -0
- package/dist-esm/src/client/sendDirectNotification.js.map +1 -0
- package/dist-esm/src/client/sendNotification.js +16 -0
- package/dist-esm/src/client/sendNotification.js.map +1 -0
- package/dist-esm/src/client/submitNotificationHubJob.js +26 -0
- package/dist-esm/src/client/submitNotificationHubJob.js.map +1 -0
- package/dist-esm/src/client/updateInstallation.js +25 -0
- package/dist-esm/src/client/updateInstallation.js.map +1 -0
- package/dist-esm/src/client/updateRegistration.js +21 -0
- package/dist-esm/src/client/updateRegistration.js.map +1 -0
- package/dist-esm/src/index.js +12 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/models/installation.js +51 -0
- package/dist-esm/src/models/installation.js.map +1 -0
- package/dist-esm/src/models/notification.js +104 -0
- package/dist-esm/src/models/notification.js.map +1 -0
- package/dist-esm/src/models/notificationBuilder.js +169 -0
- package/dist-esm/src/models/notificationBuilder.js.map +1 -0
- package/dist-esm/src/models/notificationDetails.js +4 -0
- package/dist-esm/src/models/notificationDetails.js.map +1 -0
- package/dist-esm/src/models/notificationHubJob.js +4 -0
- package/dist-esm/src/models/notificationHubJob.js.map +1 -0
- package/dist-esm/src/models/options.js +4 -0
- package/dist-esm/src/models/options.js.map +1 -0
- package/dist-esm/src/models/registration.js +135 -0
- package/dist-esm/src/models/registration.js.map +1 -0
- package/dist-esm/src/models/response.js +4 -0
- package/dist-esm/src/models/response.js.map +1 -0
- package/dist-esm/src/notificationHubsClient.js +251 -0
- package/dist-esm/src/notificationHubsClient.js.map +1 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js +58 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -0
- package/dist-esm/src/serializers/notificationHubJobSerializer.js +74 -0
- package/dist-esm/src/serializers/notificationHubJobSerializer.js.map +1 -0
- package/dist-esm/src/serializers/registrationSerializer.js +375 -0
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -0
- package/dist-esm/src/utils/connectionStringUtils.js +37 -0
- package/dist-esm/src/utils/connectionStringUtils.js.map +1 -0
- package/dist-esm/src/utils/constants.js +11 -0
- package/dist-esm/src/utils/constants.js.map +1 -0
- package/dist-esm/src/utils/retryPolicy.js +144 -0
- package/dist-esm/src/utils/retryPolicy.js.map +1 -0
- package/dist-esm/src/utils/tracing.js +13 -0
- package/dist-esm/src/utils/tracing.js.map +1 -0
- package/dist-esm/src/utils/utils.js +130 -0
- package/dist-esm/src/utils/utils.js.map +1 -0
- package/dist-esm/src/utils/xmlUtils.js +101 -0
- package/dist-esm/src/utils/xmlUtils.js.map +1 -0
- package/package.json +144 -0
- package/types/3.1/notification-hubs.d.ts +1728 -0
- package/types/latest/notification-hubs.d.ts +1840 -0
- package/types/latest/tsdoc-metadata.json +11 -0
- package/types/src/client/cancelScheduledNotification.d.ts +13 -0
- package/types/src/client/cancelScheduledNotification.d.ts.map +1 -0
- package/types/src/client/createOrUpdateInstallation.d.ts +13 -0
- package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -0
- package/types/src/client/createOrUpdateRegistration.d.ts +12 -0
- package/types/src/client/createOrUpdateRegistration.d.ts.map +1 -0
- package/types/src/client/createRegistration.d.ts +13 -0
- package/types/src/client/createRegistration.d.ts.map +1 -0
- package/types/src/client/createRegistrationId.d.ts +10 -0
- package/types/src/client/createRegistrationId.d.ts.map +1 -0
- package/types/src/client/deleteInstallation.d.ts +12 -0
- package/types/src/client/deleteInstallation.d.ts.map +1 -0
- package/types/src/client/deleteRegistration.d.ts +12 -0
- package/types/src/client/deleteRegistration.d.ts.map +1 -0
- package/types/src/client/getFeedbackContainerUrl.d.ts +11 -0
- package/types/src/client/getFeedbackContainerUrl.d.ts.map +1 -0
- package/types/src/client/getInstallation.d.ts +12 -0
- package/types/src/client/getInstallation.d.ts.map +1 -0
- package/types/src/client/getNotificationHubJob.d.ts +12 -0
- package/types/src/client/getNotificationHubJob.d.ts.map +1 -0
- package/types/src/client/getNotificationOutcomeDetails.d.ts +13 -0
- package/types/src/client/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/types/src/client/getRegistration.d.ts +12 -0
- package/types/src/client/getRegistration.d.ts.map +1 -0
- package/types/src/client/index.d.ts +41 -0
- package/types/src/client/index.d.ts.map +1 -0
- package/types/src/client/internal/_client.d.ts +26 -0
- package/types/src/client/internal/_client.d.ts.map +1 -0
- package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
- package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts +9 -0
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -0
- package/types/src/client/internal/_sendNotificationPayload.d.ts +10 -0
- package/types/src/client/internal/_sendNotificationPayload.d.ts.map +1 -0
- package/types/src/client/listNotificationHubJobs.d.ts +11 -0
- package/types/src/client/listNotificationHubJobs.d.ts.map +1 -0
- package/types/src/client/listRegistrations.d.ts +12 -0
- package/types/src/client/listRegistrations.d.ts.map +1 -0
- package/types/src/client/listRegistrationsByTag.d.ts +13 -0
- package/types/src/client/listRegistrationsByTag.d.ts.map +1 -0
- package/types/src/client/scheduleBroadcastNotification.d.ts +16 -0
- package/types/src/client/scheduleBroadcastNotification.d.ts.map +1 -0
- package/types/src/client/scheduleNotification.d.ts +17 -0
- package/types/src/client/scheduleNotification.d.ts.map +1 -0
- package/types/src/client/sendBroadcastNotification.d.ts +14 -0
- package/types/src/client/sendBroadcastNotification.d.ts.map +1 -0
- package/types/src/client/sendDirectNotification.d.ts +16 -0
- package/types/src/client/sendDirectNotification.d.ts.map +1 -0
- package/types/src/client/sendNotification.d.ts +15 -0
- package/types/src/client/sendNotification.d.ts.map +1 -0
- package/types/src/client/submitNotificationHubJob.d.ts +13 -0
- package/types/src/client/submitNotificationHubJob.d.ts.map +1 -0
- package/types/src/client/updateInstallation.d.ts +14 -0
- package/types/src/client/updateInstallation.d.ts.map +1 -0
- package/types/src/client/updateRegistration.d.ts +12 -0
- package/types/src/client/updateRegistration.d.ts.map +1 -0
- package/types/src/index.d.ts +10 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/models/installation.d.ts +200 -0
- package/types/src/models/installation.d.ts.map +1 -0
- package/types/src/models/notification.d.ts +166 -0
- package/types/src/models/notification.d.ts.map +1 -0
- package/types/src/models/notificationBuilder.d.ts +546 -0
- package/types/src/models/notificationBuilder.d.ts.map +1 -0
- package/types/src/models/notificationDetails.d.ts +87 -0
- package/types/src/models/notificationDetails.d.ts.map +1 -0
- package/types/src/models/notificationHubJob.d.ts +104 -0
- package/types/src/models/notificationHubJob.d.ts.map +1 -0
- package/types/src/models/options.d.ts +43 -0
- package/types/src/models/options.d.ts.map +1 -0
- package/types/src/models/registration.d.ts +368 -0
- package/types/src/models/registration.d.ts.map +1 -0
- package/types/src/models/response.d.ts +41 -0
- package/types/src/models/response.d.ts.map +1 -0
- package/types/src/notificationHubsClient.d.ts +190 -0
- package/types/src/notificationHubsClient.d.ts.map +1 -0
- package/types/src/serializers/notificationDetailsSerializer.d.ts +7 -0
- package/types/src/serializers/notificationDetailsSerializer.d.ts.map +1 -0
- package/types/src/serializers/notificationHubJobSerializer.d.ts +21 -0
- package/types/src/serializers/notificationHubJobSerializer.d.ts.map +1 -0
- package/types/src/serializers/registrationSerializer.d.ts +193 -0
- package/types/src/serializers/registrationSerializer.d.ts.map +1 -0
- package/types/src/utils/connectionStringUtils.d.ts +37 -0
- package/types/src/utils/connectionStringUtils.d.ts.map +1 -0
- package/types/src/utils/constants.d.ts +9 -0
- package/types/src/utils/constants.d.ts.map +1 -0
- package/types/src/utils/retryPolicy.d.ts +72 -0
- package/types/src/utils/retryPolicy.d.ts.map +1 -0
- package/types/src/utils/tracing.d.ts +6 -0
- package/types/src/utils/tracing.d.ts.map +1 -0
- package/types/src/utils/utils.d.ts +65 -0
- package/types/src/utils/utils.d.ts.map +1 -0
- package/types/src/utils/xmlUtils.d.ts +46 -0
- package/types/src/utils/xmlUtils.d.ts.map +1 -0
|
@@ -0,0 +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;AAkCD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA+D;IAE/D,uCACK,WAAW,KACd,IAAI,EAAE,eAAe,I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zD,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"]}
|
|
@@ -0,0 +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 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 * 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/**\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"]}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createClientContext } from "./client/index.js";
|
|
4
|
+
import { cancelScheduledNotification as cancelScheduledNotificationMethod } from "./client/cancelScheduledNotification.js";
|
|
5
|
+
import { createOrUpdateInstallation as createOrUpdateInstallationMethod } from "./client/createOrUpdateInstallation.js";
|
|
6
|
+
import { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from "./client/createOrUpdateRegistration.js";
|
|
7
|
+
import { createRegistrationId as createRegistrationIdMethod } from "./client/createRegistrationId.js";
|
|
8
|
+
import { createRegistration as createRegistrationMethod } from "./client/createRegistration.js";
|
|
9
|
+
import { deleteInstallation as deleteInstallationMethod } from "./client/deleteInstallation.js";
|
|
10
|
+
import { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from "./client/getFeedbackContainerUrl.js";
|
|
11
|
+
import { getInstallation as getInstallationMethod } from "./client/getInstallation.js";
|
|
12
|
+
import { getNotificationHubJob as getNotificationHubJobMethod } from "./client/getNotificationHubJob.js";
|
|
13
|
+
import { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from "./client/getNotificationOutcomeDetails.js";
|
|
14
|
+
import { getRegistration as getRegistrationMethod } from "./client/getRegistration.js";
|
|
15
|
+
import { listNotificationHubJobs as listNotificationHubJobsMethod } from "./client/listNotificationHubJobs.js";
|
|
16
|
+
import { listRegistrationsByTag as listRegistrationsByTagMethod } from "./client/listRegistrationsByTag.js";
|
|
17
|
+
import { listRegistrations as listRegistrationsMethod } from "./client/listRegistrations.js";
|
|
18
|
+
import { scheduleBroadcastNotification as scheduleBroadcastNotificationMethod } from "./client/scheduleBroadcastNotification.js";
|
|
19
|
+
import { scheduleNotification as scheduleNotificationMethod } from "./client/scheduleNotification.js";
|
|
20
|
+
import { sendBroadcastNotification as sendBroadcastNotificationMethod } from "./client/sendBroadcastNotification.js";
|
|
21
|
+
import { sendDirectNotification as sendDirectNotificationMethod } from "./client/sendDirectNotification.js";
|
|
22
|
+
import { sendNotification as sendNotificationMethod } from "./client/sendNotification.js";
|
|
23
|
+
import { submitNotificationHubJob as submitNotificationHubJobMethod } from "./client/submitNotificationHubJob.js";
|
|
24
|
+
import { updateInstallation as updateInstallationMethod } from "./client/updateInstallation.js";
|
|
25
|
+
import { updateRegistration as updateRegistrationMethod } from "./client/updateRegistration.js";
|
|
26
|
+
/**
|
|
27
|
+
* This represents a client for Azure Notification Hubs to manage installations and send
|
|
28
|
+
* messages to devices.
|
|
29
|
+
*/
|
|
30
|
+
export class NotificationHubsServiceClient {
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new instance of the NotificationClient with a connection string, hub name and options.
|
|
33
|
+
* @param connectionString - The Notification Hub Access Policy connection string.
|
|
34
|
+
* @param hubName - The name of the Azure Notification Hub.
|
|
35
|
+
* @param options - Options for configuring the Azure Notification Hubs client.
|
|
36
|
+
*/
|
|
37
|
+
constructor(connectionString, hubName, options = {}) {
|
|
38
|
+
this._client = createClientContext(connectionString, hubName, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates or overwrites an installation to a Notification Hub.
|
|
42
|
+
* @param installation - The installation to create or overwrite.
|
|
43
|
+
* @param options - Configuration options for the create or update installation operation.
|
|
44
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
45
|
+
*/
|
|
46
|
+
createOrUpdateInstallation(installation, options = {}) {
|
|
47
|
+
return createOrUpdateInstallationMethod(this._client, installation, options);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deletes an installation from a Notification Hub.
|
|
51
|
+
* @param installationId - The installation ID of the installation to delete.
|
|
52
|
+
* @param options - Configuration options for the installation delete operation.
|
|
53
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
54
|
+
*/
|
|
55
|
+
deleteInstallation(installationId, options = {}) {
|
|
56
|
+
return deleteInstallationMethod(this._client, installationId, options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets an Azure Notification Hub installation by the installation ID.
|
|
60
|
+
* @param installationId - The ID of the installation to get.
|
|
61
|
+
* @param options - Configuration options for the get installation operation.
|
|
62
|
+
* @returns The installation that matches the installation ID.
|
|
63
|
+
*/
|
|
64
|
+
getInstallation(installationId, options = {}) {
|
|
65
|
+
return getInstallationMethod(this._client, installationId, options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Updates an installation using the JSON-Patch standard in RFC6902.
|
|
69
|
+
* @param installationId - The ID of the installation to update.
|
|
70
|
+
* @param patches - An array of patches following the JSON-Patch standard.
|
|
71
|
+
* @param options - Configuration options for the patch installation operation.
|
|
72
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
73
|
+
*/
|
|
74
|
+
updateInstallation(installationId, patches, options = {}) {
|
|
75
|
+
return updateInstallationMethod(this._client, installationId, patches, options);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new registration ID.
|
|
79
|
+
* @param options - The options for creating a new registration ID.
|
|
80
|
+
* @returns The newly created registration ID.
|
|
81
|
+
*/
|
|
82
|
+
createRegistrationId(options = {}) {
|
|
83
|
+
return createRegistrationIdMethod(this._client, options);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new registration. This method generates a registration ID,
|
|
87
|
+
* which you can subsequently use to retrieve, update, and delete this registration.
|
|
88
|
+
* @param registration - The registration to create.
|
|
89
|
+
* @param options - Options for creating a new registration.
|
|
90
|
+
* @returns The newly created registration description.
|
|
91
|
+
*/
|
|
92
|
+
createRegistration(registration, options = {}) {
|
|
93
|
+
return createRegistrationMethod(this._client, registration, options);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates or updates a registration.
|
|
97
|
+
* @param registration - The registration to create or update.
|
|
98
|
+
* @param options - The operation options.
|
|
99
|
+
* @returns The created or updated registration description.
|
|
100
|
+
*/
|
|
101
|
+
createOrUpdateRegistration(registration, options = {}) {
|
|
102
|
+
return createOrUpdateRegistrationMethod(this._client, registration, options);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates an existing registration.
|
|
106
|
+
* @param registration - The registration to update.
|
|
107
|
+
* @param options - The operation options.
|
|
108
|
+
* @returns The updated registration description.
|
|
109
|
+
*/
|
|
110
|
+
updateRegistration(registration, options = {}) {
|
|
111
|
+
return updateRegistrationMethod(this._client, registration, options);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets a registration by the given registration ID.
|
|
115
|
+
* @param registrationId - The ID of the registration to get.
|
|
116
|
+
* @param options - The options for getting a registration by ID.
|
|
117
|
+
* @returns A RegistrationDescription that has the given registration ID.
|
|
118
|
+
*/
|
|
119
|
+
getRegistration(registrationId, options = {}) {
|
|
120
|
+
return getRegistrationMethod(this._client, registrationId, options);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets all registrations for the notification hub with the given query options.
|
|
124
|
+
* @param options - The options for querying the registrations such as $top and $filter.
|
|
125
|
+
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
126
|
+
*/
|
|
127
|
+
listRegistrations(options = {}) {
|
|
128
|
+
return listRegistrationsMethod(this._client, options);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Lists all registrations with the matching tag.
|
|
132
|
+
* @param tag - The tag to query for matching registrations.
|
|
133
|
+
* @param options - The query options such as $top.
|
|
134
|
+
* @returns A paged async iterable containing the matching registrations for the notification hub.
|
|
135
|
+
*/
|
|
136
|
+
listRegistrationsByTag(tag, options = {}) {
|
|
137
|
+
return listRegistrationsByTagMethod(this._client, tag, options);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Sends a direct push notification to a device with the given push handle.
|
|
141
|
+
* @param pushHandle - The push handle which is the unique identifier for the device.
|
|
142
|
+
* @param notification - The notification to send to the device.
|
|
143
|
+
* @param options - Configuration options for the direct send operation which can contain custom headers
|
|
144
|
+
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
145
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
146
|
+
*/
|
|
147
|
+
sendDirectNotification(pushHandle, notification, options = {}) {
|
|
148
|
+
return sendDirectNotificationMethod(this._client, pushHandle, notification, options);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Sends push notifications to devices that match the given tags or tag expression.
|
|
152
|
+
* @param tags - The tags used to target the device for push notifications in either an array or tag expression.
|
|
153
|
+
* @param notification - The notification to send to the matching devices.
|
|
154
|
+
* @param options - Configuration options for the direct send operation which can contain custom headers
|
|
155
|
+
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
156
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
157
|
+
*/
|
|
158
|
+
sendNotification(tags, notification, options = {}) {
|
|
159
|
+
return sendNotificationMethod(this._client, tags, notification, options);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Sends push notifications to all devices on the Notification Hub.
|
|
163
|
+
* @param notification - The notification to send to all devices.
|
|
164
|
+
* @param options - Configuration options for the direct send operation which can contain custom headers
|
|
165
|
+
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
166
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
167
|
+
*/
|
|
168
|
+
sendBroadcastNotification(notification, options = {}) {
|
|
169
|
+
return sendBroadcastNotificationMethod(this._client, notification, options);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
173
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
174
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
175
|
+
* @param tags - The tags used to target the device for push notifications in either an array or tag expression.
|
|
176
|
+
* @param notification - The notification to send to the matching devices.
|
|
177
|
+
* @param options - Configuration options for the direct send operation which can contain custom headers
|
|
178
|
+
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
179
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
180
|
+
*/
|
|
181
|
+
scheduleNotification(scheduledTime, tags, notification, options = {}) {
|
|
182
|
+
return scheduleNotificationMethod(this._client, scheduledTime, tags, notification, options);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Schedules a push notification to all devices registered on the Notification Hub.
|
|
186
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
187
|
+
* @param scheduledTime - The Date to send the push notification.
|
|
188
|
+
* @param notification - The notification to send to the matching devices.
|
|
189
|
+
* @param options - Configuration options for the direct send operation which can contain custom headers
|
|
190
|
+
* which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
|
|
191
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
192
|
+
*/
|
|
193
|
+
scheduleBroadcastNotification(scheduledTime, notification, options = {}) {
|
|
194
|
+
return scheduleBroadcastNotificationMethod(this._client, scheduledTime, notification, options);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Cancels the scheduled notification with the given notification ID.
|
|
198
|
+
* @param notificationId - The notification ID from the scheduled notification.
|
|
199
|
+
* @param options - The operation options.
|
|
200
|
+
* @returns A notification hub response with correlation ID and tracking ID.
|
|
201
|
+
*/
|
|
202
|
+
cancelScheduledNotification(notificationId, options = {}) {
|
|
203
|
+
return cancelScheduledNotificationMethod(this._client, notificationId, options);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.
|
|
207
|
+
* The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.
|
|
208
|
+
* @param options - The options for getting the push notification feedback container URL.
|
|
209
|
+
* @returns The URL of the Azure Storage Container containing the feedback data.
|
|
210
|
+
*/
|
|
211
|
+
getFeedbackContainerUrl(options = {}) {
|
|
212
|
+
return getFeedbackContainerUrlMethod(this._client, options);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed
|
|
216
|
+
* or final results if the Send* has completed. This API can only be called for Standard SKU and above.
|
|
217
|
+
* @param notificationId - The notification ID returned from the send operation.
|
|
218
|
+
* @param options - The operation options.
|
|
219
|
+
* @returns The results of the send operation.
|
|
220
|
+
*/
|
|
221
|
+
getNotificationOutcomeDetails(notificationId, options = {}) {
|
|
222
|
+
return getNotificationOutcomeDetailsMethod(this._client, notificationId, options);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Gets a Notification Hub Job by the ID.
|
|
226
|
+
* @param jobId - The Notification Hub Job ID.
|
|
227
|
+
* @param options - The operation options.
|
|
228
|
+
* @returns The Notification Hub Job with the matching ID.
|
|
229
|
+
*/
|
|
230
|
+
getNotificationHubJob(jobId, options = {}) {
|
|
231
|
+
return getNotificationHubJobMethod(this._client, jobId, options);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Submits a Notification Hub Job. Note this is available to Standard SKU namespace and above.
|
|
235
|
+
* @param job - The notification hub job to submit.
|
|
236
|
+
* @param options - The operation options.
|
|
237
|
+
* @returns The notification hub job details including job ID and status.
|
|
238
|
+
*/
|
|
239
|
+
submitNotificationHubJob(job, options = {}) {
|
|
240
|
+
return submitNotificationHubJobMethod(this._client, job, options);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Gets all Notification Hub Jobs for this Notification Hub.
|
|
244
|
+
* @param options - The operation options.
|
|
245
|
+
* @returns An array of all Notification Hub Jobs for this Notification Hub.
|
|
246
|
+
*/
|
|
247
|
+
listNotificationHubJobs(options = {}) {
|
|
248
|
+
return listNotificationHubJobsMethod(this._client, options);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=notificationHubsClient.js.map
|
|
@@ -0,0 +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,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAE,kBAAkB,IAAI,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAE,uBA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;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"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getDateOrUndefined, getInteger, getStringOrUndefined, isDefined } from "../utils/utils.js";
|
|
4
|
+
import { parseXML } from "@azure/core-xml";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Parses a NotificationDetails from incoming XML.
|
|
8
|
+
*/
|
|
9
|
+
export async function parseNotificationDetails(bodyText) {
|
|
10
|
+
const xml = await parseXML(bodyText, {
|
|
11
|
+
includeRoot: true,
|
|
12
|
+
stopNodes: ["NotificationDetails.NotificationBody"],
|
|
13
|
+
});
|
|
14
|
+
const notificationDetails = xml["NotificationDetails"];
|
|
15
|
+
let apnsOutcomeCounts;
|
|
16
|
+
if (isDefined(notificationDetails["ApnsOutcomeCounts"])) {
|
|
17
|
+
apnsOutcomeCounts = parseOutcomeCounts(notificationDetails["ApnsOutcomeCounts"]["Outcome"]);
|
|
18
|
+
}
|
|
19
|
+
let admOutcomeCounts;
|
|
20
|
+
if (isDefined(notificationDetails["AdmOutcomeCounts"])) {
|
|
21
|
+
admOutcomeCounts = parseOutcomeCounts(notificationDetails["AdmOutcomeCounts"]["Outcome"]);
|
|
22
|
+
}
|
|
23
|
+
let baiduOutcomeCounts;
|
|
24
|
+
if (isDefined(notificationDetails["BaiduOutcomeCounts"])) {
|
|
25
|
+
baiduOutcomeCounts = parseOutcomeCounts(notificationDetails["BaiduOutcomeCounts"]["Outcome"]);
|
|
26
|
+
}
|
|
27
|
+
let fcmOutcomeCounts;
|
|
28
|
+
if (isDefined(notificationDetails["GcmOutcomeCounts"])) {
|
|
29
|
+
fcmOutcomeCounts = parseOutcomeCounts(notificationDetails["GcmOutcomeCounts"]["Outcome"]);
|
|
30
|
+
}
|
|
31
|
+
let wnsOutcomeCounts;
|
|
32
|
+
if (isDefined(notificationDetails["WnsOutcomeCounts"])) {
|
|
33
|
+
wnsOutcomeCounts = parseOutcomeCounts(notificationDetails["WnsOutcomeCounts"]["Outcome"]);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
notificationId: getStringOrUndefined(notificationDetails["NotificationId"]),
|
|
37
|
+
location: getStringOrUndefined(notificationDetails["Location"]),
|
|
38
|
+
state: getStringOrUndefined(notificationDetails["State"]),
|
|
39
|
+
enqueueTime: getDateOrUndefined(notificationDetails["EnqueueTime"]),
|
|
40
|
+
startTime: getDateOrUndefined(notificationDetails["StartTime"]),
|
|
41
|
+
endTime: getDateOrUndefined(notificationDetails["EndTime"]),
|
|
42
|
+
pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails["PnsErrorDetailsUri"]),
|
|
43
|
+
targetPlatforms: getStringOrUndefined(notificationDetails["TargetPlatforms"]),
|
|
44
|
+
apnsOutcomeCounts,
|
|
45
|
+
admOutcomeCounts,
|
|
46
|
+
baiduOutcomeCounts,
|
|
47
|
+
fcmOutcomeCounts,
|
|
48
|
+
wnsOutcomeCounts,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function parseOutcomeCounts(counts) {
|
|
52
|
+
const results = [];
|
|
53
|
+
for (const item of counts) {
|
|
54
|
+
results.push({ state: item["Name"], count: getInteger(item["Count"], "Count") });
|
|
55
|
+
}
|
|
56
|
+
return results;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=notificationDetailsSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationDetailsSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationDetailsSerializer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB;IAC7D,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE;QACnC,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,CAAC,sCAAsC,CAAC;KACpD,CAAC,CAAC;IACH,MAAM,mBAAmB,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAEvD,IAAI,iBAAkE,CAAC;IACvE,IAAI,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,EAAE;QACvD,iBAAiB,GAAG,kBAAkB,CAAC,mBAA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C;QAC3D,kBAAkB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;QACnF,eAAe,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;QAC7E,iBAAiB;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA6B;IACvD,MAAM,OAAO,GAAwC,EAAE,CAAC;IACxD,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;QACzB,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;KAClF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n NotificationDetails,\n NotificationOutcomeCollectionItem,\n NotificationOutcomeState,\n} from \"../models/notificationDetails.js\";\nimport { getDateOrUndefined, getInteger, getStringOrUndefined, isDefined } from \"../utils/utils.js\";\nimport { parseXML } from \"@azure/core-xml\";\n\n/**\n * @internal\n * Parses a NotificationDetails from incoming XML.\n */\nexport async function parseNotificationDetails(bodyText: string): Promise<NotificationDetails> {\n const xml = await parseXML(bodyText, {\n includeRoot: true,\n stopNodes: [\"NotificationDetails.NotificationBody\"],\n });\n const notificationDetails = xml[\"NotificationDetails\"];\n\n let apnsOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"ApnsOutcomeCounts\"])) {\n apnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"ApnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n let admOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"AdmOutcomeCounts\"])) {\n admOutcomeCounts = parseOutcomeCounts(notificationDetails[\"AdmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let baiduOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"BaiduOutcomeCounts\"])) {\n baiduOutcomeCounts = parseOutcomeCounts(notificationDetails[\"BaiduOutcomeCounts\"][\"Outcome\"]);\n }\n\n let fcmOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"GcmOutcomeCounts\"])) {\n fcmOutcomeCounts = parseOutcomeCounts(notificationDetails[\"GcmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let wnsOutcomeCounts: NotificationOutcomeCollectionItem[] | undefined;\n if (isDefined(notificationDetails[\"WnsOutcomeCounts\"])) {\n wnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"WnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n return {\n notificationId: getStringOrUndefined(notificationDetails[\"NotificationId\"]),\n location: getStringOrUndefined(notificationDetails[\"Location\"]),\n state: getStringOrUndefined(notificationDetails[\"State\"]) as NotificationOutcomeState,\n enqueueTime: getDateOrUndefined(notificationDetails[\"EnqueueTime\"]),\n startTime: getDateOrUndefined(notificationDetails[\"StartTime\"]),\n endTime: getDateOrUndefined(notificationDetails[\"EndTime\"]),\n pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails[\"PnsErrorDetailsUri\"]),\n targetPlatforms: getStringOrUndefined(notificationDetails[\"TargetPlatforms\"]),\n apnsOutcomeCounts,\n admOutcomeCounts,\n baiduOutcomeCounts,\n fcmOutcomeCounts,\n wnsOutcomeCounts,\n };\n}\n\nfunction parseOutcomeCounts(counts: Record<string, any>[]): NotificationOutcomeCollectionItem[] {\n const results: NotificationOutcomeCollectionItem[] = [];\n for (const item of counts) {\n results.push({ state: item[\"Name\"], count: getInteger(item[\"Count\"], \"Count\") });\n }\n\n return results;\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { getDateOrUndefined, getFloatOrUndefined, getString, getStringOrUndefined, isDefined, } from "../utils/utils.js";
|
|
4
|
+
import { parseXML, stringifyXML } from "@azure/core-xml";
|
|
5
|
+
import { serializeToAtomXmlRequest } from "../utils/xmlUtils.js";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Serializes a NotificationHubJob into an Atom XML entry.
|
|
9
|
+
* @param entry - The NotificationHubJob to turn into an Atom XML entry.
|
|
10
|
+
* @returns An Atom XML entry containing the notification hub job.
|
|
11
|
+
*/
|
|
12
|
+
export function serializeNotificationHubJobEntry(entry) {
|
|
13
|
+
const job = {
|
|
14
|
+
Type: entry.type,
|
|
15
|
+
OutputContainerUri: { __cdata: entry.outputContainerUrl },
|
|
16
|
+
ImportFileUri: isDefined(entry.importFileUrl) ? { __cdata: entry.importFileUrl } : undefined,
|
|
17
|
+
};
|
|
18
|
+
const requestObject = serializeToAtomXmlRequest("NotificationHubJob", job);
|
|
19
|
+
return stringifyXML(requestObject, { rootName: "entry", cdataPropName: "__cdata" });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parses an Atom XML of an notification hub job entry.
|
|
23
|
+
* @param bodyText - The incoming Atom XML entry to parse into a notification hub job.
|
|
24
|
+
* @returns A parsed NotificationHubJob.
|
|
25
|
+
*/
|
|
26
|
+
export async function parseNotificationHubJobEntry(bodyText) {
|
|
27
|
+
const xml = await parseXML(bodyText, { includeRoot: true });
|
|
28
|
+
const content = xml.entry.content.NotificationHubJob;
|
|
29
|
+
return createNotificationHubJob(content);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parses an Atom XML feed of notification hub jobs.
|
|
33
|
+
* @param bodyText - The incoming Atom XML feed to parse into notification hub jobs.
|
|
34
|
+
* @returns A list of notification hub jobs.
|
|
35
|
+
*/
|
|
36
|
+
export async function parseNotificationHubJobFeed(bodyText) {
|
|
37
|
+
const xml = await parseXML(bodyText, { includeRoot: true });
|
|
38
|
+
const results = [];
|
|
39
|
+
for (const item of xml.feed.entry) {
|
|
40
|
+
results.push(createNotificationHubJob(item.content.NotificationHubJob));
|
|
41
|
+
}
|
|
42
|
+
return results;
|
|
43
|
+
}
|
|
44
|
+
function createInputOutputProperties(content) {
|
|
45
|
+
const props = {};
|
|
46
|
+
for (const item of content["d3p1:KeyValueOfstringstring"]) {
|
|
47
|
+
props[item["d3p1:Key"]] = item["d3p1:Value"];
|
|
48
|
+
}
|
|
49
|
+
return props;
|
|
50
|
+
}
|
|
51
|
+
function createNotificationHubJob(content) {
|
|
52
|
+
let outputProperties;
|
|
53
|
+
if (isDefined(content["OutputProperties"])) {
|
|
54
|
+
outputProperties = createInputOutputProperties(content["OutputProperties"]);
|
|
55
|
+
}
|
|
56
|
+
let inputProperties;
|
|
57
|
+
if (isDefined(content["InputProperties"])) {
|
|
58
|
+
inputProperties = createInputOutputProperties(content["InputProperties"]);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
jobId: getStringOrUndefined(content["JobId"]),
|
|
62
|
+
type: getString(content["Type"], "type"),
|
|
63
|
+
status: getStringOrUndefined(content["Status"]),
|
|
64
|
+
progress: getFloatOrUndefined(content["Progress"]),
|
|
65
|
+
outputContainerUrl: getString(content["OutputContainerUri"], "outputContainerUrl"),
|
|
66
|
+
importFileUrl: getStringOrUndefined(content["ImportFileUri"]),
|
|
67
|
+
failure: getStringOrUndefined(content["Failure"]),
|
|
68
|
+
createdAt: getDateOrUndefined(content["CreatedAt"]),
|
|
69
|
+
updatedAt: getDateOrUndefined(content["UpdatedAt"]),
|
|
70
|
+
inputProperties,
|
|
71
|
+
outputProperties,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=notificationHubJobSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationHubJobSerializer.js","sourceRoot":"","sources":["../../../src/serializers/notificationHubJobSerializer.ts"],"names":[],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;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 = [];\n for (const item of xml.feed.entry) {\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"]}
|