diff --git a/sdk/communication/communication-phone-numbers/README.md b/sdk/communication/communication-phone-numbers/README.md index d56339cef29f..61f96bd70a0c 100644 --- a/sdk/communication/communication-phone-numbers/README.md +++ b/sdk/communication/communication-phone-numbers/README.md @@ -110,8 +110,8 @@ const connectionString = "endpoint=;accessKey="; const client = new PhoneNumbersClient(connectionString); async function main() { - const countryCode = "US"; const searchRequest = { + countryCode: "US", phoneNumberType: "tollFree", assignmentType: "application", capabilities: { @@ -145,8 +145,8 @@ const connectionString = "endpoint=;accessKey="; const client = new PhoneNumbersClient(connectionString); async function main() { - const countryCode = "US"; const searchRequest = { + countryCode: "US", phoneNumberType: "tollFree", assignmentType: "application", capabilities: { diff --git a/sdk/communication/communication-phone-numbers/package.json b/sdk/communication/communication-phone-numbers/package.json index 77427d18dd43..d1b5a0e06327 100644 --- a/sdk/communication/communication-phone-numbers/package.json +++ b/sdk/communication/communication-phone-numbers/package.json @@ -65,8 +65,13 @@ "sideEffects": false, "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "dependencies": { + "@azure/communication-common": "1.0.0-beta.6", "@azure/abort-controller": "^1.0.0", + "@azure/core-auth": "^1.2.0", + "@azure/core-http": "^1.2.0", + "@azure/core-lro": "^1.0.2", "@azure/core-paging": "^1.1.1", + "@azure/core-tracing": "1.0.0-beta.1", "@azure/logger": "^1.0.0", "@opentelemetry/api": "^0.10.2", "events": "^3.0.0", diff --git a/sdk/communication/communication-phone-numbers/review/communication-phone-numbers.api.md b/sdk/communication/communication-phone-numbers/review/communication-phone-numbers.api.md index 1937a4baa425..83d65bdd467e 100644 --- a/sdk/communication/communication-phone-numbers/review/communication-phone-numbers.api.md +++ b/sdk/communication/communication-phone-numbers/review/communication-phone-numbers.api.md @@ -17,12 +17,12 @@ import { TokenCredential } from '@azure/core-auth'; export interface AcquiredPhoneNumber { assignmentType: PhoneNumberAssignmentType; capabilities: PhoneNumberCapabilities; - cost?: PhoneNumberCost; + cost: PhoneNumberCost; countryCode: string; id: string; phoneNumber: string; phoneNumberType: PhoneNumberType; - purchaseDate?: Date; + purchaseDate: Date; } // @public (undocumented) @@ -41,10 +41,10 @@ export interface BeginSearchAvailablePhoneNumbersOptions extends PhoneNumberPoll export interface BeginUpdatePhoneNumberOptions extends PhoneNumberPollerOptionsBase, OperationOptions { } -// @public (undocumented) +// @public export type GetPhoneNumberOptions = OperationOptions; -// @public (undocumented) +// @public export type GetPhoneNumberResponse = WithResponse; // @public @@ -58,18 +58,18 @@ export type PhoneNumberAssignmentType = "person" | "application"; // @public export interface PhoneNumberCapabilities { - calling: PhoneNumberCapabilityValue; - sms: PhoneNumberCapabilityValue; + calling: PhoneNumberCapabilityType; + sms: PhoneNumberCapabilityType; } // @public export interface PhoneNumberCapabilitiesRequest { - calling?: PhoneNumberCapabilityValue; - sms?: PhoneNumberCapabilityValue; + calling?: PhoneNumberCapabilityType; + sms?: PhoneNumberCapabilityType; } // @public -export type PhoneNumberCapabilityValue = "none" | "inbound" | "outbound" | "inbound+outbound"; +export type PhoneNumberCapabilityType = "none" | "inbound" | "outbound" | "inbound+outbound"; // @public export interface PhoneNumberCost { @@ -93,7 +93,7 @@ export class PhoneNumbersClient { constructor(url: string, credential: TokenCredential, options?: PhoneNumbersClientOptions); beginPurchasePhoneNumbers(searchId: string, options?: BeginPurchasePhoneNumbersOptions): Promise, VoidResponse>>; beginReleasePhoneNumber(phoneNumber: string, options?: BeginReleasePhoneNumberOptions): Promise, VoidResponse>>; - beginSearchAvailablePhoneNumbers(countryCode: string, search: PhoneNumberSearchRequest, options?: BeginSearchAvailablePhoneNumbersOptions): Promise, PhoneNumberSearchResult>>; + beginSearchAvailablePhoneNumbers(search: SearchAvailablePhoneNumbersRequest, options?: BeginSearchAvailablePhoneNumbersOptions): Promise, PhoneNumberSearchResult>>; beginUpdatePhoneNumberCapabilities(phoneNumber: string, request: PhoneNumberCapabilitiesRequest, options?: BeginUpdatePhoneNumberOptions): Promise, AcquiredPhoneNumber>>; getPhoneNumber(phoneNumber: string, options?: GetPhoneNumberOptions): Promise; listPhoneNumbers(options?: ListPhoneNumbersOptions): PagedAsyncIterableIterator; @@ -126,6 +126,11 @@ export interface PhoneNumberSearchResult { // @public export type PhoneNumberType = "geographic" | "tollFree"; +// @public +export interface SearchAvailablePhoneNumbersRequest extends PhoneNumberSearchRequest { + countryCode: string; +} + // @public export type VoidResponse = WithResponse<{}>; diff --git a/sdk/communication/communication-phone-numbers/src/generated/src/models/index.ts b/sdk/communication/communication-phone-numbers/src/generated/src/models/index.ts index f87505742c89..d555131e54a0 100644 --- a/sdk/communication/communication-phone-numbers/src/generated/src/models/index.ts +++ b/sdk/communication/communication-phone-numbers/src/generated/src/models/index.ts @@ -26,9 +26,9 @@ export interface PhoneNumberSearchRequest { /** Capabilities of a phone number. */ export interface PhoneNumberCapabilities { /** Capability value for calling. */ - calling: PhoneNumberCapabilityValue; + calling: PhoneNumberCapabilityType; /** Capability value for SMS. */ - sms: PhoneNumberCapabilityValue; + sms: PhoneNumberCapabilityType; } /** The result of a phone number search operation. */ @@ -130,9 +130,9 @@ export interface AcquiredPhoneNumber { /** The assignment type of the phone number. A phone number can be assigned to a person, or to an application. */ assignmentType: PhoneNumberAssignmentType; /** The date and time that the phone number was purchased. */ - purchaseDate?: Date; + purchaseDate: Date; /** The incurred cost for a single phone number. */ - cost?: PhoneNumberCost; + cost: PhoneNumberCost; } /** The list of acquired phone numbers. */ @@ -146,9 +146,9 @@ export interface AcquiredPhoneNumbers { /** Capabilities of a phone number. */ export interface PhoneNumberCapabilitiesRequest { /** Capability value for calling. */ - calling?: PhoneNumberCapabilityValue; + calling?: PhoneNumberCapabilityType; /** Capability value for SMS. */ - sms?: PhoneNumberCapabilityValue; + sms?: PhoneNumberCapabilityType; } /** Defines headers for PhoneNumbers_searchAvailablePhoneNumbers operation. */ @@ -165,8 +165,6 @@ export interface PhoneNumbersSearchAvailablePhoneNumbersHeaders { /** Defines headers for PhoneNumbers_purchasePhoneNumbers operation. */ export interface PhoneNumbersPurchasePhoneNumbersHeaders { - /** URL to retrieve the final result after operation completes. */ - location?: string; /** URL to query for status of the operation. */ operationLocation?: string; /** The operation id. */ @@ -207,8 +205,8 @@ export interface PhoneNumbersUpdateCapabilitiesHeaders { export type PhoneNumberType = "geographic" | "tollFree"; /** Defines values for PhoneNumberAssignmentType. */ export type PhoneNumberAssignmentType = "person" | "application"; -/** Defines values for PhoneNumberCapabilityValue. */ -export type PhoneNumberCapabilityValue = "none" | "inbound" | "outbound" | "inbound+outbound"; +/** Defines values for PhoneNumberCapabilityType. */ +export type PhoneNumberCapabilityType = "none" | "inbound" | "outbound" | "inbound+outbound"; /** Defines values for PhoneNumberOperationStatus. */ export type PhoneNumberOperationStatus = "notStarted" | "running" | "succeeded" | "failed"; /** Defines values for PhoneNumberOperationType. */ @@ -263,21 +261,15 @@ export interface PhoneNumbersPurchasePhoneNumbersOptionalParams extends coreHttp } /** Contains response data for the purchasePhoneNumbers operation. */ -export type PhoneNumbersPurchasePhoneNumbersResponse = PhoneNumbersPurchasePhoneNumbersHeaders & - PhoneNumberSearchResult & { - /** The underlying HTTP response. */ - _response: coreHttp.HttpResponse & { - /** The response body as text (string format) */ - bodyAsText: string; - - /** The response body as parsed JSON or XML */ - parsedBody: PhoneNumberSearchResult; - /** The parsed HTTP response headers. */ - parsedHeaders: PhoneNumbersPurchasePhoneNumbersHeaders; - /** The parsed HTTP response headers. */ - [LROSYM]: LROResponseInfo; - }; +export type PhoneNumbersPurchasePhoneNumbersResponse = PhoneNumbersPurchasePhoneNumbersHeaders & { + /** The underlying HTTP response. */ + _response: coreHttp.HttpResponse & { + /** The parsed HTTP response headers. */ + parsedHeaders: PhoneNumbersPurchasePhoneNumbersHeaders; + /** The parsed HTTP response headers. */ + [LROSYM]: LROResponseInfo; }; +}; /** Contains response data for the getOperation operation. */ export type PhoneNumbersGetOperationResponse = PhoneNumbersGetOperationHeaders & @@ -340,9 +332,9 @@ export type PhoneNumbersListPhoneNumbersResponse = AcquiredPhoneNumbers & { /** Optional parameters. */ export interface PhoneNumbersUpdateCapabilitiesOptionalParams extends coreHttp.OperationOptions { /** Capability value for calling. */ - calling?: PhoneNumberCapabilityValue; + calling?: PhoneNumberCapabilityType; /** Capability value for SMS. */ - sms?: PhoneNumberCapabilityValue; + sms?: PhoneNumberCapabilityType; } /** Contains response data for the updateCapabilities operation. */ diff --git a/sdk/communication/communication-phone-numbers/src/generated/src/models/mappers.ts b/sdk/communication/communication-phone-numbers/src/generated/src/models/mappers.ts index e550052b2aa4..9467934c2a4f 100644 --- a/sdk/communication/communication-phone-numbers/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-phone-numbers/src/generated/src/models/mappers.ts @@ -17,14 +17,16 @@ export const PhoneNumberSearchRequest: coreHttp.CompositeMapper = { serializedName: "phoneNumberType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["geographic", "tollFree"] } }, assignmentType: { serializedName: "assignmentType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["person", "application"] } }, capabilities: { @@ -64,14 +66,16 @@ export const PhoneNumberCapabilities: coreHttp.CompositeMapper = { serializedName: "calling", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["none", "inbound", "outbound", "inbound+outbound"] } }, sms: { serializedName: "sms", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["none", "inbound", "outbound", "inbound+outbound"] } } } @@ -106,14 +110,16 @@ export const PhoneNumberSearchResult: coreHttp.CompositeMapper = { serializedName: "phoneNumberType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["geographic", "tollFree"] } }, assignmentType: { serializedName: "assignmentType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["person", "application"] } }, capabilities: { @@ -262,7 +268,8 @@ export const PhoneNumberOperation: coreHttp.CompositeMapper = { serializedName: "status", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["notStarted", "running", "succeeded", "failed"] } }, resourceLocation: { @@ -296,7 +303,13 @@ export const PhoneNumberOperation: coreHttp.CompositeMapper = { serializedName: "operationType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: [ + "purchase", + "releasePhoneNumber", + "search", + "updatePhoneNumberCapabilities" + ] } }, lastActionDateTime: { @@ -340,7 +353,8 @@ export const AcquiredPhoneNumber: coreHttp.CompositeMapper = { serializedName: "phoneNumberType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["geographic", "tollFree"] } }, capabilities: { @@ -354,11 +368,13 @@ export const AcquiredPhoneNumber: coreHttp.CompositeMapper = { serializedName: "assignmentType", required: true, type: { - name: "String" + name: "Enum", + allowedValues: ["person", "application"] } }, purchaseDate: { serializedName: "purchaseDate", + required: true, type: { name: "DateTime" } @@ -410,13 +426,15 @@ export const PhoneNumberCapabilitiesRequest: coreHttp.CompositeMapper = { calling: { serializedName: "calling", type: { - name: "String" + name: "Enum", + allowedValues: ["none", "inbound", "outbound", "inbound+outbound"] } }, sms: { serializedName: "sms", type: { - name: "String" + name: "Enum", + allowedValues: ["none", "inbound", "outbound", "inbound+outbound"] } } } @@ -461,12 +479,6 @@ export const PhoneNumbersPurchasePhoneNumbersHeaders: coreHttp.CompositeMapper = name: "Composite", className: "PhoneNumbersPurchasePhoneNumbersHeaders", modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, operationLocation: { serializedName: "operation-location", type: { diff --git a/sdk/communication/communication-phone-numbers/src/generated/src/operations/phoneNumbers.ts b/sdk/communication/communication-phone-numbers/src/generated/src/operations/phoneNumbers.ts index 2036dac8856f..c3788207e213 100644 --- a/sdk/communication/communication-phone-numbers/src/generated/src/operations/phoneNumbers.ts +++ b/sdk/communication/communication-phone-numbers/src/generated/src/operations/phoneNumbers.ts @@ -10,7 +10,7 @@ import { PagedAsyncIterableIterator } from "@azure/core-paging"; import * as coreHttp from "@azure/core-http"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { PhoneNumbersClient } from "../phoneNumbersClient"; +import { PhoneNumbersClientContext } from "../phoneNumbersClientContext"; import { LROPoller, shouldDeserializeLRO } from "../lro"; import { AcquiredPhoneNumber, @@ -35,13 +35,13 @@ import { /** Class representing a PhoneNumbers. */ export class PhoneNumbers { - private readonly client: PhoneNumbersClient; + private readonly client: PhoneNumbersClientContext; /** * Initialize a new instance of the class PhoneNumbers class. * @param client Reference to the service client */ - constructor(client: PhoneNumbersClient) { + constructor(client: PhoneNumbersClientContext) { this.client = client; } @@ -156,7 +156,7 @@ export class PhoneNumbers { options?: PhoneNumbersPurchasePhoneNumbersOptionalParams ): Promise> { const operationArguments: coreHttp.OperationArguments = { - options: this.getOperationOptions(options, "location") + options: this.getOperationOptions(options, "undefined") }; const sendOperation = (args: coreHttp.OperationArguments, spec: coreHttp.OperationSpec) => { return this.client.sendOperationRequest(args, spec) as Promise< @@ -172,8 +172,7 @@ export class PhoneNumbers { initialOperationArguments: operationArguments, initialOperationSpec: purchasePhoneNumbersOperationSpec, initialOperationResult, - sendOperation, - finalStateVia: "location" + sendOperation }); } @@ -246,7 +245,7 @@ export class PhoneNumbers { ): Promise> { const operationArguments: coreHttp.OperationArguments = { phoneNumber, - options: this.getOperationOptions(options, "location") + options: this.getOperationOptions(options, "undefined") }; const sendOperation = (args: coreHttp.OperationArguments, spec: coreHttp.OperationSpec) => { return this.client.sendOperationRequest(args, spec) as Promise< @@ -262,8 +261,7 @@ export class PhoneNumbers { initialOperationArguments: operationArguments, initialOperationSpec: releasePhoneNumberOperationSpec, initialOperationResult, - sendOperation, - finalStateVia: "location" + sendOperation }); } @@ -411,19 +409,15 @@ const purchasePhoneNumbersOperationSpec: coreHttp.OperationSpec = { httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.PhoneNumberSearchResult, headersMapper: Mappers.PhoneNumbersPurchasePhoneNumbersHeaders }, 201: { - bodyMapper: Mappers.PhoneNumberSearchResult, headersMapper: Mappers.PhoneNumbersPurchasePhoneNumbersHeaders }, 202: { - bodyMapper: Mappers.PhoneNumberSearchResult, headersMapper: Mappers.PhoneNumbersPurchasePhoneNumbersHeaders }, 204: { - bodyMapper: Mappers.PhoneNumberSearchResult, headersMapper: Mappers.PhoneNumbersPurchasePhoneNumbersHeaders }, default: { diff --git a/sdk/communication/communication-phone-numbers/src/models.ts b/sdk/communication/communication-phone-numbers/src/models.ts index aa3b5f3d0c86..7ef565b2c1b8 100644 --- a/sdk/communication/communication-phone-numbers/src/models.ts +++ b/sdk/communication/communication-phone-numbers/src/models.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { HttpResponse, OperationOptions } from "@azure/core-http"; -import { AcquiredPhoneNumber } from "./generated/src/models/"; +import { AcquiredPhoneNumber, PhoneNumberSearchRequest } from "./generated/src/models/"; /** * Represents an object with a non-enumerable _response property which provides @@ -15,8 +15,14 @@ export type WithResponse = T & { _response: HttpResponse }; */ export type VoidResponse = WithResponse<{}>; +/** + * Additional options for the get phone number request. + */ export type GetPhoneNumberOptions = OperationOptions; +/** + * The response from the get phone number request. + */ export type GetPhoneNumberResponse = WithResponse; /** @@ -36,14 +42,25 @@ export interface ListPhoneNumbersOptions extends OperationOptions { top?: number; } +/** + * Represents a phone number search request to find phone numbers. + * Found phone numbers are temporarily held for a following purchase. + */ +export interface SearchAvailablePhoneNumbersRequest extends PhoneNumberSearchRequest { + /** + * The ISO 3166-2 country code, e.g. US, representing the location of the search. + */ + countryCode: string; +} + export { AcquiredPhoneNumber, PhoneNumberAssignmentType, PhoneNumberCapabilities, PhoneNumberCapabilitiesRequest, - PhoneNumberCapabilityValue, + PhoneNumberCapabilityType, PhoneNumberCost, - PhoneNumberSearchRequest, PhoneNumberSearchResult, + PhoneNumberSearchRequest, PhoneNumberType } from "./generated/src/models/"; diff --git a/sdk/communication/communication-phone-numbers/src/phoneNumbersClient.ts b/sdk/communication/communication-phone-numbers/src/phoneNumbersClient.ts index c9c1dfdc8589..c6624875305a 100644 --- a/sdk/communication/communication-phone-numbers/src/phoneNumbersClient.ts +++ b/sdk/communication/communication-phone-numbers/src/phoneNumbersClient.ts @@ -22,14 +22,14 @@ import { PhoneNumbers as GeneratedClient } from "./generated/src/operations"; import { AcquiredPhoneNumber, PhoneNumberCapabilitiesRequest, - PhoneNumberSearchRequest, PhoneNumberSearchResult } from "./generated/src/models/"; import { GetPhoneNumberOptions, GetPhoneNumberResponse, ListPhoneNumbersOptions, - VoidResponse + VoidResponse, + SearchAvailablePhoneNumbersRequest } from "./models"; import { BeginPurchasePhoneNumbersOptions, @@ -226,13 +226,11 @@ export class PhoneNumbersClient { * console.log(results); * ``` * - * @param {string} countryCode The ISO 3166-2 country code . - * @param {PhoneNumberSearchRequest} search Request properties to constraint the search scope. + * @param {SearchAvailablePhoneNumbersRequest} search Request properties to constraint the search scope. * @param {BeginReservePhoneNumbersOptions} options Additional request options. */ public async beginSearchAvailablePhoneNumbers( - countryCode: string, - search: PhoneNumberSearchRequest, + search: SearchAvailablePhoneNumbersRequest, options: BeginSearchAvailablePhoneNumbersOptions = {} ): Promise, PhoneNumberSearchResult>> { const { span, updatedOptions } = createSpan( @@ -241,7 +239,7 @@ export class PhoneNumbersClient { ); try { - const { phoneNumberType, assignmentType, capabilities, ...rest } = search; + const { countryCode, phoneNumberType, assignmentType, capabilities, ...rest } = search; return await this.client.searchAvailablePhoneNumbers( countryCode, phoneNumberType, diff --git a/sdk/communication/communication-phone-numbers/swagger/README.md b/sdk/communication/communication-phone-numbers/swagger/README.md index 851edd69e233..d5bbc62f3aa1 100644 --- a/sdk/communication/communication-phone-numbers/swagger/README.md +++ b/sdk/communication/communication-phone-numbers/swagger/README.md @@ -11,12 +11,12 @@ package-version: 1.0.0-beta.4 generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../src/generated -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/967da531665d4b51a7a5599324e5edd95489cc3d/specification/communication/data-plane/Microsoft.CommunicationServicesPhoneNumbers/stable/2021-03-07/phonenumbers.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a4d1e1516433894fca89f9600a6ac8a5471fc598/specification/communication/data-plane/Microsoft.CommunicationServicesPhoneNumbers/stable/2021-03-07/phonenumbers.json model-date-time-as-string: false optional-response-headers: true payload-flattening-threshold: 10 use-extension: - "@autorest/typescript": "https://bit.ly/2Zncabl" + "@autorest/typescript": "6.0.0-dev.20210223.1" add-credentials: false azure-arm: false skip-enum-validation: true diff --git a/sdk/communication/communication-phone-numbers/test/lro.purchase.spec.ts b/sdk/communication/communication-phone-numbers/test/lro.purchase.spec.ts index 5c3f425a7f22..62ede487bc12 100644 --- a/sdk/communication/communication-phone-numbers/test/lro.purchase.spec.ts +++ b/sdk/communication/communication-phone-numbers/test/lro.purchase.spec.ts @@ -3,7 +3,7 @@ import { isLiveMode, isPlaybackMode, Recorder } from "@azure/test-utils-recorder"; import { assert } from "chai"; -import { PhoneNumberSearchRequest, PhoneNumberSearchResult } from "../src"; +import { PhoneNumberSearchResult, SearchAvailablePhoneNumbersRequest } from "../src"; import { PhoneNumbersClient } from "../src/phoneNumbersClient"; import { createRecordedClient, testPollerOptions } from "./utils/recordedClient"; @@ -11,7 +11,6 @@ describe("PhoneNumbersClient - lro - purchase", function() { let recorder: Recorder; let client: PhoneNumbersClient; let includePhoneNumberLiveTests: boolean; - const countryCode = "US"; this.beforeAll(function() { if (isPlaybackMode() || isLiveMode()) { @@ -37,7 +36,8 @@ describe("PhoneNumbersClient - lro - purchase", function() { this.skip(); } - const searchRequest: PhoneNumberSearchRequest = { + const searchRequest: SearchAvailablePhoneNumbersRequest = { + countryCode: "US", phoneNumberType: "tollFree", assignmentType: "application", capabilities: { @@ -48,11 +48,9 @@ describe("PhoneNumbersClient - lro - purchase", function() { quantity: 1 }; const searchPoller = await client.beginSearchAvailablePhoneNumbers( - countryCode, searchRequest, testPollerOptions ); - //assert.ok(searchPoller.getOperationState().isStarted); searchResults = await searchPoller.pollUntilDone(); @@ -71,7 +69,6 @@ describe("PhoneNumbersClient - lro - purchase", function() { searchResults.searchId, testPollerOptions ); - //assert.ok(purchasePoller.getOperationState().isStarted); await purchasePoller.pollUntilDone(); assert.ok(purchasePoller.getOperationState().isCompleted); diff --git a/sdk/communication/communication-phone-numbers/test/lro.release.spec.ts b/sdk/communication/communication-phone-numbers/test/lro.release.spec.ts index 4cae79dc3334..03b180057d81 100644 --- a/sdk/communication/communication-phone-numbers/test/lro.release.spec.ts +++ b/sdk/communication/communication-phone-numbers/test/lro.release.spec.ts @@ -51,7 +51,6 @@ describe("PhoneNumbersClient - lro - release", function() { phoneNumberToRelease, testPollerOptions ); - //assert.ok(releasePoller.getOperationState().isStarted); await releasePoller.pollUntilDone(); assert.ok(releasePoller.getOperationState().isCompleted); diff --git a/sdk/communication/communication-phone-numbers/test/lro.search.spec.ts b/sdk/communication/communication-phone-numbers/test/lro.search.spec.ts index ca8e7676987f..4718ac33a787 100644 --- a/sdk/communication/communication-phone-numbers/test/lro.search.spec.ts +++ b/sdk/communication/communication-phone-numbers/test/lro.search.spec.ts @@ -3,7 +3,7 @@ import { isLiveMode, isPlaybackMode, Recorder } from "@azure/test-utils-recorder"; import { assert } from "chai"; -import { PhoneNumberSearchRequest } from "../src"; +import { SearchAvailablePhoneNumbersRequest } from "../src"; import { PhoneNumbersClient } from "../src/phoneNumbersClient"; import { createRecordedClient, testPollerOptions } from "./utils/recordedClient"; @@ -11,8 +11,8 @@ describe("PhoneNumbersClient - lro - search", function() { let recorder: Recorder; let client: PhoneNumbersClient; let includePhoneNumberLiveTests: boolean; - const countryCode = "US"; - const searchRequest: PhoneNumberSearchRequest = { + const searchRequest: SearchAvailablePhoneNumbersRequest = { + countryCode: "US", phoneNumberType: "tollFree", assignmentType: "application", capabilities: { @@ -42,8 +42,7 @@ describe("PhoneNumbersClient - lro - search", function() { this.skip(); } - const searchPoller = await client.beginSearchAvailablePhoneNumbers(countryCode, searchRequest); - //assert.ok(searchPoller.getOperationState().isStarted); + const searchPoller = await client.beginSearchAvailablePhoneNumbers(searchRequest); const results = await searchPoller.pollUntilDone(); assert.equal(results.phoneNumbers.length, 1); @@ -57,11 +56,9 @@ describe("PhoneNumbersClient - lro - search", function() { const quantity = 2; const searchPoller = await client.beginSearchAvailablePhoneNumbers( - countryCode, { ...searchRequest, quantity }, testPollerOptions ); - //assert.ok(searchPoller.getOperationState().isStarted); const results = await searchPoller.pollUntilDone(); assert.equal(results.phoneNumbers.length, quantity); @@ -74,11 +71,9 @@ describe("PhoneNumbersClient - lro - search", function() { } const searchPoller = await client.beginSearchAvailablePhoneNumbers( - countryCode, searchRequest, testPollerOptions ); - //assert.ok(searchPoller.getOperationState().isStarted); await searchPoller.cancelOperation(); assert.ok(searchPoller.isStopped); diff --git a/sdk/communication/communication-phone-numbers/test/utils/index.ts b/sdk/communication/communication-phone-numbers/test/utils/index.ts index a5b1563f9934..fd8b7242b808 100644 --- a/sdk/communication/communication-phone-numbers/test/utils/index.ts +++ b/sdk/communication/communication-phone-numbers/test/utils/index.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PhoneNumberCapabilitiesRequest, PhoneNumberCapabilityValue } from "../../src"; +import { PhoneNumberCapabilitiesRequest, PhoneNumberCapabilityType } from "../../src"; export const buildCapabilityUpdate = ( capabilities: PhoneNumberCapabilitiesRequest ): PhoneNumberCapabilitiesRequest => { - const values: PhoneNumberCapabilityValue[] = ["none", "inbound", "outbound", "inbound+outbound"]; + const values: PhoneNumberCapabilityType[] = ["none", "inbound", "outbound", "inbound+outbound"]; return { sms: shuffle(values).find((val) => val != capabilities.sms),