@azure/notification-hubs 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +749 -0
- package/dist/index.js +2235 -0
- package/dist/index.js.map +1 -0
- package/dist-esm/src/client/cancelScheduledNotification.js +23 -0
- package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -0
- package/dist-esm/src/client/createOrUpdateInstallation.js +24 -0
- package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -0
- package/dist-esm/src/client/createOrUpdateRegistration.js +17 -0
- package/dist-esm/src/client/createOrUpdateRegistration.js.map +1 -0
- package/dist-esm/src/client/createRegistration.js +24 -0
- package/dist-esm/src/client/createRegistration.js.map +1 -0
- package/dist-esm/src/client/createRegistrationId.js +26 -0
- package/dist-esm/src/client/createRegistrationId.js.map +1 -0
- package/dist-esm/src/client/deleteInstallation.js +22 -0
- package/dist-esm/src/client/deleteInstallation.js.map +1 -0
- package/dist-esm/src/client/deleteRegistration.js +25 -0
- package/dist-esm/src/client/deleteRegistration.js.map +1 -0
- package/dist-esm/src/client/getFeedbackContainerUrl.js +23 -0
- package/dist-esm/src/client/getFeedbackContainerUrl.js.map +1 -0
- package/dist-esm/src/client/getInstallation.js +23 -0
- package/dist-esm/src/client/getInstallation.js.map +1 -0
- package/dist-esm/src/client/getNotificationHubJob.js +24 -0
- package/dist-esm/src/client/getNotificationHubJob.js.map +1 -0
- package/dist-esm/src/client/getNotificationOutcomeDetails.js +24 -0
- package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +1 -0
- package/dist-esm/src/client/getRegistration.js +24 -0
- package/dist-esm/src/client/getRegistration.js.map +1 -0
- package/dist-esm/src/client/index.js +44 -0
- package/dist-esm/src/client/index.js.map +1 -0
- package/dist-esm/src/client/internal/_client.js +75 -0
- package/dist-esm/src/client/internal/_client.js.map +1 -0
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js +31 -0
- package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js +37 -0
- package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -0
- package/dist-esm/src/client/internal/_sendNotificationPayload.js +51 -0
- package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -0
- package/dist-esm/src/client/listNotificationHubJobs.js +23 -0
- package/dist-esm/src/client/listNotificationHubJobs.js.map +1 -0
- package/dist-esm/src/client/listRegistrations.js +89 -0
- package/dist-esm/src/client/listRegistrations.js.map +1 -0
- package/dist-esm/src/client/listRegistrationsByTag.js +87 -0
- package/dist-esm/src/client/listRegistrationsByTag.js.map +1 -0
- package/dist-esm/src/client/scheduleBroadcastNotification.js +17 -0
- package/dist-esm/src/client/scheduleBroadcastNotification.js.map +1 -0
- package/dist-esm/src/client/scheduleNotification.js +18 -0
- package/dist-esm/src/client/scheduleNotification.js.map +1 -0
- package/dist-esm/src/client/sendBroadcastNotification.js +15 -0
- package/dist-esm/src/client/sendBroadcastNotification.js.map +1 -0
- package/dist-esm/src/client/sendDirectNotification.js +16 -0
- package/dist-esm/src/client/sendDirectNotification.js.map +1 -0
- package/dist-esm/src/client/sendNotification.js +16 -0
- package/dist-esm/src/client/sendNotification.js.map +1 -0
- package/dist-esm/src/client/submitNotificationHubJob.js +26 -0
- package/dist-esm/src/client/submitNotificationHubJob.js.map +1 -0
- package/dist-esm/src/client/updateInstallation.js +25 -0
- package/dist-esm/src/client/updateInstallation.js.map +1 -0
- package/dist-esm/src/client/updateRegistration.js +21 -0
- package/dist-esm/src/client/updateRegistration.js.map +1 -0
- package/dist-esm/src/index.js +12 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/models/installation.js +51 -0
- package/dist-esm/src/models/installation.js.map +1 -0
- package/dist-esm/src/models/notification.js +104 -0
- package/dist-esm/src/models/notification.js.map +1 -0
- package/dist-esm/src/models/notificationBuilder.js +169 -0
- package/dist-esm/src/models/notificationBuilder.js.map +1 -0
- package/dist-esm/src/models/notificationDetails.js +4 -0
- package/dist-esm/src/models/notificationDetails.js.map +1 -0
- package/dist-esm/src/models/notificationHubJob.js +4 -0
- package/dist-esm/src/models/notificationHubJob.js.map +1 -0
- package/dist-esm/src/models/options.js +4 -0
- package/dist-esm/src/models/options.js.map +1 -0
- package/dist-esm/src/models/registration.js +135 -0
- package/dist-esm/src/models/registration.js.map +1 -0
- package/dist-esm/src/models/response.js +4 -0
- package/dist-esm/src/models/response.js.map +1 -0
- package/dist-esm/src/notificationHubsClient.js +251 -0
- package/dist-esm/src/notificationHubsClient.js.map +1 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js +58 -0
- package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -0
- package/dist-esm/src/serializers/notificationHubJobSerializer.js +74 -0
- package/dist-esm/src/serializers/notificationHubJobSerializer.js.map +1 -0
- package/dist-esm/src/serializers/registrationSerializer.js +375 -0
- package/dist-esm/src/serializers/registrationSerializer.js.map +1 -0
- package/dist-esm/src/utils/connectionStringUtils.js +37 -0
- package/dist-esm/src/utils/connectionStringUtils.js.map +1 -0
- package/dist-esm/src/utils/constants.js +11 -0
- package/dist-esm/src/utils/constants.js.map +1 -0
- package/dist-esm/src/utils/retryPolicy.js +144 -0
- package/dist-esm/src/utils/retryPolicy.js.map +1 -0
- package/dist-esm/src/utils/tracing.js +13 -0
- package/dist-esm/src/utils/tracing.js.map +1 -0
- package/dist-esm/src/utils/utils.js +130 -0
- package/dist-esm/src/utils/utils.js.map +1 -0
- package/dist-esm/src/utils/xmlUtils.js +101 -0
- package/dist-esm/src/utils/xmlUtils.js.map +1 -0
- package/package.json +144 -0
- package/types/3.1/notification-hubs.d.ts +1728 -0
- package/types/latest/notification-hubs.d.ts +1840 -0
- package/types/latest/tsdoc-metadata.json +11 -0
- package/types/src/client/cancelScheduledNotification.d.ts +13 -0
- package/types/src/client/cancelScheduledNotification.d.ts.map +1 -0
- package/types/src/client/createOrUpdateInstallation.d.ts +13 -0
- package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -0
- package/types/src/client/createOrUpdateRegistration.d.ts +12 -0
- package/types/src/client/createOrUpdateRegistration.d.ts.map +1 -0
- package/types/src/client/createRegistration.d.ts +13 -0
- package/types/src/client/createRegistration.d.ts.map +1 -0
- package/types/src/client/createRegistrationId.d.ts +10 -0
- package/types/src/client/createRegistrationId.d.ts.map +1 -0
- package/types/src/client/deleteInstallation.d.ts +12 -0
- package/types/src/client/deleteInstallation.d.ts.map +1 -0
- package/types/src/client/deleteRegistration.d.ts +12 -0
- package/types/src/client/deleteRegistration.d.ts.map +1 -0
- package/types/src/client/getFeedbackContainerUrl.d.ts +11 -0
- package/types/src/client/getFeedbackContainerUrl.d.ts.map +1 -0
- package/types/src/client/getInstallation.d.ts +12 -0
- package/types/src/client/getInstallation.d.ts.map +1 -0
- package/types/src/client/getNotificationHubJob.d.ts +12 -0
- package/types/src/client/getNotificationHubJob.d.ts.map +1 -0
- package/types/src/client/getNotificationOutcomeDetails.d.ts +13 -0
- package/types/src/client/getNotificationOutcomeDetails.d.ts.map +1 -0
- package/types/src/client/getRegistration.d.ts +12 -0
- package/types/src/client/getRegistration.d.ts.map +1 -0
- package/types/src/client/index.d.ts +41 -0
- package/types/src/client/index.d.ts.map +1 -0
- package/types/src/client/internal/_client.d.ts +26 -0
- package/types/src/client/internal/_client.d.ts.map +1 -0
- package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
- package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts +9 -0
- package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -0
- package/types/src/client/internal/_sendNotificationPayload.d.ts +10 -0
- package/types/src/client/internal/_sendNotificationPayload.d.ts.map +1 -0
- package/types/src/client/listNotificationHubJobs.d.ts +11 -0
- package/types/src/client/listNotificationHubJobs.d.ts.map +1 -0
- package/types/src/client/listRegistrations.d.ts +12 -0
- package/types/src/client/listRegistrations.d.ts.map +1 -0
- package/types/src/client/listRegistrationsByTag.d.ts +13 -0
- package/types/src/client/listRegistrationsByTag.d.ts.map +1 -0
- package/types/src/client/scheduleBroadcastNotification.d.ts +16 -0
- package/types/src/client/scheduleBroadcastNotification.d.ts.map +1 -0
- package/types/src/client/scheduleNotification.d.ts +17 -0
- package/types/src/client/scheduleNotification.d.ts.map +1 -0
- package/types/src/client/sendBroadcastNotification.d.ts +14 -0
- package/types/src/client/sendBroadcastNotification.d.ts.map +1 -0
- package/types/src/client/sendDirectNotification.d.ts +16 -0
- package/types/src/client/sendDirectNotification.d.ts.map +1 -0
- package/types/src/client/sendNotification.d.ts +15 -0
- package/types/src/client/sendNotification.d.ts.map +1 -0
- package/types/src/client/submitNotificationHubJob.d.ts +13 -0
- package/types/src/client/submitNotificationHubJob.d.ts.map +1 -0
- package/types/src/client/updateInstallation.d.ts +14 -0
- package/types/src/client/updateInstallation.d.ts.map +1 -0
- package/types/src/client/updateRegistration.d.ts +12 -0
- package/types/src/client/updateRegistration.d.ts.map +1 -0
- package/types/src/index.d.ts +10 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/models/installation.d.ts +200 -0
- package/types/src/models/installation.d.ts.map +1 -0
- package/types/src/models/notification.d.ts +166 -0
- package/types/src/models/notification.d.ts.map +1 -0
- package/types/src/models/notificationBuilder.d.ts +546 -0
- package/types/src/models/notificationBuilder.d.ts.map +1 -0
- package/types/src/models/notificationDetails.d.ts +87 -0
- package/types/src/models/notificationDetails.d.ts.map +1 -0
- package/types/src/models/notificationHubJob.d.ts +104 -0
- package/types/src/models/notificationHubJob.d.ts.map +1 -0
- package/types/src/models/options.d.ts +43 -0
- package/types/src/models/options.d.ts.map +1 -0
- package/types/src/models/registration.d.ts +368 -0
- package/types/src/models/registration.d.ts.map +1 -0
- package/types/src/models/response.d.ts +41 -0
- package/types/src/models/response.d.ts.map +1 -0
- package/types/src/notificationHubsClient.d.ts +190 -0
- package/types/src/notificationHubsClient.d.ts.map +1 -0
- package/types/src/serializers/notificationDetailsSerializer.d.ts +7 -0
- package/types/src/serializers/notificationDetailsSerializer.d.ts.map +1 -0
- package/types/src/serializers/notificationHubJobSerializer.d.ts +21 -0
- package/types/src/serializers/notificationHubJobSerializer.d.ts.map +1 -0
- package/types/src/serializers/registrationSerializer.d.ts +193 -0
- package/types/src/serializers/registrationSerializer.d.ts.map +1 -0
- package/types/src/utils/connectionStringUtils.d.ts +37 -0
- package/types/src/utils/connectionStringUtils.d.ts.map +1 -0
- package/types/src/utils/constants.d.ts +9 -0
- package/types/src/utils/constants.d.ts.map +1 -0
- package/types/src/utils/retryPolicy.d.ts +72 -0
- package/types/src/utils/retryPolicy.d.ts.map +1 -0
- package/types/src/utils/tracing.d.ts +6 -0
- package/types/src/utils/tracing.d.ts.map +1 -0
- package/types/src/utils/utils.d.ts +65 -0
- package/types/src/utils/utils.d.ts.map +1 -0
- package/types/src/utils/xmlUtils.d.ts +46 -0
- package/types/src/utils/xmlUtils.d.ts.map +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, parseNotificationSendResponse, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Cancels the scheduled notification with the given notification ID.
|
|
7
|
+
* NOTE: This is only available in Standard SKU Azure Notification Hubs.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param notificationId - The notification ID from the scheduled notification.
|
|
10
|
+
* @param options - The operation options.
|
|
11
|
+
* @returns A notification hub response with correlation ID and tracking ID.
|
|
12
|
+
*/
|
|
13
|
+
export function cancelScheduledNotification(context, notificationId, options = {}) {
|
|
14
|
+
return tracingClient.withSpan("NotificationHubsClientContext-cancelScheduledNotification", options, async (updatedOptions) => {
|
|
15
|
+
const endpoint = context.requestUrl();
|
|
16
|
+
endpoint.pathname += `/schedulednotifications/${notificationId}`;
|
|
17
|
+
const headers = context.createHeaders();
|
|
18
|
+
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
19
|
+
const response = await sendRequest(context, request, 200);
|
|
20
|
+
return parseNotificationSendResponse(response);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=cancelScheduledNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelScheduledNotification.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,2DAA2D,EAC3D,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\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-cancelScheduledNotification\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/schedulednotifications/${notificationId}`;\n\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates or overwrites an installation to a Notification Hub.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param installation - The installation to create or overwrite.
|
|
9
|
+
* @param options - Configuration options for the create or update installation operation.
|
|
10
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
|
+
*/
|
|
12
|
+
export function createOrUpdateInstallation(context, installation, options = {}) {
|
|
13
|
+
return tracingClient.withSpan("NotificationHubsClientContext-createOrUpdateInstallation", options, async (updatedOptions) => {
|
|
14
|
+
const endpoint = context.requestUrl();
|
|
15
|
+
endpoint.pathname += `/installations/${installation.installationId}`;
|
|
16
|
+
const headers = context.createHeaders();
|
|
17
|
+
headers.set("Content-Type", "application/json");
|
|
18
|
+
const request = createRequest(endpoint, "PUT", headers, updatedOptions);
|
|
19
|
+
request.body = JSON.stringify(installation);
|
|
20
|
+
const response = await sendRequest(context, request, 200);
|
|
21
|
+
return parseNotificationResponse(response);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=createOrUpdateInstallation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrUpdateInstallation.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,0DAA0D,EAC1D,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;QACrE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\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-createOrUpdateInstallation\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installation.installationId}`;\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createOrUpdateRegistrationDescription } from "./internal/_createOrUpdateRegistrationDescription.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates or updates a registration.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param registration - The registration to create or update.
|
|
9
|
+
* @param options - The operation options.
|
|
10
|
+
* @returns The created or updated registration description.
|
|
11
|
+
*/
|
|
12
|
+
export function createOrUpdateRegistration(context, registration, options = {}) {
|
|
13
|
+
return tracingClient.withSpan("NotificationHubsClientContext-createOrUpdateRegistration", options, async (updatedOptions) => {
|
|
14
|
+
return createOrUpdateRegistrationDescription(context, registration, "createOrUpdate", updatedOptions);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=createOrUpdateRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOrUpdateRegistration.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,0DAA0D,EAC1D,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\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-createOrUpdateRegistration\",\n options,\n async (updatedOptions) => {\n return createOrUpdateRegistrationDescription(\n context,\n registration,\n \"createOrUpdate\",\n updatedOptions\n );\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { RestError } from "@azure/core-rest-pipeline";
|
|
4
|
+
import { createOrUpdateRegistrationDescription } from "./internal/_createOrUpdateRegistrationDescription.js";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new registration. This method generates a registration ID,
|
|
8
|
+
* which you can subsequently use to retrieve, update, and delete this registration.
|
|
9
|
+
* @param context - The Notification Hubs client.
|
|
10
|
+
* @param registration - The registration to create.
|
|
11
|
+
* @param options - Options for creating a new registration.
|
|
12
|
+
* @returns The newly created registration description.
|
|
13
|
+
*/
|
|
14
|
+
export function createRegistration(context, registration, options = {}) {
|
|
15
|
+
return tracingClient.withSpan("NotificationHubsClientContext-createRegistration", options, async (updatedOptions) => {
|
|
16
|
+
if (registration.registrationId) {
|
|
17
|
+
throw new RestError("registrationId must not be set during a create operation", {
|
|
18
|
+
statusCode: 400,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return createOrUpdateRegistrationDescription(context, registration, "create", updatedOptions);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=createRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRegistration.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,YAAqC,EACrC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,kDAAkD,EAClD,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\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-createRegistration\",\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"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new registration ID.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param options - The options for creating a new registration ID.
|
|
9
|
+
* @returns The newly created registration ID.
|
|
10
|
+
*/
|
|
11
|
+
export function createRegistrationId(context, options = {}) {
|
|
12
|
+
return tracingClient.withSpan("NotificationHubsClientContext-createRegistrationId", options, async (updatedOptions) => {
|
|
13
|
+
const endpoint = context.requestUrl();
|
|
14
|
+
endpoint.pathname += "/registrationIDs";
|
|
15
|
+
const headers = context.createHeaders();
|
|
16
|
+
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
17
|
+
const request = createRequest(endpoint, "POST", headers, updatedOptions);
|
|
18
|
+
const response = await sendRequest(context, request, 201);
|
|
19
|
+
// In the form: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/<registrationId>
|
|
20
|
+
const locationHeader = response.headers.get("Location");
|
|
21
|
+
const locationUrl = new URL(locationHeader);
|
|
22
|
+
const registrationId = locationUrl.pathname.split("/")[3];
|
|
23
|
+
return registrationId;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=createRegistrationId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRegistrationId.js","sourceRoot":"","sources":["../../../src/client/createRegistrationId.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;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,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,kBAAkB,CAAC;QAExC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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,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 { tracingClient } from \"../utils/tracing.js\";\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-createRegistrationId\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/registrationIDs\";\n\n const headers = context.createHeaders();\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 const locationUrl = new URL(locationHeader!);\n const registrationId = locationUrl.pathname.split(\"/\")[3];\n\n return registrationId;\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deletes an installation from a Notification Hub.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param installationId - The installation ID of the installation to delete.
|
|
9
|
+
* @param options - Configuration options for the installation delete operation.
|
|
10
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
11
|
+
*/
|
|
12
|
+
export function deleteInstallation(context, installationId, options = {}) {
|
|
13
|
+
return tracingClient.withSpan("NotificationHubsClientContext-deleteInstallation", options, async (updatedOptions) => {
|
|
14
|
+
const endpoint = context.requestUrl();
|
|
15
|
+
endpoint.pathname += `/installations/${installationId}`;
|
|
16
|
+
const headers = context.createHeaders();
|
|
17
|
+
const request = createRequest(endpoint, "DELETE", headers, updatedOptions);
|
|
18
|
+
const response = await sendRequest(context, request, 204);
|
|
19
|
+
return parseNotificationResponse(response);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=deleteInstallation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteInstallation.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,kDAAkD,EAClD,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;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAExC,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,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/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../utils/tracing.js\";\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-deleteInstallation\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n const headers = context.createHeaders();\n\n const request = createRequest(endpoint, \"DELETE\", headers, updatedOptions);\n\n const response = await sendRequest(context, request, 204);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, parseNotificationResponse, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { isDefined } from "../utils/utils.js";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Deletes a registration with the given registration ID.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param registrationId - The registration ID of the registration to delete.
|
|
10
|
+
* @param options - The options for delete operations including the ETag
|
|
11
|
+
* @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
|
|
12
|
+
*/
|
|
13
|
+
export function deleteRegistration(context, registrationId, options = {}) {
|
|
14
|
+
return tracingClient.withSpan("NotificationHubsClientContext-deleteRegistration", options, async (updatedOptions) => {
|
|
15
|
+
const endpoint = context.requestUrl();
|
|
16
|
+
endpoint.pathname += `/registrations/${registrationId}`;
|
|
17
|
+
const headers = context.createHeaders();
|
|
18
|
+
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
19
|
+
headers.set("If-Match", isDefined(options.etag) ? `"${options.etag}"` : "*");
|
|
20
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
21
|
+
const response = await sendRequest(context, request, 200);
|
|
22
|
+
return parseNotificationResponse(response);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=deleteRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteRegistration.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,UAAkC,EAAE;IAEpC,OAAO,aAAa,CAAC,QAAQ,CAC3B,kDAAkD,EAClD,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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/response.js\";\nimport { isDefined } from \"../utils/utils.js\";\nimport { tracingClient } from \"../utils/tracing.js\";\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-deleteRegistration\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/registrations/${registrationId}`;\n\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves an Azure Storage container URL. The container has feedback data for the notification hub.
|
|
7
|
+
* The caller can then use the Azure Storage Services SDK to retrieve the contents of the container.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param options - The options for getting the push notification feedback container URL.
|
|
10
|
+
* @returns The URL of the Azure Storage Container containing the feedback data.
|
|
11
|
+
*/
|
|
12
|
+
export function getFeedbackContainerUrl(context, options = {}) {
|
|
13
|
+
return tracingClient.withSpan("NotificationHubsClientContext-getFeedbackContainerUrl", options, async (updatedOptions) => {
|
|
14
|
+
const endpoint = context.requestUrl();
|
|
15
|
+
endpoint.pathname += "/feedbackcontainer";
|
|
16
|
+
const headers = context.createHeaders();
|
|
17
|
+
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
18
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
19
|
+
const response = await sendRequest(context, request, 200);
|
|
20
|
+
return response.bodyAsText;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getFeedbackContainerUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFeedbackContainerUrl.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,uDAAuD,EACvD,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,QAAQ,CAAC,QAAQ,IAAI,oBAAoB,CAAC;QAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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\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-getFeedbackContainerUrl\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/feedbackcontainer\";\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
5
|
+
/**
|
|
6
|
+
* Gets an Azure Notification Hub installation by the installation ID.
|
|
7
|
+
* @param context - The Notification Hubs client.
|
|
8
|
+
* @param installationId - The ID of the installation to get.
|
|
9
|
+
* @param options - Configuration options for the get installation operation.
|
|
10
|
+
* @returns The installation that matches the installation ID.
|
|
11
|
+
*/
|
|
12
|
+
export function getInstallation(context, installationId, options = {}) {
|
|
13
|
+
return tracingClient.withSpan("NotificationHubsClientContext-getInstallation", options, async (updatedOptions) => {
|
|
14
|
+
const endpoint = context.requestUrl();
|
|
15
|
+
endpoint.pathname += `/installations/${installationId}`;
|
|
16
|
+
const headers = context.createHeaders();
|
|
17
|
+
headers.set("Content-Type", "application/json");
|
|
18
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
19
|
+
const response = await sendRequest(context, request, 200);
|
|
20
|
+
return JSON.parse(response.bodyAsText);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getInstallation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInstallation.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,+CAA+C,EAC/C,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;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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\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-getInstallation\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/installations/${installationId}`;\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { parseNotificationHubJobEntry } from "../serializers/notificationHubJobSerializer.js";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Gets a Notification Hub Job by the ID.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param jobId - The Notification Hub Job ID.
|
|
10
|
+
* @param options - The operation options.
|
|
11
|
+
* @returns The Notification Hub Job with the matching ID.
|
|
12
|
+
*/
|
|
13
|
+
export function getNotificationHubJob(context, jobId, options = {}) {
|
|
14
|
+
return tracingClient.withSpan("NotificationHubsClientContext-getNotificationHubJob", options, async (updatedOptions) => {
|
|
15
|
+
const endpoint = context.requestUrl();
|
|
16
|
+
endpoint.pathname += `/jobs/${jobId}`;
|
|
17
|
+
const headers = context.createHeaders();
|
|
18
|
+
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
19
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
20
|
+
const response = await sendRequest(context, request, 200);
|
|
21
|
+
return parseNotificationHubJobEntry(response.bodyAsText);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getNotificationHubJob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationHubJob.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAsC,EACtC,KAAa,EACb,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,qDAAqD,EACrD,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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\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-getNotificationHubJob\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/jobs/${jobId}`;\n\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { parseNotificationDetails } from "../serializers/notificationDetailsSerializer.js";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the results of a send operation. This can retrieve intermediate results if the send is being processed
|
|
8
|
+
* or final results if the Send* has completed. This API can only be called for Standard SKU and above.
|
|
9
|
+
* @param context - The Notification Hubs client.
|
|
10
|
+
* @param notificationId - The notification ID returned from the send operation.
|
|
11
|
+
* @param options - The operation options.
|
|
12
|
+
* @returns The results of the send operation.
|
|
13
|
+
*/
|
|
14
|
+
export function getNotificationOutcomeDetails(context, notificationId, options = {}) {
|
|
15
|
+
return tracingClient.withSpan("NotificationHubsClientContext-getNotificationOutcomeDetails", options, async (updatedOptions) => {
|
|
16
|
+
const endpoint = context.requestUrl();
|
|
17
|
+
endpoint.pathname += `/messages/${notificationId}`;
|
|
18
|
+
const headers = context.createHeaders();
|
|
19
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
20
|
+
const response = await sendRequest(context, request, 200);
|
|
21
|
+
return parseNotificationDetails(response.bodyAsText);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getNotificationOutcomeDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNotificationOutcomeDetails.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,6DAA6D,EAC7D,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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\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-getNotificationOutcomeDetails\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/messages/${notificationId}`;\n\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./internal/_client.js";
|
|
4
|
+
import { registrationDescriptionParser } from "../serializers/registrationSerializer.js";
|
|
5
|
+
import { tracingClient } from "../utils/tracing.js";
|
|
6
|
+
/**
|
|
7
|
+
* Gets a registration by the given registration ID.
|
|
8
|
+
* @param context - The Notification Hubs client.
|
|
9
|
+
* @param registrationId - The ID of the registration to get.
|
|
10
|
+
* @param options - The options for getting a registration by ID.
|
|
11
|
+
* @returns A RegistrationDescription that has the given registration ID.
|
|
12
|
+
*/
|
|
13
|
+
export function getRegistration(context, registrationId, options = {}) {
|
|
14
|
+
return tracingClient.withSpan("NotificationHubsClientContext-getRegistration", options, async (updatedOptions) => {
|
|
15
|
+
const endpoint = context.requestUrl();
|
|
16
|
+
endpoint.pathname += `/registrations/${registrationId}`;
|
|
17
|
+
const headers = context.createHeaders();
|
|
18
|
+
headers.set("Content-Type", "application/xml;type=entry;charset=utf-8");
|
|
19
|
+
const request = createRequest(endpoint, "GET", headers, updatedOptions);
|
|
20
|
+
const response = await sendRequest(context, request, 200);
|
|
21
|
+
return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRegistration.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAsC,EACtC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,+CAA+C,EAC/C,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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\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-getRegistration\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += `/registrations/${registrationId}`;\n\n const headers = context.createHeaders();\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"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createHttpHeaders, } from "@azure/core-rest-pipeline";
|
|
4
|
+
import { createTokenProviderFromConnection, parseNotificationHubsConnectionString, } from "../utils/connectionStringUtils.js";
|
|
5
|
+
import { parseXML, stringifyXML } from "@azure/core-xml";
|
|
6
|
+
import { ServiceClient } from "@azure/core-client";
|
|
7
|
+
const API_VERSION = "2020-06";
|
|
8
|
+
/**
|
|
9
|
+
* Creates a NotificationHubClient from the Access Policy connection string and hub name.
|
|
10
|
+
* @param connectionString - The Access Policy connection string for the notification hub.
|
|
11
|
+
* @param hubName - The notification hub name.
|
|
12
|
+
* @returns A NotificationHubsClientContext initialized from the connection string and hub name.
|
|
13
|
+
*/
|
|
14
|
+
export function createClientContext(connectionString, hubName, options = {}) {
|
|
15
|
+
return new NotificationHubsServiceClient(connectionString, hubName, options);
|
|
16
|
+
}
|
|
17
|
+
class NotificationHubsServiceClient extends ServiceClient {
|
|
18
|
+
constructor(connectionString, hubName, options = {}) {
|
|
19
|
+
super(Object.assign({ deserializationOptions: {
|
|
20
|
+
parseXML,
|
|
21
|
+
}, serializationOptions: {
|
|
22
|
+
stringifyXML,
|
|
23
|
+
} }, options));
|
|
24
|
+
this.hubName = hubName;
|
|
25
|
+
const parsedConnection = parseNotificationHubsConnectionString(connectionString);
|
|
26
|
+
this.baseUrl = parsedConnection.endpoint;
|
|
27
|
+
this.sasTokenProvider = createTokenProviderFromConnection(parsedConnection.sharedAccessKey, parsedConnection.sharedAccessKeyName);
|
|
28
|
+
}
|
|
29
|
+
createHeaders() {
|
|
30
|
+
const authorization = this.sasTokenProvider.getToken(this.baseUrl);
|
|
31
|
+
const headers = createHttpHeaders();
|
|
32
|
+
headers.set("Authorization", authorization.token);
|
|
33
|
+
headers.set("x-ms-version", API_VERSION);
|
|
34
|
+
return headers;
|
|
35
|
+
}
|
|
36
|
+
requestUrl() {
|
|
37
|
+
// Node doesn't allow change in protocol but browsers do, so doing a string replace
|
|
38
|
+
const url = new URL(this.baseUrl.replace("sb://", "https://"));
|
|
39
|
+
url.pathname = this.hubName;
|
|
40
|
+
url.searchParams.set("api-version", API_VERSION);
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAIL,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,mCAAmC,CAAC;AAC3C,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,EAAE;gBACpB,YAAY;aACb,IACE,OAAO,CACsB,CAAC,CAAC;QAEpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,MAAM,gBAAgB,GAAG,qCAAqC,CAAC,gBAAgB,CAAC,CAAC;QACjF,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,iCAAiC,CACvD,gBAAgB,CAAC,eAAe,EAChC,gBAAgB,CAAC,mBAAmB,CACrC,CAAC;IACJ,CAAC;IAED,aAAa;QACX,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAEzC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,UAAU;QACR,mFAAmF;QACnF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAC/D,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEjD,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n HttpHeaders,\n PipelineRequest,\n PipelineResponse,\n createHttpHeaders,\n} from \"@azure/core-rest-pipeline\";\nimport {\n createTokenProviderFromConnection,\n parseNotificationHubsConnectionString,\n} from \"../utils/connectionStringUtils.js\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { InternalClientPipelineOptions } from \"@azure/core-client\";\nimport { NotificationHubsClientOptions } from \"../models/options.js\";\nimport { SasTokenProvider } from \"@azure/core-amqp\";\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(): 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 ...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 createHeaders(): HttpHeaders {\n const authorization = this.sasTokenProvider.getToken(this.baseUrl);\n const headers = createHttpHeaders();\n headers.set(\"Authorization\", authorization.token);\n headers.set(\"x-ms-version\", API_VERSION);\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"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { RestError, createPipelineRequest, } from "@azure/core-rest-pipeline";
|
|
4
|
+
import { isDefined } from "../../utils/utils.js";
|
|
5
|
+
import { parseXMLError } from "../../utils/xmlUtils.js";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export function createRequest(endpoint, method, headers, options) {
|
|
10
|
+
return createPipelineRequest(Object.assign(Object.assign(Object.assign({}, options.tracingOptions), options.requestOptions), { url: endpoint.toString(), abortSignal: options.abortSignal, method,
|
|
11
|
+
headers }));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export function parseNotificationResponse(response) {
|
|
17
|
+
const correlationId = response.headers.get("x-ms-correlation-request-id");
|
|
18
|
+
const trackingId = response.headers.get("TrackingId");
|
|
19
|
+
const location = response.headers.get("Location");
|
|
20
|
+
return {
|
|
21
|
+
correlationId,
|
|
22
|
+
trackingId,
|
|
23
|
+
location,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export function parseNotificationSendResponse(response) {
|
|
30
|
+
const result = parseNotificationResponse(response);
|
|
31
|
+
let notificationId;
|
|
32
|
+
if (result.location) {
|
|
33
|
+
const locationUrl = new URL(result.location);
|
|
34
|
+
notificationId = locationUrl.pathname.split("/")[3];
|
|
35
|
+
}
|
|
36
|
+
return Object.assign(Object.assign({}, result), { notificationId });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sends a request through the client context.
|
|
40
|
+
* @param context - The client context to use.
|
|
41
|
+
* @param request - The HTTP request to send.
|
|
42
|
+
* @param successStatusCode - A status code or list of status codes to check for success.
|
|
43
|
+
* @returns The HTTP Response.
|
|
44
|
+
*/
|
|
45
|
+
export async function sendRequest(context, request, successStatusCode) {
|
|
46
|
+
const statuses = Array.isArray(successStatusCode)
|
|
47
|
+
? successStatusCode
|
|
48
|
+
: [successStatusCode];
|
|
49
|
+
const response = await context.sendRequest(request);
|
|
50
|
+
if (!statuses.some((statusCode) => statusCode === response.status)) {
|
|
51
|
+
const responseBody = response.bodyAsText;
|
|
52
|
+
let details;
|
|
53
|
+
if (isDefined(responseBody)) {
|
|
54
|
+
try {
|
|
55
|
+
details = await parseXMLError(responseBody);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
// eslint-disable no-empty
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let errorMessage;
|
|
62
|
+
if (isDefined(details)) {
|
|
63
|
+
errorMessage = `operations failed with: ${details}`;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
errorMessage = `operation failed with status ${response.status}`;
|
|
67
|
+
}
|
|
68
|
+
throw new RestError(errorMessage, {
|
|
69
|
+
statusCode: response.status,
|
|
70
|
+
response,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_client.js","sourceRoot":"","sources":["../../../../src/client/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,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAa,EACb,MAAmB,EACnB,OAAoB,EACpB,OAAyB;IAEzB,OAAO,qBAAqB,+CACvB,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,cAAc,KACzB,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,MAAM;QACN,OAAO,IACP,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAA0B;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAElD,OAAO;QACL,aAAa;QACb,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAA0B;IAE1B,MAAM,MAAM,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,cAAkC,CAAC;IACvC,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7C,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACrD;IAED,uCACK,MAAM,KACT,cAAc,IACd;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAsC,EACtC,OAAwB,EACxB,iBAAoC;IAEpC,MAAM,QAAQ,GAAa,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACzD,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE;QAClE,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE;YAC3B,IAAI;gBACF,OAAO,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;aAC7C;YAAC,OAAO,GAAG,EAAE;gBACZ,0BAA0B;aAC3B;SACF;QAED,IAAI,YAAgC,CAAC;QACrC,IAAI,SAAS,CAAC,OAAO,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/response.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { isDefined } from \"../../utils/utils.js\";\nimport { parseXMLError } from \"../../utils/xmlUtils.js\";\n\n/**\n * @internal\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 * @internal\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 * @internal\n */\nexport function parseNotificationSendResponse(\n response: PipelineResponse\n): 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 return {\n ...result,\n notificationId,\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"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { createRequest, sendRequest } from "./_client.js";
|
|
4
|
+
import { registrationDescriptionParser, registrationDescriptionSerializer, } from "../../serializers/registrationSerializer.js";
|
|
5
|
+
import { isDefined } from "../../utils/utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export async function createOrUpdateRegistrationDescription(context, registration, operationName, options) {
|
|
10
|
+
const endpoint = context.requestUrl();
|
|
11
|
+
endpoint.pathname += "/registrations";
|
|
12
|
+
let httpMethod = "POST";
|
|
13
|
+
if (operationName === "createOrUpdate" || operationName === "update") {
|
|
14
|
+
endpoint.pathname += `/${registration.registrationId}`;
|
|
15
|
+
httpMethod = "PUT";
|
|
16
|
+
}
|
|
17
|
+
const etag = registration.etag;
|
|
18
|
+
// Clear out readonly properties
|
|
19
|
+
registration.registrationId = undefined;
|
|
20
|
+
registration.etag = undefined;
|
|
21
|
+
const headers = context.createHeaders();
|
|
22
|
+
headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
|
|
23
|
+
if (operationName === "update") {
|
|
24
|
+
headers.set("If-Match", isDefined(etag) ? `"${etag}"` : "*");
|
|
25
|
+
}
|
|
26
|
+
const request = createRequest(endpoint, httpMethod, headers, options);
|
|
27
|
+
request.body = registrationDescriptionSerializer.serializeRegistrationDescription(registration);
|
|
28
|
+
const response = await sendRequest(context, request, [200, 201]);
|
|
29
|
+
return registrationDescriptionParser.parseRegistrationEntry(response.bodyAsText);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=_createOrUpdateRegistrationDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_createOrUpdateRegistrationDescription.js","sourceRoot":"","sources":["../../../../src/client/internal/_createOrUpdateRegistrationDescription.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,GAClC,MAAM,6CAA6C,CAAC;AAKrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,OAAsC,EACtC,YAAqC,EACrC,aAAqD,EACrD,OAAyB;IAEzB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IACtC,IAAI,UAAU,GAAgB,MAAM,CAAC;IAErC,IAAI,aAAa,KAAK,gBAAgB,IAAI,aAAa,KAAK,QAAQ,EAAE;QACpE,QAAQ,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,cAAc,EAAE,CAAC;QACvD,UAAU,GAAG,KAAK,CAAC;KACpB;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAE/B,gCAAgC;IAChC,YAAY,CAAC,cAAc,GAAG,SAAS,CAAC;IACxC,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;IAE7E,IAAI,aAAa,KAAK,QAAQ,EAAE;QAC9B,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAC9D;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,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 = context.createHeaders();\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"]}
|