@azure/communication-phone-numbers 1.3.0-alpha.20250122.7 → 1.3.0-alpha.20250129.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/README.md +165 -186
  2. package/dist/browser/generated/src/lroImpl.d.ts.map +1 -1
  3. package/dist/browser/generated/src/lroImpl.js +0 -7
  4. package/dist/browser/generated/src/lroImpl.js.map +1 -1
  5. package/dist/browser/phoneNumbersClient.d.ts +141 -50
  6. package/dist/browser/phoneNumbersClient.d.ts.map +1 -1
  7. package/dist/browser/phoneNumbersClient.js +141 -50
  8. package/dist/browser/phoneNumbersClient.js.map +1 -1
  9. package/dist/commonjs/generated/src/lroImpl.d.ts.map +1 -1
  10. package/dist/commonjs/generated/src/lroImpl.js +0 -7
  11. package/dist/commonjs/generated/src/lroImpl.js.map +1 -1
  12. package/dist/commonjs/phoneNumbersClient.d.ts +141 -50
  13. package/dist/commonjs/phoneNumbersClient.d.ts.map +1 -1
  14. package/dist/commonjs/phoneNumbersClient.js +141 -50
  15. package/dist/commonjs/phoneNumbersClient.js.map +1 -1
  16. package/dist/esm/generated/src/lroImpl.d.ts.map +1 -1
  17. package/dist/esm/generated/src/lroImpl.js +0 -7
  18. package/dist/esm/generated/src/lroImpl.js.map +1 -1
  19. package/dist/esm/phoneNumbersClient.d.ts +141 -50
  20. package/dist/esm/phoneNumbersClient.d.ts.map +1 -1
  21. package/dist/esm/phoneNumbersClient.js +141 -50
  22. package/dist/esm/phoneNumbersClient.js.map +1 -1
  23. package/dist/react-native/generated/src/lroImpl.d.ts.map +1 -1
  24. package/dist/react-native/generated/src/lroImpl.js +0 -7
  25. package/dist/react-native/generated/src/lroImpl.js.map +1 -1
  26. package/dist/react-native/phoneNumbersClient.d.ts +141 -50
  27. package/dist/react-native/phoneNumbersClient.d.ts.map +1 -1
  28. package/dist/react-native/phoneNumbersClient.js +141 -50
  29. package/dist/react-native/phoneNumbersClient.js.map +1 -1
  30. package/package.json +16 -16
