Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[communication] update new phone numbers client #13560

Merged
merged 46 commits into from
Feb 16, 2021
Merged

[communication] update new phone numbers client #13560

merged 46 commits into from
Feb 16, 2021

Conversation

0rland0Wats0n
Copy link
Contributor

@0rland0Wats0n 0rland0Wats0n commented Feb 3, 2021

This PR:

  • updates autorest/typescript extension
  • adds directive to make areaCode a required member of PhoneNumberSearchRequest
  • regenerates from the latest phone number swagger
  • sets up tracing in public client methods
  • adds tests for public methods

NB
PR does not include test recordings to reduce noise.

0rland0Wats0n and others added 30 commits January 20, 2021 09:19
@ghost ghost added the Communication label Feb 3, 2021
acquiredPhoneNumber,
update
);
const phoneNumber = await updatePoller.pollUntilDone();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still working on the LROs. This actually works in node but fails in the browser.

Copy link
Member

@DominikMe DominikMe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress!!
Left some comments but feel free to merge and iterate.

@@ -30,7 +30,7 @@
"lint": "eslint package.json tsconfig.json api-extractor.json src test --ext .ts -f html -o communication-phone-numbers-lintReport.html || exit 0",
"pack": "npm pack 2>&1",
"prebuild": "npm run clean",
"test": "npm run build:test && npm run unit-test && npm run integration-test",
"test": "rimraf dist-test && npm run build:test && npm run unit-test && npm run integration-test",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we need to add rimraf here?

export interface AcquiredPhoneNumberUpdate {
applicationId?: string;
callbackUri?: string;
purchaseDate?: Date;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up: These will change again in a future swagger, applicationId and callbackUri are going away, cost and purchaseDate will become required.

// @public (undocumented)
export type ListPhoneNumbersOptions = OperationOptions;
// @public
export const enum KnownBillingFrequency {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this Known prefix come from?

}

// @public
export const enum KnownPhoneNumberType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did autorest change how it models extensible enums? I would have expected string unions (and prefer them from a TS language perspective :-( )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this changed with the version of autorest/ts I got to fix the LRO problem.

@@ -243,23 +158,14 @@ export class PhoneNumbersClient {
*/
public listPhoneNumbers(
options: ListPhoneNumbersOptions = {}
): PagedAsyncIterableIterator<AcquiredPhoneNumber> {
): PagedAsyncIterableIterator<AcquiredPhoneNumber, AcquiredPhoneNumber[], PageSettings> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I look at PagedAsyncIterableIterator, the second and third value are T[] and PageSettings by default, so this should still be the same as PagedAsyncIterableIterator<AcquiredPhoneNumber>

sms: "inbound+outbound",
calling: "none"
},
areaCode: "844"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment. If the service keeps giving out of stock errors, we should not specify an area code and let the service pick one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service requires an area code to be sent though ¯_(ツ)_/¯

}

const quantity = 2;
searchRequest.quantity = quantity;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of modifying the searchRequest that's shared across tests I'd spread it and modify quantity, so on line 61
{...searchRequest, quantity: 2}

};
};

// Fisher-Yates Shuffle algo implementation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, overkill but okay. Used to be one of the easier interview questions I asked.

export const getPhoneNumberHttpClient: HttpClient = createMockHttpClient<AcquiredPhoneNumber>(200, {
id: "+18005550100",
phoneNumber: "+18005550100",
countryCode: "US",
phoneNumberType: "geographic",
assignmentType: "person",
assignmentType: "user",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, this should still be "person". Need to follow up with service folks

recording.replace(/\/identities\/[^\/'",]*/, "/identities/sanitized"),
(recording: string): string => recording.replace(/\+\d{1}\d{3}\d{3}\d{4}/g, "+18005551234"),
(recording: string): string => recording.replace(/(https:\/\/)([^\/'",}]*)/, "$1endpoint"),
(recording: string): string => recording.replace(/\d{1}\d{3}\d{3}\d{4}/g, "14155550100"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up and removing the unused bits 👍

@0rland0Wats0n 0rland0Wats0n marked this pull request as ready for review February 16, 2021 16:56
@0rland0Wats0n 0rland0Wats0n merged commit 91e5dc8 into Azure:feature/communication/new-phone-numbers Feb 16, 2021
DominikMe pushed a commit that referenced this pull request Mar 8, 2021
* [communication] new phone numbers package (#13349)

* [communication] update new phone numbers client (#13560)

* [communication] disable extensible enums (#13806)

* [communication] new phone numbers package (#13349)

* [communication] update new phone numbers client (#13560)

* [communication] disable extensible enums (#13806)

* [communication] add samples to readme (#13957)

* [communication] regenerate client from latest swagger (#13976)

* regenerate client from latest swagger

* update autorest/ts version

also validates that change to lro code from regen does not break lros that worked before

* add space

* get lock file from master and build

* Update package.json

* rebuild
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Apr 1, 2021
Merge Dev-containerservice-microsoft.containerservice-2021-03-01 API to master  (Azure#13737)

* Adds base for updating Microsoft.ContainerService from version stable/2021-02-01 to version 2021-03-01

* Updates readme

* Updates API version in new specs and examples

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range (Azure#13349)

Co-authored-by: Charlie Li <[email protected]>

* Add enableFIPS property to 2021-03-01 API in dev 2021-03-01 branch (Azure#13359)

* fix the top swagger offenses caused by privateLinkResources, enableCSIProxy and OSDiskSize range

* Add enableFIPS property to the 2021-03-01 API

* Add enableFIPS property to the 2021-03-01 API

Co-authored-by: Charlie Li <[email protected]>

* adding node-image upgrade channel enum (Azure#13375)

Co-authored-by: Charlie McBride <[email protected]>

* Add httpProxyConfig specs to 2021-03-01 API - dev (Azure#13410)

* Add httpProxyConfig specs to 2021-03-01 API - dev

* Fix prettier

* aks: add `bindingSelector` to managed cluster pod identity profile (Azure#13399)

* AKS runCommand new feature  (Azure#13420)

* runCommand target to 03-01

* fix api-version in examples

* Add property disableLocalAccounts to 2021-03-01 API version (Azure#13385)

* Add property disableLocalAccounts

* Fix indentation

* Add OSSKU and GPUInstanceProfile to containerservice/microsoft.container API 2021-03-01 (Azure#13532)

* Add OSSKU and GPUInstanceProfile

* Add sample for OSSKU and GPUInstanceProfile

* Fix custom words

* Reference sample files

* update custom-words

* Update readme for sdks  (Azure#13515)

* update readme for sdks

* update readme for sdks

Co-authored-by: Charlie Li <[email protected]>

* Add example to create agent pool with FIPS enabled (Azure#13557)

* add example to create agent pool with FIPS enabled

* change a property name in the example file

Co-authored-by: Charlie Li <[email protected]>

* Added extended location parameter to managed cluster which will target all agent pools to that extended location. (Azure#13560)

* Add data model for get OS options. (Azure#13619)

* Add data model for get OS options.

* Add default resource name in API path.

* Fix container service tags. (Azure#13739)

Co-authored-by: Tongyao Si <[email protected]>
Co-authored-by: Charlie Li <[email protected]>
Co-authored-by: Charlie McBride <[email protected]>
Co-authored-by: Charlie McBride <[email protected]>
Co-authored-by: Bo Wang <[email protected]>
Co-authored-by: hbc <[email protected]>
Co-authored-by: Haitao Chen <[email protected]>
Co-authored-by: Tony Xu <[email protected]>
Co-authored-by: Mirza Sikander <[email protected]>
Co-authored-by: Jun Sun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants