@azure/notification-hubs 1.0.0-alpha.20220804.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +749 -0
  3. package/dist/index.js +2235 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist-esm/src/client/cancelScheduledNotification.js +23 -0
  6. package/dist-esm/src/client/cancelScheduledNotification.js.map +1 -0
  7. package/dist-esm/src/client/createOrUpdateInstallation.js +24 -0
  8. package/dist-esm/src/client/createOrUpdateInstallation.js.map +1 -0
  9. package/dist-esm/src/client/createOrUpdateRegistration.js +17 -0
  10. package/dist-esm/src/client/createOrUpdateRegistration.js.map +1 -0
  11. package/dist-esm/src/client/createRegistration.js +24 -0
  12. package/dist-esm/src/client/createRegistration.js.map +1 -0
  13. package/dist-esm/src/client/createRegistrationId.js +26 -0
  14. package/dist-esm/src/client/createRegistrationId.js.map +1 -0
  15. package/dist-esm/src/client/deleteInstallation.js +22 -0
  16. package/dist-esm/src/client/deleteInstallation.js.map +1 -0
  17. package/dist-esm/src/client/deleteRegistration.js +25 -0
  18. package/dist-esm/src/client/deleteRegistration.js.map +1 -0
  19. package/dist-esm/src/client/getFeedbackContainerUrl.js +23 -0
  20. package/dist-esm/src/client/getFeedbackContainerUrl.js.map +1 -0
  21. package/dist-esm/src/client/getInstallation.js +23 -0
  22. package/dist-esm/src/client/getInstallation.js.map +1 -0
  23. package/dist-esm/src/client/getNotificationHubJob.js +24 -0
  24. package/dist-esm/src/client/getNotificationHubJob.js.map +1 -0
  25. package/dist-esm/src/client/getNotificationOutcomeDetails.js +24 -0
  26. package/dist-esm/src/client/getNotificationOutcomeDetails.js.map +1 -0
  27. package/dist-esm/src/client/getRegistration.js +24 -0
  28. package/dist-esm/src/client/getRegistration.js.map +1 -0
  29. package/dist-esm/src/client/index.js +44 -0
  30. package/dist-esm/src/client/index.js.map +1 -0
  31. package/dist-esm/src/client/internal/_client.js +75 -0
  32. package/dist-esm/src/client/internal/_client.js.map +1 -0
  33. package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js +31 -0
  34. package/dist-esm/src/client/internal/_createOrUpdateRegistrationDescription.js.map +1 -0
  35. package/dist-esm/src/client/internal/_scheduleNotificationPayload.js +37 -0
  36. package/dist-esm/src/client/internal/_scheduleNotificationPayload.js.map +1 -0
  37. package/dist-esm/src/client/internal/_sendNotificationPayload.js +51 -0
  38. package/dist-esm/src/client/internal/_sendNotificationPayload.js.map +1 -0
  39. package/dist-esm/src/client/listNotificationHubJobs.js +23 -0
  40. package/dist-esm/src/client/listNotificationHubJobs.js.map +1 -0
  41. package/dist-esm/src/client/listRegistrations.js +89 -0
  42. package/dist-esm/src/client/listRegistrations.js.map +1 -0
  43. package/dist-esm/src/client/listRegistrationsByTag.js +87 -0
  44. package/dist-esm/src/client/listRegistrationsByTag.js.map +1 -0
  45. package/dist-esm/src/client/scheduleBroadcastNotification.js +17 -0
  46. package/dist-esm/src/client/scheduleBroadcastNotification.js.map +1 -0
  47. package/dist-esm/src/client/scheduleNotification.js +18 -0
  48. package/dist-esm/src/client/scheduleNotification.js.map +1 -0
  49. package/dist-esm/src/client/sendBroadcastNotification.js +15 -0
  50. package/dist-esm/src/client/sendBroadcastNotification.js.map +1 -0
  51. package/dist-esm/src/client/sendDirectNotification.js +16 -0
  52. package/dist-esm/src/client/sendDirectNotification.js.map +1 -0
  53. package/dist-esm/src/client/sendNotification.js +16 -0
  54. package/dist-esm/src/client/sendNotification.js.map +1 -0
  55. package/dist-esm/src/client/submitNotificationHubJob.js +26 -0
  56. package/dist-esm/src/client/submitNotificationHubJob.js.map +1 -0
  57. package/dist-esm/src/client/updateInstallation.js +25 -0
  58. package/dist-esm/src/client/updateInstallation.js.map +1 -0
  59. package/dist-esm/src/client/updateRegistration.js +21 -0
  60. package/dist-esm/src/client/updateRegistration.js.map +1 -0
  61. package/dist-esm/src/index.js +12 -0
  62. package/dist-esm/src/index.js.map +1 -0
  63. package/dist-esm/src/models/installation.js +51 -0
  64. package/dist-esm/src/models/installation.js.map +1 -0
  65. package/dist-esm/src/models/notification.js +104 -0
  66. package/dist-esm/src/models/notification.js.map +1 -0
  67. package/dist-esm/src/models/notificationBuilder.js +169 -0
  68. package/dist-esm/src/models/notificationBuilder.js.map +1 -0
  69. package/dist-esm/src/models/notificationDetails.js +4 -0
  70. package/dist-esm/src/models/notificationDetails.js.map +1 -0
  71. package/dist-esm/src/models/notificationHubJob.js +4 -0
  72. package/dist-esm/src/models/notificationHubJob.js.map +1 -0
  73. package/dist-esm/src/models/options.js +4 -0
  74. package/dist-esm/src/models/options.js.map +1 -0
  75. package/dist-esm/src/models/registration.js +135 -0
  76. package/dist-esm/src/models/registration.js.map +1 -0
  77. package/dist-esm/src/models/response.js +4 -0
  78. package/dist-esm/src/models/response.js.map +1 -0
  79. package/dist-esm/src/notificationHubsClient.js +251 -0
  80. package/dist-esm/src/notificationHubsClient.js.map +1 -0
  81. package/dist-esm/src/serializers/notificationDetailsSerializer.js +58 -0
  82. package/dist-esm/src/serializers/notificationDetailsSerializer.js.map +1 -0
  83. package/dist-esm/src/serializers/notificationHubJobSerializer.js +74 -0
  84. package/dist-esm/src/serializers/notificationHubJobSerializer.js.map +1 -0
  85. package/dist-esm/src/serializers/registrationSerializer.js +375 -0
  86. package/dist-esm/src/serializers/registrationSerializer.js.map +1 -0
  87. package/dist-esm/src/utils/connectionStringUtils.js +37 -0
  88. package/dist-esm/src/utils/connectionStringUtils.js.map +1 -0
  89. package/dist-esm/src/utils/constants.js +11 -0
  90. package/dist-esm/src/utils/constants.js.map +1 -0
  91. package/dist-esm/src/utils/retryPolicy.js +144 -0
  92. package/dist-esm/src/utils/retryPolicy.js.map +1 -0
  93. package/dist-esm/src/utils/tracing.js +13 -0
  94. package/dist-esm/src/utils/tracing.js.map +1 -0
  95. package/dist-esm/src/utils/utils.js +130 -0
  96. package/dist-esm/src/utils/utils.js.map +1 -0
  97. package/dist-esm/src/utils/xmlUtils.js +101 -0
  98. package/dist-esm/src/utils/xmlUtils.js.map +1 -0
  99. package/package.json +144 -0
  100. package/types/3.1/notification-hubs.d.ts +1728 -0
  101. package/types/latest/notification-hubs.d.ts +1840 -0
  102. package/types/latest/tsdoc-metadata.json +11 -0
  103. package/types/src/client/cancelScheduledNotification.d.ts +13 -0
  104. package/types/src/client/cancelScheduledNotification.d.ts.map +1 -0
  105. package/types/src/client/createOrUpdateInstallation.d.ts +13 -0
  106. package/types/src/client/createOrUpdateInstallation.d.ts.map +1 -0
  107. package/types/src/client/createOrUpdateRegistration.d.ts +12 -0
  108. package/types/src/client/createOrUpdateRegistration.d.ts.map +1 -0
  109. package/types/src/client/createRegistration.d.ts +13 -0
  110. package/types/src/client/createRegistration.d.ts.map +1 -0
  111. package/types/src/client/createRegistrationId.d.ts +10 -0
  112. package/types/src/client/createRegistrationId.d.ts.map +1 -0
  113. package/types/src/client/deleteInstallation.d.ts +12 -0
  114. package/types/src/client/deleteInstallation.d.ts.map +1 -0
  115. package/types/src/client/deleteRegistration.d.ts +12 -0
  116. package/types/src/client/deleteRegistration.d.ts.map +1 -0
  117. package/types/src/client/getFeedbackContainerUrl.d.ts +11 -0
  118. package/types/src/client/getFeedbackContainerUrl.d.ts.map +1 -0
  119. package/types/src/client/getInstallation.d.ts +12 -0
  120. package/types/src/client/getInstallation.d.ts.map +1 -0
  121. package/types/src/client/getNotificationHubJob.d.ts +12 -0
  122. package/types/src/client/getNotificationHubJob.d.ts.map +1 -0
  123. package/types/src/client/getNotificationOutcomeDetails.d.ts +13 -0
  124. package/types/src/client/getNotificationOutcomeDetails.d.ts.map +1 -0
  125. package/types/src/client/getRegistration.d.ts +12 -0
  126. package/types/src/client/getRegistration.d.ts.map +1 -0
  127. package/types/src/client/index.d.ts +41 -0
  128. package/types/src/client/index.d.ts.map +1 -0
  129. package/types/src/client/internal/_client.d.ts +26 -0
  130. package/types/src/client/internal/_client.d.ts.map +1 -0
  131. package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts +8 -0
  132. package/types/src/client/internal/_createOrUpdateRegistrationDescription.d.ts.map +1 -0
  133. package/types/src/client/internal/_scheduleNotificationPayload.d.ts +9 -0
  134. package/types/src/client/internal/_scheduleNotificationPayload.d.ts.map +1 -0
  135. package/types/src/client/internal/_sendNotificationPayload.d.ts +10 -0
  136. package/types/src/client/internal/_sendNotificationPayload.d.ts.map +1 -0
  137. package/types/src/client/listNotificationHubJobs.d.ts +11 -0
  138. package/types/src/client/listNotificationHubJobs.d.ts.map +1 -0
  139. package/types/src/client/listRegistrations.d.ts +12 -0
  140. package/types/src/client/listRegistrations.d.ts.map +1 -0
  141. package/types/src/client/listRegistrationsByTag.d.ts +13 -0
  142. package/types/src/client/listRegistrationsByTag.d.ts.map +1 -0
  143. package/types/src/client/scheduleBroadcastNotification.d.ts +16 -0
  144. package/types/src/client/scheduleBroadcastNotification.d.ts.map +1 -0
  145. package/types/src/client/scheduleNotification.d.ts +17 -0
  146. package/types/src/client/scheduleNotification.d.ts.map +1 -0
  147. package/types/src/client/sendBroadcastNotification.d.ts +14 -0
  148. package/types/src/client/sendBroadcastNotification.d.ts.map +1 -0
  149. package/types/src/client/sendDirectNotification.d.ts +16 -0
  150. package/types/src/client/sendDirectNotification.d.ts.map +1 -0
  151. package/types/src/client/sendNotification.d.ts +15 -0
  152. package/types/src/client/sendNotification.d.ts.map +1 -0
  153. package/types/src/client/submitNotificationHubJob.d.ts +13 -0
  154. package/types/src/client/submitNotificationHubJob.d.ts.map +1 -0
  155. package/types/src/client/updateInstallation.d.ts +14 -0
  156. package/types/src/client/updateInstallation.d.ts.map +1 -0
  157. package/types/src/client/updateRegistration.d.ts +12 -0
  158. package/types/src/client/updateRegistration.d.ts.map +1 -0
  159. package/types/src/index.d.ts +10 -0
  160. package/types/src/index.d.ts.map +1 -0
  161. package/types/src/models/installation.d.ts +200 -0
  162. package/types/src/models/installation.d.ts.map +1 -0
  163. package/types/src/models/notification.d.ts +166 -0
  164. package/types/src/models/notification.d.ts.map +1 -0
  165. package/types/src/models/notificationBuilder.d.ts +546 -0
  166. package/types/src/models/notificationBuilder.d.ts.map +1 -0
  167. package/types/src/models/notificationDetails.d.ts +87 -0
  168. package/types/src/models/notificationDetails.d.ts.map +1 -0
  169. package/types/src/models/notificationHubJob.d.ts +104 -0
  170. package/types/src/models/notificationHubJob.d.ts.map +1 -0
  171. package/types/src/models/options.d.ts +43 -0
  172. package/types/src/models/options.d.ts.map +1 -0
  173. package/types/src/models/registration.d.ts +368 -0
  174. package/types/src/models/registration.d.ts.map +1 -0
  175. package/types/src/models/response.d.ts +41 -0
  176. package/types/src/models/response.d.ts.map +1 -0
  177. package/types/src/notificationHubsClient.d.ts +190 -0
  178. package/types/src/notificationHubsClient.d.ts.map +1 -0
  179. package/types/src/serializers/notificationDetailsSerializer.d.ts +7 -0
  180. package/types/src/serializers/notificationDetailsSerializer.d.ts.map +1 -0
  181. package/types/src/serializers/notificationHubJobSerializer.d.ts +21 -0
  182. package/types/src/serializers/notificationHubJobSerializer.d.ts.map +1 -0
  183. package/types/src/serializers/registrationSerializer.d.ts +193 -0
  184. package/types/src/serializers/registrationSerializer.d.ts.map +1 -0
  185. package/types/src/utils/connectionStringUtils.d.ts +37 -0
  186. package/types/src/utils/connectionStringUtils.d.ts.map +1 -0
  187. package/types/src/utils/constants.d.ts +9 -0
  188. package/types/src/utils/constants.d.ts.map +1 -0
  189. package/types/src/utils/retryPolicy.d.ts +72 -0
  190. package/types/src/utils/retryPolicy.d.ts.map +1 -0
  191. package/types/src/utils/tracing.d.ts +6 -0
  192. package/types/src/utils/tracing.d.ts.map +1 -0
  193. package/types/src/utils/utils.d.ts +65 -0
  194. package/types/src/utils/utils.d.ts.map +1 -0
  195. package/types/src/utils/xmlUtils.d.ts +46 -0
  196. package/types/src/utils/xmlUtils.d.ts.map +1 -0
