Skip to content

Commit

Permalink
[Communication] - PhoneNumbers - Add support for the new public previ…
Browse files Browse the repository at this point in the history
…ew API version in the PhoneNumbers SDK (#26029)

* Generate SDK for PhoneNumbers API version 2022-01-11-preview2

* Add session recordings for latest API version

* Update recorded sessions for failing tests

These recordings are the same as the previous ones, but with the new API version. This had to be done due to an issue with the sanitizer.

* Suppress ServiceVersion member name checks

* Add missing ServiceVersion member

* Don't auto generate PhoneNumbersClientOptions

Manually declaring this class and supressing codegen ensures that:
1. ServiceVersion members are not overwritten, preserving compatibility
2. ServiceVersion members can now use PascalCase

For more information on this issues, see:
- Azure/autorest.csharp#1524
- #24153
- #23793
- Azure/autorest.csharp#1497

* Update API version in client and test recordings

TODO: Update autorest config file once the spec is merged

* Use latest autorest spec

* Add changelog entry for 1.1.0-beta.1 release
  • Loading branch information
danielortega-msft authored Jan 18, 2022
1 parent 8548961 commit 68ddcee
Show file tree
Hide file tree
Showing 42 changed files with 33,125 additions and 4,532 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History

## 1.1.0-beta.1 (2022-01-24)
### Features Added
- Add support for API version `2022-01-11-preview2`.

## 1.0.2 (2021-10-05)
- Dependency versions updated.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ public PhoneNumbersClient(System.Uri endpoint, Azure.Core.TokenCredential tokenC
}
public partial class PhoneNumbersClientOptions : Azure.Core.ClientOptions
{
public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2021_03_07) { }
public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2022_01_11_Preview_2) { }
public enum ServiceVersion
{
V2021_03_07 = 1,
V2022_01_11_Preview_2 = 2,
}
}
public partial class PhoneNumberSearchOptions
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// <auto-generated/>

#nullable disable

using System;
using Azure.Core;

[assembly: CodeGenSuppressType("PhoneNumbersClientOptions")]
namespace Azure.Communication.PhoneNumbers
{
/// <summary> Client options for PhoneNumbersClient. </summary>
public partial class PhoneNumbersClientOptions : ClientOptions
public class PhoneNumbersClientOptions : ClientOptions
{
private const ServiceVersion LatestVersion = ServiceVersion.V2021_03_07;
private const ServiceVersion LatestVersion = ServiceVersion.V2022_01_11_Preview_2;

/// <summary> The version of the service to use. </summary>
public enum ServiceVersion
{
#pragma warning disable CA1707 // Identifiers should not contain underscores
/// <summary> Service version "2021-03-07". </summary>
V2021_03_07 = 1,
/// <summary> Service version "2022-01-11-preview". </summary>
V2022_01_11_Preview_2 = 2,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}

internal string Version { get; }
Expand All @@ -30,6 +33,7 @@ public PhoneNumbersClientOptions(ServiceVersion version = LatestVersion)
Version = version switch
{
ServiceVersion.V2021_03_07 => "2021-03-07",
ServiceVersion.V2022_01_11_Preview_2 => "2022-01-11-preview2",
_ => throw new NotSupportedException()
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Run `dotnet msbuild /t:GenerateCode` to generate code.
``` yaml
public-clients: true
tag: package-phonenumber-2021-03-07
tag: package-phonenumber-2022-01-11-preview2
model-namespace: false
require:
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/5d491b126dd42e95b5b19f4ac6bfeeac68bd3395/specification/communication/data-plane/PhoneNumbers/readme.md
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/02fce64677f78021ba70d69bb8bd0d916d653927/specification/communication/data-plane/PhoneNumbers/readme.md
title: Phone numbers
payload-flattening-threshold: 3
```
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 68ddcee

Please sign in to comment.