diff --git a/sdk/communication/Azure.Communication.Sms/api/Azure.Communication.Sms.netstandard2.0.cs b/sdk/communication/Azure.Communication.Sms/api/Azure.Communication.Sms.netstandard2.0.cs index caa9ec7378ed9..2e92fbc69eb1d 100644 --- a/sdk/communication/Azure.Communication.Sms/api/Azure.Communication.Sms.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.Sms/api/Azure.Communication.Sms.netstandard2.0.cs @@ -13,18 +13,19 @@ internal SendSmsResponse() { } public partial class SmsClient { protected SmsClient() { } - public SmsClient(string connectionString, Azure.Communication.Sms.SmsClientOptions? options = null) { } - public SmsClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.Sms.SmsClientOptions? options = null) { } - public SmsClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.Sms.SmsClientOptions? options = null) { } - public virtual Azure.Response Send(Azure.Communication.PhoneNumberIdentifier from, Azure.Communication.PhoneNumberIdentifier to, string message, Azure.Communication.Sms.SendSmsOptions? sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Send(Azure.Communication.PhoneNumberIdentifier from, System.Collections.Generic.IEnumerable to, string message, Azure.Communication.Sms.SendSmsOptions? sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> SendAsync(Azure.Communication.PhoneNumberIdentifier from, Azure.Communication.PhoneNumberIdentifier to, string message, Azure.Communication.Sms.SendSmsOptions? sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> SendAsync(Azure.Communication.PhoneNumberIdentifier from, System.Collections.Generic.IEnumerable to, string message, Azure.Communication.Sms.SendSmsOptions? sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public SmsClient(string connectionString) { } + public SmsClient(string connectionString, Azure.Communication.Sms.SmsClientOptions options) { } + public SmsClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.Sms.SmsClientOptions options = null) { } + public SmsClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.Sms.SmsClientOptions options = null) { } + public virtual Azure.Response Send(Azure.Communication.PhoneNumberIdentifier from, Azure.Communication.PhoneNumberIdentifier to, string message, Azure.Communication.Sms.SendSmsOptions sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Send(Azure.Communication.PhoneNumberIdentifier from, System.Collections.Generic.IEnumerable to, string message, Azure.Communication.Sms.SendSmsOptions sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SendAsync(Azure.Communication.PhoneNumberIdentifier from, Azure.Communication.PhoneNumberIdentifier to, string message, Azure.Communication.Sms.SendSmsOptions sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SendAsync(Azure.Communication.PhoneNumberIdentifier from, System.Collections.Generic.IEnumerable to, string message, Azure.Communication.Sms.SendSmsOptions sendSmsOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class SmsClientOptions : Azure.Core.ClientOptions { public const Azure.Communication.Sms.SmsClientOptions.ServiceVersion LatestVersion = Azure.Communication.Sms.SmsClientOptions.ServiceVersion.V1; - public SmsClientOptions(Azure.Communication.Sms.SmsClientOptions.ServiceVersion version = Azure.Communication.Sms.SmsClientOptions.ServiceVersion.V1, Azure.Core.RetryOptions? retryOptions = null, Azure.Core.Pipeline.HttpPipelineTransport? transport = null) { } + public SmsClientOptions(Azure.Communication.Sms.SmsClientOptions.ServiceVersion version = Azure.Communication.Sms.SmsClientOptions.ServiceVersion.V1, Azure.Core.RetryOptions retryOptions = null, Azure.Core.Pipeline.HttpPipelineTransport transport = null) { } public enum ServiceVersion { V1 = 1, diff --git a/sdk/communication/Azure.Communication.Sms/src/Azure.Communication.Sms.csproj b/sdk/communication/Azure.Communication.Sms/src/Azure.Communication.Sms.csproj index f9b41d42dd4b5..224977caf0bf9 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Azure.Communication.Sms.csproj +++ b/sdk/communication/Azure.Communication.Sms/src/Azure.Communication.Sms.csproj @@ -10,7 +10,6 @@ Microsoft Azure Communication Sms Service;Microsoft;Azure;Azure Communication Service;Azure Communication Sms Service;Sms;Communication;$(PackageCommonTags) $(RequiredTargetFrameworks) false - enable diff --git a/sdk/communication/Azure.Communication.Sms/src/SmsClient.cs b/sdk/communication/Azure.Communication.Sms/src/SmsClient.cs index 8180952ed5b19..27d29ada32374 100644 --- a/sdk/communication/Azure.Communication.Sms/src/SmsClient.cs +++ b/sdk/communication/Azure.Communication.Sms/src/SmsClient.cs @@ -24,17 +24,25 @@ public class SmsClient /// The URI of the Azure Communication Services resource. /// The used to authenticate requests. /// Client option exposing , , , etc. - public SmsClient(Uri endpoint, AzureKeyCredential keyCredential, SmsClientOptions? options = default) + public SmsClient(Uri endpoint, AzureKeyCredential keyCredential, SmsClientOptions options = default) : this( AssertNotNull(endpoint, nameof(endpoint)), options ?? new SmsClientOptions(), AssertNotNull(keyCredential, nameof(keyCredential))) { } + /// Initializes a new instance of . + /// Connection string acquired from the Azure Communication Services resource. + public SmsClient(string connectionString) + : this( + new SmsClientOptions(), + ConnectionString.Parse(AssertNotNullOrEmpty(connectionString, nameof(connectionString)))) + { } + /// Initializes a new instance of . /// Connection string acquired from the Azure Communication Services resource. /// Client option exposing , , , etc. - public SmsClient(string connectionString, SmsClientOptions? options = default) + public SmsClient(string connectionString, SmsClientOptions options) : this( options ?? new SmsClientOptions(), ConnectionString.Parse(AssertNotNullOrEmpty(connectionString, nameof(connectionString)))) @@ -44,7 +52,7 @@ public SmsClient(string connectionString, SmsClientOptions? options = default) /// The URI of the Azure Communication Services resource. /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. /// Client option exposing , , , etc. - public SmsClient(Uri endpoint, TokenCredential tokenCredential, SmsClientOptions? options = default) + public SmsClient(Uri endpoint, TokenCredential tokenCredential, SmsClientOptions options = default) : this( endpoint, options ?? new SmsClientOptions(), @@ -104,7 +112,7 @@ private SmsClient(Uri endpoint, SmsClientOptions options, AzureKeyCredential cre /// is null. /// is null. /// is null. - public virtual async Task> SendAsync(PhoneNumberIdentifier from, PhoneNumberIdentifier to, string message, SendSmsOptions? sendSmsOptions = null, CancellationToken cancellationToken = default) + public virtual async Task> SendAsync(PhoneNumberIdentifier from, PhoneNumberIdentifier to, string message, SendSmsOptions sendSmsOptions = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(from.PhoneNumber, nameof(from)); Argument.AssertNotNullOrEmpty(to.PhoneNumber, nameof(to)); @@ -123,7 +131,7 @@ public virtual async Task> SendAsync(PhoneNumberIdenti /// is null. /// is null. /// is null. - public virtual Response Send(PhoneNumberIdentifier from, PhoneNumberIdentifier to, string message, SendSmsOptions? sendSmsOptions = null, CancellationToken cancellationToken = default) + public virtual Response Send(PhoneNumberIdentifier from, PhoneNumberIdentifier to, string message, SendSmsOptions sendSmsOptions = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(from.PhoneNumber, nameof(from)); Argument.AssertNotNullOrEmpty(to.PhoneNumber, nameof(to)); @@ -140,7 +148,7 @@ public virtual Response Send(PhoneNumberIdentifier from, PhoneN /// is null. /// is null. /// is null. - public virtual async Task> SendAsync(PhoneNumberIdentifier from, IEnumerable to, string message, SendSmsOptions? sendSmsOptions = null, CancellationToken cancellationToken = default) + public virtual async Task> SendAsync(PhoneNumberIdentifier from, IEnumerable to, string message, SendSmsOptions sendSmsOptions = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SmsClient)}.{nameof(Send)}"); scope.Start(); @@ -166,7 +174,7 @@ public virtual async Task> SendAsync(PhoneNumberIdenti /// is null. /// is null. /// is null. - public virtual Response Send(PhoneNumberIdentifier from, IEnumerable to, string message, SendSmsOptions? sendSmsOptions = null, CancellationToken cancellationToken = default) + public virtual Response Send(PhoneNumberIdentifier from, IEnumerable to, string message, SendSmsOptions sendSmsOptions = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SmsClient)}.{nameof(Send)}"); scope.Start(); diff --git a/sdk/communication/Azure.Communication.Sms/src/SmsClientOptions.cs b/sdk/communication/Azure.Communication.Sms/src/SmsClientOptions.cs index e81fa03e89dbe..9782a3f1b2217 100644 --- a/sdk/communication/Azure.Communication.Sms/src/SmsClientOptions.cs +++ b/sdk/communication/Azure.Communication.Sms/src/SmsClientOptions.cs @@ -22,7 +22,7 @@ public class SmsClientOptions : ClientOptions /// /// Initializes a new instance of the . /// - public SmsClientOptions(ServiceVersion version = LatestVersion, RetryOptions? retryOptions = default, HttpPipelineTransport? transport = default) + public SmsClientOptions(ServiceVersion version = LatestVersion, RetryOptions retryOptions = default, HttpPipelineTransport transport = default) { ApiVersion = version switch {