@azure/notification-hubs 2.0.1-alpha.20250619.1 → 2.0.1-alpha.20250729.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/api/beginSubmitNotificationHubJob.js +6 -7
- package/dist/browser/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist/browser/api/clientContext.js +12 -5
- package/dist/browser/api/clientContext.js.map +1 -1
- package/dist/browser/api/internal/_client.js +21 -4
- package/dist/browser/api/internal/_client.js.map +1 -1
- package/dist/browser/api/internal/_listRegistrations.js +13 -31
- package/dist/browser/api/internal/_listRegistrations.js.map +1 -1
- package/dist/browser/api/listRegistrationsByChannel.js +4 -1
- package/dist/browser/api/listRegistrationsByChannel.js.map +1 -1
- package/dist/browser/api/listRegistrationsByTag.js +13 -31
- package/dist/browser/api/listRegistrationsByTag.js.map +1 -1
- package/dist/browser/auth/sasTokenCredential.js +4 -0
- package/dist/browser/auth/sasTokenCredential.js.map +1 -1
- package/dist/browser/models/installation.js +32 -8
- package/dist/browser/models/installation.js.map +1 -1
- package/dist/browser/models/notification.js +69 -13
- package/dist/browser/models/notification.js.map +1 -1
- package/dist/browser/models/registration.js +64 -16
- package/dist/browser/models/registration.js.map +1 -1
- package/dist/browser/notificationHubsClient.js +1 -0
- package/dist/browser/notificationHubsClient.js.map +1 -1
- package/dist/browser/serializers/notificationDetailsSerializer.js +6 -7
- package/dist/browser/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist/browser/serializers/notificationHubJobSerializer.js +4 -5
- package/dist/browser/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist/browser/serializers/registrationSerializer.js +185 -48
- package/dist/browser/serializers/registrationSerializer.js.map +1 -1
- package/dist/browser/utils/xmlUtils.js +1 -1
- package/dist/browser/utils/xmlUtils.js.map +1 -1
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js +6 -7
- package/dist/commonjs/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist/commonjs/api/clientContext.js +12 -5
- package/dist/commonjs/api/clientContext.js.map +1 -1
- package/dist/commonjs/api/internal/_client.js +21 -4
- package/dist/commonjs/api/internal/_client.js.map +1 -1
- package/dist/commonjs/api/internal/_listRegistrations.js +13 -31
- package/dist/commonjs/api/internal/_listRegistrations.js.map +1 -1
- package/dist/commonjs/api/listRegistrationsByChannel.js +4 -1
- package/dist/commonjs/api/listRegistrationsByChannel.js.map +1 -1
- package/dist/commonjs/api/listRegistrationsByTag.js +13 -31
- package/dist/commonjs/api/listRegistrationsByTag.js.map +1 -1
- package/dist/commonjs/auth/sasTokenCredential.js +4 -0
- package/dist/commonjs/auth/sasTokenCredential.js.map +1 -1
- package/dist/commonjs/models/installation.js +32 -8
- package/dist/commonjs/models/installation.js.map +1 -1
- package/dist/commonjs/models/notification.js +69 -13
- package/dist/commonjs/models/notification.js.map +1 -1
- package/dist/commonjs/models/registration.js +64 -16
- package/dist/commonjs/models/registration.js.map +1 -1
- package/dist/commonjs/notificationHubsClient.js +1 -0
- package/dist/commonjs/notificationHubsClient.js.map +1 -1
- package/dist/commonjs/serializers/notificationDetailsSerializer.js +6 -7
- package/dist/commonjs/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist/commonjs/serializers/notificationHubJobSerializer.js +4 -5
- package/dist/commonjs/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist/commonjs/serializers/registrationSerializer.js +185 -48
- package/dist/commonjs/serializers/registrationSerializer.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/commonjs/utils/xmlUtils.js +1 -1
- package/dist/commonjs/utils/xmlUtils.js.map +1 -1
- package/dist/esm/api/beginSubmitNotificationHubJob.js +6 -7
- package/dist/esm/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist/esm/api/clientContext.js +12 -5
- package/dist/esm/api/clientContext.js.map +1 -1
- package/dist/esm/api/internal/_client.js +21 -4
- package/dist/esm/api/internal/_client.js.map +1 -1
- package/dist/esm/api/internal/_listRegistrations.js +13 -31
- package/dist/esm/api/internal/_listRegistrations.js.map +1 -1
- package/dist/esm/api/listRegistrationsByChannel.js +4 -1
- package/dist/esm/api/listRegistrationsByChannel.js.map +1 -1
- package/dist/esm/api/listRegistrationsByTag.js +13 -31
- package/dist/esm/api/listRegistrationsByTag.js.map +1 -1
- package/dist/esm/auth/sasTokenCredential.js +4 -0
- package/dist/esm/auth/sasTokenCredential.js.map +1 -1
- package/dist/esm/models/installation.js +32 -8
- package/dist/esm/models/installation.js.map +1 -1
- package/dist/esm/models/notification.js +69 -13
- package/dist/esm/models/notification.js.map +1 -1
- package/dist/esm/models/registration.js +64 -16
- package/dist/esm/models/registration.js.map +1 -1
- package/dist/esm/notificationHubsClient.js +1 -0
- package/dist/esm/notificationHubsClient.js.map +1 -1
- package/dist/esm/serializers/notificationDetailsSerializer.js +6 -7
- package/dist/esm/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist/esm/serializers/notificationHubJobSerializer.js +4 -5
- package/dist/esm/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist/esm/serializers/registrationSerializer.js +185 -48
- package/dist/esm/serializers/registrationSerializer.js.map +1 -1
- package/dist/esm/utils/xmlUtils.js +1 -1
- package/dist/esm/utils/xmlUtils.js.map +1 -1
- package/dist/react-native/api/beginSubmitNotificationHubJob.js +6 -7
- package/dist/react-native/api/beginSubmitNotificationHubJob.js.map +1 -1
- package/dist/react-native/api/clientContext.js +12 -5
- package/dist/react-native/api/clientContext.js.map +1 -1
- package/dist/react-native/api/internal/_client.js +21 -4
- package/dist/react-native/api/internal/_client.js.map +1 -1
- package/dist/react-native/api/internal/_listRegistrations.js +13 -31
- package/dist/react-native/api/internal/_listRegistrations.js.map +1 -1
- package/dist/react-native/api/listRegistrationsByChannel.js +4 -1
- package/dist/react-native/api/listRegistrationsByChannel.js.map +1 -1
- package/dist/react-native/api/listRegistrationsByTag.js +13 -31
- package/dist/react-native/api/listRegistrationsByTag.js.map +1 -1
- package/dist/react-native/auth/sasTokenCredential.js +4 -0
- package/dist/react-native/auth/sasTokenCredential.js.map +1 -1
- package/dist/react-native/models/installation.js +32 -8
- package/dist/react-native/models/installation.js.map +1 -1
- package/dist/react-native/models/notification.js +69 -13
- package/dist/react-native/models/notification.js.map +1 -1
- package/dist/react-native/models/registration.js +64 -16
- package/dist/react-native/models/registration.js.map +1 -1
- package/dist/react-native/notificationHubsClient.js +1 -0
- package/dist/react-native/notificationHubsClient.js.map +1 -1
- package/dist/react-native/serializers/notificationDetailsSerializer.js +6 -7
- package/dist/react-native/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist/react-native/serializers/notificationHubJobSerializer.js +4 -5
- package/dist/react-native/serializers/notificationHubJobSerializer.js.map +1 -1
- package/dist/react-native/serializers/registrationSerializer.js +185 -48
- package/dist/react-native/serializers/registrationSerializer.js.map +1 -1
- package/dist/react-native/utils/xmlUtils.js +1 -1
- package/dist/react-native/utils/xmlUtils.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AASnD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAmED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAqC;IAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjG,uCACK,YAAY,KACf,IAAI,EACJ,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AA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S,CAAC,OAAO,CAAC;IAC9D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport * as Constants from \"../utils/constants.js\";\nimport type {\n AdmNativeMessage,\n AppleNativeMessage,\n FirebaseLegacyNativeMessage,\n FirebaseV1NativeMessage,\n} from \"./notificationBodyBuilder.js\";\nimport type { AppleHeaders, WindowsHeaders } from \"./notificationHeaderBuilder.js\";\n\nfunction isString(value: unknown): value is string {\n return typeof value === \"string\" || value instanceof String;\n}\n\n/**\n * Represents a notification that can be sent to a device.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * The common notification parameters to accept a string body or JSON body.\n */\nexport interface NotificationCommonParams {\n /**\n * The body for the push notification.\n */\n body: string | unknown;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Represents an Apple notification that can be sent to a device.\n */\nexport interface AppleNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AppleNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: AppleHeaders;\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(notification: AppleNotificationParams): AppleNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Represents an ADM notification that can be sent to a device.\n */\nexport interface AdmNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AdmNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(notification: AdmNotificationParams): AdmNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: NotificationCommonParams,\n): BrowserNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FcmLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Represents an Firebase Legacy notification that can be sent to a device.\n */\nexport interface FcmLegacyNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseLegacyNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmLegacyNotification(\n notification: FcmLegacyNotificationParams,\n): FcmLegacyNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Firebase V1 API notification that can be sent to a device.\n */\nexport interface FcmV1Notification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Represents an Firebase V1 notification that can be sent to a device.\n */\nexport interface FcmV1NotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseV1NativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmV1Notification(notification: FcmV1NotificationParams): FcmV1Notification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"fcmv1\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Xiaomi push notification.\n */\nexport interface XiaomiNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a notification to send to Xiaomi.\n * @param notification - A partial message used to create a message for Xiaomi.\n * @returns A newly created Xiaomi notification.\n */\nexport function createXiaomiNotification(\n notification: NotificationCommonParams,\n): XiaomiNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"xiaomi\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a template notification.\n * @param notification - A partial message used to be used for a template notification.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: NotificationCommonParams,\n): TemplateNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"windows\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Represents a WNS notification that can be sent to a device.\n */\nexport interface WnsNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: WindowsHeaders;\n}\n\n/**\n * Creates a notification to send to WNS.\n * @param notification - The WNS notification to send.\n * @returns A newly created WNS message.\n */\nexport function createWindowsNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n if (notification?.headers && notification.headers[\"X-WNS-Type\"]) {\n const wnsType = notification.headers[\"X-WNS-Type\"];\n switch (wnsType) {\n case Constants.WNS_TOAST:\n return createWindowsToastNotification(notification);\n case Constants.WNS_TITLE:\n return createWindowsTileNotification(notification);\n case Constants.WNS_BADGE:\n return createWindowsBadgeNotification(notification);\n case Constants.WNS_RAW:\n return createWindowsRawNotification(notification);\n default:\n throw new Error(`Invalid WNS type: ${wnsType}`);\n }\n } else {\n throw new Error(`Missing WNS type in headers`);\n }\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n }\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n }\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n }\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n }\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FcmLegacyNotification\n | FcmV1Notification\n | XiaomiNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AASnD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAmED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAqC;IAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjG,OAAO;QACL,GAAG,YAAY;QACf,IAAI;QACJ,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,SAAS,CAAC,iBAAiB;KACzC,CAAC;AACJ,CAAC;AA2BD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAmC;IACvE,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjG,OAAO;QACL,GAAG,YAAY;QACf,IAAI;QACJ,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,SAAS,CAAC,iBAAiB;KACzC,CAAC;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAsC;IAC5E,MAAM,IAAI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E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,YAAmC;IAEnC,MAAM,MAAM,GAAwB;QAClC,GAAG,YAAY;QACf,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,SAAS,CAAC,gBAAgB;KACxC,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,YAAmC;IAEnC,MAAM,MAAM,GAAwB;QAClC,GAAG,YAAY;QACf,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,SAAS,CAAC,mBAAmB;KAC3C,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;IAC9D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport * as Constants from \"../utils/constants.js\";\nimport type {\n AdmNativeMessage,\n AppleNativeMessage,\n FirebaseLegacyNativeMessage,\n FirebaseV1NativeMessage,\n} from \"./notificationBodyBuilder.js\";\nimport type { AppleHeaders, WindowsHeaders } from \"./notificationHeaderBuilder.js\";\n\nfunction isString(value: unknown): value is string {\n return typeof value === \"string\" || value instanceof String;\n}\n\n/**\n * Represents a notification that can be sent to a device.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * The common notification parameters to accept a string body or JSON body.\n */\nexport interface NotificationCommonParams {\n /**\n * The body for the push notification.\n */\n body: string | unknown;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Represents an Apple notification that can be sent to a device.\n */\nexport interface AppleNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AppleNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: AppleHeaders;\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(notification: AppleNotificationParams): AppleNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Represents an ADM notification that can be sent to a device.\n */\nexport interface AdmNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AdmNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(notification: AdmNotificationParams): AdmNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: NotificationCommonParams,\n): BrowserNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FcmLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Represents an Firebase Legacy notification that can be sent to a device.\n */\nexport interface FcmLegacyNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseLegacyNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmLegacyNotification(\n notification: FcmLegacyNotificationParams,\n): FcmLegacyNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Firebase V1 API notification that can be sent to a device.\n */\nexport interface FcmV1Notification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Represents an Firebase V1 notification that can be sent to a device.\n */\nexport interface FcmV1NotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseV1NativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmV1Notification(notification: FcmV1NotificationParams): FcmV1Notification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"fcmv1\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Xiaomi push notification.\n */\nexport interface XiaomiNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a notification to send to Xiaomi.\n * @param notification - A partial message used to create a message for Xiaomi.\n * @returns A newly created Xiaomi notification.\n */\nexport function createXiaomiNotification(\n notification: NotificationCommonParams,\n): XiaomiNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"xiaomi\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a template notification.\n * @param notification - A partial message used to be used for a template notification.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: NotificationCommonParams,\n): TemplateNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"windows\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Represents a WNS notification that can be sent to a device.\n */\nexport interface WnsNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: WindowsHeaders;\n}\n\n/**\n * Creates a notification to send to WNS.\n * @param notification - The WNS notification to send.\n * @returns A newly created WNS message.\n */\nexport function createWindowsNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n if (notification?.headers && notification.headers[\"X-WNS-Type\"]) {\n const wnsType = notification.headers[\"X-WNS-Type\"];\n switch (wnsType) {\n case Constants.WNS_TOAST:\n return createWindowsToastNotification(notification);\n case Constants.WNS_TITLE:\n return createWindowsTileNotification(notification);\n case Constants.WNS_BADGE:\n return createWindowsBadgeNotification(notification);\n case Constants.WNS_RAW:\n return createWindowsRawNotification(notification);\n default:\n throw new Error(`Invalid WNS type: ${wnsType}`);\n }\n } else {\n throw new Error(`Missing WNS type in headers`);\n }\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n }\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n }\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n }\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n }\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FcmLegacyNotification\n | FcmV1Notification\n | XiaomiNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* @returns A created ADM registration description.
|
|
7
7
|
*/
|
|
8
8
|
export function createAdmRegistrationDescription(description) {
|
|
9
|
-
return
|
|
9
|
+
return {
|
|
10
|
+
...description,
|
|
11
|
+
kind: "Adm",
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Creates an ADM template registration description.
|
|
@@ -14,7 +17,10 @@ export function createAdmRegistrationDescription(description) {
|
|
|
14
17
|
* @returns A created ADM template registration description.
|
|
15
18
|
*/
|
|
16
19
|
export function createAdmTemplateRegistrationDescription(description) {
|
|
17
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
...description,
|
|
22
|
+
kind: "AdmTemplate",
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* Creates an Apple registration description.
|
|
@@ -22,7 +28,10 @@ export function createAdmTemplateRegistrationDescription(description) {
|
|
|
22
28
|
* @returns A created Apple registration description.
|
|
23
29
|
*/
|
|
24
30
|
export function createAppleRegistrationDescription(description) {
|
|
25
|
-
return
|
|
31
|
+
return {
|
|
32
|
+
...description,
|
|
33
|
+
kind: "Apple",
|
|
34
|
+
};
|
|
26
35
|
}
|
|
27
36
|
/**
|
|
28
37
|
* Creates an Apple template registration description.
|
|
@@ -30,7 +39,10 @@ export function createAppleRegistrationDescription(description) {
|
|
|
30
39
|
* @returns A created Apple template registration description.
|
|
31
40
|
*/
|
|
32
41
|
export function createAppleTemplateRegistrationDescription(description) {
|
|
33
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
...description,
|
|
44
|
+
kind: "AppleTemplate",
|
|
45
|
+
};
|
|
34
46
|
}
|
|
35
47
|
/**
|
|
36
48
|
* Creates a Baidu registration description.
|
|
@@ -38,7 +50,10 @@ export function createAppleTemplateRegistrationDescription(description) {
|
|
|
38
50
|
* @returns A created Baidu registration description.
|
|
39
51
|
*/
|
|
40
52
|
export function createBaiduRegistrationDescription(description) {
|
|
41
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
...description,
|
|
55
|
+
kind: "Baidu",
|
|
56
|
+
};
|
|
42
57
|
}
|
|
43
58
|
/**
|
|
44
59
|
* Creates a Baidu template registration description.
|
|
@@ -46,7 +61,10 @@ export function createBaiduRegistrationDescription(description) {
|
|
|
46
61
|
* @returns A created Baidu template registration description.
|
|
47
62
|
*/
|
|
48
63
|
export function createBaiduTemplateRegistrationDescription(description) {
|
|
49
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
...description,
|
|
66
|
+
kind: "BaiduTemplate",
|
|
67
|
+
};
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
52
70
|
* Creates a Web Push registration description.
|
|
@@ -54,7 +72,10 @@ export function createBaiduTemplateRegistrationDescription(description) {
|
|
|
54
72
|
* @returns A created Web Push registration description.
|
|
55
73
|
*/
|
|
56
74
|
export function createBrowserRegistrationDescription(description) {
|
|
57
|
-
return
|
|
75
|
+
return {
|
|
76
|
+
...description,
|
|
77
|
+
kind: "Browser",
|
|
78
|
+
};
|
|
58
79
|
}
|
|
59
80
|
/**
|
|
60
81
|
* Creates a Web Push registration description.
|
|
@@ -62,7 +83,10 @@ export function createBrowserRegistrationDescription(description) {
|
|
|
62
83
|
* @returns A created Web Push template registration description.
|
|
63
84
|
*/
|
|
64
85
|
export function createBrowserTemplateRegistrationDescription(description) {
|
|
65
|
-
return
|
|
86
|
+
return {
|
|
87
|
+
...description,
|
|
88
|
+
kind: "BrowserTemplate",
|
|
89
|
+
};
|
|
66
90
|
}
|
|
67
91
|
/**
|
|
68
92
|
* Creates a Firebase Legacy registration description.
|
|
@@ -70,7 +94,10 @@ export function createBrowserTemplateRegistrationDescription(description) {
|
|
|
70
94
|
* @returns A created GCM registration description.
|
|
71
95
|
*/
|
|
72
96
|
export function createFcmLegacyRegistrationDescription(description) {
|
|
73
|
-
return
|
|
97
|
+
return {
|
|
98
|
+
...description,
|
|
99
|
+
kind: "Gcm",
|
|
100
|
+
};
|
|
74
101
|
}
|
|
75
102
|
/**
|
|
76
103
|
* Creates a GCM template registration description.
|
|
@@ -78,7 +105,10 @@ export function createFcmLegacyRegistrationDescription(description) {
|
|
|
78
105
|
* @returns A created GCM template registration description.
|
|
79
106
|
*/
|
|
80
107
|
export function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
81
|
-
return
|
|
108
|
+
return {
|
|
109
|
+
...description,
|
|
110
|
+
kind: "GcmTemplate",
|
|
111
|
+
};
|
|
82
112
|
}
|
|
83
113
|
/**
|
|
84
114
|
* Creates a Firebase V1 registration description.
|
|
@@ -86,7 +116,10 @@ export function createFcmLegacyTemplateRegistrationDescription(description) {
|
|
|
86
116
|
* @returns A created FCM V1 registration description.
|
|
87
117
|
*/
|
|
88
118
|
export function createFcmV1RegistrationDescription(description) {
|
|
89
|
-
return
|
|
119
|
+
return {
|
|
120
|
+
...description,
|
|
121
|
+
kind: "FcmV1",
|
|
122
|
+
};
|
|
90
123
|
}
|
|
91
124
|
/**
|
|
92
125
|
* Creates a FCM V1 template registration description.
|
|
@@ -94,7 +127,10 @@ export function createFcmV1RegistrationDescription(description) {
|
|
|
94
127
|
* @returns A created FCM V1 template registration description.
|
|
95
128
|
*/
|
|
96
129
|
export function createFcmV1TemplateRegistrationDescription(description) {
|
|
97
|
-
return
|
|
130
|
+
return {
|
|
131
|
+
...description,
|
|
132
|
+
kind: "FcmV1Template",
|
|
133
|
+
};
|
|
98
134
|
}
|
|
99
135
|
/**
|
|
100
136
|
* Creates a Windows registration description.
|
|
@@ -102,7 +138,10 @@ export function createFcmV1TemplateRegistrationDescription(description) {
|
|
|
102
138
|
* @returns A created Windows registration description.
|
|
103
139
|
*/
|
|
104
140
|
export function createWindowsRegistrationDescription(description) {
|
|
105
|
-
return
|
|
141
|
+
return {
|
|
142
|
+
...description,
|
|
143
|
+
kind: "Windows",
|
|
144
|
+
};
|
|
106
145
|
}
|
|
107
146
|
/**
|
|
108
147
|
* Creates a Windows template registration description.
|
|
@@ -110,7 +149,10 @@ export function createWindowsRegistrationDescription(description) {
|
|
|
110
149
|
* @returns A created Windows template registration description.
|
|
111
150
|
*/
|
|
112
151
|
export function createWindowsTemplateRegistrationDescription(description) {
|
|
113
|
-
return
|
|
152
|
+
return {
|
|
153
|
+
...description,
|
|
154
|
+
kind: "WindowsTemplate",
|
|
155
|
+
};
|
|
114
156
|
}
|
|
115
157
|
/**
|
|
116
158
|
* Creates a Xiaomi registration description.
|
|
@@ -118,7 +160,10 @@ export function createWindowsTemplateRegistrationDescription(description) {
|
|
|
118
160
|
* @returns A created Xiaomi registration description.
|
|
119
161
|
*/
|
|
120
162
|
export function createXiaomiRegistrationDescription(description) {
|
|
121
|
-
return
|
|
163
|
+
return {
|
|
164
|
+
...description,
|
|
165
|
+
kind: "Xiaomi",
|
|
166
|
+
};
|
|
122
167
|
}
|
|
123
168
|
/**
|
|
124
169
|
* Creates a Xiaomi template registration description.
|
|
@@ -126,6 +171,9 @@ export function createXiaomiRegistrationDescription(description) {
|
|
|
126
171
|
* @returns A created Xiaomi template registration description.
|
|
127
172
|
*/
|
|
128
173
|
export function createXiaomiTemplateRegistrationDescription(description) {
|
|
129
|
-
return
|
|
174
|
+
return {
|
|
175
|
+
...description,
|
|
176
|
+
kind: "XiaomiTemplate",
|
|
177
|
+
};
|
|
130
178
|
}
|
|
131
179
|
//# sourceMappingURL=registration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA0FlC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,WAA6C;IAE7C,uCACK,WAAW,KACd,IAAI,EAAE,KAAK,IACX;AACJ,CAAC;AAoBD;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,WAAqD;IAErD,uCACK,WAAW,KACd,IAAI,EAAE,aAAa,IACnB;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAA+C;IAE/C,uCACK,WAAW,KACd,IAAI,EAAE,OAAO,IACb;AACJ,CAAC;AAmCD;;;;G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,iBAAiB,IACvB;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CACjD,WAAgD;IAEhD,uCACK,WAAW,KACd,IAAI,EAAE,QAAQ,IACd;AACJ,CAAC;AAoBD;;;;GAIG;AACH,MAAM,UAAU,2CAA2C,CACzD,WAAwD;IAExD,uCACK,WAAW,KACd,IAAI,EAAE,gBAAgB,IACtB;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 | \"FcmV1\"\n | \"FcmV1Template\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Xiaomi\"\n | \"XiaomiTemplate\"\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/**\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 * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\n}\nexport interface AdmRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends AdmRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AdmRegistrationDescriptionCommon,\n): AdmRegistrationDescription {\n return {\n ...description,\n kind: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescriptionCommon\n extends AdmRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends AdmTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AdmTemplateRegistrationDescriptionCommon,\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends AppleRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AppleRegistrationDescriptionCommon,\n): AppleRegistrationDescription {\n return {\n ...description,\n kind: \"Apple\",\n };\n}\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescriptionCommon\n extends AppleRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: \"10\" | \"5\";\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n}\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends AppleTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AppleTemplateRegistrationDescriptionCommon,\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"AppleTemplate\",\n };\n}\n\nexport interface BaiduRegistrationDescriptionCommon 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/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends BaiduRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BaiduRegistrationDescriptionCommon,\n): BaiduRegistrationDescription {\n return {\n ...description,\n kind: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescriptionCommon\n extends BaiduRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends BaiduTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BaiduTemplateRegistrationDescriptionCommon,\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescriptionCommon 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/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends BrowserRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BrowserRegistrationDescriptionCommon,\n): BrowserRegistrationDescription {\n return {\n ...description,\n kind: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescriptionCommon\n extends BrowserRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends BrowserTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BrowserTemplateRegistrationDescriptionCommon,\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescription extends GcmRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: GcmRegistrationDescriptionCommon,\n): GcmRegistrationDescription {\n return {\n ...description,\n kind: \"Gcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescriptionCommon\n extends GcmRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescription\n extends GcmTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: GcmTemplateRegistrationDescriptionCommon,\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface FcmV1RegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Firebase Cloud Messaging service.\n */\n fcmV1RegistrationId: string;\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface FcmV1RegistrationDescription extends FcmV1RegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"FcmV1\";\n}\n\n/**\n * Creates a Firebase V1 registration description.\n * @param description - A partial FCM V1 registration description.\n * @returns A created FCM V1 registration description.\n */\nexport function createFcmV1RegistrationDescription(\n description: FcmV1RegistrationDescriptionCommon,\n): FcmV1RegistrationDescription {\n return {\n ...description,\n kind: \"FcmV1\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase V1 Cloud Messaging.\n */\nexport interface FcmV1TemplateRegistrationDescriptionCommon\n extends FcmV1RegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents Notification Hub template registration description for Firebase V1 Cloud Messaging.\n */\nexport interface FcmV1TemplateRegistrationDescription\n extends FcmV1TemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"FcmV1Template\";\n}\n\n/**\n * Creates a FCM V1 template registration description.\n * @param description - A partial FCM V1 template registration description.\n * @returns A created FCM V1 template registration description.\n */\nexport function createFcmV1TemplateRegistrationDescription(\n description: FcmV1TemplateRegistrationDescriptionCommon,\n): FcmV1TemplateRegistrationDescription {\n return {\n ...description,\n kind: \"FcmV1Template\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\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 MpnsRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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 MpnsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The kind of the registration.\n */\n kind: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescriptionCommon\n extends MpnsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\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 MpnsTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends WindowsRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: WindowsRegistrationDescriptionCommon,\n): WindowsRegistrationDescription {\n return {\n ...description,\n kind: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescriptionCommon\n extends WindowsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends WindowsTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: WindowsTemplateRegistrationDescriptionCommon,\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"WindowsTemplate\",\n };\n}\n\n/**\n * Represents a Xiaomi registration description.\n */\nexport interface XiaomiRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The Xiaomi registration ID.\n */\n xiaomiRegistrationId: string;\n}\n\n/**\n * Represents a Xiaomi registration description.\n */\nexport interface XiaomiRegistrationDescription extends XiaomiRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"Xiaomi\";\n}\n\n/**\n * Creates a Xiaomi registration description.\n * @param description - A partial Xiaomi registration description.\n * @returns A created Xiaomi registration description.\n */\nexport function createXiaomiRegistrationDescription(\n description: XiaomiRegistrationDescriptionCommon,\n): XiaomiRegistrationDescription {\n return {\n ...description,\n kind: \"Xiaomi\",\n };\n}\n\n/**\n * Represents a Xiaomi template registration.\n */\nexport interface XiaomiTemplateRegistrationDescriptionCommon\n extends XiaomiRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface XiaomiTemplateRegistrationDescription\n extends XiaomiTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"XiaomiTemplate\";\n}\n\n/**\n * Creates a Xiaomi template registration description.\n * @param description - A partial Xiaomi template registration description.\n * @returns A created Xiaomi template registration description.\n */\nexport function createXiaomiTemplateRegistrationDescription(\n description: XiaomiTemplateRegistrationDescriptionCommon,\n): XiaomiTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"XiaomiTemplate\",\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 | FcmV1RegistrationDescription\n | FcmV1TemplateRegistrationDescription\n | MpnsRegistrationDescription\n | MpnsTemplateRegistrationDescription\n | XiaomiRegistrationDescription\n | XiaomiTemplateRegistrationDescription\n | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n\n/**\n * Describes an ADM Registration channel query.\n */\nexport interface AdmRegistrationChannel {\n /**\n * The ADM Registration ID.\n */\n admRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"adm\";\n}\n\n/**\n * Describes an Apple Registration channel query.\n */\nexport interface AppleRegistrationChannel {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"apple\";\n}\n\n/**\n * Describes an Baidu Registration channel query.\n */\nexport interface BaiduRegistrationChannel {\n /**\n * The Baidu Channel ID.\n */\n baiduChannelId: string;\n /**\n * The Baidu User ID.\n */\n baiduUserId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"baidu\";\n}\n\n/**\n * Describes an Browser Registration channel query.\n */\nexport interface BrowserRegistrationChannel {\n /**\n * The Web Push endpoint URL.\n */\n endpoint: string;\n /**\n * The Web Push subscription P256DH.\n */\n p256dh: string;\n /**\n * The Web Push subscription auth secret.\n */\n auth: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"browser\";\n}\n\n/**\n * Describes an Firebase Legacy Registration channel query.\n */\nexport interface FirebaseLegacyRegistrationChannel {\n /**\n * The FCM Legacy registration ID.\n */\n gcmRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"gcm\";\n}\n\n/**\n * Describes an Firebase Legacy Registration channel query.\n */\nexport interface FirebaseV1RegistrationChannel {\n /**\n * The FCM V1 registration ID.\n */\n fcmV1RegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"fcmv1\";\n}\n\n/**\n * Describes an Windows Notification Services Registration channel query.\n */\nexport interface WindowsRegistrationChannel {\n /**\n * The WNS Channel URI.\n */\n channelUri: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"windows\";\n}\n\n/**\n * Describes an Xiaomi Registration channel query.\n */\nexport interface XiaomiRegistrationChannel {\n /**\n * The Xiaomi registration ID.\n */\n xiaomiRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"xiaomi\";\n}\n\n/**\n * Describes a Registration query.\n */\nexport type RegistrationChannel =\n | AdmRegistrationChannel\n | AppleRegistrationChannel\n | BaiduRegistrationChannel\n | BrowserRegistrationChannel\n | FirebaseLegacyRegistrationChannel\n | FirebaseV1RegistrationChannel\n | XiaomiRegistrationChannel\n | WindowsRegistrationChannel;\n"]}
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/models/registration.ts"],"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C;AAoBD;;;;GAIG;AACH,MAAM,UAAU,8CAA8C,CAC5D,WAAqD;IAErD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,aAAa;KACpB,CAAC;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,WAA+C;IAE/C,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC;AAoBD;;;;GAIG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAAuD;IAEvD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,eAAe;KACtB,CAAC;AACJ,CAAC;AAuFD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAClD,WAAiD;IAEjD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC;AAyBD;;;;GAIG;AACH,MAAM,UAAU,4CAA4C,CAC1D,WAAyD;IAEzD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,iBAAiB;KACxB,CAAC;AACJ,CAAC;AAsBD;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CACjD,WAAgD;IAEhD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,QAAQ;KACf,CAAC;AACJ,CAAC;AAoBD;;;;GAIG;AACH,MAAM,UAAU,2CAA2C,CACzD,WAAwD;IAExD,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,gBAAgB;KACvB,CAAC;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 | \"FcmV1\"\n | \"FcmV1Template\"\n | \"Mpns\"\n | \"MpnsTemplate\"\n | \"Xiaomi\"\n | \"XiaomiTemplate\"\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/**\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 * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\n}\nexport interface AdmRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The Amazon Device Messaging registration identifier.\n */\n admRegistrationId: string;\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) registration.\n */\nexport interface AdmRegistrationDescription extends AdmRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AdmRegistrationDescriptionCommon,\n): AdmRegistrationDescription {\n return {\n ...description,\n kind: \"Adm\",\n };\n}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescriptionCommon\n extends AdmRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents the description of the Amazon Device Messaging (ADM) template registration.\n */\nexport interface AdmTemplateRegistrationDescription\n extends AdmTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AdmTemplateRegistrationDescriptionCommon,\n): AdmTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"AdmTemplate\",\n };\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n}\n\n/**\n * Represents the description of apple registration.\n */\nexport interface AppleRegistrationDescription extends AppleRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AppleRegistrationDescriptionCommon,\n): AppleRegistrationDescription {\n return {\n ...description,\n kind: \"Apple\",\n };\n}\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescriptionCommon\n extends AppleRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The expiry date.\n */\n expiry?: Date;\n\n /**\n * The notification priority.\n */\n priority?: \"10\" | \"5\";\n\n /**\n * The APNS headers.\n */\n apnsHeaders?: Record<string, string>;\n}\n\n/**\n * Represents the description of the Apple template registration.\n */\nexport interface AppleTemplateRegistrationDescription\n extends AppleTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: AppleTemplateRegistrationDescriptionCommon,\n): AppleTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"AppleTemplate\",\n };\n}\n\nexport interface BaiduRegistrationDescriptionCommon 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/**\n * Represents a Baidu registration description.\n */\nexport interface BaiduRegistrationDescription extends BaiduRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BaiduRegistrationDescriptionCommon,\n): BaiduRegistrationDescription {\n return {\n ...description,\n kind: \"Baidu\",\n };\n}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescriptionCommon\n extends BaiduRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Baidu template registration description.\n */\nexport interface BaiduTemplateRegistrationDescription\n extends BaiduTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BaiduTemplateRegistrationDescriptionCommon,\n): BaiduTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"BaiduTemplate\",\n };\n}\n\n/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescriptionCommon 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/**\n * Represents a Browser Push registration description.\n */\nexport interface BrowserRegistrationDescription extends BrowserRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BrowserRegistrationDescriptionCommon,\n): BrowserRegistrationDescription {\n return {\n ...description,\n kind: \"Browser\",\n };\n}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescriptionCommon\n extends BrowserRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Browser Push remplate registration description.\n */\nexport interface BrowserTemplateRegistrationDescription\n extends BrowserTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: BrowserTemplateRegistrationDescriptionCommon,\n): BrowserTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"BrowserTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Google Cloud Messaging service.\n */\n gcmRegistrationId: string;\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface GcmRegistrationDescription extends GcmRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: GcmRegistrationDescriptionCommon,\n): GcmRegistrationDescription {\n return {\n ...description,\n kind: \"Gcm\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescriptionCommon\n extends GcmRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents Notification Hub template registration description for Firebase Legacy Cloud Messaging.\n */\nexport interface GcmTemplateRegistrationDescription\n extends GcmTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: GcmTemplateRegistrationDescriptionCommon,\n): GcmTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"GcmTemplate\",\n };\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface FcmV1RegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * Registration id obtained from the Firebase Cloud Messaging service.\n */\n fcmV1RegistrationId: string;\n}\n\n/**\n * Represents Notification Hub registration description for Google Cloud Messaging.\n */\nexport interface FcmV1RegistrationDescription extends FcmV1RegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"FcmV1\";\n}\n\n/**\n * Creates a Firebase V1 registration description.\n * @param description - A partial FCM V1 registration description.\n * @returns A created FCM V1 registration description.\n */\nexport function createFcmV1RegistrationDescription(\n description: FcmV1RegistrationDescriptionCommon,\n): FcmV1RegistrationDescription {\n return {\n ...description,\n kind: \"FcmV1\",\n };\n}\n\n/**\n * Represents Notification Hub template registration description for Firebase V1 Cloud Messaging.\n */\nexport interface FcmV1TemplateRegistrationDescriptionCommon\n extends FcmV1RegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents Notification Hub template registration description for Firebase V1 Cloud Messaging.\n */\nexport interface FcmV1TemplateRegistrationDescription\n extends FcmV1TemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"FcmV1Template\";\n}\n\n/**\n * Creates a FCM V1 template registration description.\n * @param description - A partial FCM V1 template registration description.\n * @returns A created FCM V1 template registration description.\n */\nexport function createFcmV1TemplateRegistrationDescription(\n description: FcmV1TemplateRegistrationDescriptionCommon,\n): FcmV1TemplateRegistrationDescription {\n return {\n ...description,\n kind: \"FcmV1Template\",\n };\n}\n\n/**\n * Represents a Windows Phone Notification Services registration description.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\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 MpnsRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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 MpnsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\n\n /**\n * The kind of the registration.\n */\n kind: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Phone Notification Services template registration.\n * @deprecated Windows Phone is no longer supported.\n */\nexport interface MpnsTemplateRegistrationDescriptionCommon\n extends MpnsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n mpnsHeaders?: Record<string, string>;\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 MpnsTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"MpnsTemplate\";\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The channel URI.\n */\n channelUri: string;\n}\n\n/**\n * Represents a Windows Notification Services (WNS) registration description.\n */\nexport interface WindowsRegistrationDescription extends WindowsRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: WindowsRegistrationDescriptionCommon,\n): WindowsRegistrationDescription {\n return {\n ...description,\n kind: \"Windows\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescriptionCommon\n extends WindowsRegistrationDescriptionCommon,\n TemplateRegistrationDescription {\n /**\n * The WNS headers.\n */\n wnsHeaders?: Record<string, string>;\n}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface WindowsTemplateRegistrationDescription\n extends WindowsTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"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: WindowsTemplateRegistrationDescriptionCommon,\n): WindowsTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"WindowsTemplate\",\n };\n}\n\n/**\n * Represents a Xiaomi registration description.\n */\nexport interface XiaomiRegistrationDescriptionCommon extends RegistrationDescriptionCommon {\n /**\n * The Xiaomi registration ID.\n */\n xiaomiRegistrationId: string;\n}\n\n/**\n * Represents a Xiaomi registration description.\n */\nexport interface XiaomiRegistrationDescription extends XiaomiRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"Xiaomi\";\n}\n\n/**\n * Creates a Xiaomi registration description.\n * @param description - A partial Xiaomi registration description.\n * @returns A created Xiaomi registration description.\n */\nexport function createXiaomiRegistrationDescription(\n description: XiaomiRegistrationDescriptionCommon,\n): XiaomiRegistrationDescription {\n return {\n ...description,\n kind: \"Xiaomi\",\n };\n}\n\n/**\n * Represents a Xiaomi template registration.\n */\nexport interface XiaomiTemplateRegistrationDescriptionCommon\n extends XiaomiRegistrationDescriptionCommon,\n TemplateRegistrationDescription {}\n\n/**\n * Represents a Windows Notification Services (WNS) template registration.\n */\nexport interface XiaomiTemplateRegistrationDescription\n extends XiaomiTemplateRegistrationDescriptionCommon {\n /**\n * The kind of the registration.\n */\n kind: \"XiaomiTemplate\";\n}\n\n/**\n * Creates a Xiaomi template registration description.\n * @param description - A partial Xiaomi template registration description.\n * @returns A created Xiaomi template registration description.\n */\nexport function createXiaomiTemplateRegistrationDescription(\n description: XiaomiTemplateRegistrationDescriptionCommon,\n): XiaomiTemplateRegistrationDescription {\n return {\n ...description,\n kind: \"XiaomiTemplate\",\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 | FcmV1RegistrationDescription\n | FcmV1TemplateRegistrationDescription\n | MpnsRegistrationDescription\n | MpnsTemplateRegistrationDescription\n | XiaomiRegistrationDescription\n | XiaomiTemplateRegistrationDescription\n | WindowsRegistrationDescription\n | WindowsTemplateRegistrationDescription;\n\n/**\n * Describes an ADM Registration channel query.\n */\nexport interface AdmRegistrationChannel {\n /**\n * The ADM Registration ID.\n */\n admRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"adm\";\n}\n\n/**\n * Describes an Apple Registration channel query.\n */\nexport interface AppleRegistrationChannel {\n /**\n * The APNs device token.\n */\n deviceToken: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"apple\";\n}\n\n/**\n * Describes an Baidu Registration channel query.\n */\nexport interface BaiduRegistrationChannel {\n /**\n * The Baidu Channel ID.\n */\n baiduChannelId: string;\n /**\n * The Baidu User ID.\n */\n baiduUserId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"baidu\";\n}\n\n/**\n * Describes an Browser Registration channel query.\n */\nexport interface BrowserRegistrationChannel {\n /**\n * The Web Push endpoint URL.\n */\n endpoint: string;\n /**\n * The Web Push subscription P256DH.\n */\n p256dh: string;\n /**\n * The Web Push subscription auth secret.\n */\n auth: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"browser\";\n}\n\n/**\n * Describes an Firebase Legacy Registration channel query.\n */\nexport interface FirebaseLegacyRegistrationChannel {\n /**\n * The FCM Legacy registration ID.\n */\n gcmRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"gcm\";\n}\n\n/**\n * Describes an Firebase Legacy Registration channel query.\n */\nexport interface FirebaseV1RegistrationChannel {\n /**\n * The FCM V1 registration ID.\n */\n fcmV1RegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"fcmv1\";\n}\n\n/**\n * Describes an Windows Notification Services Registration channel query.\n */\nexport interface WindowsRegistrationChannel {\n /**\n * The WNS Channel URI.\n */\n channelUri: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"windows\";\n}\n\n/**\n * Describes an Xiaomi Registration channel query.\n */\nexport interface XiaomiRegistrationChannel {\n /**\n * The Xiaomi registration ID.\n */\n xiaomiRegistrationId: string;\n /**\n * The kind of the registration channel.\n */\n kind: \"xiaomi\";\n}\n\n/**\n * Describes a Registration query.\n */\nexport type RegistrationChannel =\n | AdmRegistrationChannel\n | AppleRegistrationChannel\n | BaiduRegistrationChannel\n | BrowserRegistrationChannel\n | FirebaseLegacyRegistrationChannel\n | FirebaseV1RegistrationChannel\n | XiaomiRegistrationChannel\n | WindowsRegistrationChannel;\n"]}
|
|
@@ -30,6 +30,7 @@ import { updateRegistration as updateRegistrationMethod } from "./api/updateRegi
|
|
|
30
30
|
* messages to devices.
|
|
31
31
|
*/
|
|
32
32
|
export class NotificationHubsClient {
|
|
33
|
+
_client;
|
|
33
34
|
/**
|
|
34
35
|
* Creates a new instance of the NotificationClient with a connection string, hub name and options.
|
|
35
36
|
* @param connectionString - The Notification Hub Access Policy connection string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationHubsClient.js","sourceRoot":"","sources":["../../src/notificationHubsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAoBlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,EAAE,6BAA6B,IAAI,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC9H,OAAO,EAAE,2BAA2B,IAAI,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AACxH,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EA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E,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,6BAA6B,CAC3B,kBAAsC;IACtC,8DAA8D;IAC9D,UAAkC,EAAE;QAEpC,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACxF,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 type {\n BroadcastSendNotificationOptions,\n DirectSendNotificationOptions,\n EntityOperationOptions,\n NotificationHubsClientOptions,\n PolledOperationOptions,\n RegistrationQueryLimitOptions,\n ScheduleNotificationOptions,\n SendNotificationOptions,\n} from \"./models/options.js\";\nimport type { Installation, JsonPatch } from \"./models/installation.js\";\nimport type {\n NotificationDetails,\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"./models/notificationDetails.js\";\nimport type { NotificationHubJob, NotificationHubJobPoller } from \"./models/notificationHubJob.js\";\nimport type { NotificationHubsClientContext } from \"./api/clientContext.js\";\nimport { createClientContext } from \"./api/clientContext.js\";\nimport type { RegistrationDescription, RegistrationChannel } from \"./models/registration.js\";\nimport type { Notification } from \"./models/notification.js\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { beginSubmitNotificationHubJob as beginSubmitNotificationHubJobMethod } from \"./api/beginSubmitNotificationHubJob.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./api/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./api/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./api/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./api/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./api/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./api/deleteInstallation.js\";\nimport { deleteRegistration } from \"./api/deleteRegistration.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./api/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./api/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./api/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./api/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./api/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./api/listNotificationHubJobs.js\";\nimport { listRegistrationsByChannel as listRegistrationsByChannelMethod } from \"./api/listRegistrationsByChannel.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./api/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./api/listRegistrations.js\";\nimport { scheduleBroadcastNotification as scheduleBroadcastNotificationMethod } from \"./api/scheduleBroadcastNotification.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./api/scheduleNotification.js\";\nimport { sendBroadcastNotification as sendBroadcastNotificationMethod } from \"./api/sendBroadcastNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./api/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./api/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./api/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./api/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 NotificationHubsClient {\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 // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\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.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given device information and options.\n * @param channel - The registration channel information to query per PNS type.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrationsByChannel(\n channel: RegistrationChannel,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByChannelMethod(this._client, channel, 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 // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends push notifications to devices all devices.\n * @param notification - The notification to send to all devices.\n * @param options - Options for the notification including whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendBroadcastNotification(\n notification: Notification,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: BroadcastSendNotificationOptions = {},\n ): Promise<NotificationHubsMessageResponse> {\n return sendBroadcastNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions,\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Schedules a push notification to all devices 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 notification - The notification to send to the matching devices.\n * @param options - The operation options.\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 * 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 notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions,\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(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 and creates a poller to poll for results.\n * @param notificationHubJob - The Notification Hub import/export job to start.\n * @param options - The operation options.\n * @returns A poller which can be called to poll until completion of the job.\n */\n beginSubmitNotificationHubJob(\n notificationHubJob: NotificationHubJob,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: PolledOperationOptions = {},\n ): Promise<NotificationHubJobPoller> {\n return beginSubmitNotificationHubJobMethod(this._client, notificationHubJob, 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;AAoBlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,EAAE,6BAA6B,IAAI,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC9H,OAAO,EAAE,2BAA2B,IAA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;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,6BAA6B,CAC3B,kBAAsC;IACtC,8DAA8D;IAC9D,UAAkC,EAAE;QAEpC,OAAO,mCAAmC,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACxF,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 type {\n BroadcastSendNotificationOptions,\n DirectSendNotificationOptions,\n EntityOperationOptions,\n NotificationHubsClientOptions,\n PolledOperationOptions,\n RegistrationQueryLimitOptions,\n ScheduleNotificationOptions,\n SendNotificationOptions,\n} from \"./models/options.js\";\nimport type { Installation, JsonPatch } from \"./models/installation.js\";\nimport type {\n NotificationDetails,\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"./models/notificationDetails.js\";\nimport type { NotificationHubJob, NotificationHubJobPoller } from \"./models/notificationHubJob.js\";\nimport type { NotificationHubsClientContext } from \"./api/clientContext.js\";\nimport { createClientContext } from \"./api/clientContext.js\";\nimport type { RegistrationDescription, RegistrationChannel } from \"./models/registration.js\";\nimport type { Notification } from \"./models/notification.js\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { beginSubmitNotificationHubJob as beginSubmitNotificationHubJobMethod } from \"./api/beginSubmitNotificationHubJob.js\";\nimport { cancelScheduledNotification as cancelScheduledNotificationMethod } from \"./api/cancelScheduledNotification.js\";\nimport { createOrUpdateInstallation as createOrUpdateInstallationMethod } from \"./api/createOrUpdateInstallation.js\";\nimport { createOrUpdateRegistration as createOrUpdateRegistrationMethod } from \"./api/createOrUpdateRegistration.js\";\nimport { createRegistrationId as createRegistrationIdMethod } from \"./api/createRegistrationId.js\";\nimport { createRegistration as createRegistrationMethod } from \"./api/createRegistration.js\";\nimport { deleteInstallation as deleteInstallationMethod } from \"./api/deleteInstallation.js\";\nimport { deleteRegistration } from \"./api/deleteRegistration.js\";\nimport { getFeedbackContainerUrl as getFeedbackContainerUrlMethod } from \"./api/getFeedbackContainerUrl.js\";\nimport { getInstallation as getInstallationMethod } from \"./api/getInstallation.js\";\nimport { getNotificationHubJob as getNotificationHubJobMethod } from \"./api/getNotificationHubJob.js\";\nimport { getNotificationOutcomeDetails as getNotificationOutcomeDetailsMethod } from \"./api/getNotificationOutcomeDetails.js\";\nimport { getRegistration as getRegistrationMethod } from \"./api/getRegistration.js\";\nimport { listNotificationHubJobs as listNotificationHubJobsMethod } from \"./api/listNotificationHubJobs.js\";\nimport { listRegistrationsByChannel as listRegistrationsByChannelMethod } from \"./api/listRegistrationsByChannel.js\";\nimport { listRegistrationsByTag as listRegistrationsByTagMethod } from \"./api/listRegistrationsByTag.js\";\nimport { listRegistrations as listRegistrationsMethod } from \"./api/listRegistrations.js\";\nimport { scheduleBroadcastNotification as scheduleBroadcastNotificationMethod } from \"./api/scheduleBroadcastNotification.js\";\nimport { scheduleNotification as scheduleNotificationMethod } from \"./api/scheduleNotification.js\";\nimport { sendBroadcastNotification as sendBroadcastNotificationMethod } from \"./api/sendBroadcastNotification.js\";\nimport { sendNotification as sendNotificationMethod } from \"./api/sendNotification.js\";\nimport { submitNotificationHubJob as submitNotificationHubJobMethod } from \"./api/submitNotificationHubJob.js\";\nimport { updateInstallation as updateInstallationMethod } from \"./api/updateInstallation.js\";\nimport { updateRegistration as updateRegistrationMethod } from \"./api/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 NotificationHubsClient {\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 // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\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.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrations(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsMethod(this._client, options);\n }\n\n /**\n * Gets all registrations for the notification hub with the given device information and options.\n * @param channel - The registration channel information to query per PNS type.\n * @param options - The options for querying the registrations such as $top.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\n listRegistrationsByChannel(\n channel: RegistrationChannel,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByChannelMethod(this._client, channel, 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 // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RegistrationQueryLimitOptions = {},\n ): PagedAsyncIterableIterator<RegistrationDescription> {\n return listRegistrationsByTagMethod(this._client, tag, options);\n }\n\n /**\n * Sends push notifications to devices all devices.\n * @param notification - The notification to send to all devices.\n * @param options - Options for the notification including whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendBroadcastNotification(\n notification: Notification,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: BroadcastSendNotificationOptions = {},\n ): Promise<NotificationHubsMessageResponse> {\n return sendBroadcastNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n sendNotification(\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions,\n ): Promise<NotificationHubsMessageResponse> {\n return sendNotificationMethod(this._client, notification, options);\n }\n\n /**\n * Schedules a push notification to all devices 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 notification - The notification to send to the matching devices.\n * @param options - The operation options.\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 * 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 notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\n scheduleNotification(\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions,\n ): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationMethod(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 and creates a poller to poll for results.\n * @param notificationHubJob - The Notification Hub import/export job to start.\n * @param options - The operation options.\n * @returns A poller which can be called to poll until completion of the job.\n */\n beginSubmitNotificationHubJob(\n notificationHubJob: NotificationHubJob,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: PolledOperationOptions = {},\n ): Promise<NotificationHubJobPoller> {\n return beginSubmitNotificationHubJobMethod(this._client, notificationHubJob, 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"]}
|
|
@@ -7,7 +7,6 @@ import { parseXML } from "@azure/core-xml";
|
|
|
7
7
|
* Parses a NotificationDetails from incoming XML.
|
|
8
8
|
*/
|
|
9
9
|
export async function parseNotificationDetails(bodyText) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f;
|
|
11
10
|
const xml = await parseXML(bodyText, {
|
|
12
11
|
includeRoot: true,
|
|
13
12
|
});
|
|
@@ -45,15 +44,15 @@ export async function parseNotificationDetails(bodyText) {
|
|
|
45
44
|
wnsOutcomeCounts = parseOutcomeCounts(notificationDetails["WnsOutcomeCounts"]["Outcome"]);
|
|
46
45
|
}
|
|
47
46
|
return {
|
|
48
|
-
notificationId:
|
|
49
|
-
location:
|
|
50
|
-
state:
|
|
47
|
+
notificationId: getStringOrUndefined(notificationDetails["NotificationId"])?.trim(),
|
|
48
|
+
location: getStringOrUndefined(notificationDetails["Location"])?.trim(),
|
|
49
|
+
state: getStringOrUndefined(notificationDetails["State"])?.trim(),
|
|
51
50
|
enqueueTime: getDateOrUndefined(notificationDetails["EnqueueTime"]),
|
|
52
51
|
startTime: getDateOrUndefined(notificationDetails["StartTime"]),
|
|
53
52
|
endTime: getDateOrUndefined(notificationDetails["EndTime"]),
|
|
54
|
-
pnsErrorDetailsUrl:
|
|
55
|
-
targetPlatforms:
|
|
56
|
-
notificationBody:
|
|
53
|
+
pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails["PnsErrorDetailsUri"])?.trim(),
|
|
54
|
+
targetPlatforms: getStringOrUndefined(notificationDetails["TargetPlatforms"])?.trim(),
|
|
55
|
+
notificationBody: getStringOrUndefined(notificationDetails["NotificationBody"])?.trim(),
|
|
57
56
|
apnsOutcomeCounts,
|
|
58
57
|
admOutcomeCounts,
|
|
59
58
|
baiduOutcomeCounts,
|
|
@@ -1 +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
|
|
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;KAClB,CAAC,CAAC;IACH,MAAM,mBAAmB,GAAG,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAEvD,IAAI,iBAAoD,CAAC;IACzD,IAAI,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC;QACxD,iBAAiB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,gBAAmD,CAAC;IACxD,IAAI,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC;QACvD,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,kBAAqD,CAAC;IAC1D,IAAI,SAAS,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC;QACzD,kBAAkB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,oBAAuD,CAAC;IAC5D,IAAI,SAAS,CAAC,mBAAmB,CAAC,sBA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,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QACnE,SAAS,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC/D,OAAO,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC3D,kBAAkB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE;QAC3F,eAAe,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE;QACrF,gBAAgB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,EAAE;QACvF,iBAAiB;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,oBAAoB;QACpB,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB;QACnB,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAmD;IAEnD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;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;IACnF,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n NotificationDetails,\n NotificationOutcome,\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 });\n const notificationDetails = xml[\"NotificationDetails\"];\n\n let apnsOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"ApnsOutcomeCounts\"])) {\n apnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"ApnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n let admOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"AdmOutcomeCounts\"])) {\n admOutcomeCounts = parseOutcomeCounts(notificationDetails[\"AdmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let baiduOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"BaiduOutcomeCounts\"])) {\n baiduOutcomeCounts = parseOutcomeCounts(notificationDetails[\"BaiduOutcomeCounts\"][\"Outcome\"]);\n }\n\n let browserOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"BrowserOutcomeCounts\"])) {\n browserOutcomeCounts = parseOutcomeCounts(\n notificationDetails[\"BrowserOutcomeCounts\"][\"Outcome\"],\n );\n }\n\n let fcmOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"GcmOutcomeCounts\"])) {\n fcmOutcomeCounts = parseOutcomeCounts(notificationDetails[\"GcmOutcomeCounts\"][\"Outcome\"]);\n }\n\n let fcmV1OutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"FcmV1OutcomeCounts\"])) {\n fcmV1OutcomeCounts = parseOutcomeCounts(notificationDetails[\"FcmV1OutcomeCounts\"][\"Outcome\"]);\n }\n\n let xiaomiOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"XiaomiOutcomeCounts\"])) {\n xiaomiOutcomeCounts = parseOutcomeCounts(notificationDetails[\"XiaomiOutcomeCounts\"][\"Outcome\"]);\n }\n\n let wnsOutcomeCounts: NotificationOutcome[] | undefined;\n if (isDefined(notificationDetails[\"WnsOutcomeCounts\"])) {\n wnsOutcomeCounts = parseOutcomeCounts(notificationDetails[\"WnsOutcomeCounts\"][\"Outcome\"]);\n }\n\n return {\n notificationId: getStringOrUndefined(notificationDetails[\"NotificationId\"])?.trim(),\n location: getStringOrUndefined(notificationDetails[\"Location\"])?.trim(),\n state: getStringOrUndefined(notificationDetails[\"State\"])?.trim() as NotificationOutcomeState,\n enqueueTime: getDateOrUndefined(notificationDetails[\"EnqueueTime\"]),\n startTime: getDateOrUndefined(notificationDetails[\"StartTime\"]),\n endTime: getDateOrUndefined(notificationDetails[\"EndTime\"]),\n pnsErrorDetailsUrl: getStringOrUndefined(notificationDetails[\"PnsErrorDetailsUri\"])?.trim(),\n targetPlatforms: getStringOrUndefined(notificationDetails[\"TargetPlatforms\"])?.trim(),\n notificationBody: getStringOrUndefined(notificationDetails[\"NotificationBody\"])?.trim(),\n apnsOutcomeCounts,\n admOutcomeCounts,\n baiduOutcomeCounts,\n browserOutcomeCounts,\n fcmOutcomeCounts,\n fcmV1OutcomeCounts,\n xiaomiOutcomeCounts,\n wnsOutcomeCounts,\n };\n}\n\nfunction parseOutcomeCounts(\n counts: Record<string, any>[] | Record<string, any>,\n): NotificationOutcome[] {\n const items = Array.isArray(counts) ? counts : [counts];\n const results: NotificationOutcome[] = [];\n for (const item of items) {\n results.push({ state: item[\"Name\"], count: getInteger(item[\"Count\"], \"Count\") });\n }\n\n return results;\n}\n"]}
|
|
@@ -55,7 +55,6 @@ function createInputOutputProperties(content) {
|
|
|
55
55
|
return props;
|
|
56
56
|
}
|
|
57
57
|
function createNotificationHubJob(content) {
|
|
58
|
-
var _a, _b, _c, _d;
|
|
59
58
|
let outputProperties;
|
|
60
59
|
if (isDefined(content["OutputProperties"])) {
|
|
61
60
|
outputProperties = createInputOutputProperties(content["OutputProperties"]);
|
|
@@ -65,13 +64,13 @@ function createNotificationHubJob(content) {
|
|
|
65
64
|
inputProperties = createInputOutputProperties(content["InputProperties"]);
|
|
66
65
|
}
|
|
67
66
|
return {
|
|
68
|
-
jobId:
|
|
67
|
+
jobId: getStringOrUndefined(content["JobId"])?.trim(),
|
|
69
68
|
type: getString(content["Type"], "type").trim(),
|
|
70
|
-
status:
|
|
69
|
+
status: getStringOrUndefined(content["Status"])?.trim(),
|
|
71
70
|
progress: getFloatOrUndefined(content["Progress"]),
|
|
72
71
|
outputContainerUrl: getString(content["OutputContainerUri"], "outputContainerUrl").trim(),
|
|
73
|
-
importFileUrl:
|
|
74
|
-
failure:
|
|
72
|
+
importFileUrl: getStringOrUndefined(content["ImportFileUri"])?.trim(),
|
|
73
|
+
failure: getStringOrUndefined(content["Failure"])?.trim(),
|
|
75
74
|
createdAt: getDateOrUndefined(content["CreatedAt"]),
|
|
76
75
|
updatedAt: getDateOrUndefined(content["UpdatedAt"]),
|
|
77
76
|
inputProperties,
|