@azure/communication-sms 1.2.0-alpha.20241210.1 → 1.2.0-beta.2

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 (189) hide show
  1. package/dist/browser/constants.js +1 -1
  2. package/dist/browser/constants.js.map +1 -1
  3. package/dist/browser/generated/src/models/index.d.ts +39 -0
  4. package/dist/browser/generated/src/models/index.d.ts.map +1 -1
  5. package/dist/browser/generated/src/models/index.js.map +1 -1
  6. package/dist/browser/generated/src/models/mappers.d.ts +4 -0
  7. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -1
  8. package/dist/browser/generated/src/models/mappers.js +111 -0
  9. package/dist/browser/generated/src/models/mappers.js.map +1 -1
  10. package/dist/browser/generated/src/models/parameters.d.ts +1 -0
  11. package/dist/browser/generated/src/models/parameters.d.ts.map +1 -1
  12. package/dist/browser/generated/src/models/parameters.js +6 -2
  13. package/dist/browser/generated/src/models/parameters.js.map +1 -1
  14. package/dist/browser/generated/src/operations/index.d.ts +1 -0
  15. package/dist/browser/generated/src/operations/index.d.ts.map +1 -1
  16. package/dist/browser/generated/src/operations/index.js +1 -0
  17. package/dist/browser/generated/src/operations/index.js.map +1 -1
  18. package/dist/browser/generated/src/operations/optOuts.d.ts +31 -0
  19. package/dist/browser/generated/src/operations/optOuts.d.ts.map +1 -0
  20. package/dist/browser/generated/src/operations/optOuts.js +99 -0
  21. package/dist/browser/generated/src/operations/optOuts.js.map +1 -0
  22. package/dist/browser/generated/src/operationsInterfaces/index.d.ts +1 -0
  23. package/dist/browser/generated/src/operationsInterfaces/index.d.ts.map +1 -1
  24. package/dist/browser/generated/src/operationsInterfaces/index.js +1 -0
  25. package/dist/browser/generated/src/operationsInterfaces/index.js.map +1 -1
  26. package/dist/browser/generated/src/operationsInterfaces/optOuts.d.ts +23 -0
  27. package/dist/browser/generated/src/operationsInterfaces/optOuts.d.ts.map +1 -0
  28. package/dist/browser/generated/src/operationsInterfaces/optOuts.js +9 -0
  29. package/dist/browser/generated/src/operationsInterfaces/optOuts.js.map +1 -0
  30. package/dist/browser/generated/src/smsApiClient.d.ts +2 -1
  31. package/dist/browser/generated/src/smsApiClient.d.ts.map +1 -1
  32. package/dist/browser/generated/src/smsApiClient.js +4 -3
  33. package/dist/browser/generated/src/smsApiClient.js.map +1 -1
  34. package/dist/browser/generated/src/tracing.js +1 -1
  35. package/dist/browser/generated/src/tracing.js.map +1 -1
  36. package/dist/browser/optOutsClient.d.ts +105 -0
  37. package/dist/browser/optOutsClient.d.ts.map +1 -0
  38. package/dist/browser/optOutsClient.js +79 -0
  39. package/dist/browser/optOutsClient.js.map +1 -0
  40. package/dist/browser/smsClient.d.ts +109 -1
  41. package/dist/browser/smsClient.d.ts.map +1 -1
  42. package/dist/browser/smsClient.js +2 -0
  43. package/dist/browser/smsClient.js.map +1 -1
  44. package/dist/browser/utils/smsUtils.d.ts +2 -1
  45. package/dist/browser/utils/smsUtils.d.ts.map +1 -1
  46. package/dist/browser/utils/smsUtils.js +10 -0
  47. package/dist/browser/utils/smsUtils.js.map +1 -1
  48. package/dist/commonjs/constants.js +1 -1
  49. package/dist/commonjs/constants.js.map +1 -1
  50. package/dist/commonjs/generated/src/models/index.d.ts +39 -0
  51. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
  52. package/dist/commonjs/generated/src/models/index.js.map +1 -1
  53. package/dist/commonjs/generated/src/models/mappers.d.ts +4 -0
  54. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
  55. package/dist/commonjs/generated/src/models/mappers.js +112 -1
  56. package/dist/commonjs/generated/src/models/mappers.js.map +1 -1
  57. package/dist/commonjs/generated/src/models/parameters.d.ts +1 -0
  58. package/dist/commonjs/generated/src/models/parameters.d.ts.map +1 -1
  59. package/dist/commonjs/generated/src/models/parameters.js +6 -2
  60. package/dist/commonjs/generated/src/models/parameters.js.map +1 -1
  61. package/dist/commonjs/generated/src/operations/index.d.ts +1 -0
  62. package/dist/commonjs/generated/src/operations/index.d.ts.map +1 -1
  63. package/dist/commonjs/generated/src/operations/index.js +1 -0
  64. package/dist/commonjs/generated/src/operations/index.js.map +1 -1
  65. package/dist/commonjs/generated/src/operations/optOuts.d.ts +31 -0
  66. package/dist/commonjs/generated/src/operations/optOuts.d.ts.map +1 -0
  67. package/dist/commonjs/generated/src/operations/optOuts.js +104 -0
  68. package/dist/commonjs/generated/src/operations/optOuts.js.map +1 -0
  69. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts +1 -0
  70. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts.map +1 -1
  71. package/dist/commonjs/generated/src/operationsInterfaces/index.js +1 -0
  72. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +1 -1
  73. package/dist/commonjs/generated/src/operationsInterfaces/optOuts.d.ts +23 -0
  74. package/dist/commonjs/generated/src/operationsInterfaces/optOuts.d.ts.map +1 -0
  75. package/dist/commonjs/generated/src/operationsInterfaces/optOuts.js +10 -0
  76. package/dist/commonjs/generated/src/operationsInterfaces/optOuts.js.map +1 -0
  77. package/dist/commonjs/generated/src/smsApiClient.d.ts +2 -1
  78. package/dist/commonjs/generated/src/smsApiClient.d.ts.map +1 -1
  79. package/dist/commonjs/generated/src/smsApiClient.js +3 -2
  80. package/dist/commonjs/generated/src/smsApiClient.js.map +1 -1
  81. package/dist/commonjs/generated/src/tracing.js +1 -1
  82. package/dist/commonjs/generated/src/tracing.js.map +1 -1
  83. package/dist/commonjs/optOutsClient.d.ts +105 -0
  84. package/dist/commonjs/optOutsClient.d.ts.map +1 -0
  85. package/dist/commonjs/optOutsClient.js +83 -0
  86. package/dist/commonjs/optOutsClient.js.map +1 -0
  87. package/dist/commonjs/smsClient.d.ts +109 -1
  88. package/dist/commonjs/smsClient.d.ts.map +1 -1
  89. package/dist/commonjs/smsClient.js +2 -0
  90. package/dist/commonjs/smsClient.js.map +1 -1
  91. package/dist/commonjs/utils/smsUtils.d.ts +2 -1
  92. package/dist/commonjs/utils/smsUtils.d.ts.map +1 -1
  93. package/dist/commonjs/utils/smsUtils.js +11 -0
  94. package/dist/commonjs/utils/smsUtils.js.map +1 -1
  95. package/dist/esm/constants.js +1 -1
  96. package/dist/esm/constants.js.map +1 -1
  97. package/dist/esm/generated/src/models/index.d.ts +39 -0
  98. package/dist/esm/generated/src/models/index.d.ts.map +1 -1
  99. package/dist/esm/generated/src/models/index.js.map +1 -1
  100. package/dist/esm/generated/src/models/mappers.d.ts +4 -0
  101. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
  102. package/dist/esm/generated/src/models/mappers.js +111 -0
  103. package/dist/esm/generated/src/models/mappers.js.map +1 -1
  104. package/dist/esm/generated/src/models/parameters.d.ts +1 -0
  105. package/dist/esm/generated/src/models/parameters.d.ts.map +1 -1
  106. package/dist/esm/generated/src/models/parameters.js +6 -2
  107. package/dist/esm/generated/src/models/parameters.js.map +1 -1
  108. package/dist/esm/generated/src/operations/index.d.ts +1 -0
  109. package/dist/esm/generated/src/operations/index.d.ts.map +1 -1
  110. package/dist/esm/generated/src/operations/index.js +1 -0
  111. package/dist/esm/generated/src/operations/index.js.map +1 -1
  112. package/dist/esm/generated/src/operations/optOuts.d.ts +31 -0
  113. package/dist/esm/generated/src/operations/optOuts.d.ts.map +1 -0
  114. package/dist/esm/generated/src/operations/optOuts.js +99 -0
  115. package/dist/esm/generated/src/operations/optOuts.js.map +1 -0
  116. package/dist/esm/generated/src/operationsInterfaces/index.d.ts +1 -0
  117. package/dist/esm/generated/src/operationsInterfaces/index.d.ts.map +1 -1
  118. package/dist/esm/generated/src/operationsInterfaces/index.js +1 -0
  119. package/dist/esm/generated/src/operationsInterfaces/index.js.map +1 -1
  120. package/dist/esm/generated/src/operationsInterfaces/optOuts.d.ts +23 -0
  121. package/dist/esm/generated/src/operationsInterfaces/optOuts.d.ts.map +1 -0
  122. package/dist/esm/generated/src/operationsInterfaces/optOuts.js +9 -0
  123. package/dist/esm/generated/src/operationsInterfaces/optOuts.js.map +1 -0
  124. package/dist/esm/generated/src/smsApiClient.d.ts +2 -1
  125. package/dist/esm/generated/src/smsApiClient.d.ts.map +1 -1
  126. package/dist/esm/generated/src/smsApiClient.js +4 -3
  127. package/dist/esm/generated/src/smsApiClient.js.map +1 -1
  128. package/dist/esm/generated/src/tracing.js +1 -1
  129. package/dist/esm/generated/src/tracing.js.map +1 -1
  130. package/dist/esm/optOutsClient.d.ts +105 -0
  131. package/dist/esm/optOutsClient.d.ts.map +1 -0
  132. package/dist/esm/optOutsClient.js +79 -0
  133. package/dist/esm/optOutsClient.js.map +1 -0
  134. package/dist/esm/smsClient.d.ts +109 -1
  135. package/dist/esm/smsClient.d.ts.map +1 -1
  136. package/dist/esm/smsClient.js +2 -0
  137. package/dist/esm/smsClient.js.map +1 -1
  138. package/dist/esm/utils/smsUtils.d.ts +2 -1
  139. package/dist/esm/utils/smsUtils.d.ts.map +1 -1
  140. package/dist/esm/utils/smsUtils.js +10 -0
  141. package/dist/esm/utils/smsUtils.js.map +1 -1
  142. package/dist/react-native/constants.js +1 -1
  143. package/dist/react-native/constants.js.map +1 -1
  144. package/dist/react-native/generated/src/models/index.d.ts +39 -0
  145. package/dist/react-native/generated/src/models/index.d.ts.map +1 -1
  146. package/dist/react-native/generated/src/models/index.js.map +1 -1
  147. package/dist/react-native/generated/src/models/mappers.d.ts +4 -0
  148. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -1
  149. package/dist/react-native/generated/src/models/mappers.js +111 -0
  150. package/dist/react-native/generated/src/models/mappers.js.map +1 -1
  151. package/dist/react-native/generated/src/models/parameters.d.ts +1 -0
  152. package/dist/react-native/generated/src/models/parameters.d.ts.map +1 -1
  153. package/dist/react-native/generated/src/models/parameters.js +6 -2
  154. package/dist/react-native/generated/src/models/parameters.js.map +1 -1
  155. package/dist/react-native/generated/src/operations/index.d.ts +1 -0
  156. package/dist/react-native/generated/src/operations/index.d.ts.map +1 -1
  157. package/dist/react-native/generated/src/operations/index.js +1 -0
  158. package/dist/react-native/generated/src/operations/index.js.map +1 -1
  159. package/dist/react-native/generated/src/operations/optOuts.d.ts +31 -0
  160. package/dist/react-native/generated/src/operations/optOuts.d.ts.map +1 -0
  161. package/dist/react-native/generated/src/operations/optOuts.js +99 -0
  162. package/dist/react-native/generated/src/operations/optOuts.js.map +1 -0
  163. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts +1 -0
  164. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts.map +1 -1
  165. package/dist/react-native/generated/src/operationsInterfaces/index.js +1 -0
  166. package/dist/react-native/generated/src/operationsInterfaces/index.js.map +1 -1
  167. package/dist/react-native/generated/src/operationsInterfaces/optOuts.d.ts +23 -0
  168. package/dist/react-native/generated/src/operationsInterfaces/optOuts.d.ts.map +1 -0
  169. package/dist/react-native/generated/src/operationsInterfaces/optOuts.js +9 -0
  170. package/dist/react-native/generated/src/operationsInterfaces/optOuts.js.map +1 -0
  171. package/dist/react-native/generated/src/smsApiClient.d.ts +2 -1
  172. package/dist/react-native/generated/src/smsApiClient.d.ts.map +1 -1
  173. package/dist/react-native/generated/src/smsApiClient.js +4 -3
  174. package/dist/react-native/generated/src/smsApiClient.js.map +1 -1
  175. package/dist/react-native/generated/src/tracing.js +1 -1
  176. package/dist/react-native/generated/src/tracing.js.map +1 -1
  177. package/dist/react-native/optOutsClient.d.ts +105 -0
  178. package/dist/react-native/optOutsClient.d.ts.map +1 -0
  179. package/dist/react-native/optOutsClient.js +79 -0
  180. package/dist/react-native/optOutsClient.js.map +1 -0
  181. package/dist/react-native/smsClient.d.ts +109 -1
  182. package/dist/react-native/smsClient.d.ts.map +1 -1
  183. package/dist/react-native/smsClient.js +2 -0
  184. package/dist/react-native/smsClient.js.map +1 -1
  185. package/dist/react-native/utils/smsUtils.d.ts +2 -1
  186. package/dist/react-native/utils/smsUtils.d.ts.map +1 -1
  187. package/dist/react-native/utils/smsUtils.js +10 -0
  188. package/dist/react-native/utils/smsUtils.js.map +1 -1
  189. package/package.json +5 -5