@@ -50,10 +50,18 @@ class PhoneNumbersClient {
50
50
  * Iterates the purchased phone numbers.
51
51
  *
52
52
  * Example usage:
53
- * ```ts
54
- * let client = new PhoneNumbersClient(credentials);
55
- * for await (const purchased of client.listPhoneNumbers()) {
56
- * console.log("phone number: ", purchased.phoneNumber);
53
+ * ```ts snippet:PhoneNumbersClientListPurchasedPhoneNumbers
54
+ * import { DefaultAzureCredential } from "@azure/identity";
55
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
56
+ *
57
+ * const credential = new DefaultAzureCredential();
58
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
59
+ *
60
+ * const phoneNumbers = client.listPurchasedPhoneNumbers();
61
+ *
62
+ * for await (const phoneNumber of phoneNumbers) {
63
+ * console.log(`The id is the same as the phone number: ${phoneNumber.id}`);
64
+ * console.log(`Phone number type is ${phoneNumber.phoneNumberType}`);
57
65
  * }
58
66
  * ```
59
67
  * List all purchased phone numbers.
@@ -81,16 +89,20 @@ class PhoneNumbersClient {
81
89
  * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.
82
90
  *
83
91
  * Example usage:
84
- * ```ts
85
- * const client = new PhoneNumbersClient(CONNECTION_STRING);
86
- * const releasePoller = await client.beginReleasePhoneNumber("+14125550100");
92
+ * ```ts snippet:PhoneNumbersClientReleasePhoneNumber
93
+ * import { DefaultAzureCredential } from "@azure/identity";
94
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
87
95
  *
88
- * // Serializing the poller
89
- * const serialized = releasePoller.toString();
96
+ * const credential = new DefaultAzureCredential();
97
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
90
98
  *
91
- * // Waiting until it's done
92
- * const results = await releasePoller.pollUntilDone();
93
- * console.log(results);
99
+ * const phoneNumberToRelease = "<phone-number-to-release>";
100
+ *
101
+ * const releasePoller = await client.beginReleasePhoneNumber(phoneNumberToRelease);
102
+ *
103
+ * // Release is underway.
104
+ * await releasePoller.pollUntilDone();
105
+ * console.log("Successfully release phone number.");
94
106
  * ```
95
107
  * @param phoneNumber - The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.
96
108
  * @param options - Additional request options.
@@ -107,16 +119,33 @@ class PhoneNumbersClient {
107
119
  * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.
108
120
  *
109
121
  * Example usage:
110
- * ```ts
111
- * const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);
112
- * const searchPoller = await client.beginSearchAvailablePhoneNumbers(SEARCH_REQUEST);
122
+ * ```ts snippet:PhoneNumbersClientSearchAvailablePhoneNumbers
123
+ * import { DefaultAzureCredential } from "@azure/identity";
124
+ * import {
125
+ * PhoneNumbersClient,
126
+ * SearchAvailablePhoneNumbersRequest,
127
+ * } from "@azure/communication-phone-numbers";
128
+ *
129
+ * const credential = new DefaultAzureCredential();
130
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
113
131
  *
114
- * // Serializing the poller
115
- * const serialized = searchPoller.toString();
132
+ * const searchRequest: SearchAvailablePhoneNumbersRequest = {
133
+ * countryCode: "US",
134
+ * phoneNumberType: "tollFree",
135
+ * assignmentType: "application",
136
+ * capabilities: {
137
+ * sms: "outbound",
138
+ * calling: "none",
139
+ * },
140
+ * quantity: 1,
141
+ * };
116
142
  *
117
- * // Waiting until it's done
118
- * const results = await searchPoller.pollUntilDone();
119
- * console.log(results);
143
+ * const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
144
+ *
145
+ * // The search is underway. Wait to receive searchId.
146
+ * const searchResults = await searchPoller.pollUntilDone();
147
+ * console.log(`Found phone number: ${searchResults.phoneNumbers[0]}`);
148
+ * console.log(`searchId: ${searchResults.searchId}`);
120
149
  * ```
121
150
  *
122
151
  * @param search - Request properties to constraint the search scope.
@@ -134,16 +163,37 @@ class PhoneNumbersClient {
134
163
  * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.
135
164
  *
136
165
  * Example usage:
137
- * ```ts
138
- * const client = new PhoneNumbersClient(CONNECTION_STRING);
139
- * const purchasePoller = await client.beginPurchasePhoneNumbers(SEARCH_ID);
166
+ * ```ts snippet:PhoneNumbersClientPurchasePhoneNumbers
167
+ * import { DefaultAzureCredential } from "@azure/identity";
168
+ * import {
169
+ * PhoneNumbersClient,
170
+ * SearchAvailablePhoneNumbersRequest,
171
+ * } from "@azure/communication-phone-numbers";
172
+ *
173
+ * const credential = new DefaultAzureCredential();
174
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
175
+ *
176
+ * const searchRequest: SearchAvailablePhoneNumbersRequest = {
177
+ * countryCode: "US",
178
+ * phoneNumberType: "tollFree",
179
+ * assignmentType: "application",
180
+ * capabilities: {
181
+ * sms: "outbound",
182
+ * calling: "none",
183
+ * },
184
+ * quantity: 1,
185
+ * };
140
186
  *
141
- * // Serializing the poller
142
- * const serialized = purchasePoller.toString();
187
+ * const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);
143
188
  *
144
- * // Waiting until it's done
145
- * const results = await purchasePoller.pollUntilDone();
146
- * console.log(results);
189
+ * // The search is underway. Wait to receive searchId.
190
+ * const { searchId, phoneNumbers } = await searchPoller.pollUntilDone();
191
+ *
192
+ * const purchasePoller = await client.beginPurchasePhoneNumbers(searchId);
193
+ *
194
+ * // Purchase is underway.
195
+ * await purchasePoller.pollUntilDone();
196
+ * console.log(`Successfully purchased ${phoneNumbers[0]}`);
147
197
  * ```
148
198
  *
149
199
  * @param searchId - The id of the search to purchase. Returned from `beginSearchAvailablePhoneNumbers`
@@ -160,16 +210,32 @@ class PhoneNumbersClient {
160
210
  * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.
161
211
  *
162
212
  * Example usage:
163
- * ```ts
164
- * const client = new PhoneNumbersClient(CONNECTION_STRING);
165
- * const updatePoller = await client.beginUpdatePhoneNumberCapabilities("+14125550100", UPDATE_REQUEST);
213
+ * ```ts snippet:PhoneNumbersClientUpdatePhoneNumberCapabilities
214
+ * import { DefaultAzureCredential } from "@azure/identity";
215
+ * import {
216
+ * PhoneNumbersClient,
217
+ * PhoneNumberCapabilitiesRequest,
218
+ * } from "@azure/communication-phone-numbers";
219
+ *
220
+ * const credential = new DefaultAzureCredential();
221
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
166
222
  *
167
- * // Serializing the poller
168
- * const serialized = updatePoller.toString();
223
+ * const phoneNumberToUpdate = "<phone-number-to-update>";
169
224
  *
170
- * // Waiting until it's done
171
- * const results = await updatePoller.pollUntilDone();
172
- * console.log(results);
225
+ * // This will update phone number to send and receive sms, but only send calls.
226
+ * const updateRequest: PhoneNumberCapabilitiesRequest = {
227
+ * sms: "inbound+outbound",
228
+ * calling: "outbound",
229
+ * };
230
+ *
231
+ * const updatePoller = await client.beginUpdatePhoneNumberCapabilities(
232
+ * phoneNumberToUpdate,
233
+ * updateRequest,
234
+ * );
235
+ *
236
+ * // Update is underway.
237
+ * const { capabilities } = await updatePoller.pollUntilDone();
238
+ * console.log(`These are the update capabilities: ${capabilities}`);
173
239
  * ```
174
240
  *
175
241
  * @param phoneNumber - The E.164 formatted phone number being updated. The leading plus can be either + or encoded as %2B.
@@ -188,8 +254,13 @@ class PhoneNumbersClient {
188
254
  * Iterates the available countries.
189
255
  *
190
256
  * Example usage:
191
- * ```ts
192
- * let client = new PhoneNumbersClient(credentials);
257
+ * ```ts snippet:PhoneNumbersClientListAvailableCountries
258
+ * import { DefaultAzureCredential } from "@azure/identity";
259
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
260
+ *
261
+ * const credential = new DefaultAzureCredential();
262
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
263
+ *
193
264
  * for await (const country of client.listAvailableCountries()) {
194
265
  * console.log("country: ", country.localizedName);
195
266
  * }
@@ -217,9 +288,14 @@ class PhoneNumbersClient {
217
288
  * Iterates the available Toll-Free area codes.
218
289
  *
219
290
  * Example usage:
220
- * ```ts
221
- * let client = new PhoneNumbersClient(credentials);
222
- * for await (const areaCodeItem of client.listTollFreeAreaCodes()) {
291
+ * ```ts snippet:PhoneNumbersClientListTollFreeAreaCodes
292
+ * import { DefaultAzureCredential } from "@azure/identity";
293
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
294
+ *
295
+ * const credential = new DefaultAzureCredential();
296
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
297
+ *
298
+ * for await (const areaCodeItem of client.listAvailableTollFreeAreaCodes("US")) {
223
299
  * console.log("area code: ", areaCodeItem.areaCode);
224
300
  * }
225
301
  * ```
@@ -247,9 +323,14 @@ class PhoneNumbersClient {
247
323
  * Iterates the available Geographic area codes.
248
324
  *
249
325
  * Example usage:
250
- * ```ts
251
- * let client = new PhoneNumbersClient(credentials);
252
- * for await (const areaCodeItem of client.listGeographicAreaCodes()) {
326
+ * ```ts snippet:PhoneNumbersClientListGeographicAreaCodes
327
+ * import { DefaultAzureCredential } from "@azure/identity";
328
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
329
+ *
330
+ * const credential = new DefaultAzureCredential();
331
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
332
+ *
333
+ * for await (const areaCodeItem of client.listAvailableGeographicAreaCodes("US")) {
253
334
  * console.log("area code: ", areaCodeItem.areaCode);
254
335
  * }
255
336
  * ```
@@ -277,9 +358,14 @@ class PhoneNumbersClient {
277
358
  * Iterates the available localities.
278
359
  *
279
360
  * Example usage:
280
- * ```ts
281
- * let client = new PhoneNumbersClient(credentials);
282
- * for await (const locality of client.listAvailableLocalities()) {
361
+ * ```ts snippet:PhoneNumbersClientListAvailableLocalities
362
+ * import { DefaultAzureCredential } from "@azure/identity";
363
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
364
+ *
365
+ * const credential = new DefaultAzureCredential();
366
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
367
+ *
368
+ * for await (const locality of client.listAvailableLocalities("US")) {
283
369
  * console.log("locality: ", locality.localizedName);
284
370
  * }
285
371
  * ```
@@ -307,9 +393,14 @@ class PhoneNumbersClient {
307
393
  * Iterates the available offerings.
308
394
  *
309
395
  * Example usage:
310
- * ```ts
311
- * let client = new PhoneNumbersClient(credentials);
312
- * for await (const offering of client.listAvailableOfferings()) {
396
+ * ```ts snippet:PhoneNumbersClientListAvailableOfferings
397
+ * import { DefaultAzureCredential } from "@azure/identity";
398
+ * import { PhoneNumbersClient } from "@azure/communication-phone-numbers";
399
+ *
400
+ * const credential = new DefaultAzureCredential();
401
+ * const client = new PhoneNumbersClient("<endpoint-from-resource>", credential);
402
+ *
403
+ * for await (const offering of client.listAvailableOfferings("US")) {
313
404
  * console.log("phone number type: ", offering.phoneNumberType);
314
405
  * console.log("cost: ", offering.cost.amount);
315
406
  * }
@@ -1 +1 @@
1
- {"version":3,"file":"phoneNumbersClient.js","sourceRoot":"","sources":["../../src/phoneNumbersClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;;;AAE5C,uDAAuD;AACvD,sEAIqC;AAErC,gDAAqD;AAIrD,uDAA6F;AA8B7F,iFAAmF;AAEnF,+CAA0C;AAC1C,2DAA2D;AAY3D,MAAM,2BAA2B,GAAG,CAAC,OAAY,EAAwC,EAAE,CACzF,OAAO,IAAI,CAAC,IAAA,sCAAe,EAAC,OAAO,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,OAAO,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAa,kBAAkB;IAoC7B,YACE,qBAA6B,EAC7B,mBAAiF,EACjF,eAA0C,EAAE;QAE5C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,IAAA,2CAAoB,EAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QAC7F,MAAM,OAAO,GAAG,2BAA2B,CAAC,mBAAmB,CAAC;YAC9D,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,YAAY,CAAC;QAEjB,MAAM,uBAAuB,mCACxB,OAAO,GACP;YACD,cAAc,EAAE;gBACd,MAAM,EAAE,iBAAM,C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yright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\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 { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PhoneNumbersClient as PhoneNumbersGeneratedClient } from \"./generated/src/index.js\";\nimport type {\n OperatorInformationResult,\n PhoneNumberAreaCode,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCountry,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchResult,\n PurchasedPhoneNumber,\n} from \"./generated/src/models/index.js\";\nimport type {\n GetPurchasedPhoneNumberOptions,\n ListAvailableCountriesOptions,\n ListGeographicAreaCodesOptions,\n ListLocalitiesOptions,\n ListOfferingsOptions,\n ListPurchasedPhoneNumbersOptions,\n ListTollFreeAreaCodesOptions,\n PurchasePhoneNumbersResult,\n ReleasePhoneNumberResult,\n SearchAvailablePhoneNumbersRequest,\n SearchOperatorInformationOptions,\n} from \"./models.js\";\nimport type {\n BeginPurchasePhoneNumbersOptions,\n BeginReleasePhoneNumberOptions,\n BeginSearchAvailablePhoneNumbersOptions,\n BeginUpdatePhoneNumberCapabilitiesOptions,\n} from \"./lroModels.js\";\nimport { createPhoneNumbersPagingPolicy } from \"./utils/customPipelinePolicies.js\";\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport { logger } from \"./utils/index.js\";\nimport { tracingClient } from \"./generated/src/tracing.js\";\n\n/**\n * Client options used to configure the PhoneNumbersClient API requests.\n */\nexport interface PhoneNumbersClientOptions extends CommonClientOptions {\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n acceptLanguage?: string;\n}\n\nconst isPhoneNumbersClientOptions = (options: any): options is PhoneNumbersClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services Phone Number Administration.\n */\nexport class PhoneNumbersClient {\n /**\n * A reference to the auto-generated PhoneNumber HTTP client.\n */\n private readonly client: PhoneNumbersGeneratedClient;\n\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n private acceptLanguage: string | undefined;\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using an Azure KeyCredential.\n *\n * @param url - The endpoint of the service (eg: 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 public constructor(url: string, credential: KeyCredential, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a TokenCredential.\n * @param url - 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 public constructor(url: string, credential: TokenCredential, options?: PhoneNumbersClientOptions);\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | PhoneNumbersClientOptions,\n maybeOptions: PhoneNumbersClientOptions = {},\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isPhoneNumbersClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new PhoneNumbersGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n\n // This policy is temporary workarounds to address compatibility issues with Azure Core V2.\n const phoneNumbersPagingPolicy = createPhoneNumbersPagingPolicy(url);\n this.client.pipeline.addPolicy(phoneNumbersPagingPolicy);\n this.acceptLanguage = maybeOptions.acceptLanguage;\n }\n\n /**\n * Gets the details of a purchased phone number. Includes phone number, cost, country code, etc.\n *\n * @param phoneNumber - The E.164 formatted phone number being fetched. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public getPurchasedPhoneNumber(\n phoneNumber: string,\n options: GetPurchasedPhoneNumberOptions = {},\n ): Promise<PurchasedPhoneNumber> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-getPurchasedPhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.getByNumber(phoneNumber, {\n ...updatedOptions,\n });\n },\n );\n }\n\n /**\n * Iterates the purchased phone numbers.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const purchased of client.listPhoneNumbers()) {\n * console.log(\"phone number: \", purchased.phoneNumber);\n * }\n * ```\n * List all purchased phone numbers.\n * @param options - The optional parameters.\n */\n public listPurchasedPhoneNumbers(\n options: ListPurchasedPhoneNumbersOptions = {},\n ): PagedAsyncIterableIterator<PurchasedPhoneNumber> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listPurchasedPhoneNumbers\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listPhoneNumbers({\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Starts the release of a purchased phone number.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const releasePoller = await client.beginReleasePhoneNumber(\"+14125550100\");\n *\n * // Serializing the poller\n * const serialized = releasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await releasePoller.pollUntilDone();\n * console.log(results);\n * ```\n * @param phoneNumber - The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public beginReleasePhoneNumber(\n phoneNumber: string,\n options: BeginReleasePhoneNumberOptions = {},\n ): Promise<PollerLike<PollOperationState<ReleasePhoneNumberResult>, ReleasePhoneNumberResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginReleasePhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginReleasePhoneNumber(phoneNumber, updatedOptions);\n },\n );\n }\n\n /**\n * Starts a search for phone numbers given some constraints such as name or area code.\n * The phone numbers that are found are reserved until you cancel, purchase or the reservation expires.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);\n * const searchPoller = await client.beginSearchAvailablePhoneNumbers(SEARCH_REQUEST);\n *\n * // Serializing the poller\n * const serialized = searchPoller.toString();\n *\n * // Waiting until it's done\n * const results = await searchPoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param search - Request properties to constraint the search scope.\n * @param options - Additional request options.\n */\n public beginSearchAvailablePhoneNumbers(\n search: SearchAvailablePhoneNumbersRequest,\n options: BeginSearchAvailablePhoneNumbersOptions = {},\n ): Promise<PollerLike<PollOperationState<PhoneNumberSearchResult>, PhoneNumberSearchResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginSearchAvailablePhoneNumbers\",\n options,\n (updatedOptions) => {\n const { countryCode, phoneNumberType, assignmentType, capabilities, ...rest } = search;\n return this.client.phoneNumbers.beginSearchAvailablePhoneNumbers(\n countryCode,\n phoneNumberType,\n assignmentType,\n capabilities,\n {\n ...updatedOptions,\n ...rest,\n },\n );\n },\n );\n }\n\n /**\n * Starts the purchase of the phone number(s) in the search associated with a given id.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const purchasePoller = await client.beginPurchasePhoneNumbers(SEARCH_ID);\n *\n * // Serializing the poller\n * const serialized = purchasePoller.toString();\n *\n * // Waiting until it's done\n * const results = await purchasePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param searchId - The id of the search to purchase. Returned from `beginSearchAvailablePhoneNumbers`\n * @param options - Additional request options.\n */\n public beginPurchasePhoneNumbers(\n searchId: string,\n options: BeginPurchasePhoneNumbersOptions = {},\n ): Promise<\n PollerLike<PollOperationState<PurchasePhoneNumbersResult>, PurchasePhoneNumbersResult>\n > {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginPurchasePhoneNumbers\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginPurchasePhoneNumbers({ ...updatedOptions, searchId });\n },\n );\n }\n\n /**\n * Starts the update of a purchased phone number's capabilities.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts\n * const client = new PhoneNumbersClient(CONNECTION_STRING);\n * const updatePoller = await client.beginUpdatePhoneNumberCapabilities(\"+14125550100\", UPDATE_REQUEST);\n *\n * // Serializing the poller\n * const serialized = updatePoller.toString();\n *\n * // Waiting until it's done\n * const results = await updatePoller.pollUntilDone();\n * console.log(results);\n * ```\n *\n * @param phoneNumber - The E.164 formatted phone number being updated. The leading plus can be either + or encoded as %2B.\n * @param request - The updated properties which will be applied to the phone number.\n * @param options - Additional request options.\n */\n public beginUpdatePhoneNumberCapabilities(\n phoneNumber: string,\n request: PhoneNumberCapabilitiesRequest,\n options: BeginUpdatePhoneNumberCapabilitiesOptions = {},\n ): Promise<PollerLike<PollOperationState<PurchasedPhoneNumber>, PurchasedPhoneNumber>> {\n if (!phoneNumber) {\n throw Error(\"phone number can't be empty\");\n }\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginUpdatePhoneNumberCapabilities\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginUpdateCapabilities(phoneNumber, {\n ...updatedOptions,\n ...request,\n });\n },\n );\n }\n\n /**\n * Iterates the available countries.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const country of client.listAvailableCountries()) {\n * console.log(\"country: \", country.localizedName);\n * }\n * ```\n * List all available countries.\n * @param options - The optional parameters.\n */\n public listAvailableCountries(\n options: ListAvailableCountriesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberCountry> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableCountries\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAvailableCountries({\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Toll-Free area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listTollFreeAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Toll-Free area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableTollFreeAreaCodes(\n countryCode: string,\n options: ListTollFreeAreaCodesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableTollFreeAreaCodes\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"tollFree\", {\n ...updatedOptions,\n assignmentType: \"application\",\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Geographic area codes.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const areaCodeItem of client.listGeographicAreaCodes()) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Geographic area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableGeographicAreaCodes(\n countryCode: string,\n options: ListGeographicAreaCodesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableGeographicFreeAreaCodes\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"geographic\", {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available localities.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const locality of client.listAvailableLocalities()) {\n * console.log(\"locality: \", locality.localizedName);\n * }\n * ```\n * List all available localities.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableLocalities(\n countryCode: string,\n options: ListLocalitiesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberLocality> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableLocalities\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAvailableLocalities(countryCode, {\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available offerings.\n *\n * Example usage:\n * ```ts\n * let client = new PhoneNumbersClient(credentials);\n * for await (const offering of client.listAvailableOfferings()) {\n * console.log(\"phone number type: \", offering.phoneNumberType);\n * console.log(\"cost: \", offering.cost.amount);\n * }\n * ```\n * List all available offerings.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableOfferings(\n countryCode: string,\n options: ListOfferingsOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberOffering> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listOfferings\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listOfferings(countryCode, {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Search for operator information about specified phone numbers.\n *\n * @param phoneNumbers - The phone numbers to search.\n * @param options - Additional request options.\n */\n public searchOperatorInformation(\n phoneNumbers: string[],\n options: SearchOperatorInformationOptions = { includeAdditionalOperatorDetails: false },\n ): Promise<OperatorInformationResult> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-searchOperatorInformation\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.operatorInformationSearch(phoneNumbers, {\n ...updatedOptions,\n options: { includeAdditionalOperatorDetails: options.includeAdditionalOperatorDetails },\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"phoneNumbersClient.js","sourceRoot":"","sources":["../../src/phoneNumbersClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;;;AAE5C,uDAAuD;AACvD,sEAIqC;AAErC,gDAAqD;AAIrD,uDAA6F;AA8B7F,iFAAmF;AAEnF,+CAA0C;AAC1C,2DAA2D;AAY3D,MAAM,2BAA2B,GAAG,CAAC,OAAY,EAAwC,EAAE,CACzF,OAAO,IAAI,CAAC,IAAA,sCAAe,EAAC,OAAO,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,OAAO,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAa,kBAAkB;IAoC7B,YACE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CACR,CAAC;QAEF,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,YAAY,kCACjE,cAAc,KACjB,OAAO,EAAE,EAAE,gCAAgC,EAAE,OAAO,CAAC,gCAAgC,EAAE,IACvF,CAAC;QACL,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;IACH,CAAC;CACF;AAzlBD,gDAylBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\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 { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PhoneNumbersClient as PhoneNumbersGeneratedClient } from \"./generated/src/index.js\";\nimport type {\n OperatorInformationResult,\n PhoneNumberAreaCode,\n PhoneNumberCapabilitiesRequest,\n PhoneNumberCountry,\n PhoneNumberLocality,\n PhoneNumberOffering,\n PhoneNumberSearchResult,\n PurchasedPhoneNumber,\n} from \"./generated/src/models/index.js\";\nimport type {\n GetPurchasedPhoneNumberOptions,\n ListAvailableCountriesOptions,\n ListGeographicAreaCodesOptions,\n ListLocalitiesOptions,\n ListOfferingsOptions,\n ListPurchasedPhoneNumbersOptions,\n ListTollFreeAreaCodesOptions,\n PurchasePhoneNumbersResult,\n ReleasePhoneNumberResult,\n SearchAvailablePhoneNumbersRequest,\n SearchOperatorInformationOptions,\n} from \"./models.js\";\nimport type {\n BeginPurchasePhoneNumbersOptions,\n BeginReleasePhoneNumberOptions,\n BeginSearchAvailablePhoneNumbersOptions,\n BeginUpdatePhoneNumberCapabilitiesOptions,\n} from \"./lroModels.js\";\nimport { createPhoneNumbersPagingPolicy } from \"./utils/customPipelinePolicies.js\";\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport { logger } from \"./utils/index.js\";\nimport { tracingClient } from \"./generated/src/tracing.js\";\n\n/**\n * Client options used to configure the PhoneNumbersClient API requests.\n */\nexport interface PhoneNumbersClientOptions extends CommonClientOptions {\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n acceptLanguage?: string;\n}\n\nconst isPhoneNumbersClientOptions = (options: any): options is PhoneNumbersClientOptions =>\n options && !isKeyCredential(options) && !isTokenCredential(options);\n\n/**\n * Client class for interacting with Azure Communication Services Phone Number Administration.\n */\nexport class PhoneNumbersClient {\n /**\n * A reference to the auto-generated PhoneNumber HTTP client.\n */\n private readonly client: PhoneNumbersGeneratedClient;\n\n /**\n * The accept language parameter to be used in the request header's \"accept-language\" property.\n */\n private acceptLanguage: string | undefined;\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a connection string.\n *\n * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret)\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n public constructor(connectionString: string, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using an Azure KeyCredential.\n *\n * @param url - The endpoint of the service (eg: 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 public constructor(url: string, credential: KeyCredential, options?: PhoneNumbersClientOptions);\n\n /**\n * Initializes a new instance of the PhoneNumberAdministrationClient class using a TokenCredential.\n * @param url - 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 public constructor(url: string, credential: TokenCredential, options?: PhoneNumbersClientOptions);\n\n public constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | PhoneNumbersClientOptions,\n maybeOptions: PhoneNumbersClientOptions = {},\n ) {\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const options = isPhoneNumbersClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new PhoneNumbersGeneratedClient(url, {\n endpoint: url,\n ...internalPipelineOptions,\n });\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.client.pipeline.addPolicy(authPolicy);\n\n // This policy is temporary workarounds to address compatibility issues with Azure Core V2.\n const phoneNumbersPagingPolicy = createPhoneNumbersPagingPolicy(url);\n this.client.pipeline.addPolicy(phoneNumbersPagingPolicy);\n this.acceptLanguage = maybeOptions.acceptLanguage;\n }\n\n /**\n * Gets the details of a purchased phone number. Includes phone number, cost, country code, etc.\n *\n * @param phoneNumber - The E.164 formatted phone number being fetched. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public getPurchasedPhoneNumber(\n phoneNumber: string,\n options: GetPurchasedPhoneNumberOptions = {},\n ): Promise<PurchasedPhoneNumber> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-getPurchasedPhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.getByNumber(phoneNumber, {\n ...updatedOptions,\n });\n },\n );\n }\n\n /**\n * Iterates the purchased phone numbers.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListPurchasedPhoneNumbers\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * const phoneNumbers = client.listPurchasedPhoneNumbers();\n *\n * for await (const phoneNumber of phoneNumbers) {\n * console.log(`The id is the same as the phone number: ${phoneNumber.id}`);\n * console.log(`Phone number type is ${phoneNumber.phoneNumberType}`);\n * }\n * ```\n * List all purchased phone numbers.\n * @param options - The optional parameters.\n */\n public listPurchasedPhoneNumbers(\n options: ListPurchasedPhoneNumbersOptions = {},\n ): PagedAsyncIterableIterator<PurchasedPhoneNumber> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listPurchasedPhoneNumbers\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listPhoneNumbers({\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Starts the release of a purchased phone number.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientReleasePhoneNumber\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * const phoneNumberToRelease = \"<phone-number-to-release>\";\n *\n * const releasePoller = await client.beginReleasePhoneNumber(phoneNumberToRelease);\n *\n * // Release is underway.\n * await releasePoller.pollUntilDone();\n * console.log(\"Successfully release phone number.\");\n * ```\n * @param phoneNumber - The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.\n * @param options - Additional request options.\n */\n public beginReleasePhoneNumber(\n phoneNumber: string,\n options: BeginReleasePhoneNumberOptions = {},\n ): Promise<PollerLike<PollOperationState<ReleasePhoneNumberResult>, ReleasePhoneNumberResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginReleasePhoneNumber\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginReleasePhoneNumber(phoneNumber, updatedOptions);\n },\n );\n }\n\n /**\n * Starts a search for phone numbers given some constraints such as name or area code.\n * The phone numbers that are found are reserved until you cancel, purchase or the reservation expires.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientSearchAvailablePhoneNumbers\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import {\n * PhoneNumbersClient,\n * SearchAvailablePhoneNumbersRequest,\n * } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * const searchRequest: SearchAvailablePhoneNumbersRequest = {\n * countryCode: \"US\",\n * phoneNumberType: \"tollFree\",\n * assignmentType: \"application\",\n * capabilities: {\n * sms: \"outbound\",\n * calling: \"none\",\n * },\n * quantity: 1,\n * };\n *\n * const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);\n *\n * // The search is underway. Wait to receive searchId.\n * const searchResults = await searchPoller.pollUntilDone();\n * console.log(`Found phone number: ${searchResults.phoneNumbers[0]}`);\n * console.log(`searchId: ${searchResults.searchId}`);\n * ```\n *\n * @param search - Request properties to constraint the search scope.\n * @param options - Additional request options.\n */\n public beginSearchAvailablePhoneNumbers(\n search: SearchAvailablePhoneNumbersRequest,\n options: BeginSearchAvailablePhoneNumbersOptions = {},\n ): Promise<PollerLike<PollOperationState<PhoneNumberSearchResult>, PhoneNumberSearchResult>> {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginSearchAvailablePhoneNumbers\",\n options,\n (updatedOptions) => {\n const { countryCode, phoneNumberType, assignmentType, capabilities, ...rest } = search;\n return this.client.phoneNumbers.beginSearchAvailablePhoneNumbers(\n countryCode,\n phoneNumberType,\n assignmentType,\n capabilities,\n {\n ...updatedOptions,\n ...rest,\n },\n );\n },\n );\n }\n\n /**\n * Starts the purchase of the phone number(s) in the search associated with a given id.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientPurchasePhoneNumbers\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import {\n * PhoneNumbersClient,\n * SearchAvailablePhoneNumbersRequest,\n * } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * const searchRequest: SearchAvailablePhoneNumbersRequest = {\n * countryCode: \"US\",\n * phoneNumberType: \"tollFree\",\n * assignmentType: \"application\",\n * capabilities: {\n * sms: \"outbound\",\n * calling: \"none\",\n * },\n * quantity: 1,\n * };\n *\n * const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest);\n *\n * // The search is underway. Wait to receive searchId.\n * const { searchId, phoneNumbers } = await searchPoller.pollUntilDone();\n *\n * const purchasePoller = await client.beginPurchasePhoneNumbers(searchId);\n *\n * // Purchase is underway.\n * await purchasePoller.pollUntilDone();\n * console.log(`Successfully purchased ${phoneNumbers[0]}`);\n * ```\n *\n * @param searchId - The id of the search to purchase. Returned from `beginSearchAvailablePhoneNumbers`\n * @param options - Additional request options.\n */\n public beginPurchasePhoneNumbers(\n searchId: string,\n options: BeginPurchasePhoneNumbersOptions = {},\n ): Promise<\n PollerLike<PollOperationState<PurchasePhoneNumbersResult>, PurchasePhoneNumbersResult>\n > {\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginPurchasePhoneNumbers\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginPurchasePhoneNumbers({ ...updatedOptions, searchId });\n },\n );\n }\n\n /**\n * Starts the update of a purchased phone number's capabilities.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientUpdatePhoneNumberCapabilities\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import {\n * PhoneNumbersClient,\n * PhoneNumberCapabilitiesRequest,\n * } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * const phoneNumberToUpdate = \"<phone-number-to-update>\";\n *\n * // This will update phone number to send and receive sms, but only send calls.\n * const updateRequest: PhoneNumberCapabilitiesRequest = {\n * sms: \"inbound+outbound\",\n * calling: \"outbound\",\n * };\n *\n * const updatePoller = await client.beginUpdatePhoneNumberCapabilities(\n * phoneNumberToUpdate,\n * updateRequest,\n * );\n *\n * // Update is underway.\n * const { capabilities } = await updatePoller.pollUntilDone();\n * console.log(`These are the update capabilities: ${capabilities}`);\n * ```\n *\n * @param phoneNumber - The E.164 formatted phone number being updated. The leading plus can be either + or encoded as %2B.\n * @param request - The updated properties which will be applied to the phone number.\n * @param options - Additional request options.\n */\n public beginUpdatePhoneNumberCapabilities(\n phoneNumber: string,\n request: PhoneNumberCapabilitiesRequest,\n options: BeginUpdatePhoneNumberCapabilitiesOptions = {},\n ): Promise<PollerLike<PollOperationState<PurchasedPhoneNumber>, PurchasedPhoneNumber>> {\n if (!phoneNumber) {\n throw Error(\"phone number can't be empty\");\n }\n return tracingClient.withSpan(\n \"PhoneNumbersClient-beginUpdatePhoneNumberCapabilities\",\n options,\n (updatedOptions) => {\n return this.client.phoneNumbers.beginUpdateCapabilities(phoneNumber, {\n ...updatedOptions,\n ...request,\n });\n },\n );\n }\n\n /**\n * Iterates the available countries.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListAvailableCountries\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * for await (const country of client.listAvailableCountries()) {\n * console.log(\"country: \", country.localizedName);\n * }\n * ```\n * List all available countries.\n * @param options - The optional parameters.\n */\n public listAvailableCountries(\n options: ListAvailableCountriesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberCountry> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableCountries\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAvailableCountries({\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Toll-Free area codes.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListTollFreeAreaCodes\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * for await (const areaCodeItem of client.listAvailableTollFreeAreaCodes(\"US\")) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Toll-Free area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableTollFreeAreaCodes(\n countryCode: string,\n options: ListTollFreeAreaCodesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableTollFreeAreaCodes\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"tollFree\", {\n ...updatedOptions,\n assignmentType: \"application\",\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available Geographic area codes.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListGeographicAreaCodes\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * for await (const areaCodeItem of client.listAvailableGeographicAreaCodes(\"US\")) {\n * console.log(\"area code: \", areaCodeItem.areaCode);\n * }\n * ```\n * List all available Geographic area codes.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableGeographicAreaCodes(\n countryCode: string,\n options: ListGeographicAreaCodesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberAreaCode> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableGeographicFreeAreaCodes\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAreaCodes(countryCode, \"geographic\", {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available localities.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListAvailableLocalities\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * for await (const locality of client.listAvailableLocalities(\"US\")) {\n * console.log(\"locality: \", locality.localizedName);\n * }\n * ```\n * List all available localities.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableLocalities(\n countryCode: string,\n options: ListLocalitiesOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberLocality> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listAvailableLocalities\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listAvailableLocalities(countryCode, {\n ...updatedOptions,\n acceptLanguage: this.acceptLanguage,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Iterates the available offerings.\n *\n * Example usage:\n * ```ts snippet:PhoneNumbersClientListAvailableOfferings\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { PhoneNumbersClient } from \"@azure/communication-phone-numbers\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = new PhoneNumbersClient(\"<endpoint-from-resource>\", credential);\n *\n * for await (const offering of client.listAvailableOfferings(\"US\")) {\n * console.log(\"phone number type: \", offering.phoneNumberType);\n * console.log(\"cost: \", offering.cost.amount);\n * }\n * ```\n * List all available offerings.\n * @param countryCode - The ISO 3166-2 country code.\n * @param options - The optional parameters.\n */\n public listAvailableOfferings(\n countryCode: string,\n options: ListOfferingsOptions = {},\n ): PagedAsyncIterableIterator<PhoneNumberOffering> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-listOfferings\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.listOfferings(countryCode, {\n ...updatedOptions,\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Search for operator information about specified phone numbers.\n *\n * @param phoneNumbers - The phone numbers to search.\n * @param options - Additional request options.\n */\n public searchOperatorInformation(\n phoneNumbers: string[],\n options: SearchOperatorInformationOptions = { includeAdditionalOperatorDetails: false },\n ): Promise<OperatorInformationResult> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"PhoneNumbersClient-searchOperatorInformation\",\n options,\n );\n\n try {\n return this.client.phoneNumbers.operatorInformationSearch(phoneNumbers, {\n ...updatedOptions,\n options: { includeAdditionalOperatorDetails: options.includeAdditionalOperatorDetails },\n });\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n\n throw e;\n } finally {\n span.end();\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lroImpl.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEpE,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE;IACvC,eAAe,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE;QACJ,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAmB1B"}
1
+ {"version":3,"file":"lroImpl.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEpE,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE;IACvC,eAAe,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE;QACJ,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAmB1B"}
@@ -1,10 +1,3 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
1
  import { __rest } from "tslib";
9
2
  export function createLroSpec(inputs) {
10
3
  const { args, spec, sendOperationFn } = inputs;
@@ -1 +1 @@
1
- {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAQH,MAAM,UAAU,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,KAAkB,IAAI,EAAjB,QAAQ,UAAK,IAAI,EAAnC,eAA4B,CAAO,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,kCACtB,QAAQ,KACX,UAAU,EAAE,KAAK,EACjB,IAAI,EACJ,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,IACjC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,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\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike },\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal,\n });\n },\n };\n}\n"]}
1
+ {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../../src/generated/src/lroImpl.ts"],"names":[],"mappings":";AAUA,MAAM,UAAU,aAAa,CAAI,MAQhC;IACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAC/C,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,UAAU;QAC9B,WAAW,EAAE,IAAI,CAAC,IAAK;QACvB,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrD,eAAe,EAAE,CACf,IAAY,EACZ,OAA2C,EAC3C,EAAE;YACF,MAAM,EAAE,WAAW,KAAkB,IAAI,EAAjB,QAAQ,UAAK,IAAI,EAAnC,eAA4B,CAAO,CAAC;YAC1C,OAAO,eAAe,CAAC,IAAI,kCACtB,QAAQ,KACX,UAAU,EAAE,KAAK,EACjB,IAAI,EACJ,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,IACjC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,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 */\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport function createLroSpec<T>(inputs: {\n sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;\n args: Record<string, unknown>;\n spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>;\n}): LongRunningOperation<T> {\n const { args, spec, sendOperationFn } = inputs;\n return {\n requestMethod: spec.httpMethod,\n requestPath: spec.path!,\n sendInitialRequest: () => sendOperationFn(args, spec),\n sendPollRequest: (\n path: string,\n options?: { abortSignal?: AbortSignalLike },\n ) => {\n const { requestBody, ...restSpec } = spec;\n return sendOperationFn(args, {\n ...restSpec,\n httpMethod: \"GET\",\n path,\n abortSignal: options?.abortSignal,\n });\n },\n };\n}\n"]}