@@ -0,0 +1,37 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { createRequest, parseNotificationSendResponse, sendRequest } from "./_client.js";
4
+ import { tracingClient } from "../../utils/tracing.js";
5
+ /**
6
+ * @internal
7
+ */
8
+ export function scheduleNotificationPayload(context, scheduledTime, tags, notification, options = {}) {
9
+ return tracingClient.withSpan("NotificationHubsClientContext-$scheduleNotification", options, async (updatedOptions) => {
10
+ const endpoint = context.requestUrl();
11
+ endpoint.pathname += "/schedulednotifications/";
12
+ const headers = context.createHeaders();
13
+ if (notification.headers) {
14
+ for (const headerName of Object.keys(notification.headers)) {
15
+ headers.set(headerName, notification.headers[headerName]);
16
+ }
17
+ }
18
+ headers.set("ServiceBusNotification-ScheduleTime", scheduledTime.toISOString());
19
+ headers.set("Content-Type", notification.contentType);
20
+ headers.set("ServiceBusNotification-Format", notification.platform);
21
+ if (tags) {
22
+ let tagExpression = null;
23
+ if (Array.isArray(tags)) {
24
+ tagExpression = tags.join("||");
25
+ }
26
+ else {
27
+ tagExpression = tags;
28
+ }
29
+ headers.set("ServiceBusNotification-Tags", tagExpression);
30
+ }
31
+ const request = createRequest(endpoint, "POST", headers, updatedOptions);
32
+ request.body = notification.body;
33
+ const response = await sendRequest(context, request, 201);
34
+ return parseNotificationSendResponse(response);
35
+ });
36
+ }
37
+ //# sourceMappingURL=_scheduleNotificationPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_scheduleNotificationPayload.js","sourceRoot":"","sources":["../../../../src/client/internal/_scheduleNotificationPayload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;GAEG;AAEH,MAAM,UAAU,2BAA2B,CACzC,OAAsC,EACtC,aAAmB,EACnB,IAAmC,EACnC,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,qDAAqD,EACrD,OAAO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F,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./_client.js\";\nimport { Notification } from \"../../models/notification.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { NotificationHubsMessageResponse } from \"../../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { tracingClient } from \"../../utils/tracing.js\";\n\n/**\n * @internal\n */\n\nexport function scheduleNotificationPayload(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n tags: string[] | string | undefined,\n notification: Notification,\n options: OperationOptions = {}\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 = context.createHeaders();\n if (notification.headers) {\n for (const headerName of Object.keys(notification.headers)) {\n headers.set(headerName, notification.headers[headerName]);\n }\n }\n\n headers.set(\"ServiceBusNotification-ScheduleTime\", scheduledTime.toISOString());\n headers.set(\"Content-Type\", notification.contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n if (tags) {\n let tagExpression = null;\n if (Array.isArray(tags)) {\n tagExpression = tags.join(\"||\");\n } else {\n tagExpression = tags;\n }\n headers.set(\"ServiceBusNotification-Tags\", 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"]}
@@ -0,0 +1,51 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { createRequest, parseNotificationSendResponse, sendRequest } from "./_client.js";
4
+ import { tracingClient } from "../../utils/tracing.js";
5
+ /**
6
+ * @internal
7
+ */
8
+ export function sendNotificationPayload(context, notification, method, pushHandle, tags, options = {}) {
9
+ return tracingClient.withSpan(`NotificationHubsClientContext-${method}`, options, async (updatedOptions) => {
10
+ const endpoint = context.requestUrl();
11
+ endpoint.pathname += "/messages/";
12
+ if (options.enableTestSend) {
13
+ endpoint.searchParams.append("debug", "true");
14
+ }
15
+ const headers = context.createHeaders();
16
+ if (notification.headers) {
17
+ for (const headerName of Object.keys(notification.headers)) {
18
+ headers.set(headerName, notification.headers[headerName]);
19
+ }
20
+ }
21
+ if (pushHandle) {
22
+ endpoint.searchParams.append("direct", "true");
23
+ if (notification.platform === "browser") {
24
+ const browserHandle = pushHandle;
25
+ headers.set("ServiceBusNotification-DeviceHandle", browserHandle.endpoint);
26
+ headers.set("Auth", browserHandle.auth);
27
+ headers.set("P256DH", browserHandle.p256dh);
28
+ }
29
+ else {
30
+ headers.set("ServiceBusNotification-DeviceHandle", pushHandle);
31
+ }
32
+ }
33
+ headers.set("Content-Type", notification.contentType);
34
+ headers.set("ServiceBusNotification-Format", notification.platform);
35
+ if (tags) {
36
+ let tagExpression = null;
37
+ if (Array.isArray(tags)) {
38
+ tagExpression = tags.join("||");
39
+ }
40
+ else {
41
+ tagExpression = tags;
42
+ }
43
+ headers.set("ServiceBusNotification-Tags", tagExpression);
44
+ }
45
+ const request = createRequest(endpoint, "POST", headers, updatedOptions);
46
+ request.body = notification.body;
47
+ const response = await sendRequest(context, request, 201);
48
+ return parseNotificationSendResponse(response);
49
+ });
50
+ }
51
+ //# sourceMappingURL=_sendNotificationPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_sendNotificationPayload.js","sourceRoot":"","sources":["../../../../src/client/internal/_sendNotificationPayload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,YAA0B,EAC1B,MAA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,CAAC,GAAG,CAAC,+BAA+B,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEpE,IAAI,IAAI,EAAE;YACR,IAAI,aAAa,GAAG,IAAI,CAAC;YACzB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACvB,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACjC;iBAAM;gBACL,aAAa,GAAG,IAAI,CAAC;aACtB;YACD,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,aAAa,CAAC,CAAC;SAC3D;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 { BrowserPushChannel, PushHandle } from \"../../models/installation.js\";\nimport { createRequest, parseNotificationSendResponse, sendRequest } from \"./_client.js\";\nimport { Notification } from \"../../models/notification.js\";\nimport { NotificationHubsClientContext } from \"../index.js\";\nimport { NotificationHubsMessageResponse } from \"../../models/response.js\";\nimport { SendOperationOptions } from \"../../models/options.js\";\nimport { tracingClient } from \"../../utils/tracing.js\";\n\n/**\n * @internal\n */\nexport function sendNotificationPayload(\n context: NotificationHubsClientContext,\n notification: Notification,\n method: string,\n pushHandle?: PushHandle,\n tags?: string | string[],\n options: SendOperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return tracingClient.withSpan(\n `NotificationHubsClientContext-${method}`,\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/messages/\";\n\n if (options.enableTestSend) {\n endpoint.searchParams.append(\"debug\", \"true\");\n }\n\n const headers = context.createHeaders();\n if (notification.headers) {\n for (const headerName of Object.keys(notification.headers)) {\n headers.set(headerName, notification.headers[headerName]);\n }\n }\n\n if (pushHandle) {\n endpoint.searchParams.append(\"direct\", \"true\");\n\n if (notification.platform === \"browser\") {\n const browserHandle = pushHandle 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\", pushHandle as string);\n }\n }\n\n headers.set(\"Content-Type\", notification.contentType);\n headers.set(\"ServiceBusNotification-Format\", notification.platform);\n\n if (tags) {\n let tagExpression = null;\n if (Array.isArray(tags)) {\n tagExpression = tags.join(\"||\");\n } else {\n tagExpression = tags;\n }\n headers.set(\"ServiceBusNotification-Tags\", 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"]}
@@ -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 { parseNotificationHubJobFeed } from "../serializers/notificationHubJobSerializer.js";
5
+ import { tracingClient } from "../utils/tracing.js";
6
+ /**
7
+ * Gets all Notification Hub Jobs for this Notification Hub.
8
+ * @param context - The Notification Hubs client.xs
9
+ * @param options - The operation options.
10
+ * @returns An array of all Notification Hub Jobs for this Notification Hub.
11
+ */
12
+ export function listNotificationHubJobs(context, options = {}) {
13
+ return tracingClient.withSpan("NotificationHubsClientContext-getNotificationHubJobs", options, async (updatedOptions) => {
14
+ const endpoint = context.requestUrl();
15
+ endpoint.pathname += "/jobs";
16
+ const headers = context.createHeaders();
17
+ headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
18
+ const request = createRequest(endpoint, "GET", headers, updatedOptions);
19
+ const response = await sendRequest(context, request, 200);
20
+ return parseNotificationHubJobFeed(response.bodyAsText);
21
+ });
22
+ }
23
+ //# sourceMappingURL=listNotificationHubJobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listNotificationHubJobs.js","sourceRoot":"","sources":["../../../src/client/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;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsC,EACtC,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,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,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,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\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-getNotificationHubJobs\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/jobs\";\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 parseNotificationHubJobFeed(response.bodyAsText!);\n }\n );\n}\n"]}
@@ -0,0 +1,89 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
+ import { createRequest, sendRequest } from "./internal/_client.js";
5
+ import { registrationDescriptionParser } from "../serializers/registrationSerializer.js";
6
+ import { tracingClient } from "../utils/tracing.js";
7
+ /**
8
+ * Gets all registrations for the notification hub with the given query options.
9
+ * @param context - The Notification Hubs client.
10
+ * @param options - The options for querying the registrations such as $top and $filter.
11
+ * @returns A paged async iterable containing all of the registrations for the notification hub.
12
+ */
13
+ export function listRegistrations(context, options = {}) {
14
+ const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext-listRegistrations", options);
15
+ try {
16
+ const iter = listRegistrationsAll(context, updatedOptions);
17
+ return {
18
+ next() {
19
+ return iter.next();
20
+ },
21
+ [Symbol.asyncIterator]() {
22
+ return this;
23
+ },
24
+ byPage: () => {
25
+ return listRegistrationPagingPage(context, options);
26
+ },
27
+ };
28
+ }
29
+ catch (e) {
30
+ span.setStatus({ status: "error", error: e });
31
+ throw e;
32
+ }
33
+ finally {
34
+ span.end();
35
+ }
36
+ }
37
+ function listRegistrationsAll(context, options) {
38
+ return __asyncGenerator(this, arguments, function* listRegistrationsAll_1() {
39
+ var e_1, _a;
40
+ try {
41
+ for (var _b = __asyncValues(listRegistrationPagingPage(context, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
42
+ const page = _c.value;
43
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
44
+ }
45
+ }
46
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
47
+ finally {
48
+ try {
49
+ if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
50
+ }
51
+ finally { if (e_1) throw e_1.error; }
52
+ }
53
+ });
54
+ }
55
+ function listRegistrationPagingPage(context, options) {
56
+ return __asyncGenerator(this, arguments, function* listRegistrationPagingPage_1() {
57
+ let result = yield __await(_listRegistrations(context, options));
58
+ yield yield __await(result.registrations || []);
59
+ let continuationToken = result.continuationToken;
60
+ while (continuationToken) {
61
+ result = yield __await(_listRegistrations(context, options, continuationToken));
62
+ continuationToken = result.continuationToken;
63
+ yield yield __await(result.registrations || []);
64
+ }
65
+ });
66
+ }
67
+ async function _listRegistrations(context, options, continuationToken) {
68
+ const endpoint = context.requestUrl();
69
+ endpoint.pathname += "/registrations";
70
+ if (options.top !== undefined) {
71
+ endpoint.searchParams.set("$top", `${options.top}`);
72
+ }
73
+ if (options.filter !== undefined) {
74
+ endpoint.searchParams.set("$filter", options.filter);
75
+ }
76
+ if (continuationToken !== undefined) {
77
+ endpoint.searchParams.set("continuationtoken", continuationToken);
78
+ }
79
+ const headers = context.createHeaders();
80
+ const request = createRequest(endpoint, "GET", headers, options);
81
+ const response = await sendRequest(context, request, 200);
82
+ const registrations = await registrationDescriptionParser.parseRegistrationFeed(response.bodyAsText);
83
+ const nextToken = response.headers.get("x-ms-continuationtoken");
84
+ return {
85
+ registrations,
86
+ continuationToken: nextToken,
87
+ };
88
+ }
89
+ //# sourceMappingURL=listRegistrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listRegistrations.js","sourceRoot":"","sources":["../../../src/client/listRegistrations.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;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAsC,EACtC,UAAoC,EAAE;IAEtC,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,OAAO,CAAC,CAAC;YACtD,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;AAED,SAAgB,oBAAoB,CAClC,OAAsC,EACtC,OAAiC;;;;YAEjC,KAAyB,IAAA,KAAA,cAAA,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,IAAA;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AAC,aAAa,EAAE,CAAC;IAExC,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 { RegistrationQueryOptions } from \"../models/options.js\";\nimport { RegistrationQueryResponse } from \"../models/response.js\";\nimport { registrationDescriptionParser } from \"../serializers/registrationSerializer.js\";\nimport { tracingClient } from \"../utils/tracing.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 and $filter.\n * @returns A paged async iterable containing all of the registrations for the notification hub.\n */\nexport function listRegistrations(\n context: NotificationHubsClientContext,\n options: RegistrationQueryOptions = {}\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, 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* 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\nasync 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 = context.createHeaders();\n\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"]}
@@ -0,0 +1,87 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
+ import { createRequest, sendRequest } from "./internal/_client.js";
5
+ import { registrationDescriptionParser } from "../serializers/registrationSerializer.js";
6
+ import { tracingClient } from "../utils/tracing.js";
7
+ /**
8
+ * Lists all registrations with the matching tag.
9
+ * @param context - The Notification Hubs client.
10
+ * @param tag - The tag to query for matching registrations.
11
+ * @param options - The query options such as $top.
12
+ * @returns A paged async iterable containing the matching registrations for the notification hub.
13
+ */
14
+ export function listRegistrationsByTag(context, tag, options = {}) {
15
+ const { span, updatedOptions } = tracingClient.startSpan("NotificationHubsClientContext-listRegistrationsByTag", options);
16
+ try {
17
+ const iter = listRegistrationsByTagAll(context, tag, updatedOptions);
18
+ return {
19
+ next() {
20
+ return iter.next();
21
+ },
22
+ [Symbol.asyncIterator]() {
23
+ return this;
24
+ },
25
+ byPage: () => {
26
+ return listRegistrationsByTagPagingPage(context, tag, 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 listRegistrationsByTagAll(context, tag, options) {
39
+ return __asyncGenerator(this, arguments, function* listRegistrationsByTagAll_1() {
40
+ var e_1, _a;
41
+ try {
42
+ for (var _b = __asyncValues(listRegistrationsByTagPagingPage(context, tag, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
43
+ const page = _c.value;
44
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
45
+ }
46
+ }
47
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
48
+ finally {
49
+ try {
50
+ if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
51
+ }
52
+ finally { if (e_1) throw e_1.error; }
53
+ }
54
+ });
55
+ }
56
+ function listRegistrationsByTagPagingPage(context, tag, options) {
57
+ return __asyncGenerator(this, arguments, function* listRegistrationsByTagPagingPage_1() {
58
+ let result = yield __await(_listRegistrationsByTag(context, tag, options));
59
+ yield yield __await(result.registrations || []);
60
+ let continuationToken = result.continuationToken;
61
+ while (continuationToken) {
62
+ result = yield __await(_listRegistrationsByTag(context, tag, options, continuationToken));
63
+ continuationToken = result.continuationToken;
64
+ yield yield __await(result.registrations || []);
65
+ }
66
+ });
67
+ }
68
+ async function _listRegistrationsByTag(context, tag, options, continuationToken) {
69
+ const endpoint = context.requestUrl();
70
+ endpoint.pathname += `/tags/${tag}/registrations`;
71
+ if (options.top !== undefined) {
72
+ endpoint.searchParams.set("$top", `${options.top}`);
73
+ }
74
+ if (continuationToken !== undefined) {
75
+ endpoint.searchParams.set("continuationtoken", continuationToken);
76
+ }
77
+ const headers = context.createHeaders();
78
+ const request = createRequest(endpoint, "GET", headers, options);
79
+ const response = await sendRequest(context, request, 200);
80
+ const registrations = await registrationDescriptionParser.parseRegistrationFeed(response.bodyAsText);
81
+ const nextToken = response.headers.get("x-ms-continuationtoken");
82
+ return {
83
+ registrations,
84
+ continuationToken: nextToken,
85
+ };
86
+ }
87
+ //# sourceMappingURL=listRegistrationsByTag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listRegistrationsByTag.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAsC,EACtC,GAAW,EACX,UAAyC,EAAE;IAE3C,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,sDAAsD,EACtD,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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IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE;QAC7B,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;KACrD;IAED,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACnC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;KACnE;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAExC,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\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-listRegistrationsByTag\",\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 = context.createHeaders();\n\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"]}
@@ -0,0 +1,17 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { scheduleNotificationPayload } from "./internal/_scheduleNotificationPayload.js";
4
+ /**
5
+ * Schedules a push notification to all devices registered on the Notification Hub.
6
+ * NOTE: This is only available in Standard SKU Azure Notification Hubs.
7
+ * @param context - The Notification Hubs client.
8
+ * @param scheduledTime - The Date to send the push notification.
9
+ * @param notification - The notification to send to the matching devices.
10
+ * @param options - Configuration options for the direct send operation which can contain custom headers
11
+ * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
12
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
13
+ */
14
+ export function scheduleBroadcastNotification(context, scheduledTime, notification, options = {}) {
15
+ return scheduleNotificationPayload(context, scheduledTime, undefined, notification, options);
16
+ }
17
+ //# sourceMappingURL=scheduleBroadcastNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduleBroadcastNotification.js","sourceRoot":"","sources":["../../../src/client/scheduleBroadcastNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF;;;;;;;;;GASG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAsC,EACtC,aAAmB,EACnB,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAC/F,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { scheduleNotificationPayload } from \"./internal/_scheduleNotificationPayload.js\";\n\n/**\n * Schedules a push notification to all devices registered on the Notification Hub.\n * NOTE: This is only available in Standard SKU Azure Notification Hubs.\n * @param 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 - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleBroadcastNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n notification: Notification,\n options: OperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationPayload(context, scheduledTime, undefined, notification, options);\n}\n"]}
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { scheduleNotificationPayload } from "./internal/_scheduleNotificationPayload.js";
4
+ /**
5
+ * Schedules a push notification to devices that match the given tags or tag expression at the specified time.
6
+ * NOTE: This is only available in Standard SKU Azure Notification Hubs.
7
+ * @param context - The Notification Hubs client.
8
+ * @param scheduledTime - The Date to send the push notification.
9
+ * @param tags - The tags used to target the device for push notifications in either an array or tag expression.
10
+ * @param notification - The notification to send to the matching devices.
11
+ * @param options - Configuration options for the direct send operation which can contain custom headers
12
+ * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
13
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
14
+ */
15
+ export function scheduleNotification(context, scheduledTime, tags, notification, options = {}) {
16
+ return scheduleNotificationPayload(context, scheduledTime, tags, notification, options);
17
+ }
18
+ //# sourceMappingURL=scheduleNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduleNotification.js","sourceRoot":"","sources":["../../../src/client/scheduleNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAsC,EACtC,aAAmB,EACnB,IAAuB,EACvB,YAA0B,EAC1B,UAA4B,EAAE;IAE9B,OAAO,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/response.js\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { scheduleNotificationPayload } from \"./internal/_scheduleNotificationPayload.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 tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function scheduleNotification(\n context: NotificationHubsClientContext,\n scheduledTime: Date,\n tags: string[] | string,\n notification: Notification,\n options: OperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return scheduleNotificationPayload(context, scheduledTime, tags, notification, options);\n}\n"]}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { sendNotificationPayload } from "./internal/_sendNotificationPayload.js";
4
+ /**
5
+ * Sends push notifications to all devices on the Notification Hub.
6
+ * @param context - The Notification Hubs client.
7
+ * @param notification - The notification to send to all devices.
8
+ * @param options - Configuration options for the direct send operation which can contain custom headers
9
+ * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
10
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
11
+ */
12
+ export function sendBroadcastNotification(context, notification, options = {}) {
13
+ return sendNotificationPayload(context, notification, "sendNotification", undefined, undefined, options);
14
+ }
15
+ //# sourceMappingURL=sendBroadcastNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendBroadcastNotification.js","sourceRoot":"","sources":["../../../src/client/sendBroadcastNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAsC,EACtC,YAA0B,EAC1B,UAAgC,EAAE;IAElC,OAAO,uBAAuB,CAC5B,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/response.js\";\nimport { SendOperationOptions } from \"../models/options.js\";\nimport { sendNotificationPayload } from \"./internal/_sendNotificationPayload.js\";\n\n/**\n * Sends push notifications to all devices on the Notification Hub.\n * @param context - The Notification Hubs client.\n * @param notification - The notification to send to all devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendBroadcastNotification(\n context: NotificationHubsClientContext,\n notification: Notification,\n options: SendOperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return sendNotificationPayload(\n context,\n notification,\n \"sendNotification\",\n undefined,\n undefined,\n options\n );\n}\n"]}
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { sendNotificationPayload } from "./internal/_sendNotificationPayload.js";
4
+ /**
5
+ * Sends a direct push notification to a device with the given push handle.
6
+ * @param context - The Notification Hubs client.
7
+ * @param pushHandle - The push handle which is the unique identifier for the device.
8
+ * @param notification - The notification to send to the device.
9
+ * @param options - Configuration options for the direct send operation which can contain custom headers
10
+ * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
11
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
12
+ */
13
+ export function sendDirectNotification(context, pushHandle, notification, options = {}) {
14
+ return sendNotificationPayload(context, notification, "sendDirectNotification", pushHandle, undefined, options);
15
+ }
16
+ //# sourceMappingURL=sendDirectNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendDirectNotification.js","sourceRoot":"","sources":["../../../src/client/sendDirectNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAsC,EACtC,UAAsB,EACtB,YAA0B,EAC1B,UAAgC,EAAE;IAElC,OAAO,uBAAuB,CAC5B,OAAO,EACP,YAAY,EACZ,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/response.js\";\nimport { PushHandle } from \"../models/installation.js\";\nimport { SendOperationOptions } from \"../models/options.js\";\nimport { sendNotificationPayload } from \"./internal/_sendNotificationPayload.js\";\n\n/**\n * Sends a direct push notification to a device with the given push handle.\n * @param context - The Notification Hubs client.\n * @param pushHandle - The push handle which is the unique identifier for the device.\n * @param notification - The notification to send to the device.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendDirectNotification(\n context: NotificationHubsClientContext,\n pushHandle: PushHandle,\n notification: Notification,\n options: SendOperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return sendNotificationPayload(\n context,\n notification,\n \"sendDirectNotification\",\n pushHandle,\n undefined,\n options\n );\n}\n"]}
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { sendNotificationPayload } from "./internal/_sendNotificationPayload.js";
4
+ /**
5
+ * Sends push notifications to devices that match the given tags or tag expression.
6
+ * @param context - The Notification Hubs client.
7
+ * @param tags - The tags used to target the device for push notifications in either an array or tag expression.
8
+ * @param notification - The notification to send to the matching devices.
9
+ * @param options - Configuration options for the direct send operation which can contain custom headers
10
+ * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.
11
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
12
+ */
13
+ export function sendNotification(context, tags, notification, options = {}) {
14
+ return sendNotificationPayload(context, notification, "sendNotification", undefined, tags, options);
15
+ }
16
+ //# sourceMappingURL=sendNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/client/sendNotification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAsC,EACtC,IAAuB,EACvB,YAA0B,EAC1B,UAAgC,EAAE;IAElC,OAAO,uBAAuB,CAC5B,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Notification } from \"../models/notification.js\";\nimport { NotificationHubsClientContext } from \"./index.js\";\nimport { NotificationHubsMessageResponse } from \"../models/response.js\";\nimport { SendOperationOptions } from \"../models/options.js\";\nimport { sendNotificationPayload } from \"./internal/_sendNotificationPayload.js\";\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 tags - The tags used to target the device for push notifications in either an array or tag expression.\n * @param notification - The notification to send to the matching devices.\n * @param options - Configuration options for the direct send operation which can contain custom headers\n * which may include APNs specific such as apns-topic or for WNS, X-WNS-TYPE.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function sendNotification(\n context: NotificationHubsClientContext,\n tags: string[] | string,\n notification: Notification,\n options: SendOperationOptions = {}\n): Promise<NotificationHubsMessageResponse> {\n return sendNotificationPayload(\n context,\n notification,\n \"sendNotification\",\n undefined,\n tags,\n options\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 { parseNotificationHubJobEntry, serializeNotificationHubJobEntry, } from "../serializers/notificationHubJobSerializer.js";
5
+ import { tracingClient } from "../utils/tracing.js";
6
+ /**
7
+ * Submits a Notification Hub Job.
8
+ * Note: this is available to Standard SKU namespace and above.
9
+ * @param context - The Notification Hubs client.
10
+ * @param job - The notification hub job to submit.
11
+ * @param options - The operation options.
12
+ * @returns The notification hub job details including job ID and status.
13
+ */
14
+ export function submitNotificationHubJob(context, job, options = {}) {
15
+ return tracingClient.withSpan("NotificationHubsClientContext-submitNotificationHubJob", options, async (updatedOptions) => {
16
+ const endpoint = context.requestUrl();
17
+ endpoint.pathname += "/jobs";
18
+ const headers = context.createHeaders();
19
+ headers.set("Content-Type", "application/atom+xml;type=entry;charset=utf-8");
20
+ const request = createRequest(endpoint, "POST", headers, updatedOptions);
21
+ request.body = serializeNotificationHubJobEntry(job);
22
+ const response = await sendRequest(context, request, 201);
23
+ return parseNotificationHubJobEntry(response.bodyAsText);
24
+ });
25
+ }
26
+ //# sourceMappingURL=submitNotificationHubJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submitNotificationHubJob.js","sourceRoot":"","sources":["../../../src/client/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;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAsC,EACtC,GAAuB,EACvB,UAA4B,EAAE;IAE9B,OAAO,aAAa,CAAC,QAAQ,CAC3B,wDAAwD,EACxD,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,OAAO,CAAC,aAAa,EAAE,CAAC;QACxC,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;QAErD,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\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-submitNotificationHubJob\",\n options,\n async (updatedOptions) => {\n const endpoint = context.requestUrl();\n endpoint.pathname += \"/jobs\";\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, \"POST\", headers, updatedOptions);\n request.body = serializeNotificationHubJobEntry(job);\n\n const response = await sendRequest(context, request, 201);\n\n return parseNotificationHubJobEntry(response.bodyAsText!);\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 { tracingClient } from "../utils/tracing.js";
5
+ /**
6
+ * Updates an installation using the JSON-Patch standard in RFC6902.
7
+ * @param context - The Notification Hubs client.
8
+ * @param installationId - The ID of the installation to update.
9
+ * @param installationPatches - An array of patches following the JSON-Patch standard.
10
+ * @param options - Configuration options for the patch installation operation.
11
+ * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.
12
+ */
13
+ export function updateInstallation(context, installationId, installationPatches, options = {}) {
14
+ return tracingClient.withSpan("NotificationHubsClientContext-updateInstallation", options, async (updatedOptions) => {
15
+ const endpoint = context.requestUrl();
16
+ endpoint.pathname += `/installations/${installationId}`;
17
+ const headers = context.createHeaders();
18
+ headers.set("Content-Type", "application/json");
19
+ const request = createRequest(endpoint, "PATCH", headers, updatedOptions);
20
+ request.body = JSON.stringify(installationPatches);
21
+ const response = await sendRequest(context, request, 200);
22
+ return parseNotificationResponse(response);
23
+ });
24
+ }
25
+ //# sourceMappingURL=updateInstallation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateInstallation.js","sourceRoot":"","sources":["../../../src/client/updateInstallation.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;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsC,EACtC,cAAsB,EACtB,mBAAgC,EAChC,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;QACxC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAEnD,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 { JsonPatch } 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 * Updates an installation using the JSON-Patch standard in RFC6902.\n * @param context - The Notification Hubs client.\n * @param installationId - The ID of the installation to update.\n * @param installationPatches - An array of patches following the JSON-Patch standard.\n * @param options - Configuration options for the patch installation operation.\n * @returns A NotificationHubResponse with the tracking ID, correlation ID and location.\n */\nexport function updateInstallation(\n context: NotificationHubsClientContext,\n installationId: string,\n installationPatches: JsonPatch[],\n options: OperationOptions = {}\n): Promise<NotificationHubsResponse> {\n return tracingClient.withSpan(\n \"NotificationHubsClientContext-updateInstallation\",\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, \"PATCH\", headers, updatedOptions);\n request.body = JSON.stringify(installationPatches);\n\n const response = await sendRequest(context, request, 200);\n\n return parseNotificationResponse(response);\n }\n );\n}\n"]}
@@ -0,0 +1,21 @@
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
+ * Updates an existing registration.
8
+ * @param context - The Notification Hubs client.
9
+ * @param registration - The registration to update.
10
+ * @param options - The operation options.
11
+ * @returns The updated registration description.
12
+ */
13
+ export function updateRegistration(context, registration, options = {}) {
14
+ return tracingClient.withSpan("NotificationHubsClientContext-updateRegistration", options, async (updatedOptions) => {
15
+ if (!registration.etag) {
16
+ throw new RestError("ETag is required for registration update", { statusCode: 400 });
17
+ }
18
+ return createOrUpdateRegistrationDescription(context, registration, "update", updatedOptions);
19
+ });
20
+ }
21
+ //# sourceMappingURL=updateRegistration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateRegistration.js","sourceRoot":"","sources":["../../../src/client/updateRegistration.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;;;;;;GAMG;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,CAAC,YAAY,CAAC,IAAI,EAAE;YACtB,MAAM,IAAI,SAAS,CAAC,0CAA0C,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;SACtF;QACD,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 * Updates an existing registration.\n * @param context - The Notification Hubs client.\n * @param registration - The registration to update.\n * @param options - The operation options.\n * @returns The updated registration description.\n */\nexport function updateRegistration(\n context: NotificationHubsClientContext,\n registration: RegistrationDescription,\n options: OperationOptions = {}\n): Promise<RegistrationDescription> {\n return tracingClient.withSpan(\n \"NotificationHubsClientContext-updateRegistration\",\n options,\n async (updatedOptions) => {\n if (!registration.etag) {\n throw new RestError(\"ETag is required for registration update\", { statusCode: 400 });\n }\n return createOrUpdateRegistrationDescription(context, registration, \"update\", updatedOptions);\n }\n );\n}\n"]}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export { NotificationHubsServiceClient } from "./notificationHubsClient.js";
4
+ export * from "./models/installation.js";
5
+ export * from "./models/notification.js";
6
+ export * from "./models/notificationBuilder.js";
7
+ export * from "./models/notificationDetails.js";
8
+ export * from "./models/notificationHubJob.js";
9
+ export * from "./models/options.js";
10
+ export * from "./models/registration.js";
11
+ export * from "./models/response.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { NotificationHubsServiceClient } from \"./notificationHubsClient.js\";\nexport * from \"./models/installation.js\";\nexport * from \"./models/notification.js\";\nexport * from \"./models/notificationBuilder.js\";\nexport * from \"./models/notificationDetails.js\";\nexport * from \"./models/notificationHubJob.js\";\nexport * from \"./models/options.js\";\nexport * from \"./models/registration.js\";\nexport * from \"./models/response.js\";\n"]}