@@ -0,0 +1,105 @@
1
+ import type { SmsApiClient } from "./generated/src/smsApiClient.js";
2
+ import type { OperationOptions } from "@azure/core-client";
3
+ /**
4
+ * The result of Opt Out Check request.
5
+ */
6
+ export interface OptOutCheckResult {
7
+ /**
8
+ * The recipient's phone number in E.164 format.
9
+ */
10
+ to: string;
11
+ /**
12
+ * Indicates if the recipient's phone number in opted out from receiving messages or not.
13
+ */
14
+ isOptedOut: boolean;
15
+ /**
16
+ * HTTP Status code.
17
+ */
18
+ httpStatusCode: number;
19
+ /**
20
+ * Optional error message in case of 4xx/5xx/repeatable errors.
21
+ */
22
+ errorMessage?: string;
23
+ }
24
+ /**
25
+ * The result of Opt Out Add request.
26
+ */
27
+ export interface OptOutAddResult {
28
+ /**
29
+ * The recipient's phone number in E.164 format.
30
+ */
31
+ to: string;
32
+ /**
33
+ * HTTP Status code.
34
+ */
35
+ httpStatusCode: number;
36
+ /**
37
+ * Optional error message in case of 4xx/5xx/repeatable errors.
38
+ */
39
+ errorMessage?: string;
40
+ }
41
+ /**
42
+ * The result of Opt Out Remove request.
43
+ */
44
+ export interface OptOutRemoveResult {
45
+ /**
46
+ * The recipient's phone number in E.164 format.
47
+ */
48
+ to: string;
49
+ /**
50
+ * HTTP Status code.
51
+ */
52
+ httpStatusCode: number;
53
+ /**
54
+ * Optional error message in case of 4xx/5xx/repeatable errors.
55
+ */
56
+ errorMessage?: string;
57
+ }
58
+ /**
59
+ * Client options used to configure OptOuts Client API Check requests.
60
+ */
61
+ export interface CheckOptions extends OperationOptions {
62
+ }
63
+ /**
64
+ * Client options used to configure OptOuts Client API Add requests.
65
+ */
66
+ export interface AddOptions extends OperationOptions {
67
+ }
68
+ /**
69
+ * Client options used to configure OptOuts Client API Remove requests.
70
+ */
71
+ export interface RemoveOptions extends OperationOptions {
72
+ }
73
+ /**
74
+ * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you
75
+ * to call Opt Out Management Api methods.
76
+ */
77
+ export declare class OptOutsClient {
78
+ private readonly api;
79
+ constructor(api: SmsApiClient);
80
+ /**
81
+ * Removes phone numbers from the optouts list.
82
+ *
83
+ * @param from - The sender's phone number
84
+ * @param to - The recipient's phone numbers
85
+ * @param options - Additional request options
86
+ */
87
+ remove(from: string, to: string[], options?: RemoveOptions): Promise<OptOutRemoveResult[]>;
88
+ /**
89
+ * Adds phone numbers to the optouts list.
90
+ *
91
+ * @param from - The sender's phone number
92
+ * @param to - The recipient's phone numbers
93
+ * @param options - Additional request options
94
+ */
95
+ add(from: string, to: string[], options?: AddOptions): Promise<OptOutAddResult[]>;
96
+ /**
97
+ * Checks if phone numbers are in the optouts list.
98
+ *
99
+ * @param from - The sender's phone number
100
+ * @param to - The recipient's phone numbers
101
+ * @param options - Additional request options
102
+ */
103
+ check(from: string, to: string[], options?: CheckOptions): Promise<OptOutCheckResult[]>;
104
+ }
105
+ //# sourceMappingURL=optOutsClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optOutsClient.d.ts","sourceRoot":"","sources":["../../src/optOutsClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;CAAG;AAEzD;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,gBAAgB;CAAG;AAEvD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;CAAG;AAE1D;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,GAAG,EAAE,YAAY;IAI7B;;;;;;OAMG;IACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EAAE,EACZ,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAehC;;;;;;OAMG;IACU,GAAG,CACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EAAE,EACZ,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC;IAe7B;;;;;;OAMG;IACU,KAAK,CAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EAAE,EACZ,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAkBhC"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.OptOutsClient = void 0;
6
+ const tracing_js_1 = require("./generated/src/tracing.js");
7
+ const smsUtils_js_1 = require("./utils/smsUtils.js");
8
+ const extractOperationOptions_js_1 = require("./extractOperationOptions.js");
9
+ /**
10
+ * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you
11
+ * to call Opt Out Management Api methods.
12
+ */
13
+ class OptOutsClient {
14
+ constructor(api) {
15
+ this.api = api;
16
+ }
17
+ /**
18
+ * Removes phone numbers from the optouts list.
19
+ *
20
+ * @param from - The sender's phone number
21
+ * @param to - The recipient's phone numbers
22
+ * @param options - Additional request options
23
+ */
24
+ async remove(from, to, options = {}) {
25
+ const { operationOptions } = (0, extractOperationOptions_js_1.extractOperationOptions)(options);
26
+ return tracing_js_1.tracingClient.withSpan("OptOuts-Remove", operationOptions, async (updatedOptions) => {
27
+ const response = await this.api.optOuts.add((0, smsUtils_js_1.generateOptOutRequest)(from, to), updatedOptions);
28
+ return response.value.map((optOutResponseItem) => {
29
+ var _a;
30
+ return {
31
+ to: optOutResponseItem.to,
32
+ httpStatusCode: optOutResponseItem.httpStatusCode,
33
+ errorMessage: (_a = optOutResponseItem.errorMessage) !== null && _a !== void 0 ? _a : "",
34
+ };
35
+ });
36
+ });
37
+ }
38
+ /**
39
+ * Adds phone numbers to the optouts list.
40
+ *
41
+ * @param from - The sender's phone number
42
+ * @param to - The recipient's phone numbers
43
+ * @param options - Additional request options
44
+ */
45
+ async add(from, to, options = {}) {
46
+ const { operationOptions } = (0, extractOperationOptions_js_1.extractOperationOptions)(options);
47
+ return tracing_js_1.tracingClient.withSpan("OptOuts-Add", operationOptions, async (updatedOptions) => {
48
+ const response = await this.api.optOuts.add((0, smsUtils_js_1.generateOptOutRequest)(from, to), updatedOptions);
49
+ return response.value.map((optOutResponseItem) => {
50
+ var _a;
51
+ return {
52
+ to: optOutResponseItem.to,
53
+ httpStatusCode: optOutResponseItem.httpStatusCode,
54
+ errorMessage: (_a = optOutResponseItem.errorMessage) !== null && _a !== void 0 ? _a : "",
55
+ };
56
+ });
57
+ });
58
+ }
59
+ /**
60
+ * Checks if phone numbers are in the optouts list.
61
+ *
62
+ * @param from - The sender's phone number
63
+ * @param to - The recipient's phone numbers
64
+ * @param options - Additional request options
65
+ */
66
+ async check(from, to, options = {}) {
67
+ const { operationOptions } = (0, extractOperationOptions_js_1.extractOperationOptions)(options);
68
+ return tracing_js_1.tracingClient.withSpan("OptOuts-Check", operationOptions, async (updatedOptions) => {
69
+ const response = await this.api.optOuts.check((0, smsUtils_js_1.generateOptOutRequest)(from, to), updatedOptions);
70
+ return response.value.map((optOutResponseItem) => {
71
+ var _a, _b;
72
+ return {
73
+ to: optOutResponseItem.to,
74
+ isOptedOut: (_a = optOutResponseItem.isOptedOut) !== null && _a !== void 0 ? _a : false,
75
+ httpStatusCode: optOutResponseItem.httpStatusCode,
76
+ errorMessage: (_b = optOutResponseItem.errorMessage) !== null && _b !== void 0 ? _b : "",
77
+ };
78
+ });
79
+ });
80
+ }
81
+ }
82
+ exports.OptOutsClient = OptOutsClient;
83
+ //# sourceMappingURL=optOutsClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optOutsClient.js","sourceRoot":"","sources":["../../src/optOutsClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,2DAA2D;AAG3D,qDAA4D;AAC5D,6EAAuE;AA4EvE;;;GAGG;AACH,MAAa,aAAa;IAGxB,YAAY,GAAiB;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CACjB,IAAY,EACZ,EAAY,EACZ,UAAyB,EAAE;QAE3B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,oDAAuB,EAAC,OAAO,CAAC,CAAC;QAC9D,OAAO,0BAAa,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;YACzF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,mCAAqB,EAAC,IAAI,EAAE,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;YAE7F,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,kBAAsC,EAAE,EAAE;;gBACnE,OAAO;oBACL,EAAE,EAAE,kBAAkB,CAAC,EAAE;oBACzB,cAAc,EAAE,kBAAkB,CAAC,cAAc;o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CAAC;YAEF,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,kBAAsC,EAAE,EAAE;;gBACnE,OAAO;oBACL,EAAE,EAAE,kBAAkB,CAAC,EAAE;oBACzB,UAAU,EAAE,MAAA,kBAAkB,CAAC,UAAU,mCAAI,KAAK;oBAClD,cAAc,EAAE,kBAAkB,CAAC,cAAc;oBACjD,YAAY,EAAE,MAAA,kBAAkB,CAAC,YAAY,mCAAI,EAAE;iBACpD,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,sCAwFC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { tracingClient } from \"./generated/src/tracing.js\";\nimport type { OptOutResponseItem } from \"./generated/src/index.js\";\nimport type { SmsApiClient } from \"./generated/src/smsApiClient.js\";\nimport { generateOptOutRequest } from \"./utils/smsUtils.js\";\nimport { extractOperationOptions } from \"./extractOperationOptions.js\";\nimport type { OperationOptions } from \"@azure/core-client\";\n\n/**\n * The result of Opt Out Check request.\n */\nexport interface OptOutCheckResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * Indicates if the recipient's phone number in opted out from receiving messages or not.\n */\n isOptedOut: boolean;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * The result of Opt Out Add request.\n */\nexport interface OptOutAddResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * The result of Opt Out Remove request.\n */\nexport interface OptOutRemoveResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * Client options used to configure OptOuts Client API Check requests.\n */\nexport interface CheckOptions extends OperationOptions {}\n\n/**\n * Client options used to configure OptOuts Client API Add requests.\n */\nexport interface AddOptions extends OperationOptions {}\n\n/**\n * Client options used to configure OptOuts Client API Remove requests.\n */\nexport interface RemoveOptions extends OperationOptions {}\n\n/**\n * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you\n * to call Opt Out Management Api methods.\n */\nexport class OptOutsClient {\n private readonly api: SmsApiClient;\n\n constructor(api: SmsApiClient) {\n this.api = api;\n }\n\n /**\n * Removes phone numbers from the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n public async remove(\n from: string,\n to: string[],\n options: RemoveOptions = {},\n ): Promise<OptOutRemoveResult[]> {\n const { operationOptions } = extractOperationOptions(options);\n return tracingClient.withSpan(\"OptOuts-Remove\", operationOptions, async (updatedOptions) => {\n const response = await this.api.optOuts.add(generateOptOutRequest(from, to), updatedOptions);\n\n return response.value.map((optOutResponseItem: OptOutResponseItem) => {\n return {\n to: optOutResponseItem.to,\n httpStatusCode: optOutResponseItem.httpStatusCode,\n errorMessage: optOutResponseItem.errorMessage ?? \"\",\n };\n });\n });\n }\n\n /**\n * Adds phone numbers to the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n public async add(\n from: string,\n to: string[],\n options: AddOptions = {},\n ): Promise<OptOutAddResult[]> {\n const { operationOptions } = extractOperationOptions(options);\n return tracingClient.withSpan(\"OptOuts-Add\", operationOptions, async (updatedOptions) => {\n const response = await this.api.optOuts.add(generateOptOutRequest(from, to), updatedOptions);\n\n return response.value.map((optOutResponseItem: OptOutResponseItem) => {\n return {\n to: optOutResponseItem.to,\n httpStatusCode: optOutResponseItem.httpStatusCode,\n errorMessage: optOutResponseItem.errorMessage ?? \"\",\n };\n });\n });\n }\n\n /**\n * Checks if phone numbers are in the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n public async check(\n from: string,\n to: string[],\n options: CheckOptions = {},\n ): Promise<OptOutCheckResult[]> {\n const { operationOptions } = extractOperationOptions(options);\n return tracingClient.withSpan(\"OptOuts-Check\", operationOptions, async (updatedOptions) => {\n const response = await this.api.optOuts.check(\n generateOptOutRequest(from, to),\n updatedOptions,\n );\n\n return response.value.map((optOutResponseItem: OptOutResponseItem) => {\n return {\n to: optOutResponseItem.to,\n isOptedOut: optOutResponseItem.isOptedOut ?? false,\n httpStatusCode: optOutResponseItem.httpStatusCode,\n errorMessage: optOutResponseItem.errorMessage ?? \"\",\n };\n });\n });\n }\n}\n"]}
@@ -24,7 +24,7 @@ export interface SmsSendRequest {
24
24
  message: string;
25
25
  }
