@azure/notification-hubs 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -78
- package/dist/index.cjs +321 -369
- package/dist/index.cjs.map +1 -1
- package/dist-esm/src/{client → api}/beginSubmitNotificationHubJob.js +0 -0
- package/dist-esm/src/api/beginSubmitNotificationHubJob.js.map +1 -0
- package/dist-esm/src/{client → api}/cancelScheduledNotification.js +0 -0
- package/dist-esm/src/api/cancelScheduledNotification.js.map +1 -0
- package/dist-esm/src/{client → api}/createOrUpdateInstallation.js +0 -0
- package/dist-esm/src/api/createOrUpdateInstallation.js.map +1 -0
- package/dist-esm/src/{client → api}/createOrUpdateRegistration.js +0 -0
- package/dist-esm/src/api/createOrUpdateRegistration.js.map +1 -0
- package/dist-esm/src/{client → api}/createRegistration.js +0 -0
- package/dist-esm/src/api/createRegistration.js.map +1 -0
- package/dist-esm/src/{client → api}/createRegistrationId.js +8 -0
- package/dist-esm/src/api/createRegistrationId.js.map +1 -0
- package/dist-esm/src/{client → api}/deleteInstallation.js +0 -0
- package/dist-esm/src/api/deleteInstallation.js.map +1 -0
- package/dist-esm/src/{client → api}/deleteRegistration.js +0 -0
- package/dist-esm/src/api/deleteRegistration.js.map +1 -0
- package/dist-esm/src/{client → api}/getFeedbackContainerUrl.js +0 -0
- package/dist-esm/src/api/getFeedbackContainerUrl.js.map +1 -0
- package/dist-esm/src/{client → api}/getInstallation.js +0 -0
- package/dist-esm/src/api/getInstallation.js.map +1 -0
- package/dist-esm/src/{client → api}/getNotificationHubJob.js +0 -0
- package/dist-esm/src/api/getNotificationHubJob.js.map +1 -0
- package/dist-esm/src/{client → api}/getNotificationOutcomeDetails.js +0 -0
- package/dist-esm/src/api/getNotificationOutcomeDetails.js.map +1 -0
- package/dist-esm/src/{client → api}/getRegistration.js +0 -0
- package/dist-esm/src/api/getRegistration.js.map +1 -0
- package/dist-esm/src/{client → api}/index.js +22 -0
- package/dist-esm/src/api/index.js.map +1 -0
- package/dist-esm/src/{client → api}/internal/_client.js +1 -1
- package/dist-esm/src/api/internal/_client.js.map +1 -0
- package/dist-esm/src/{client → api}/internal/_createOrUpdateRegistrationDescription.js +0 -0
- package/dist-esm/src/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist-esm/src/{client/listRegistrations.js → api/internal/_listRegistrations.js} +6 -38
- package/dist-esm/src/api/internal/_listRegistrations.js.map +1 -0
- package/dist-esm/src/{client → api}/listNotificationHubJobs.js +0 -0
- package/dist-esm/src/api/listNotificationHubJobs.js.map +1 -0
- package/dist-esm/src/api/listRegistrations.js +35 -0
- package/dist-esm/src/api/listRegistrations.js.map +1 -0
- package/dist-esm/src/api/listRegistrationsByChannel.js +58 -0
- package/dist-esm/src/api/listRegistrationsByChannel.js.map +1 -0
- package/dist-esm/src/{client → api}/listRegistrationsByTag.js +0 -0
- package/dist-esm/src/api/listRegistrationsByTag.js.map +1 -0
- package/dist-esm/src/{client → api}/scheduleNotification.js +2 -3
- package/dist-esm/src/api/scheduleNotification.js.map +1 -0
- package/dist-esm/src/{client → api}/sendNotification.js +3 -3
- package/dist-esm/src/api/sendNotification.js.map +1 -0
- package/dist-esm/src/{client → api}/submitNotificationHubJob.js +0 -0
- package/dist-esm/src/api/submitNotificationHubJob.js.map +1 -0
- package/dist-esm/src/{client → api}/updateInstallation.js +0 -0
- package/dist-esm/src/api/updateInstallation.js.map +1 -0
- package/dist-esm/src/{client → api}/updateRegistration.js +0 -0
- package/dist-esm/src/api/updateRegistration.js.map +1 -0
- package/dist-esm/src/index.js +3 -2
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.js +12 -0
- package/dist-esm/src/models/index.js.map +1 -0
- package/dist-esm/src/models/installation.js.map +1 -1
- package/dist-esm/src/models/notification.js.map +1 -1
- package/dist-esm/src/models/notificationBodyBuilder.js +48 -0
- package/dist-esm/src/models/notificationBodyBuilder.js.map +1 -0
- package/dist-esm/src/models/notificationDetails.js.map +1 -1
- package/dist-esm/src/models/options.js.map +1 -1
- package/dist-esm/src/models/registration.js +12 -12
- package/dist-esm/src/models/registration.js.map +1 -1
- package/dist-esm/src/models/tagExpressionBuilder.js +11 -0
- package/dist-esm/src/models/tagExpressionBuilder.js.map +1 -0
- package/dist-esm/src/notificationHubsClient.js +34 -24
- package/dist-esm/src/notificationHubsClient.js.map +1 -1
- package/dist-esm/src/serializers/notificationDetailsSerializer.js +1 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -1
- package/dist-esm/src/serializers/notificationOutcomeSerializer.js +2 -2
- package/dist-esm/src/serializers/notificationOutcomeSerializer.js.map +1 -1
- package/dist-esm/src/serializers/registrationSerializer.js +17 -16
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -1
- package/dist-esm/src/utils/constants.js +1 -1
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/dist-esm/src/utils/notificationUtils.js +0 -6
- package/dist-esm/src/utils/notificationUtils.js.map +1 -1
- package/package.json +23 -19
- package/types/3.1/notification-hubs.d.ts +420 -249
- package/types/latest/notification-hubs.d.ts +448 -254
- package/types/latest/tsdoc-metadata.json +1 -1
- package/types/src/{client → api}/beginSubmitNotificationHubJob.d.ts +0 -0
- package/types/src/api/beginSubmitNotificationHubJob.d.ts.map +1 -0
- package/types/src/{client → api}/cancelScheduledNotification.d.ts +0 -0
- package/types/src/api/cancelScheduledNotification.d.ts.map +1 -0
- package/types/src/{client → api}/createOrUpdateInstallation.d.ts +0 -0
- package/types/src/api/createOrUpdateInstallation.d.ts.map +1 -0
- package/types/src/{client → api}/createOrUpdateRegistration.d.ts +0 -0
- package/types/src/api/createOrUpdateRegistration.d.ts.map +1 -0
- package/types/src/{client → api}/createRegistration.d.ts +0 -0
- package/types/src/api/createRegistration.d.ts.map +1 -0
- package/types/src/{client → api}/createRegistrationId.d.ts +0 -0
- package/types/src/api/createRegistrationId.d.ts.map +1 -0
- package/types/src/{client → api}/deleteInstallation.d.ts +0 -0
- package/types/src/api/deleteInstallation.d.ts.map +1 -0
- package/types/src/{client → api}/deleteRegistration.d.ts +0 -0
- package/types/src/api/deleteRegistration.d.ts.map +1 -0
- package/types/src/{client → api}/getFeedbackContainerUrl.d.ts +0 -0
- package/types/src/api/getFeedbackContainerUrl.d.ts.map +1 -0
- package/types/src/{client → api}/getInstallation.d.ts +0 -0
- package/types/src/api/getInstallation.d.ts.map +1 -0
- package/types/src/{client → api}/getNotificationHubJob.d.ts +0 -0
- package/types/src/api/getNotificationHubJob.d.ts.map +1 -0
- package/types/src/{client → api}/getNotificationOutcomeDetails.d.ts +0 -0
- package/types/src/api/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/types/src/{client → api}/getRegistration.d.ts +0 -0
- package/types/src/api/getRegistration.d.ts.map +1 -0
- package/types/src/{client → api}/index.d.ts +22 -0
- package/types/src/api/index.d.ts.map +1 -0
- package/types/src/{client → api}/internal/_client.d.ts +0 -0
- package/types/src/api/internal/_client.d.ts.map +1 -0
- package/types/src/{client → api}/internal/_createOrUpdateRegistrationDescription.d.ts +0 -0
- package/types/src/api/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/types/src/api/internal/_listRegistrations.d.ts +6 -0
- package/types/src/api/internal/_listRegistrations.d.ts.map +1 -0
- package/types/src/{client → api}/listNotificationHubJobs.d.ts +0 -0
- package/types/src/api/listNotificationHubJobs.d.ts.map +1 -0
- package/types/src/{client → api}/listRegistrations.d.ts +3 -3
- package/types/src/api/listRegistrations.d.ts.map +1 -0
- package/types/src/api/listRegistrationsByChannel.d.ts +13 -0
- package/types/src/api/listRegistrationsByChannel.d.ts.map +1 -0
- package/types/src/{client → api}/listRegistrationsByTag.d.ts +0 -0
- package/types/src/api/listRegistrationsByTag.d.ts.map +1 -0
- package/types/src/{client → api}/scheduleNotification.d.ts +0 -0
- package/types/src/api/scheduleNotification.d.ts.map +1 -0
- package/types/src/{client → api}/sendNotification.d.ts +0 -0
- package/types/src/api/sendNotification.d.ts.map +1 -0
- package/types/src/{client → api}/submitNotificationHubJob.d.ts +0 -0
- package/types/src/api/submitNotificationHubJob.d.ts.map +1 -0
- package/types/src/{client → api}/updateInstallation.d.ts +0 -0
- package/types/src/api/updateInstallation.d.ts.map +1 -0
- package/types/src/{client → api}/updateRegistration.d.ts +0 -0
- package/types/src/api/updateRegistration.d.ts.map +1 -0
- package/types/src/index.d.ts +3 -2
- package/types/src/index.d.ts.map +1 -1
- package/types/src/models/index.d.ts +10 -0
- package/types/src/models/index.d.ts.map +1 -0
- package/types/src/models/installation.d.ts +12 -11
- package/types/src/models/installation.d.ts.map +1 -1
- package/types/src/models/notification.d.ts +10 -18
- package/types/src/models/notification.d.ts.map +1 -1
- package/types/src/models/{notificationBuilder.d.ts → notificationBodyBuilder.d.ts} +62 -64
- package/types/src/models/notificationBodyBuilder.d.ts.map +1 -0
- package/types/src/models/notificationDetails.d.ts +9 -9
- package/types/src/models/notificationDetails.d.ts.map +1 -1
- package/types/src/models/options.d.ts +4 -4
- package/types/src/models/options.d.ts.map +1 -1
- package/types/src/models/registration.d.ts +235 -69
- package/types/src/models/registration.d.ts.map +1 -1
- package/types/src/models/tagExpressionBuilder.d.ts +7 -0
- package/types/src/models/tagExpressionBuilder.d.ts.map +1 -0
- package/types/src/notificationHubsClient.d.ts +12 -5
- package/types/src/notificationHubsClient.d.ts.map +1 -1
- package/types/src/serializers/notificationDetailsSerializer.d.ts.map +1 -1
- package/types/src/serializers/registrationSerializer.d.ts +14 -14
- package/types/src/serializers/registrationSerializer.d.ts.map +1 -1
- package/types/src/utils/notificationUtils.d.ts +0 -4
- package/types/src/utils/notificationUtils.d.ts.map +1 -1
- package/dist-esm/src/client/beginSubmitNotificationHubJob.js.map +0 -1
- package/dist-esm/src/client/cancelScheduledNotification.js.map +0 -1
- package/dist-esm/src/client/createOrUpdateInstallation.js.map +0 -1
- package/dist-esm/src/client/createOrUpdateRegistration.js.map +0 -1
- package/dist-esm/src/client/createRegistration.js.map +0 -1
- package/dist-esm/src/client/createRegistrationId.js.map +0 -1
- package/dist-esm/src/client/deleteInstallation.js.map +0 -1
- package/dist-esm/src/client/deleteRegistration.js.map +0 -1
- package/dist-esm/src/client/getFeedbackContainerUrl.js.map +0 -1
- package/dist-esm/src/client/getInstallation.js.map +0 -1
- package/dist-esm/src/client/getNotificationHubJob.js.map +0 -1
- package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +0 -1
- package/dist-esm/src/client/getRegistration.js.map +0 -1
- package/dist-esm/src/client/index.js.map +0 -1
- package/dist-esm/src/client/internal/_client.js.map +0 -1
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +0 -1
- package/dist-esm/src/client/listNotificationHubJobs.js.map +0 -1
- package/dist-esm/src/client/listRegistrations.js.map +0 -1
- package/dist-esm/src/client/listRegistrationsByTag.js.map +0 -1
- package/dist-esm/src/client/scheduleNotification.js.map +0 -1
- package/dist-esm/src/client/sendNotification.js.map +0 -1
- package/dist-esm/src/client/submitNotificationHubJob.js.map +0 -1
- package/dist-esm/src/client/updateInstallation.js.map +0 -1
- package/dist-esm/src/client/updateRegistration.js.map +0 -1
- package/dist-esm/src/models/notificationBuilder.js +0 -169
- package/dist-esm/src/models/notificationBuilder.js.map +0 -1
- package/dist-esm/src/utils/retryPolicy.js +0 -144
- package/dist-esm/src/utils/retryPolicy.js.map +0 -1
- package/types/src/client/beginSubmitNotificationHubJob.d.ts.map +0 -1
- package/types/src/client/cancelScheduledNotification.d.ts.map +0 -1
- package/types/src/client/createOrUpdateInstallation.d.ts.map +0 -1
- package/types/src/client/createOrUpdateRegistration.d.ts.map +0 -1
- package/types/src/client/createRegistration.d.ts.map +0 -1
- package/types/src/client/createRegistrationId.d.ts.map +0 -1
- package/types/src/client/deleteInstallation.d.ts.map +0 -1
- package/types/src/client/deleteRegistration.d.ts.map +0 -1
- package/types/src/client/getFeedbackContainerUrl.d.ts.map +0 -1
- package/types/src/client/getInstallation.d.ts.map +0 -1
- package/types/src/client/getNotificationHubJob.d.ts.map +0 -1
- package/types/src/client/getNotificationOutcomeDetails.d.ts.map +0 -1
- package/types/src/client/getRegistration.d.ts.map +0 -1
- package/types/src/client/index.d.ts.map +0 -1
- package/types/src/client/internal/_client.d.ts.map +0 -1
- package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts.map +0 -1
- package/types/src/client/listNotificationHubJobs.d.ts.map +0 -1
- package/types/src/client/listRegistrations.d.ts.map +0 -1
- package/types/src/client/listRegistrationsByTag.d.ts.map +0 -1
- package/types/src/client/scheduleNotification.d.ts.map +0 -1
- package/types/src/client/sendNotification.d.ts.map +0 -1
- package/types/src/client/submitNotificationHubJob.d.ts.map +0 -1
- package/types/src/client/updateInstallation.d.ts.map +0 -1
- package/types/src/client/updateRegistration.d.ts.map +0 -1
- package/types/src/models/notificationBuilder.d.ts.map +0 -1
- package/types/src/utils/retryPolicy.d.ts +0 -72
- package/types/src/utils/retryPolicy.d.ts.map +0 -1
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beginSubmitNotificationHubJob.js","sourceRoot":"","sources":["../../../src/api/beginSubmitNotificationHubJob.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAmB,MAAM,yBAAyB,CAAC;AAK3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAsC,EACtC,kBAAsC,EACtC,yBAAiD,EAAE;;IAEnD,IAAI,YAAY,GAAG,MAAM,wBAAwB,CAC/C,OAAO,EACP,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;IAIF,MAAM,KAAK,GAAuC;QAChD,MAAM,EAAE,YAAY;KACrB,CAAC;IAEF,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA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,CAAC,CAAC;gBACrB,OAAO;aACR;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAE1D,SAAS,OAAO;YACd,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,YAAY,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortController, AbortSignalLike } from \"@azure/abort-controller\";\nimport { CancelOnProgress, OperationState, SimplePollerLike } from \"@azure/core-lro\";\nimport { NotificationHubJob, NotificationHubJobPoller } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PolledOperationOptions } from \"../models/options.js\";\nimport { getNotificationHubJob } from \"./getNotificationHubJob.js\";\nimport { submitNotificationHubJob } from \"./submitNotificationHubJob.js\";\n\n/**\n * Submits a Notification Hub job and creates a poller to poll for results.\n * @param context - The Notification Hubs client.\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 */\nexport async function beginSubmitNotificationHubJob(\n context: NotificationHubsClientContext,\n notificationHubJob: NotificationHubJob,\n polledOperationOptions: PolledOperationOptions = {}\n): Promise<NotificationHubJobPoller> {\n let submittedJob = await submitNotificationHubJob(\n context,\n notificationHubJob,\n polledOperationOptions\n );\n\n type Handler = (state: OperationState<NotificationHubJob>) => void;\n\n const state: OperationState<NotificationHubJob> = {\n status: \"notStarted\",\n };\n\n const progressCallbacks = new Map<symbol, Handler>();\n const processProgressCallbacks = async (): Promise<void> =>\n progressCallbacks.forEach((h) => h(state));\n let resultPromise: Promise<NotificationHubJob> | undefined;\n let cancelJob: (() => void) | undefined;\n const abortController = new AbortController();\n const currentPollIntervalInMs = polledOperationOptions.updateIntervalInMs ?? 2000;\n\n const poller: SimplePollerLike<OperationState<NotificationHubJob>, NotificationHubJob> = {\n async poll(options?: { abortSignal?: AbortSignalLike }): Promise<void> {\n submittedJob = await getNotificationHubJob(context, submittedJob.jobId!, options);\n if (submittedJob.status === \"Running\" || submittedJob.status === \"Started\") {\n state.status = \"running\";\n }\n\n if (submittedJob.status === \"Completed\") {\n state.status = \"succeeded\";\n state.result = submittedJob;\n }\n\n if (submittedJob.status === \"Failed\") {\n state.status = \"failed\";\n state.error = new Error(submittedJob.failure);\n }\n\n await processProgressCallbacks();\n\n if (state.status === \"canceled\") {\n throw new Error(\"Operation was canceled\");\n }\n if (state.status === \"failed\") {\n throw state.error;\n }\n },\n\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<NotificationHubJob> {\n return (resultPromise ??= (async () => {\n const { abortSignal: inputAbortSignal } = pollOptions || {};\n const { signal: abortSignal } = inputAbortSignal\n ? new AbortController([inputAbortSignal, abortController.signal])\n : abortController;\n if (!poller.isDone()) {\n await poller.poll({ abortSignal });\n while (!poller.isDone()) {\n const delay = sleep(currentPollIntervalInMs, abortSignal);\n cancelJob = () => abortController.abort();\n await delay;\n await poller.poll({ abortSignal });\n }\n }\n switch (state.status) {\n case \"succeeded\": {\n return poller.getResult() as NotificationHubJob;\n }\n case \"canceled\": {\n throw new Error(\"Operation was canceled\");\n }\n case \"failed\": {\n throw state.error;\n }\n case \"notStarted\":\n case \"running\": {\n // Unreachable\n throw new Error(`polling completed without succeeding or failing`);\n }\n }\n })().finally(() => {\n resultPromise = undefined;\n }));\n },\n\n onProgress(callback: (state: OperationState<NotificationHubJob>) => void): CancelOnProgress {\n const s = Symbol();\n progressCallbacks.set(s, callback);\n\n return () => progressCallbacks.delete(s);\n },\n\n isDone(): boolean {\n return [\"succeeded\", \"failed\", \"canceled\"].includes(state.status);\n },\n\n stopPolling(): void {\n abortController.abort();\n cancelJob?.();\n },\n\n isStopped(): boolean {\n return resultPromise === undefined;\n },\n\n getOperationState(): OperationState<NotificationHubJob> {\n return state;\n },\n\n getResult(): NotificationHubJob | undefined {\n return state.result;\n },\n\n toString() {\n return JSON.stringify({ state });\n },\n };\n\n return poller;\n}\n\nconst REJECTED_ERR = new Error(\"The operation has been aborted\");\n\nfunction sleep(ms: number, signal: AbortSignalLike): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (signal.aborted) {\n reject(REJECTED_ERR);\n return;\n }\n\n const id = setTimeout(() => {\n signal.removeEventListener(\"abort\", onAbort);\n\n if (signal.aborted) {\n reject(REJECTED_ERR);\n return;\n }\n\n resolve();\n }, ms);\n\n signal.addEventListener(\"abort\", onAbort, { once: true });\n\n function onAbort(): void {\n clearTimeout(id);\n reject(REJECTED_ERR);\n }\n });\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelScheduledNotification.js","sourceRoot":"","sources":["../../../src/api/cancelScheduledNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIlG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,2BAA2B,cAAc,EAAE,CAAC;QAEjE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"cancelScheduledNotification\";\n\n/**\n * Cancels the scheduled notification with the given notification ID.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\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 */\nexport function cancelScheduledNotification(\n context: NotificationHubsClientContext,\n notificationId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/schedulednotifications/${notificationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"DELETE\", headers, updatedOptions);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationSendResponse(response);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrUpdateInstallation.js","sourceRoot":"","sources":["../../../src/api/createOrUpdateInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,YAAY,CAAC,cAAc,EAAE,CAAC;QAErE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { Installation } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createOrUpdateInstallation\";\n\n/**\n * Creates or overwrites an installation to a Notification Hub.\n * @param context - The Notification Hubs client.\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 */\nexport function createOrUpdateInstallation(\n context: NotificationHubsClientContext,\n installation: Installation,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installation.installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"PUT\", headers, updatedOptions);\n request.body = JSON.stringify(installation);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrUpdateRegistration.js","sourceRoot":"","sources":["../../../src/api/createOrUpdateRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,OAAO,qCAAqC,CAC1C,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,CACf,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createOrUpdateRegistration\";\n\n/**\n * Creates or updates a registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to create or update.\n * @param options - The operation options.\n * @returns The created or updated registration description.\n */\nexport function createOrUpdateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n return createOrUpdateRegistrationDescription(\n context,\n registration,\n \"createOrUpdate\",\n updatedOptions\n );\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRegistration.js","sourceRoot":"","sources":["../../../src/api/createRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,IAAI,YAAY,CAAC,cAAc,EAAE;YAC/B,MAAM,IAAI,SAAS,CAAC,0DAA0D,EAAE;gBAC9E,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;SACJ;QAED,OAAO,qCAAqC,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChG,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { createOrUpdateRegistrationDescription } from \"./internal/_createOrUpdateRegistrationDescription.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createRegistration\";\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 context - The Notification Hubs client.\n * @param registration - The registration to create.\n * @param options - Options for creating a new registration.\n * @returns The newly created registration description.\n */\nexport function createRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n if (registration.registrationId) {\n throw new RestError(\"registrationId must not be set during a create operation\", {\n statusCode: 400,\n });\n }\n\n return createOrUpdateRegistrationDescription(context, registration, \"create\", updatedOptions);\n }\n );\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { RestError } from "@azure/core-rest-pipeline";
|
|
4
5
|
import { tracingClient } from "../utils/tracing.js";
|
|
5
6
|
const OPERATION_NAME = "createRegistrationId";
|
|
6
7
|
/**
|
|
@@ -19,6 +20,13 @@ export function createRegistrationId(context, options = {}) {
|
|
|
19
20
|
const response = await sendRequest(context, request, 201);
|
|
20
21
|
// In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>
|
|
21
22
|
const locationHeader = response.headers.get("Location");
|
|
23
|
+
if (!locationHeader || !locationHeader.startsWith("https://")) {
|
|
24
|
+
throw new RestError(`Location header ${locationHeader} is an invalid URL`, {
|
|
25
|
+
statusCode: 500,
|
|
26
|
+
request,
|
|
27
|
+
response,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
22
30
|
const locationUrl = new URL(locationHeader);
|
|
23
31
|
const registrationId = locationUrl.pathname.split("/")[3];
|
|
24
32
|
return registrationId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRegistrationId.js","sourceRoot":"","sources":["../../../src/api/createRegistrationId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,CAAC;QAExC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,2GAA2G;QAC3G,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC7D,MAAM,IAAI,SAAS,CAAC,mBAAmB,cAAc,oBAAoB,EAAE;gBACzE,UAAU,EAAE,GAAG;gBACf,OAAO;gBACP,QAAQ;aACT,CAAC,CAAC;SACJ;QACD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,cAAe,CAAC,CAAC;QAC7C,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1D,OAAO,cAAc,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"createRegistrationId\";\n\n/**\n * Creates a new registration ID.\n * @param context - The Notification Hubs client.\n * @param options - The options for creating a new registration ID.\n * @returns The newly created registration ID.\n */\nexport function createRegistrationId(\n context: NotificationHubsClientContext,\n options: OperationOptions = {}\n): Promise<string> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrationIDs\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n const response = await sendRequest(context, request, 201);\n\n // In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>\n const locationHeader = response.headers.get(\"Location\");\n if (!locationHeader || !locationHeader.startsWith(\"https://\")) {\n throw new RestError(`Location header ${locationHeader} is an invalid URL`, {\n statusCode: 500,\n request,\n response,\n });\n }\n const locationUrl = new URL(locationHeader!);\n const registrationId = locationUrl.pathname.split(\"/\")[3];\n\n return registrationId;\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteInstallation.js","sourceRoot":"","sources":["../../../src/api/deleteInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"deleteInstallation\";\n\n/**\n * Deletes an installation from a Notification Hub.\n * @param context - The Notification Hubs client.\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 */\nexport function deleteInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"DELETE\", headers, updatedOptions);\n const response = await sendRequest(context, request, 204);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteRegistration.js","sourceRoot":"","sources":["../../../src/api/deleteRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAAkC,EAAE;IAEpC,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationResponse, sendRequest } from \"./internal/_client.js\";\nimport { EntityOperationOptions } from \"../models/options.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsResponse } from \"../models/notificationDetails.js\";\nimport { isDefined } from \"../utils/utils.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"deleteRegistration\";\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 */\nexport function deleteRegistration(\n context: NotificationHubsClientContext,\n registrationId: string,\n options: EntityOperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/registrations/${registrationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n headers.set(\"If-Match\", isDefined(options.etag) ? `\"${options.etag}\"` : \"*\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFeedbackContainerUrl.js","sourceRoot":"","sources":["../../../src/api/getFeedbackContainerUrl.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,oBAAoB,CAAC;QAE1C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,QAAQ,CAAC,UAAW,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getFeedbackContainerUrl\";\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 context - The Notification Hubs client.\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 */\nexport function getFeedbackContainerUrl(\n context: NotificationHubsClientContext,\n options: OperationOptions = {}\n): Promise<string> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/feedbackcontainer\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return response.bodyAsText!;\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInstallation.js","sourceRoot":"","sources":["../../../src/api/getInstallation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAW,CAAiB,CAAC;IAC1D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { Installation } from \"../models/installation.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getInstallation\";\n\n/**\n * Gets an Azure Notification Hub installation by the installation ID.\n * @param context - The Notification Hubs client.\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 */\nexport function getInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n options: OperationOptions = {}\n): Promise<Installation> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/json\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return JSON.parse(response.bodyAsText!) as Installation;\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationHubJob.js","sourceRoot":"","sources":["../../../src/api/getNotificationHubJob.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,KAAa,EACb,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,SAAS,KAAK,EAAE,CAAC;QAEtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,4BAA4B,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubJob } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { parseNotificationHubJobEntry } from \"../serializers/notificationHubJobSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getNotificationHubJob\";\n\n/**\n * Gets a Notification Hub Job by the ID.\n * @param context - The Notification Hubs client.\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 */\nexport function getNotificationHubJob(\n context: NotificationHubsClientContext,\n jobId: string,\n options: OperationOptions = {}\n): Promise<NotificationHubJob> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/jobs/${jobId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationHubJobEntry(response.bodyAsText!);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationOutcomeDetails.js","sourceRoot":"","sources":["../../../src/api/getNotificationOutcomeDetails.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,aAAa,cAAc,EAAE,CAAC;QAEnD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,wBAAwB,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationDetails } from \"../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { parseNotificationDetails } from \"../serializers/notificationDetailsSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getNotificationOutcomeDetails\";\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 context - The Notification Hubs client.\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 */\nexport function getNotificationOutcomeDetails(\n context: NotificationHubsClientContext,\n notificationId: string,\n options: OperationOptions = {}\n): Promise<NotificationDetails> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/messages/${notificationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationDetails(response.bodyAsText!);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRegistration.js","sourceRoot":"","sources":["../../../src/api/getRegistration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,kBAAkB,cAAc,EAAE,CAAC;QAExD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,sBAAsB,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IACpF,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { registrationDescriptionParser } from \"../serializers/registrationSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"getRegistration\";\n\n/**\n * Gets a registration by the given registration ID.\n * @param context - The Notification Hubs client.\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 */\nexport function getRegistration(\n context: NotificationHubsClientContext,\n registrationId: string,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/registrations/${registrationId}`;\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText!);\n }\n );\n}\n"]}
|
|
@@ -45,4 +45,26 @@ class NotificationHubsServiceClient extends ServiceClient {
|
|
|
45
45
|
return url;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
export * from "./beginSubmitNotificationHubJob.js";
|
|
49
|
+
export * from "./cancelScheduledNotification.js";
|
|
50
|
+
export * from "./createOrUpdateInstallation.js";
|
|
51
|
+
export * from "./createOrUpdateRegistration.js";
|
|
52
|
+
export * from "./createRegistration.js";
|
|
53
|
+
export * from "./createRegistrationId.js";
|
|
54
|
+
export * from "./deleteInstallation.js";
|
|
55
|
+
export * from "./deleteRegistration.js";
|
|
56
|
+
export * from "./getFeedbackContainerUrl.js";
|
|
57
|
+
export * from "./getInstallation.js";
|
|
58
|
+
export * from "./getNotificationHubJob.js";
|
|
59
|
+
export * from "./getNotificationOutcomeDetails.js";
|
|
60
|
+
export * from "./getRegistration.js";
|
|
61
|
+
export * from "./listNotificationHubJobs.js";
|
|
62
|
+
export * from "./listRegistrations.js";
|
|
63
|
+
export * from "./listRegistrationsByChannel.js";
|
|
64
|
+
export * from "./listRegistrationsByTag.js";
|
|
65
|
+
export * from "./scheduleNotification.js";
|
|
66
|
+
export * from "./sendNotification.js";
|
|
67
|
+
export * from "./submitNotificationHubJob.js";
|
|
68
|
+
export * from "./updateInstallation.js";
|
|
69
|
+
export * from "./updateRegistration.js";
|
|
48
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAIL,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,GAAG,SAAS,CAAC;AAqC9B;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,gBAAwB,EACxB,OAAe,EACf,UAAyC,EAAE;IAE3C,OAAO,IAAI,6BAA6B,CAAC,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,6BAA8B,SAAQ,aAAa;IAKvD,YACE,gBAAwB,EACxB,OAAe,EACf,UAAyC,EAAE;QAE3C,KAAK,CAAC,gBACJ,sBAAsB,EAAE;gBACtB,QAAQ;aACT,EACD,oBAAoB,E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,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as constants from \"../utils/constants.js\";\nimport {\n HttpHeaders,\n PipelineRequest,\n PipelineResponse,\n createHttpHeaders,\n} from \"@azure/core-rest-pipeline\";\nimport {\n createTokenProviderFromConnection,\n parseNotificationHubsConnectionString,\n} from \"../auth/connectionStringUtils.js\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { InternalClientPipelineOptions } from \"@azure/core-client\";\nimport { NotificationHubsClientOptions } from \"../models/options.js\";\nimport { SasTokenProvider } from \"../auth/sasTokenProvider.js\";\nimport { ServiceClient } from \"@azure/core-client\";\n\nconst API_VERSION = \"2020-06\";\n\n/**\n * Represents the Notification Hubs SDK client context.\n */\nexport interface NotificationHubsClientContext {\n /**\n * The SAS Token Provider for connecting to Notification Hubs.\n */\n readonly sasTokenProvider: SasTokenProvider;\n\n /**\n * The base URL for the Notification Hub namespace.\n */\n readonly baseUrl: string;\n\n /**\n * The Notification Hub name.\n */\n readonly hubName: string;\n\n /**\n * @internal\n */\n sendRequest(request: PipelineRequest): Promise<PipelineResponse>;\n\n /**\n * @internal\n */\n createHeaders(operationName: string, rawHeaders?: Record<string, string>): Promise<HttpHeaders>;\n\n /**\n * @internal\n */\n requestUrl(): URL;\n}\n\n/**\n * Creates a NotificationHubClient from the Access Policy connection string and hub name.\n * @param connectionString - The Access Policy connection string for the notification hub.\n * @param hubName - The notification hub name.\n * @returns A NotificationHubsClientContext initialized from the connection string and hub name.\n */\nexport function createClientContext(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n): NotificationHubsClientContext {\n return new NotificationHubsServiceClient(connectionString, hubName, options);\n}\n\nclass NotificationHubsServiceClient extends ServiceClient implements NotificationHubsClientContext {\n sasTokenProvider: SasTokenProvider;\n baseUrl: string;\n hubName: string;\n\n constructor(\n connectionString: string,\n hubName: string,\n options: NotificationHubsClientOptions = {}\n ) {\n super({\n deserializationOptions: {\n parseXML,\n },\n serializationOptions: {\n stringifyXML,\n },\n userAgentOptions: {\n userAgentPrefix: `azsdk-js-messaging-notificationhubs/${constants.SDK_VERSION}`,\n },\n ...options,\n } as InternalClientPipelineOptions);\n\n this.hubName = hubName;\n\n const parsedConnection = parseNotificationHubsConnectionString(connectionString);\n this.baseUrl = parsedConnection.endpoint;\n this.sasTokenProvider = createTokenProviderFromConnection(\n parsedConnection.sharedAccessKey,\n parsedConnection.sharedAccessKeyName\n );\n }\n\n async createHeaders(\n operationName: string,\n rawHeaders?: Record<string, string>\n ): Promise<HttpHeaders> {\n const authorization = await this.sasTokenProvider.getToken(this.baseUrl);\n const headers = createHttpHeaders(rawHeaders);\n headers.set(\"Authorization\", authorization.token);\n headers.set(\"x-ms-version\", API_VERSION);\n headers.set(\n \"x-ms-azsdk-telemetry\",\n `class=NotificationHubsServiceClient;method=${operationName}`\n );\n\n return headers;\n }\n\n requestUrl(): URL {\n // Node doesn't allow change in protocol but browsers do, so doing a string replace\n const url = new URL(this.baseUrl.replace(\"sb://\", \"https://\"));\n url.pathname = this.hubName;\n url.searchParams.set(\"api-version\", API_VERSION);\n\n return url;\n }\n}\n\nexport * from \"./beginSubmitNotificationHubJob.js\";\nexport * from \"./cancelScheduledNotification.js\";\nexport * from \"./createOrUpdateInstallation.js\";\nexport * from \"./createOrUpdateRegistration.js\";\nexport * from \"./createRegistration.js\";\nexport * from \"./createRegistrationId.js\";\nexport * from \"./deleteInstallation.js\";\nexport * from \"./deleteRegistration.js\";\nexport * from \"./getFeedbackContainerUrl.js\";\nexport * from \"./getInstallation.js\";\nexport * from \"./getNotificationHubJob.js\";\nexport * from \"./getNotificationOutcomeDetails.js\";\nexport * from \"./getRegistration.js\";\nexport * from \"./listNotificationHubJobs.js\";\nexport * from \"./listRegistrations.js\";\nexport * from \"./listRegistrationsByChannel.js\";\nexport * from \"./listRegistrationsByTag.js\";\nexport * from \"./scheduleNotification.js\";\nexport * from \"./sendNotification.js\";\nexport * from \"./submitNotificationHubJob.js\";\nexport * from \"./updateInstallation.js\";\nexport * from \"./updateRegistration.js\";\n"]}
|
|
@@ -49,7 +49,7 @@ export async function parseNotificationSendResponse(response) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function createDefaultResponse(response, notificationId) {
|
|
52
|
-
return Object.assign(Object.assign({}, response), { notificationId,
|
|
52
|
+
return Object.assign(Object.assign({}, response), { notificationId, successCount: 0, failureCount: 0, results: [], state: "Enqueued" });
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Sends a request through the client context.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/api/internal/_client.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAKL,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,M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O,CAAC,EAAE;YACtB,YAAY,GAAG,2BAA2B,OAAO,EAAE,CAAC;SACrD;aAAM;YACL,YAAY,GAAG,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC;SAClE;QAED,MAAM,IAAI,SAAS,CAAC,YAAY,EAAE;YAChC,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;SACT,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n RestError,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n NotificationHubsMessageResponse,\n NotificationHubsResponse,\n} from \"../../models/notificationDetails.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseNotificationOutcome } from \"../../serializers/notificationOutcomeSerializer.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\nexport function createRequest(\n endpoint: URL,\n method: HttpMethods,\n headers: HttpHeaders,\n options: OperationOptions\n): PipelineRequest {\n return createPipelineRequest({\n ...options.tracingOptions,\n ...options.requestOptions,\n url: endpoint.toString(),\n abortSignal: options.abortSignal,\n method,\n headers,\n });\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsResponse with header information from the operation.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsResponse with header information from the operation.\n */\nexport function parseNotificationResponse(response: PipelineResponse): NotificationHubsResponse {\n const correlationId = response.headers.get(\"x-ms-correlation-request-id\");\n const trackingId = response.headers.get(\"TrackingId\");\n const location = response.headers.get(\"Location\");\n\n return {\n correlationId,\n trackingId,\n location,\n };\n}\n\n/**\n * Parses the HTTP response and creates a NotificationHubsMessageResponse with results from the notification.\n * @param response - The HTTP response used to populate the result.\n * @returns A NotificationHubsMessageResponse with results from the notification.\n */\nexport async function parseNotificationSendResponse(\n response: PipelineResponse\n): Promise<NotificationHubsMessageResponse> {\n const result = parseNotificationResponse(response);\n let notificationId: string | undefined;\n if (result.location) {\n const locationUrl = new URL(result.location);\n notificationId = locationUrl.pathname.split(\"/\")[3];\n }\n\n const requestUrl = new URL(response.request.url);\n const isTestSend = requestUrl.searchParams.has(\"test\");\n const isDirectSend = requestUrl.searchParams.has(\"direct\");\n\n // Only broadcast/tag based sends are supported for test send\n const responseBody = response.bodyAsText;\n if (isTestSend && !isDirectSend && isDefined(responseBody)) {\n const outcome = await parseNotificationOutcome(responseBody);\n return {\n ...result,\n ...outcome,\n notificationId,\n };\n } else {\n return createDefaultResponse(result, notificationId);\n }\n}\n\nfunction createDefaultResponse(\n response: NotificationHubsResponse,\n notificationId?: string\n): NotificationHubsMessageResponse {\n return {\n ...response,\n notificationId,\n successCount: 0,\n failureCount: 0,\n results: [],\n state: \"Enqueued\",\n };\n}\n\n/**\n * Sends a request through the client context.\n * @param context - The client context to use.\n * @param request - The HTTP request to send.\n * @param successStatusCode - A status code or list of status codes to check for success.\n * @returns The HTTP Response.\n */\nexport async function sendRequest(\n context: NotificationHubsClientContext,\n request: PipelineRequest,\n successStatusCode: number | number[]\n): Promise<PipelineResponse> {\n const statuses: number[] = Array.isArray(successStatusCode)\n ? successStatusCode\n : [successStatusCode];\n\n const response = await context.sendRequest(request);\n\n if (!statuses.some((statusCode) => statusCode === response.status)) {\n const responseBody = response.bodyAsText;\n let details: string | undefined;\n if (isDefined(responseBody)) {\n try {\n details = await parseXMLError(responseBody);\n } catch (err) {\n // eslint-disable no-empty\n }\n }\n\n let errorMessage: string | undefined;\n if (isDefined(details)) {\n errorMessage = `operations failed with: ${details}`;\n } else {\n errorMessage = `operation failed with status ${response.status}`;\n }\n\n throw new RestError(errorMessage, {\n statusCode: response.status,\n response,\n });\n }\n\n return response;\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_create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,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAC,gCAAgC,CAAC,YAAY,CAAC,CAAC;IAChG,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAEjE,OAAO,6BAA6B,CAAC,sBAAsB,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;AACpF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./_client.js\";\nimport {\n registrationDescriptionParser,\n registrationDescriptionSerializer,\n} from \"../../serializers/registrationSerializer.js\";\nimport { HttpMethods } from \"@azure/core-rest-pipeline\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { RegistrationDescription } from \"../../models/registration.js\";\nimport { isDefined } from \"../../utils/utils.js\";\n\n/**\n * @internal\n */\nexport async function createOrUpdateRegistrationDescription(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n operationName: \"create\" | \"createOrUpdate\" | \"update\",\n options: OperationOptions\n): Promise<RegistrationDescription> {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrations\";\n let httpMethod: HttpMethods = \"POST\";\n\n if (operationName === \"createOrUpdate\" || operationName === \"update\") {\n endpoint.pathname += `/${registration.registrationId}`;\n httpMethod = \"PUT\";\n }\n\n const etag = registration.etag;\n\n // Clear out readonly properties\n registration.registrationId = undefined;\n registration.etag = undefined;\n\n const headers = await context.createHeaders(`${operationName}Registration`);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n if (operationName === \"update\") {\n headers.set(\"If-Match\", isDefined(etag) ? `\"${etag}\"` : \"*\");\n }\n\n const request = createRequest(endpoint, httpMethod, headers, options);\n request.body = registrationDescriptionSerializer.serializeRegistrationDescription(registration);\n const response = await sendRequest(context, request, [200, 201]);\n\n return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText!);\n}\n"]}
|
|
@@ -1,41 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
|
-
import { createRequest, sendRequest } from "./
|
|
5
|
-
import { registrationDescriptionParser } from "
|
|
6
|
-
|
|
7
|
-
const OPERATION_NAME = "listRegistrations";
|
|
8
|
-
/**
|
|
9
|
-
* Gets all registrations for the notification hub with the given query options.
|
|
10
|
-
* @param context - The Notification Hubs client.
|
|
11
|
-
* @param options - The options for querying the registrations such as $top and $filter.
|
|
12
|
-
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
13
|
-
*/
|
|
14
|
-
export function listRegistrations(context, options = {}) {
|
|
15
|
-
const { span, updatedOptions } = tracingClient.startSpan(`NotificationHubsClientContext.${OPERATION_NAME}`, options);
|
|
16
|
-
try {
|
|
17
|
-
const iter = listRegistrationsAll(context, updatedOptions);
|
|
18
|
-
return {
|
|
19
|
-
next() {
|
|
20
|
-
return iter.next();
|
|
21
|
-
},
|
|
22
|
-
[Symbol.asyncIterator]() {
|
|
23
|
-
return this;
|
|
24
|
-
},
|
|
25
|
-
byPage: () => {
|
|
26
|
-
return listRegistrationPagingPage(context, options);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
span.setStatus({ status: "error", error: e });
|
|
32
|
-
throw e;
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
span.end();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function listRegistrationsAll(context, options) {
|
|
4
|
+
import { createRequest, sendRequest } from "./_client.js";
|
|
5
|
+
import { registrationDescriptionParser } from "../../serializers/registrationSerializer.js";
|
|
6
|
+
export function listRegistrationsAll(context, options) {
|
|
39
7
|
return __asyncGenerator(this, arguments, function* listRegistrationsAll_1() {
|
|
40
8
|
var e_1, _a;
|
|
41
9
|
try {
|
|
@@ -53,7 +21,7 @@ function listRegistrationsAll(context, options) {
|
|
|
53
21
|
}
|
|
54
22
|
});
|
|
55
23
|
}
|
|
56
|
-
function listRegistrationPagingPage(context, options) {
|
|
24
|
+
export function listRegistrationPagingPage(context, options) {
|
|
57
25
|
return __asyncGenerator(this, arguments, function* listRegistrationPagingPage_1() {
|
|
58
26
|
let result = yield __await(_listRegistrations(context, options));
|
|
59
27
|
yield yield __await(result.registrations || []);
|
|
@@ -77,7 +45,7 @@ async function _listRegistrations(context, options, continuationToken) {
|
|
|
77
45
|
if (continuationToken !== undefined) {
|
|
78
46
|
endpoint.searchParams.set("continuationtoken", continuationToken);
|
|
79
47
|
}
|
|
80
|
-
const headers = await context.createHeaders(
|
|
48
|
+
const headers = await context.createHeaders("listRegistrations");
|
|
81
49
|
const request = createRequest(endpoint, "GET", headers, options);
|
|
82
50
|
const response = await sendRequest(context, request, 200);
|
|
83
51
|
const registrations = await registrationDescriptionParser.parseRegistrationFeed(response.bodyAsText);
|
|
@@ -87,4 +55,4 @@ async function _listRegistrations(context, options, continuationToken) {
|
|
|
87
55
|
continuationToken: nextToken,
|
|
88
56
|
};
|
|
89
57
|
}
|
|
90
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=_listRegistrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_listRegistrations.js","sourceRoot":"","sources":["../../../../src/api/internal/_listRegistrations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,MAAM,UAAiB,oBAAoB,CACzC,OAAsC,EACtC,OAAiC;;;;YAEjC,KAAyB,IAAA,KAAA,cAAA,0BAA0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iB,CAAC,CAAC;KACnE;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,MAAM,6BAA6B,CAAC,qBAAqB,CAC7E,QAAQ,CAAC,UAAW,CACrB,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACjE,OAAO;QACL,aAAa;QACb,iBAAiB,EAAE,SAAS;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./_client.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { RegistrationDescription } from \"../../models/registration.js\";\nimport { RegistrationQueryOptions } from \"../../models/options.js\";\nimport { RegistrationQueryResponse } from \"../../models/response.js\";\nimport { registrationDescriptionParser } from \"../../serializers/registrationSerializer.js\";\n\nexport async function* listRegistrationsAll(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions\n): AsyncIterableIterator<RegistrationDescription> {\n for await (const page of listRegistrationPagingPage(context, options)) {\n yield* page;\n }\n}\n\nexport async function* listRegistrationPagingPage(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions\n): AsyncIterableIterator<RegistrationDescription[]> {\n let result = await _listRegistrations(context, options);\n yield result.registrations || [];\n let continuationToken = result.continuationToken;\n while (continuationToken) {\n result = await _listRegistrations(context, options, continuationToken);\n continuationToken = result.continuationToken;\n yield result.registrations || [];\n }\n}\n\nasync function _listRegistrations(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions,\n continuationToken?: string\n): Promise<RegistrationQueryResponse> {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrations\";\n if (options.top !== undefined) {\n endpoint.searchParams.set(\"$top\", `${options.top}`);\n }\n\n if (options.filter !== undefined) {\n endpoint.searchParams.set(\"$filter\", options.filter);\n }\n\n if (continuationToken !== undefined) {\n endpoint.searchParams.set(\"continuationtoken\", continuationToken);\n }\n\n const headers = await context.createHeaders(\"listRegistrations\");\n const request = createRequest(endpoint, \"GET\", headers, options);\n const response = await sendRequest(context, request, 200);\n\n const registrations = await registrationDescriptionParser.parseRegistrationFeed(\n response.bodyAsText!\n );\n const nextToken = response.headers.get(\"x-ms-continuationtoken\");\n return {\n registrations,\n continuationToken: nextToken,\n };\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listNotificationHubJobs.js","sourceRoot":"","sources":["../../../src/api/listNotificationHubJobs.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC;QAE7B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,2BAA2B,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IAC3D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubJob } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { parseNotificationHubJobFeed } from \"../serializers/notificationHubJobSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"listNotificationHubJobs\";\n\n/**\n * Gets all Notification Hub Jobs for this Notification Hub.\n * @param context - The Notification Hubs client.xs\n * @param options - The operation options.\n * @returns An array of all Notification Hub Jobs for this Notification Hub.\n */\nexport function listNotificationHubJobs(\n context: NotificationHubsClientContext,\n options: OperationOptions = {}\n): Promise<NotificationHubJob[]> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/jobs\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"GET\", headers, updatedOptions);\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationHubJobFeed(response.bodyAsText!);\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
4
|
+
import { listRegistrationPagingPage, listRegistrationsAll } from "./internal/_listRegistrations.js";
|
|
5
|
+
/**
|
|
6
|
+
* Gets all registrations for the notification hub with the given query options.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param options - The options for querying the registrations such as $top.
|
|
9
|
+
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
10
|
+
*/
|
|
11
|
+
export function listRegistrations(context, options = {}) {
|
|
12
|
+
const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext.listRegistrations", options);
|
|
13
|
+
try {
|
|
14
|
+
const iter = listRegistrationsAll(context, updatedOptions);
|
|
15
|
+
return {
|
|
16
|
+
next() {
|
|
17
|
+
return iter.next();
|
|
18
|
+
},
|
|
19
|
+
[Symbol.asyncIterator]() {
|
|
20
|
+
return this;
|
|
21
|
+
},
|
|
22
|
+
byPage: () => {
|
|
23
|
+
return listRegistrationPagingPage(context, updatedOptions);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
span.setStatus({ status: "error", error: e });
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
span.end();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=listRegistrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listRegistrations.js","sourceRoot":"","sources":["../../../src/api/listRegistrations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEpG;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAsC,EACtC,UAAyC,EAAE;IAE3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,iDAAiD,EACjD,OAAO,CACR,CAAC;IACF,IAAI;QACF,MAAM,IAAI,GAAG,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3D,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,0BAA0B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAC7D,CAAC;SACF,CAAC;KACH;IAAC,OAAO,CAAM,EAAE;QACf,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,CAAC;KACT;YAAS;QACR,IAAI,CAAC,GAAG,EAAE,CAAC;KACZ;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\nimport { listRegistrationPagingPage, listRegistrationsAll } from \"./internal/_listRegistrations.js\";\n\n/**\n * Gets all registrations for the notification hub with the given query options.\n * @param context - The Notification Hubs client.\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 */\nexport function listRegistrations(\n context: NotificationHubsClientContext,\n options: RegistrationQueryLimitOptions = {}\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"NotificationHubsClientContext.listRegistrations\",\n options\n );\n try {\n const iter = listRegistrationsAll(context, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationPagingPage(context, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { listRegistrationPagingPage, listRegistrationsAll } from "./internal/_listRegistrations.js";
|
|
4
|
+
import { RestError } from "@azure/core-rest-pipeline";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Gets all registrations for the notification hub with the given device information and options.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param channel - The Registration channel information to query per PNS type.
|
|
10
|
+
* @param options - The options for querying the registrations such as $top.
|
|
11
|
+
* @returns A paged async iterable containing all of the registrations for the notification hub.
|
|
12
|
+
*/
|
|
13
|
+
export function listRegistrationsByChannel(context, channel, options = {}) {
|
|
14
|
+
const newOptions = Object.assign(Object.assign({}, options), { filter: getFilterByChannel(channel) });
|
|
15
|
+
const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext.listRegistrationsByDevice", newOptions);
|
|
16
|
+
try {
|
|
17
|
+
const iter = listRegistrationsAll(context, updatedOptions);
|
|
18
|
+
return {
|
|
19
|
+
next() {
|
|
20
|
+
return iter.next();
|
|
21
|
+
},
|
|
22
|
+
[Symbol.asyncIterator]() {
|
|
23
|
+
return this;
|
|
24
|
+
},
|
|
25
|
+
byPage: () => {
|
|
26
|
+
return listRegistrationPagingPage(context, updatedOptions);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
span.setStatus({ status: "error", error: e });
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
span.end();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function getFilterByChannel(device) {
|
|
39
|
+
switch (device.kind) {
|
|
40
|
+
case "adm":
|
|
41
|
+
return `AdmRegistrationId eq '${device.admRegistrationId}'`;
|
|
42
|
+
case "apple":
|
|
43
|
+
return `DeviceToken eq '${device.deviceToken.toLocaleUpperCase()}'`;
|
|
44
|
+
case "baidu":
|
|
45
|
+
return `BaiduChannelId eq ${device.baiduChannelId}' and BaiduUserId eq '${device.baiduUserId}'`;
|
|
46
|
+
case "browser":
|
|
47
|
+
return `Endpoint eq '${encodeURIComponent(device.endpoint)}' and P256DH eq '${device.p256dh}' and Auth eq '${device.auth}'`;
|
|
48
|
+
case "gcm":
|
|
49
|
+
return `GcmRegistrationId eq '${device.gcmRegistrationId}'`;
|
|
50
|
+
case "windows":
|
|
51
|
+
return `ChannelUri eq '${encodeURIComponent(device.channelUri)}'`;
|
|
52
|
+
default:
|
|
53
|
+
throw new RestError(`Device type is unsupported`, {
|
|
54
|
+
statusCode: 400,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=listRegistrationsByChannel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listRegistrationsByChannel.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByChannel.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAGpG,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,OAA4B,EAC5B,UAAyC,EAAE;IAE3C,MAAM,UAAU,mCACX,OAAO,KACV,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACpC,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,yDAAyD,EACzD,UAAU,CACX,CAAC;IACF,IAAI;QACF,MAAM,IAAI,GAA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;KACN;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RegistrationDescription, RegistrationChannel } from \"../models/registration.js\";\nimport { listRegistrationPagingPage, listRegistrationsAll } from \"./internal/_listRegistrations.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Gets all registrations for the notification hub with the given device information and options.\n * @param context - The Notification Hubs client.\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 */\nexport function listRegistrationsByChannel(\n context: NotificationHubsClientContext,\n channel: RegistrationChannel,\n options: RegistrationQueryLimitOptions = {}\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const newOptions = {\n ...options,\n filter: getFilterByChannel(channel),\n };\n const { span, updatedOptions } = tracingClient.startSpan(\n \"NotificationHubsClientContext.listRegistrationsByDevice\",\n newOptions\n );\n try {\n const iter = listRegistrationsAll(context, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationPagingPage(context, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n\nfunction getFilterByChannel(device: RegistrationChannel): string {\n switch (device.kind) {\n case \"adm\":\n return `AdmRegistrationId eq '${device.admRegistrationId}'`;\n case \"apple\":\n return `DeviceToken eq '${device.deviceToken.toLocaleUpperCase()}'`;\n case \"baidu\":\n return `BaiduChannelId eq ${device.baiduChannelId}' and BaiduUserId eq '${device.baiduUserId}'`;\n case \"browser\":\n return `Endpoint eq '${encodeURIComponent(device.endpoint)}' and P256DH eq '${\n device.p256dh\n }' and Auth eq '${device.auth}'`;\n case \"gcm\":\n return `GcmRegistrationId eq '${device.gcmRegistrationId}'`;\n case \"windows\":\n return `ChannelUri eq '${encodeURIComponent(device.channelUri)}'`;\n default:\n throw new RestError(`Device type is unsupported`, {\n statusCode: 400,\n });\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listRegistrationsByTag.js","sourceRoot":"","sources":["../../../src/api/listRegistrationsByTag.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAsC,EACtC,GAAW,EACX,UAAyC,EAAE;IAE3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,iCAAiC,cAAc,EAAE,EACjD,OAAO,CACR,CAAC;IACF,IAAI;QACF,MAAM,IAAI,GAAG,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QACrE,OAAO;YACL,IAAI;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,gCAAgC,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;YACjE,CAAC;SACF,CAAC;KACH;IAAC,OAAO,CAAM,EAAE;QACf,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,CA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IAAI,iBAAiB,KAAK,SAAS,EAAE;QACnC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;KACnE;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,MAAM,6BAA6B,CAAC,qBAAqB,CAC7E,QAAQ,CAAC,UAAW,CACrB,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACjE,OAAO;QACL,aAAa;QACb,iBAAiB,EAAE,SAAS;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { RegistrationDescription } from \"../models/registration.js\";\nimport { RegistrationQueryLimitOptions } from \"../models/options.js\";\nimport { RegistrationQueryResponse } from \"../models/response.js\";\nimport { registrationDescriptionParser } from \"../serializers/registrationSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"listRegistrationsByTag\";\n\n/**\n * Lists all registrations with the matching tag.\n * @param context - The Notification Hubs client.\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 */\nexport function listRegistrationsByTag(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions = {}\n): PagedAsyncIterableIterator<RegistrationDescription> {\n const { span, updatedOptions } = tracingClient.startSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options\n );\n try {\n const iter = listRegistrationsByTagAll(context, tag, updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: () => {\n return listRegistrationsByTagPagingPage(context, tag, options);\n },\n };\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n throw e;\n } finally {\n span.end();\n }\n}\n\nasync function* listRegistrationsByTagAll(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions\n): AsyncIterableIterator<RegistrationDescription> {\n for await (const page of listRegistrationsByTagPagingPage(context, tag, options)) {\n yield* page;\n }\n}\n\nasync function* listRegistrationsByTagPagingPage(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions\n): AsyncIterableIterator<RegistrationDescription[]> {\n let result = await _listRegistrationsByTag(context, tag, options);\n yield result.registrations || [];\n let continuationToken = result.continuationToken;\n while (continuationToken) {\n result = await _listRegistrationsByTag(context, tag, options, continuationToken);\n continuationToken = result.continuationToken;\n yield result.registrations || [];\n }\n}\n\nasync function _listRegistrationsByTag(\n context: NotificationHubsClientContext,\n tag: string,\n options: RegistrationQueryLimitOptions,\n continuationToken?: string\n): Promise<RegistrationQueryResponse> {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/tags/${tag}/registrations`;\n if (options.top !== undefined) {\n endpoint.searchParams.set(\"$top\", `${options.top}`);\n }\n\n if (continuationToken !== undefined) {\n endpoint.searchParams.set(\"continuationtoken\", continuationToken);\n }\n\n const headers = await context.createHeaders(OPERATION_NAME);\n const request = createRequest(endpoint, \"GET\", headers, options);\n const response = await sendRequest(context, request, 200);\n\n const registrations = await registrationDescriptionParser.parseRegistrationFeed(\n response.bodyAsText!\n );\n const nextToken = response.headers.get(\"x-ms-continuationtoken\");\n return {\n registrations,\n continuationToken: nextToken,\n };\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { createRequest, parseNotificationSendResponse, sendRequest } from "./internal/_client.js";
|
|
4
|
-
import { normalizeTags } from "../utils/notificationUtils.js";
|
|
5
4
|
import { tracingClient } from "../utils/tracing.js";
|
|
6
5
|
/**
|
|
7
6
|
* Schedules a push notification to devices that match the given tags or tag expression at the specified time.
|
|
@@ -20,8 +19,8 @@ export function scheduleNotification(context, scheduledTime, notification, optio
|
|
|
20
19
|
headers.set("ServiceBusNotification-ScheduleTime", scheduledTime.toISOString());
|
|
21
20
|
headers.set("Content-Type", notification.contentType);
|
|
22
21
|
headers.set("ServiceBusNotification-Format", notification.platform);
|
|
23
|
-
if (options.
|
|
24
|
-
headers.set("ServiceBusNotification-Tags",
|
|
22
|
+
if (options.tagExpression) {
|
|
23
|
+
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
25
24
|
}
|
|
26
25
|
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
27
26
|
request.body = notification.body;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/api/scheduleNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKlG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,UAAuC,EAAE;IAEzC,OAAO,aAAa,CAAC,QAAQ,CAC3B,oDAAoD,EACpD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,0BAA0B,CAAC;QAEhD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QAC1F,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;SACnE;QAED,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./internal/_client.js\";\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { ScheduleNotificationOptions } from \"../models/options.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\n/**\n * Schedules a push notification to devices that match the given tags or tag expression at the specified time.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param context - The Notification Hubs client.\n * @param scheduledTime - The Date to send the push notification.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options which include tags used to target the device for push notifications in either an array or tag expression.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: ScheduleNotificationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.scheduleNotification`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/schedulednotifications/\";\n\n const headers = await context.createHeaders(\"scheduleNotification\", notification.headers);\n headers.set(\"ServiceBusNotification-ScheduleTime\", scheduledTime.toISOString());\n headers.set(\"Content-Type\", notification.contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n if (options.tagExpression) {\n headers.set(\"ServiceBusNotification-Tags\", options.tagExpression);\n }\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = notification.body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n }\n );\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { createMultipartDirectNotification, normalizeTags } from "../utils/notificationUtils.js";
|
|
4
3
|
import { createRequest, parseNotificationSendResponse, sendRequest } from "./internal/_client.js";
|
|
5
4
|
import { isDirectSendNotificationOptions, isSendNotificationOptions, } from "../utils/optionUtils.js";
|
|
5
|
+
import { createMultipartDirectNotification } from "../utils/notificationUtils.js";
|
|
6
6
|
import { tracingClient } from "../utils/tracing.js";
|
|
7
7
|
import { v4 as uuid } from "uuid";
|
|
8
8
|
/**
|
|
@@ -48,8 +48,8 @@ export function sendNotification(context, notification, options = { enableTestSe
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
else if (isSendNotificationOptions(options)) {
|
|
51
|
-
if (options.
|
|
52
|
-
headers.set("ServiceBusNotification-Tags",
|
|
51
|
+
if (options.tagExpression) {
|
|
52
|
+
headers.set("ServiceBusNotification-Tags", options.tagExpression);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
headers.set("Content-Type", contentType);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/api/sendNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,iCAAiC,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAsC,EACtC,YAA0B,EAC1B,UAAmE,EAAE,cAAc,EAAE,KAAK,EAAE;IAE5F,OAAO,aAAa,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC;QAElC,6BAA6B;QAC7B,IAAI,+BAA+B,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;YACnF,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC;SAC/B;QAED,sBAAsB;QACtB,IAAI,yBAAyB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE;YAChE,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC9C;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,kBAAkB,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QACtF,OAAO,CAA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,aAAa,CAAC,CAAC;aACnE;SACF;QAED,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAEpB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DirectSendNotificationOptions, SendNotificationOptions } from \"../models/options.js\";\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./internal/_client.js\";\nimport {\n isDirectSendNotificationOptions,\n isSendNotificationOptions,\n} from \"../utils/optionUtils.js\";\nimport { BrowserPushChannel } from \"../models/installation.js\";\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/notificationDetails.js\";\nimport { createMultipartDirectNotification } from \"../utils/notificationUtils.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Sends push notifications to devices that match the given tags or tag expression.\n * @param context - The Notification Hubs client.\n * @param notification - The notification to send to the matching devices.\n * @param options - Options for the notification including tags, device handles and whether to enable test send.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendNotification(\n context: NotificationHubsClientContext,\n notification: Notification,\n options: DirectSendNotificationOptions | SendNotificationOptions = { enableTestSend: false }\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.sendNotification`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/messages/\";\n\n // Check if batch direct send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.pathname += \"$batch\";\n }\n\n // Check for test send\n if (isSendNotificationOptions(options) && options.enableTestSend) {\n endpoint.searchParams.append(\"test\", \"true\");\n }\n\n const headers = await context.createHeaders(\"sendNotification\", notification.headers);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n let body = notification.body;\n let contentType: string = notification.contentType;\n\n // Check for direct batch send\n if (isDirectSendNotificationOptions(options) && Array.isArray(options.deviceHandle)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n const boundary = `nh-boundary-${uuid()}`;\n contentType = `multipart/mixed; boundary = \"${boundary}\"`;\n body = createMultipartDirectNotification(boundary, notification, options.deviceHandle);\n } else if (isDirectSendNotificationOptions(options)) {\n endpoint.searchParams.append(\"direct\", \"true\");\n\n if (notification.platform === \"browser\") {\n const browserHandle = options.deviceHandle as BrowserPushChannel;\n headers.set(\"ServiceBusNotification-DeviceHandle\", browserHandle.endpoint);\n headers.set(\"Auth\", browserHandle.auth);\n headers.set(\"P256DH\", browserHandle.p256dh);\n } else {\n headers.set(\"ServiceBusNotification-DeviceHandle\", options.deviceHandle as string);\n }\n } else if (isSendNotificationOptions(options)) {\n if (options.tagExpression) {\n headers.set(\"ServiceBusNotification-Tags\", options.tagExpression);\n }\n }\n\n headers.set(\"Content-Type\", contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = body;\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationSendResponse(response);\n }\n );\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitNotificationHubJob.js","sourceRoot":"","sources":["../../../src/api/submitNotificationHubJob.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,gDAAgD,CAAC;AAIxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAsC,EACtC,GAAuB,EACvB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,iCAAiC,cAAc,EAAE,EACjD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC;QAE7B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,GAAG,gCAAgC,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO,4BAA4B,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, sendRequest } from \"./internal/_client.js\";\nimport {\n parseNotificationHubJobEntry,\n serializeNotificationHubJobEntry,\n} from \"../serializers/notificationHubJobSerializer.js\";\nimport { NotificationHubJob } from \"../models/notificationHubJob.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\n\nconst OPERATION_NAME = \"submitNotificationHubJob\";\n\n/**\n * Submits a Notification Hub Job.\n * Note: this is available to Standard SKU namespace and above.\n * @param context - The Notification Hubs client.\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 */\nexport function submitNotificationHubJob(\n context: NotificationHubsClientContext,\n job: NotificationHubJob,\n options: OperationOptions = {}\n): Promise<NotificationHubJob> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext.${OPERATION_NAME}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/jobs\";\n\n const headers = await context.createHeaders(OPERATION_NAME);\n headers.set(\"Content-Type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n const request = createRequest(endpoint, \"POST\", headers, updatedOptions);\n request.body = serializeNotificationHubJobEntry(job);\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationHubJobEntry(response.bodyAsText!);\n }\n );\n}\n"]}
|