@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
@@ -6,7 +6,7 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
  import * as coreClient from "@azure/core-client";
9
- import { SmsImpl } from "./operations/index.js";
9
+ import { SmsImpl, OptOutsImpl } from "./operations/index.js";
10
10
  export class SmsApiClient extends coreClient.ServiceClient {
11
11
  /**
12
12
  * Initializes a new instance of the SmsApiClient class.
@@ -25,7 +25,7 @@ export class SmsApiClient extends coreClient.ServiceClient {
25
25
  const defaults = {
26
26
  requestContentType: "application/json; charset=utf-8",
27
27
  };
28
- const packageDetails = `azsdk-js-communication-sms/1.2.0-beta.1`;
28
+ const packageDetails = `azsdk-js-communication-sms/1.2.0-beta.2`;
29
29
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
30
30
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
31
31
  : `${packageDetails}`;
@@ -36,8 +36,9 @@ export class SmsApiClient extends coreClient.ServiceClient {
36
36
  // Parameter assignments
37
37
  this.endpoint = endpoint;
38
38
  // Assigning values to Constant parameters
39
- this.apiVersion = options.apiVersion || "2024-02-05-preview";
39
+ this.apiVersion = options.apiVersion || "2024-12-10-preview";
40
40
  this.sms = new SmsImpl(this);
41
+ this.optOuts = new OptOutsImpl(this);
41
42
  this.addCustomApiVersionPolicy(options.apiVersion);
42
43
  }
43
44
  /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
@@ -1 +1 @@
1
- {"version":3,"file":"smsApiClient.js","sourceRoot":"","sources":["../../../../src/generated/src/smsApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAMjD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,MAAM,OAAO,YAAa,SAAQ,UAAU,CAAC,aAAa;IAIxD;;;;OAIG;IACH,YAAY,QAAgB,EAAE,OAAoC;;QAChE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,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AAC;gBACrC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;4BACrC,OAAO,cAAc,GAAG,UAAU,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CAGF","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\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { SmsImpl } from \"./operations/index.js\";\nimport { Sms } from \"./operationsInterfaces/index.js\";\nimport { SmsApiClientOptionalParams } from \"./models/index.js\";\n\nexport class SmsApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the SmsApiClient class.\n * @param endpoint The communication resource, for example https://my-resource.communication.azure.com\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: SmsApiClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: SmsApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n };\n\n const packageDetails = `azsdk-js-communication-sms/1.2.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{endpoint}\",\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2024-02-05-preview\";\n this.sms = new SmsImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest,\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n },\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n sms: Sms;\n}\n"]}
1
+ {"version":3,"file":"smsApiClient.js","sourceRoot":"","sources":["../../../../src/generated/src/smsApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAMjD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI7D,MAAM,OAAO,YAAa,SAAQ,UAAU,CAAC,aAAa;IAIxD;;;;OAIG;IACH,YAAY,QAAgB,EAA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AAE,wBAAwB;YAC9B,KAAK,CAAC,WAAW,CACf,OAAwB,EACxB,IAAiB;gBAEjB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACrC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;4BACrC,OAAO,cAAc,GAAG,UAAU,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CAIF","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\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { SmsImpl, OptOutsImpl } from \"./operations/index.js\";\nimport { Sms, OptOuts } from \"./operationsInterfaces/index.js\";\nimport { SmsApiClientOptionalParams } from \"./models/index.js\";\n\nexport class SmsApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the SmsApiClient class.\n * @param endpoint The communication resource, for example https://my-resource.communication.azure.com\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: SmsApiClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: SmsApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n };\n\n const packageDetails = `azsdk-js-communication-sms/1.2.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{endpoint}\",\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2024-12-10-preview\";\n this.sms = new SmsImpl(this);\n this.optOuts = new OptOutsImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest,\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n },\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n sms: Sms;\n optOuts: OptOuts;\n}\n"]}
@@ -9,6 +9,6 @@ import { createTracingClient } from "@azure/core-tracing";
9
9
  export const tracingClient = createTracingClient({
10
10
  namespace: "Microsoft.Communication",
11
11
  packageName: "@azure/communication-sms",
12
- packageVersion: "1.2.0-beta.1",
12
+ packageVersion: "1.2.0-beta.2",
13
13
  });
14
14
  //# sourceMappingURL=tracing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../../src/generated/src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;IAC/C,SAAS,EAAE,yBAAyB;IACpC,WAAW,EAAE,0BAA0B;IACvC,cAAc,EAAE,cAAc;CAC/B,CAAC,CAAC","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 { createTracingClient } from \"@azure/core-tracing\";\n\nexport const tracingClient = createTracingClient({\n namespace: \"Microsoft.Communication\",\n packageName: \"@azure/communication-sms\",\n packageVersion: \"1.2.0-beta.1\",\n});\n"]}
1
+ {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../../src/generated/src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;IAC/C,SAAS,EAAE,yBAAyB;IACpC,WAAW,EAAE,0BAA0B;IACvC,cAAc,EAAE,cAAc;CAC/B,CAAC,CAAC","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 { createTracingClient } from \"@azure/core-tracing\";\n\nexport const tracingClient = createTracingClient({\n namespace: \"Microsoft.Communication\",\n packageName: \"@azure/communication-sms\",\n packageVersion: \"1.2.0-beta.2\",\n});\n"]}
@@ -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,79 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { tracingClient } from "./generated/src/tracing.js";
4
+ import { generateOptOutRequest } from "./utils/smsUtils.js";
5
+ import { extractOperationOptions } from "./extractOperationOptions.js";
6
+ /**
7
+ * A OptOutsClient represents a Client to the Azure Communication Sms service allowing you
8
+ * to call Opt Out Management Api methods.
9
+ */
10
+ export class OptOutsClient {
11
+ constructor(api) {
12
+ this.api = api;
13
+ }
14
+ /**
15
+ * Removes phone numbers from the optouts list.
16
+ *
17
+ * @param from - The sender's phone number
18
+ * @param to - The recipient's phone numbers
19
+ * @param options - Additional request options
20
+ */
21
+ async remove(from, to, options = {}) {
22
+ const { operationOptions } = extractOperationOptions(options);
23
+ return tracingClient.withSpan("OptOuts-Remove", operationOptions, async (updatedOptions) => {
24
+ const response = await this.api.optOuts.add(generateOptOutRequest(from, to), updatedOptions);
25
+ return response.value.map((optOutResponseItem) => {
26
+ var _a;
27
+ return {
28
+ to: optOutResponseItem.to,
29
+ httpStatusCode: optOutResponseItem.httpStatusCode,
30
+ errorMessage: (_a = optOutResponseItem.errorMessage) !== null && _a !== void 0 ? _a : "",
31
+ };
32
+ });
33
+ });
34
+ }
35
+ /**
36
+ * Adds phone numbers to the optouts list.
37
+ *
38
+ * @param from - The sender's phone number
39
+ * @param to - The recipient's phone numbers
40
+ * @param options - Additional request options
41
+ */
42
+ async add(from, to, options = {}) {
43
+ const { operationOptions } = extractOperationOptions(options);
44
+ return tracingClient.withSpan("OptOuts-Add", operationOptions, async (updatedOptions) => {
45
+ const response = await this.api.optOuts.add(generateOptOutRequest(from, to), updatedOptions);
46
+ return response.value.map((optOutResponseItem) => {
47
+ var _a;
48
+ return {
49
+ to: optOutResponseItem.to,
50
+ httpStatusCode: optOutResponseItem.httpStatusCode,
51
+ errorMessage: (_a = optOutResponseItem.errorMessage) !== null && _a !== void 0 ? _a : "",
52
+ };
53
+ });
54
+ });
55
+ }
56
+ /**
57
+ * Checks if phone numbers are in the optouts list.
58
+ *
59
+ * @param from - The sender's phone number
60
+ * @param to - The recipient's phone numbers
61
+ * @param options - Additional request options
62
+ */
63
+ async check(from, to, options = {}) {
64
+ const { operationOptions } = extractOperationOptions(options);
65
+ return tracingClient.withSpan("OptOuts-Check", operationOptions, async (updatedOptions) => {
66
+ const response = await this.api.optOuts.check(generateOptOutRequest(from, to), updatedOptions);
67
+ return response.value.map((optOutResponseItem) => {
68
+ var _a, _b;
69
+ return {
70
+ to: optOutResponseItem.to,
71
+ isOptedOut: (_a = optOutResponseItem.isOptedOut) !== null && _a !== void 0 ? _a : false,
72
+ httpStatusCode: optOutResponseItem.httpStatusCode,
73
+ errorMessage: (_b = optOutResponseItem.errorMessage) !== null && _b !== void 0 ? _b : "",
74
+ };
75
+ });
76
+ });
77
+ }
78
+ }
79
+ //# 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,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AA4EvE;;;GAGG;AACH,MAAM,OAAO,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,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC9D,OAAO,aAAa,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,qBAAqB,CAAC,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;oBACjD,YAAY,EAAE,MAAA,kBAAkB,CAAC,YAAY,mCAAI,EAAE;iBACpD,CAAC;YACJ,CAAC,CAAC,CA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AkB,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","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,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC;;;;;OAKG;gBACS,gB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X;;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"}
@@ -8,6 +8,7 @@ import { extractOperationOptions } from "./extractOperationOptions.js";
8
8
  import { generateSendMessageRequest } from "./utils/smsUtils.js";
9
9
  import { logger } from "./logger.js";
10
10
  import { tracingClient } from "./generated/src/tracing.js";
11
+ import { OptOutsClient as OptOutsClientImpl } from "./optOutsClient.js";
11
12
  /**
12
13
  * Checks whether the type of a value is SmsClientOptions or not.
13
14
  *
@@ -30,6 +31,7 @@ export class SmsClient {
30
31
  const authPolicy = createCommunicationAuthPolicy(credential);
31
32
  this.api = new SmsApiClient(url, internalPipelineOptions);
32
33
  this.api.pipeline.addPolicy(authPolicy);
34
+ this.optOuts = new OptOutsClientImpl(this.api);
33
35
  }
34
36
  /**
35
37
  * 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,OAAO,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CACf,WAA2B,EAC3B,UAA0B,EAAE,oBAAoB,EAAE,KAAK,EAAE;QAEzD,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC3E,OAAO,aAAa,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,0BAA0B,CAAC,WAAW,EAAE,WAAW,CAAC,EACpD,cAAc,CACf,CAAC;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","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,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAA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;QAC3E,OAAO,aAAa,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,0BAA0B,CAAC,WAAW,EAAE,WAAW,CAAC,EACpD,cAAc,CACf,CAAC;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","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\";\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"}
@@ -22,4 +22,14 @@ export function generateSendMessageRequest(smsRequest, options = {}) {
22
22
  smsSendOptions: Object.assign({ enableDeliveryReport: (_b = options.enableDeliveryReport) !== null && _b !== void 0 ? _b : false }, (options.tag && { tag: options.tag })),
23
23
  };
24
24
  }
25
+ export function generateOptOutRequest(from, to) {
26
+ return {
27
+ from: from,
28
+ recipients: to.map((phoneNumberStr) => {
29
+ return {
30
+ to: phoneNumberStr,
31
+ };
32
+ }),
33
+ };
34
+ }
25
35
  //# sourceMappingURL=smsUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smsUtils.js","sourceRoot":"","sources":["../../../src/utils/smsUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,UAAU,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,IAAI,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;AAIlC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,UAAU,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,IAAI,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,MAAM,UAAU,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"]}
@@ -3,5 +3,5 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.SDK_VERSION = void 0;
6
- exports.SDK_VERSION = "1.2.0-beta.1";
6
+ exports.SDK_VERSION = "1.2.0-beta.2";
7
7
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,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;;;AAErB,QAAA,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,u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