26
26
  /**
27
- * Options to configure Sms requests
27
+ * Options to configure Sms requests.
28
28
  */
29
29
  export interface SmsSendOptions extends OperationOptions {
30
30
  /**
@@ -40,6 +40,9 @@ export interface SmsSendOptions extends OperationOptions {
40
40
  /** Time to wait for a delivery report. After this time a delivery report with timeout error code is generated. */
41
41
  deliveryReportTimeoutInSeconds?: number;
42
42
  }
43
+ /**
44
+ * The result of Sms send request.
45
+ */
43
46
  export interface SmsSendResult {
44
47
  /**
45
48
  * The recipient's phone number in E.164 format.
@@ -62,12 +65,117 @@ export interface SmsSendResult {
62
65
  */
63
66
  errorMessage?: string;
64
67
  }
68
+ /**
69
+ * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you
70
+ * to call Opt Out Management Api methods.
71
+ */
72
+ export interface OptOutsClient {
73
+ /**
74
+ * Adds phone numbers to the optouts list.
75
+ *
76
+ * @param from - The sender's phone number
77
+ * @param to - The recipient's phone numbers
78
+ * @param options - Additional request options
79
+ */
80
+ add(from: string, to: string[], options?: AddOptions): Promise<OptOutAddResult[]>;
81
+ /**
82
+ * Checks if phone numbers are in the optouts list.
83
+ *
84
+ * @param from - The sender's phone number
85
+ * @param to - The recipient's phone numbers
86
+ * @param options - Additional request options
87
+ */
88
+ check(from: string, to: string[], options?: CheckOptions): Promise<OptOutCheckResult[]>;
89
+ /**
90
+ * Removes phone numbers from the optouts list.
91
+ *
92
+ * @param from - The sender's phone number
93
+ * @param to - The recipient's phone numbers
94
+ * @param options - Additional request options
95
+ */
96
+ remove(from: string, to: string[], options?: RemoveOptions): Promise<OptOutRemoveResult[]>;
97
+ }
98
+ /**
99
+ * Client options used to configure OptOuts Client API Add requests.
100
+ */
101
+ export interface AddOptions extends OperationOptions {
102
+ }
103
+ /**
104
+ * Client options used to configure OptOuts Client API Check requests.
105
+ */
106
+ export interface CheckOptions extends OperationOptions {
107
+ }
108
+ /**
109
+ * Client options used to configure OptOuts Client API Remove requests.
110
+ */
111
+ export interface RemoveOptions extends OperationOptions {
112
+ }
113
+ /**
114
+ * The result of Opt Out Check request.
115
+ */
116
+ export interface OptOutCheckResult {
117
+ /**
118
+ * The recipient's phone number in E.164 format.
119
+ */
120
+ to: string;
121
+ /**
122
+ * Indicates if the recipient's phone number in opted out from receiving messages or not.
123
+ */
124
+ isOptedOut: boolean;
125
+ /**
126
+ * HTTP Status code.
127
+ */
128
+ httpStatusCode: number;
129
+ /**
130
+ * Optional error message in case of 4xx/5xx/repeatable errors.
131
+ */
132
+ errorMessage?: string;
133
+ }
134
+ /**
135
+ * The result of Opt Out Add request.
136
+ */
137
+ export interface OptOutAddResult {
138
+ /**
139
+ * The recipient's phone number in E.164 format.
140
+ */
141
+ to: string;
142
+ /**
143
+ * HTTP Status code.
144
+ */
145
+ httpStatusCode: number;
146
+ /**
147
+ * Optional error message in case of 4xx/5xx/repeatable errors.
148
+ */
149
+ errorMessage?: string;
150
+ }
151
+ /**
152
+ * The result of Opt Out Remove request.
153
+ */
154
+ export interface OptOutRemoveResult {
155
+ /**
156
+ * The recipient's phone number in E.164 format.
157
+ */
158
+ to: string;
159
+ /**
160
+ * HTTP Status code.
161
+ */
162
+ httpStatusCode: number;
163
+ /**
164
+ * Optional error message in case of 4xx/5xx/repeatable errors.
165
+ */
166
+ errorMessage?: string;
167
+ }
65
168
  /**
66
169
  * A SmsClient represents a Client to the Azure Communication Sms service allowing you
67
170
  * to send SMS messages.
68
171
  */
69
172
  export declare class SmsClient {
70
173
  private readonly api;
174
+ /**
175
+ * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you
176
+ * to call Opt Out Management Api methods.
177
+ */
178
+ optOuts: OptOutsClient;
71
179
  /**
72
180
  * Initializes a new instance of the SmsClient class.
73
181
  * @param connectionString - Connection string to connect to an Azure Communication Service resource.
@@ -1 +1 @@
1
- {"version":3,"file":"smsClient.d.ts","sourceRoot":"","sources":["../../src/smsClient.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQhF;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;CAAG;AAEhE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,EAAE,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kHAAkH;IAClH,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,YAAY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vB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC;;;OAGG;IACI,OAAO,EAAE,aAAa,CAAC;IAE9B;;;;;OAKG;gBACS,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAEhE;;;;;OAKG;gBACS,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAEnF;;;;;OAKG;gBACS,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAyBrF;;;;;OAKG;IACU,IAAI,CACf,WAAW,EAAE,cAAc,EAC3B,OAAO,GAAE,cAAgD,GACxD,OAAO,CAAC,aAAa,EAAE,CAAC;CAU5B"}
@@ -11,6 +11,7 @@ const extractOperationOptions_js_1 = require("./extractOperationOptions.js");
11
11
  const smsUtils_js_1 = require("./utils/smsUtils.js");
12
12
  const logger_js_1 = require("./logger.js");
13
13
  const tracing_js_1 = require("./generated/src/tracing.js");
14
+ const optOutsClient_js_1 = require("./optOutsClient.js");
14
15
  /**
15
16
  * Checks whether the type of a value is SmsClientOptions or not.
16
17
  *
@@ -33,6 +34,7 @@ class SmsClient {
33
34
  const authPolicy = (0, communication_common_1.createCommunicationAuthPolicy)(credential);
34
35
  this.api = new smsApiClient_js_1.SmsApiClient(url, internalPipelineOptions);
35
36
  this.api.pipeline.addPolicy(authPolicy);
37
+ this.optOuts = new optOutsClient_js_1.OptOutsClient(this.api);
36
38
  }
37
39
  /**
38
40
  * Sends an SMS from a phone number that is acquired by the authenticated account, to another phone number.
@@ -1 +1 @@
1
- {"version":3,"file":"smsClient.js","sourceRoot":"","sources":["../../src/smsClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;;AAE5C,sEAIqC;AAErC,gDAAqD;AAGrD,qEAA+D;AAC/D,6EAAuE;AACvE,qDAAiE;AACjE,2CAAqC;AACrC,2DAA2D;AAmE3D;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAY,EAA+B,EAAE,CACvE,CAAC,CAAC,OAAO,IAAI,CAAC,IAAA,6BAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,IAAA,sCAAe,EAAC,OAAO,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAa,SAAS;IA2BpB,YACE,qBAA6B,EAC7B,mBAAwE,EACxE,eAAiC,EAAE;QAEnC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,IAAA,2CAAoB,EAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC;QAE7F,MAAM,uBAAuB,mCACxB,OAAO,GACP;YACD,cAAc,EAAE;gBACd,MAAM,EAAE,kBAAM,CAAC,IAAI;aACpB;SACF,CACF,CAAC;QAEF,MAAM,UAAU,GAAG,IAAA,oDAA6B,EAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,GAAG,GAAG,IAAI,8BAAY,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CACf,WAA2B,EAC3B,UAA0B,EAAE,oBAAoB,EAAE,KAAK,EAAE;QAEzD,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,IAAA,oDAAuB,EAAC,OAAO,CAAC,CAAC;QAC3E,OAAO,0BAAa,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;YACzF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CACtC,IAAA,wCAA0B,EAAC,WAAW,EAAE,WAAW,CAAC,EACpD,cAAc,CACf,CAAC;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApED,8BAoEC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { SmsApiClient } from \"./generated/src/smsApiClient.js\";\nimport { extractOperationOptions } from \"./extractOperationOptions.js\";\nimport { generateSendMessageRequest } from \"./utils/smsUtils.js\";\nimport { logger } from \"./logger.js\";\nimport { tracingClient } from \"./generated/src/tracing.js\";\n\n/**\n * Client options used to configure SMS Client API requests.\n */\nexport interface SmsClientOptions extends CommonClientOptions {}\n\n/**\n * Values used to configure Sms message\n */\nexport interface SmsSendRequest {\n /**\n * The sender's phone number in E.164 format that is owned by the authenticated account.\n */\n from: string;\n /**\n * The list of recipient's phone number in E.164 format.\n */\n to: string[];\n /**\n * The contents of the message that will be sent to the recipient. The allowable content is\n * defined by RFC 5724.\n */\n message: string;\n}\n\n/**\n * Options to configure Sms requests\n */\nexport interface SmsSendOptions extends OperationOptions {\n /**\n * Enable this flag to receive a delivery report for this message on the Azure Resource\n * EventGrid. Default value: false.\n */\n enableDeliveryReport?: boolean;\n /**\n * Use this field to provide metadata that will then be sent back in the corresponding Delivery\n * Report.\n */\n tag?: string;\n /** Time to wait for a delivery report. After this time a delivery report with timeout error code is generated. */\n deliveryReportTimeoutInSeconds?: number;\n}\n\nexport interface SmsSendResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * The identifier of the outgoing Sms message. Only present if message processed.\n */\n messageId?: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Indicates if the message is processed successfully or not.\n */\n successful: boolean;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * Checks whether the type of a value is SmsClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isSmsClientOptions = (options: any): options is SmsClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * A SmsClient represents a Client to the Azure Communication Sms service allowing you\n * to send SMS messages.\n */\nexport class SmsClient {\n private readonly api: SmsApiClient;\n\n /**\n * Initializes a new instance of the SmsClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: SmsClientOptions);\n\n /**\n * Initializes a new instance of the SmsClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: SmsClientOptions);\n\n /**\n * Initializes a new instance of the SmsClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: TokenCredential, options?: SmsClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | SmsClientOptions,\n maybeOptions: SmsClientOptions = {},\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isSmsClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.api = new SmsApiClient(url, internalPipelineOptions);\n this.api.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Sends an SMS from a phone number that is acquired by the authenticated account, to another phone number.\n *\n * @param sendRequest - Provides the sender's and recipient's phone numbers, and the contents of the message\n * @param options - Additional request options\n */\n public async send(\n sendRequest: SmsSendRequest,\n options: SmsSendOptions = { enableDeliveryReport: false },\n ): Promise<SmsSendResult[]> {\n const { operationOptions, restOptions } = extractOperationOptions(options);\n return tracingClient.withSpan(\"SmsClient-Send\", operationOptions, async (updatedOptions) => {\n const response = await this.api.sms.send(\n generateSendMessageRequest(sendRequest, restOptions),\n updatedOptions,\n );\n return response.value;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"smsClient.js","sourceRoot":"","sources":["../../src/smsClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;;AAE5C,sEAIqC;AAErC,gDAAqD;AAGrD,qEAA+D;AAC/D,6EAAuE;AACvE,qDAAiE;AACjE,2CAAqC;AACrC,2DAA2D;AAC3D,yDAAwE;AA8KxE;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAY,EAA+B,EAAE,CACvE,CAAC,CAAC,OAAO,IAAI,CAAC,IAAA,6BAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,IAAA,sCAAe,EAAC,OAAO,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAa,SAAS;IAgCpB,YACE,qBAA6B,EAC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n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { SmsApiClient } from \"./generated/src/smsApiClient.js\";\nimport { extractOperationOptions } from \"./extractOperationOptions.js\";\nimport { generateSendMessageRequest } from \"./utils/smsUtils.js\";\nimport { logger } from \"./logger.js\";\nimport { tracingClient } from \"./generated/src/tracing.js\";\nimport { OptOutsClient as OptOutsClientImpl } from \"./optOutsClient.js\";\n\n/**\n * Client options used to configure SMS Client API requests.\n */\nexport interface SmsClientOptions extends CommonClientOptions {}\n\n/**\n * Values used to configure Sms message\n */\nexport interface SmsSendRequest {\n /**\n * The sender's phone number in E.164 format that is owned by the authenticated account.\n */\n from: string;\n /**\n * The list of recipient's phone number in E.164 format.\n */\n to: string[];\n /**\n * The contents of the message that will be sent to the recipient. The allowable content is\n * defined by RFC 5724.\n */\n message: string;\n}\n\n/**\n * Options to configure Sms requests.\n */\nexport interface SmsSendOptions extends OperationOptions {\n /**\n * Enable this flag to receive a delivery report for this message on the Azure Resource\n * EventGrid. Default value: false.\n */\n enableDeliveryReport?: boolean;\n /**\n * Use this field to provide metadata that will then be sent back in the corresponding Delivery\n * Report.\n */\n tag?: string;\n /** Time to wait for a delivery report. After this time a delivery report with timeout error code is generated. */\n deliveryReportTimeoutInSeconds?: number;\n}\n\n/**\n * The result of Sms send request.\n */\nexport interface SmsSendResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * The identifier of the outgoing Sms message. Only present if message processed.\n */\n messageId?: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Indicates if the message is processed successfully or not.\n */\n successful: boolean;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you\n * to call Opt Out Management Api methods.\n */\nexport interface OptOutsClient {\n /**\n * Adds phone numbers to the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n add(from: string, to: string[], options?: AddOptions): Promise<OptOutAddResult[]>;\n /**\n * Checks if phone numbers are in the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n check(from: string, to: string[], options?: CheckOptions): Promise<OptOutCheckResult[]>;\n /**\n * Removes phone numbers from the optouts list.\n *\n * @param from - The sender's phone number\n * @param to - The recipient's phone numbers\n * @param options - Additional request options\n */\n remove(from: string, to: string[], options?: RemoveOptions): Promise<OptOutRemoveResult[]>;\n}\n\n/**\n * Client options used to configure OptOuts Client API Add requests.\n */\nexport interface AddOptions extends OperationOptions {}\n\n/**\n * Client options used to configure OptOuts Client API Check requests.\n */\nexport interface CheckOptions extends OperationOptions {}\n\n/**\n * Client options used to configure OptOuts Client API Remove requests.\n */\nexport interface RemoveOptions extends OperationOptions {}\n\n/**\n * The result of Opt Out Check request.\n */\nexport interface OptOutCheckResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * Indicates if the recipient's phone number in opted out from receiving messages or not.\n */\n isOptedOut: boolean;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * The result of Opt Out Add request.\n */\nexport interface OptOutAddResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * The result of Opt Out Remove request.\n */\nexport interface OptOutRemoveResult {\n /**\n * The recipient's phone number in E.164 format.\n */\n to: string;\n /**\n * HTTP Status code.\n */\n httpStatusCode: number;\n /**\n * Optional error message in case of 4xx/5xx/repeatable errors.\n */\n errorMessage?: string;\n}\n\n/**\n * Checks whether the type of a value is SmsClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isSmsClientOptions = (options: any): options is SmsClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * A SmsClient represents a Client to the Azure Communication Sms service allowing you\n * to send SMS messages.\n */\nexport class SmsClient {\n private readonly api: SmsApiClient;\n /**\n * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you\n * to call Opt Out Management Api methods.\n */\n public optOuts: OptOutsClient;\n\n /**\n * Initializes a new instance of the SmsClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: SmsClientOptions);\n\n /**\n * Initializes a new instance of the SmsClient class using an Azure KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: KeyCredential, options?: SmsClientOptions);\n\n /**\n * Initializes a new instance of the SmsClient class using a TokenCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(endpoint: string, credential: TokenCredential, options?: SmsClientOptions);\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | SmsClientOptions,\n maybeOptions: SmsClientOptions = {},\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isSmsClientOptions(credentialOrOptions) ? credentialOrOptions : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.api = new SmsApiClient(url, internalPipelineOptions);\n this.api.pipeline.addPolicy(authPolicy);\n this.optOuts = new OptOutsClientImpl(this.api);\n }\n\n /**\n * Sends an SMS from a phone number that is acquired by the authenticated account, to another phone number.\n *\n * @param sendRequest - Provides the sender's and recipient's phone numbers, and the contents of the message\n * @param options - Additional request options\n */\n public async send(\n sendRequest: SmsSendRequest,\n options: SmsSendOptions = { enableDeliveryReport: false },\n ): Promise<SmsSendResult[]> {\n const { operationOptions, restOptions } = extractOperationOptions(options);\n return tracingClient.withSpan(\"SmsClient-Send\", operationOptions, async (updatedOptions) => {\n const response = await this.api.sms.send(\n generateSendMessageRequest(sendRequest, restOptions),\n updatedOptions,\n );\n return response.value;\n });\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
- import type { SendMessageRequest } from "../generated/src/models/index.js";
1
+ import type { SendMessageRequest, OptOutRequest } from "../generated/src/models/index.js";
2
2
  import type { SmsSendOptions, SmsSendRequest } from "../smsClient.js";
3
3
  export declare function generateSendMessageRequest(smsRequest: SmsSendRequest, options?: SmsSendOptions): SendMessageRequest;
4
+ export declare function generateOptOutRequest(from: string, to: string[]): OptOutRequest;
4
5
  //# sourceMappingURL=smsUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"smsUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/smsUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItE,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,cAAmB,GAC3B,kBAAkB,CAuBpB"}
1
+ {"version":3,"file":"smsUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/smsUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItE,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,cAAmB,GAC3B,kBAAkB,CAuBpB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,aAAa,CAS/E"}
@@ -3,6 +3,7 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.generateSendMessageRequest = generateSendMessageRequest;
6
+ exports.generateOptOutRequest = generateOptOutRequest;
6
7
  const uuid_js_1 = require("./uuid.js");
7
8
  function generateSendMessageRequest(smsRequest, options = {}) {
8
9
  var _a, _b;
@@ -25,4 +26,14 @@ function generateSendMessageRequest(smsRequest, options = {}) {
25
26
  smsSendOptions: Object.assign({ enableDeliveryReport: (_b = options.enableDeliveryReport) !== null && _b !== void 0 ? _b : false }, (options.tag && { tag: options.tag })),
26
27
  };
27
28
  }
29
+ function generateOptOutRequest(from, to) {
30
+ return {
31
+ from: from,
32
+ recipients: to.map((phoneNumberStr) => {
33
+ return {
34
+ to: phoneNumberStr,
35
+ };
36
+ }),
37
+ };
38
+ }
28
39
  //# sourceMappingURL=smsUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smsUtils.js","sourceRoot":"","sources":["../../../src/utils/smsUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAOlC,gEA0BC;AA7BD,uCAAiC;AAGjC,SAAgB,0BAA0B,CACxC,UAA0B,EAC1B,UAA0B,EAAE;;IAE5B,MAAM,eAAe,GAAoB;QACvC,oBAAoB,EAAE,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK;KAC5D,CAAC;IACF,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,eAAe,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IACvC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;YAClD,OAAO;gBACL,EAAE,EAAE,cAAc;gBAClB,sBAAsB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE;gBAC1D,sBAAsB,EAAE,cAAI,CAAC,YAAY,EAAE;aAC5C,CAAC;QACJ,CAAC,CAAC;QACF,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,cAAc,kBACZ,oBAAoB,EAAE,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,IACxD,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CACzC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { SendMessageRequest } from \"../generated/src/models/index.js\";\nimport type { SmsSendOptions, SmsSendRequest } from \"../smsClient.js\";\nimport { Uuid } from \"./uuid.js\";\nimport type { SmsSendOptions as InternalOptions } from \"../generated/src/models/index.js\";\n\nexport function generateSendMessageRequest(\n smsRequest: SmsSendRequest,\n options: SmsSendOptions = {},\n): SendMessageRequest {\n const _smsSendOptions: InternalOptions = {\n enableDeliveryReport: options.enableDeliveryReport ?? false,\n };\n if (options.tag) {\n _smsSendOptions[\"tag\"] = options.tag;\n }\n\n return {\n from: smsRequest.from,\n smsRecipients: smsRequest.to.map((phoneNumberStr) => {\n return {\n to: phoneNumberStr,\n repeatabilityFirstSent: new Date(Date.now()).toUTCString(),\n repeatabilityRequestId: Uuid.generateUuid(),\n };\n }),\n message: smsRequest.message,\n smsSendOptions: {\n enableDeliveryReport: options.enableDeliveryReport ?? false,\n ...(options.tag && { tag: options.tag }),\n },\n };\n}\n"]}
1
+ {"version":3,"file":"smsUtils.js","sourceRoot":"","sources":["../../../src/utils/smsUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAOlC,gEA0BC;AAED,sDASC;AAxCD,uCAAiC;AAGjC,SAAgB,0BAA0B,CACxC,UAA0B,EAC1B,UAA0B,EAAE;;IAE5B,MAAM,eAAe,GAAoB;QACvC,oBAAoB,EAAE,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK;KAC5D,CAAC;IACF,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,eAAe,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IACvC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;YAClD,OAAO;gBACL,EAAE,EAAE,cAAc;gBAClB,sBAAsB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE;gBAC1D,sBAAsB,EAAE,cAAI,CAAC,YAAY,EAAE;aAC5C,CAAC;QACJ,CAAC,CAAC;QACF,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,cAAc,kBACZ,oBAAoB,EAAE,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,IACxD,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CACzC;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAY,EAAE,EAAY;IAC9D,OAAO;QACL,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;YACpC,OAAO;gBACL,EAAE,EAAE,cAAc;aACnB,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { SendMessageRequest, OptOutRequest } from \"../generated/src/models/index.js\";\nimport type { SmsSendOptions, SmsSendRequest } from \"../smsClient.js\";\nimport { Uuid } from \"./uuid.js\";\nimport type { SmsSendOptions as InternalOptions } from \"../generated/src/models/index.js\";\n\nexport function generateSendMessageRequest(\n smsRequest: SmsSendRequest,\n options: SmsSendOptions = {},\n): SendMessageRequest {\n const _smsSendOptions: InternalOptions = {\n enableDeliveryReport: options.enableDeliveryReport ?? false,\n };\n if (options.tag) {\n _smsSendOptions[\"tag\"] = options.tag;\n }\n\n return {\n from: smsRequest.from,\n smsRecipients: smsRequest.to.map((phoneNumberStr) => {\n return {\n to: phoneNumberStr,\n repeatabilityFirstSent: new Date(Date.now()).toUTCString(),\n repeatabilityRequestId: Uuid.generateUuid(),\n };\n }),\n message: smsRequest.message,\n smsSendOptions: {\n enableDeliveryReport: options.enableDeliveryReport ?? false,\n ...(options.tag && { tag: options.tag }),\n },\n };\n}\n\nexport function generateOptOutRequest(from: string, to: string[]): OptOutRequest {\n return {\n from: from,\n recipients: to.map((phoneNumberStr) => {\n return {\n to: phoneNumberStr,\n };\n }),\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- export const SDK_VERSION = "1.2.0-beta.1";
3
+ export const SDK_VERSION = "1.2.0-beta.2";
4
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"1.2.0-beta.1\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"1.2.0-beta.2\";\n"]}
@@ -47,6 +47,30 @@ export interface SmsSendResponseItem {
47
47
  /** Optional error message in case of 4xx/5xx/repeatable errors. */
48
48
  errorMessage?: string;
49
49
  }
50
+ /** An opt out request. */
51
+ export interface OptOutRequest {
52
+ /** The sender's identifier (typically phone number in E.164 format) that is owned by the authenticated account. */
53
+ from: string;
54
+ recipients: OptOutRecipient[];
55
+ }
56
+ /** A single opt out recipient number. */
57
+ export interface OptOutRecipient {
58
+ /** The recipient's phone number (in E.164 format). */
59
+ to: string;
60
+ }
61
+ /** Response for an opt out request. Validate the returned items in the response to see which recipients were successfully added or removed from the opt outs list. */
62
+ export interface OptOutResponse {
63
+ value: OptOutResponseItem[];
64
+ }
65
+ export interface OptOutResponseItem {
66
+ /** The recipient phone number (in E.164 format). */
67
+ to: string;
68
+ httpStatusCode: number;
69
+ /** Optional flag specifying if number was Opted Out from receiving messages */
70
+ isOptedOut?: boolean;
71
+ /** Optional error message in case of 4xx/5xx errors. */
72
+ errorMessage?: string;
73
+ }
50
74
  /** Known values of {@link SmsSendResponseItemRepeatabilityResult} that the service accepts. */
51
75
  export declare enum KnownSmsSendResponseItemRepeatabilityResult {
52
76
  /** Accepted */
@@ -69,6 +93,21 @@ export interface SmsSendOptionalParams extends coreClient.OperationOptions {
69
93
  /** Contains response data for the send operation. */
70
94
  export type SmsSendOperationResponse = SmsSendResponse;
71
95
  /** Optional parameters. */
96
+ export interface OptOutsAddOptionalParams extends coreClient.OperationOptions {
97
+ }
98
+ /** Contains response data for the add operation. */
99
+ export type OptOutsAddResponse = OptOutResponse;
100
+ /** Optional parameters. */
101
+ export interface OptOutsRemoveOptionalParams extends coreClient.OperationOptions {
102
+ }
103
+ /** Contains response data for the remove operation. */
104
+ export type OptOutsRemoveResponse = OptOutResponse;
105
+ /** Optional parameters. */
106
+ export interface OptOutsCheckOptionalParams extends coreClient.OperationOptions {
107
+ }
108
+ /** Contains response data for the check operation. */
109
+ export type OptOutsCheckResponse = OptOutResponse;
110
+ /** Optional parameters. */
72
111
  export interface SmsApiClientOptionalParams extends coreClient.ServiceClientOptions {
73
112
  /** Api Version */
74
113
  apiVersion?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;IACb,uIAAuI;IACvI,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,oHAAoH;IACpH,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,ocAAoc;IACpc,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8MAA8M;IAC9M,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,sGAAsG;IACtG,oBAAoB,EAAE,OAAO,CAAC;IAC9B,2GAA2G;IAC3G,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kHAAkH;IAClH,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B;AAED,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,mBAAmB,CAAC,EAAE,sCAAsC,CAAC;IAC7D,iEAAiE;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,+FAA+F;AAC/F,oBAAY,2CAA2C;IACrD,eAAe;IACf,QAAQ,aAAa;IACrB,eAAe;IACf,QAAQ,aAAa;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG,MAAM,CAAC;AAE5D,2BAA2B;AAC3B,MAAM,WAAW,qBAAsB,SAAQ,UAAU,CAAC,gBAAgB;CAAG;AAE7E,qDAAqD;AACrD,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC;AAEvD,2BAA2B;AAC3B,MAAM,WAAW,0BACf,SAAQ,UAAU,CAAC,oBAAoB;IACvC,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;IACb,uIAAuI;IACvI,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,oHAAoH;IACpH,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,ocAAoc;IACpc,sBAAsB,CAAC,EAAE,MA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D,eAAe;IACf,QAAQ,aAAa;IACrB,eAAe;IACf,QAAQ,aAAa;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG,MAAM,CAAC;AAE5D,2BAA2B;AAC3B,MAAM,WAAW,qBAAsB,SAAQ,UAAU,CAAC,gBAAgB;CAAG;AAE7E,qDAAqD;AACrD,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC;AAEvD,2BAA2B;AAC3B,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,gBAAgB;CAAG;AAEhF,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEhD,2BAA2B;AAC3B,MAAM,WAAW,2BACf,SAAQ,UAAU,CAAC,gBAAgB;CAAG;AAExC,uDAAuD;AACvD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,2BAA2B;AAC3B,MAAM,WAAW,0BACf,SAAQ,UAAU,CAAC,gBAAgB;CAAG;AAExC,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,2BAA2B;AAC3B,MAAM,WAAW,0BACf,SAAQ,UAAU,CAAC,oBAAoB;IACvC,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyDH,+FAA+F;AAC/F,MAAM,CAAN,IAAY,2CAKX;AALD,WAAY,2CAA2C;IACrD,eAAe;IACf,oEAAqB,CAAA;IACrB,eAAe;IACf,oEAAqB,CAAA;AACvB,CAAC,EALW,2CAA2C,KAA3C,2CAA2C,QAKtD","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** Represents the properties of a send message request. */\nexport interface SendMessageRequest {\n /** The sender's phone number in E.164 format that is owned by the authenticated account. */\n from: string;\n /** The recipient's phone number in E.164 format. In this version, a minimum of 1 and upto 100 recipients in the list are supported. */\n smsRecipients: SmsRecipient[];\n /** The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724. */\n message: string;\n /** Optional configuration for sending SMS messages. */\n smsSendOptions?: SmsSendOptions;\n}\n\n/** Recipient details for sending SMS messages. */\nexport interface SmsRecipient {\n /** The recipient's phone number in E.164 format. */\n to: string;\n /** If specified, the client directs that the request is repeatable; that is, the client can make the request multiple times with the same Repeatability-Request-ID and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-ID is an opaque string representing a client-generated, 36-character hexadecimal case-insensitive encoding of a UUID (GUID), identifier for the request. */\n repeatabilityRequestId?: string;\n /** MUST be sent by clients to specify that a request is repeatable. Repeatability-First-Sent is used to specify the date and time at which the request was first created.eg- Tue, 26 Mar 2019 16:06:51 GMT */\n repeatabilityFirstSent?: string;\n}\n\n/** Optional configuration for sending SMS messages. */\nexport interface SmsSendOptions {\n /** Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. */\n enableDeliveryReport: boolean;\n /** Use this field to provide metadata that will then be sent back in the corresponding Delivery Report. */\n tag?: string;\n /** Time to wait for a delivery report. After this time a delivery report with timeout error code is generated. */\n deliveryReportTimeoutInSeconds?: number;\n}\n\n/** Response for a successful or multi status send Sms request. */\nexport interface SmsSendResponse {\n value: SmsSendResponseItem[];\n}\n\n/** Response for a single recipient. */\nexport interface SmsSendResponseItem {\n /** The recipient's phone number in E.164 format. */\n to: string;\n /** The identifier of the outgoing Sms message. Only present if message processed. */\n messageId?: string;\n /** HTTP Status code. */\n httpStatusCode: number;\n /** The result of a repeatable request with one of the case-insensitive values accepted or rejected. */\n repeatabilityResult?: SmsSendResponseItemRepeatabilityResult;\n /** Indicates if the message is processed successfully or not. */\n successful: boolean;\n /** Optional error message in case of 4xx/5xx/repeatable errors. */\n errorMessage?: string;\n}\n\n/** Known values of {@link SmsSendResponseItemRepeatabilityResult} that the service accepts. */\nexport enum KnownSmsSendResponseItemRepeatabilityResult {\n /** Accepted */\n Accepted = \"accepted\",\n /** Rejected */\n Rejected = \"rejected\",\n}\n\n/**\n * Defines values for SmsSendResponseItemRepeatabilityResult. \\\n * {@link KnownSmsSendResponseItemRepeatabilityResult} can be used interchangeably with SmsSendResponseItemRepeatabilityResult,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **accepted** \\\n * **rejected**\n */\nexport type SmsSendResponseItemRepeatabilityResult = string;\n\n/** Optional parameters. */\nexport interface SmsSendOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the send operation. */\nexport type SmsSendOperationResponse = SmsSendResponse;\n\n/** Optional parameters. */\nexport interface SmsApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqFH,+FAA+F;AAC/F,MAAM,CAAN,IAAY,2CAKX;AALD,WAAY,2CAA2C;IACrD,eAAe;IACf,oEAAqB,CAAA;IACrB,eAAe;IACf,oEAAqB,CAAA;AACvB,CAAC,EALW,2CAA2C,KAA3C,2CAA2C,QAKtD","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** Represents the properties of a send message request. */\nexport interface SendMessageRequest {\n /** The sender's phone number in E.164 format that is owned by the authenticated account. */\n from: string;\n /** The recipient's phone number in E.164 format. In this version, a minimum of 1 and upto 100 recipients in the list are supported. */\n smsRecipients: SmsRecipient[];\n /** The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724. */\n message: string;\n /** Optional configuration for sending SMS messages. */\n smsSendOptions?: SmsSendOptions;\n}\n\n/** Recipient details for sending SMS messages. */\nexport interface SmsRecipient {\n /** The recipient's phone number in E.164 format. */\n to: string;\n /** If specified, the client directs that the request is repeatable; that is, the client can make the request multiple times with the same Repeatability-Request-ID and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-ID is an opaque string representing a client-generated, 36-character hexadecimal case-insensitive encoding of a UUID (GUID), identifier for the request. */\n repeatabilityRequestId?: string;\n /** MUST be sent by clients to specify that a request is repeatable. Repeatability-First-Sent is used to specify the date and time at which the request was first created.eg- Tue, 26 Mar 2019 16:06:51 GMT */\n repeatabilityFirstSent?: string;\n}\n\n/** Optional configuration for sending SMS messages. */\nexport interface SmsSendOptions {\n /** Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. */\n enableDeliveryReport: boolean;\n /** Use this field to provide metadata that will then be sent back in the corresponding Delivery Report. */\n tag?: string;\n /** Time to wait for a delivery report. After this time a delivery report with timeout error code is generated. */\n deliveryReportTimeoutInSeconds?: number;\n}\n\n/** Response for a successful or multi status send Sms request. */\nexport interface SmsSendResponse {\n value: SmsSendResponseItem[];\n}\n\n/** Response for a single recipient. */\nexport interface SmsSendResponseItem {\n /** The recipient's phone number in E.164 format. */\n to: string;\n /** The identifier of the outgoing Sms message. Only present if message processed. */\n messageId?: string;\n /** HTTP Status code. */\n httpStatusCode: number;\n /** The result of a repeatable request with one of the case-insensitive values accepted or rejected. */\n repeatabilityResult?: SmsSendResponseItemRepeatabilityResult;\n /** Indicates if the message is processed successfully or not. */\n successful: boolean;\n /** Optional error message in case of 4xx/5xx/repeatable errors. */\n errorMessage?: string;\n}\n\n/** An opt out request. */\nexport interface OptOutRequest {\n /** The sender's identifier (typically phone number in E.164 format) that is owned by the authenticated account. */\n from: string;\n recipients: OptOutRecipient[];\n}\n\n/** A single opt out recipient number. */\nexport interface OptOutRecipient {\n /** The recipient's phone number (in E.164 format). */\n to: string;\n}\n\n/** Response for an opt out request. Validate the returned items in the response to see which recipients were successfully added or removed from the opt outs list. */\nexport interface OptOutResponse {\n value: OptOutResponseItem[];\n}\n\nexport interface OptOutResponseItem {\n /** The recipient phone number (in E.164 format). */\n to: string;\n httpStatusCode: number;\n /** Optional flag specifying if number was Opted Out from receiving messages */\n isOptedOut?: boolean;\n /** Optional error message in case of 4xx/5xx errors. */\n errorMessage?: string;\n}\n\n/** Known values of {@link SmsSendResponseItemRepeatabilityResult} that the service accepts. */\nexport enum KnownSmsSendResponseItemRepeatabilityResult {\n /** Accepted */\n Accepted = \"accepted\",\n /** Rejected */\n Rejected = \"rejected\",\n}\n\n/**\n * Defines values for SmsSendResponseItemRepeatabilityResult. \\\n * {@link KnownSmsSendResponseItemRepeatabilityResult} can be used interchangeably with SmsSendResponseItemRepeatabilityResult,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **accepted** \\\n * **rejected**\n */\nexport type SmsSendResponseItemRepeatabilityResult = string;\n\n/** Optional parameters. */\nexport interface SmsSendOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the send operation. */\nexport type SmsSendOperationResponse = SmsSendResponse;\n\n/** Optional parameters. */\nexport interface OptOutsAddOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the add operation. */\nexport type OptOutsAddResponse = OptOutResponse;\n\n/** Optional parameters. */\nexport interface OptOutsRemoveOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the remove operation. */\nexport type OptOutsRemoveResponse = OptOutResponse;\n\n/** Optional parameters. */\nexport interface OptOutsCheckOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the check operation. */\nexport type OptOutsCheckResponse = OptOutResponse;\n\n/** Optional parameters. */\nexport interface SmsApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
@@ -4,4 +4,8 @@ export declare const SmsRecipient: coreClient.CompositeMapper;
4
4
  export declare const SmsSendOptions: coreClient.CompositeMapper;
5
5
  export declare const SmsSendResponse: coreClient.CompositeMapper;
6
6
  export declare const SmsSendResponseItem: coreClient.CompositeMapper;
7
+ export declare const OptOutRequest: coreClient.CompositeMapper;
8
+ export declare const OptOutRecipient: coreClient.CompositeMapper;
9
+ export declare const OptOutResponse: coreClient.CompositeMapper;
10
+ export declare const OptOutResponseItem: coreClient.CompositeMapper;
7
11
  //# sourceMappingURL=mappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../../src/generated/src/models/mappers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,eA4C3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,eA0BrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,eA8BvC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,eAoBxC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,eA8C5C,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../../src/generated/src/models/mappers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,eA4C3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,eA0BrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,eA8BvC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,eAoBxC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,eA8C5C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,eAkCtC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC,eAiBxC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,eAoBvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,eAoC3C,CAAC"}