diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Azure.Communication.ProgrammableConnectivity.sln b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Azure.Communication.ProgrammableConnectivity.sln new file mode 100644 index 0000000000000..fc1ee5156b11c --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Azure.Communication.ProgrammableConnectivity.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Communication.ProgrammableConnectivity", "src\Azure.Communication.ProgrammableConnectivity.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Communication.ProgrammableConnectivity.Tests", "tests\Azure.Communication.ProgrammableConnectivity.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/CHANGELOG.md b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/CHANGELOG.md new file mode 100644 index 0000000000000..13dd08af78abe --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Directory.Build.props b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Directory.Build.props new file mode 100644 index 0000000000000..63bd836ad44b7 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/README.md b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/README.md new file mode 100644 index 0000000000000..4800bd72defb9 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/README.md @@ -0,0 +1,86 @@ +# Azure.Communication.ProgrammableConnectivity client library for .NET + +Azure.Communication.ProgrammableConnectivity is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.Communication.ProgrammableConnectivity --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/README.png) diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/api/Azure.Communication.ProgrammableConnectivity.netstandard2.0.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/api/Azure.Communication.ProgrammableConnectivity.netstandard2.0.cs new file mode 100644 index 0000000000000..09b1c0a957d92 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/api/Azure.Communication.ProgrammableConnectivity.netstandard2.0.cs @@ -0,0 +1,242 @@ +namespace Azure.Communication.ProgrammableConnectivity +{ + public static partial class CommunicationProgrammableConnectivityModelFactory + { + public static Azure.Communication.ProgrammableConnectivity.DeviceLocationVerificationResult DeviceLocationVerificationResult(bool verificationResult = false) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.NetworkRetrievalResult NetworkRetrievalResult(string networkCode = null) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.NumberRetrievalResult NumberRetrievalResult(string phoneNumber = null) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.NumberVerificationResult NumberVerificationResult(bool verificationResult = false) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.SimSwapRetrievalResult SimSwapRetrievalResult(System.DateTimeOffset date = default(System.DateTimeOffset)) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.SimSwapVerificationResult SimSwapVerificationResult(bool verificationResult = false) { throw null; } + } + public partial class DeviceLocation + { + protected DeviceLocation() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Verify(Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum location, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.DeviceLocationVerificationContent deviceLocationVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Verify(string location, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> VerifyAsync(Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum location, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.DeviceLocationVerificationContent deviceLocationVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task VerifyAsync(string location, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DeviceLocationEnum : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeviceLocationEnum(string value) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum Location { get { throw null; } } + public bool Equals(Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum left, Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum right) { throw null; } + public static implicit operator Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum (string value) { throw null; } + public static bool operator !=(Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum left, Azure.Communication.ProgrammableConnectivity.DeviceLocationEnum right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DeviceLocationVerificationContent + { + public DeviceLocationVerificationContent(Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier, float latitude, float longitude, int accuracy, Azure.Communication.ProgrammableConnectivity.LocationDevice locationDevice) { } + public int Accuracy { get { throw null; } } + public float Latitude { get { throw null; } } + public Azure.Communication.ProgrammableConnectivity.LocationDevice LocationDevice { get { throw null; } } + public float Longitude { get { throw null; } } + public Azure.Communication.ProgrammableConnectivity.NetworkIdentifier NetworkIdentifier { get { throw null; } } + } + public partial class DeviceLocationVerificationResult + { + internal DeviceLocationVerificationResult() { } + public bool VerificationResult { get { throw null; } } + } + public partial class DeviceNetwork + { + protected DeviceNetwork() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Retrieve(Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum network, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.DeviceNetworkIdentifier deviceNetworkIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Retrieve(string network, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> RetrieveAsync(Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum network, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.DeviceNetworkIdentifier deviceNetworkIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RetrieveAsync(string network, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DeviceNetworkEnum : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeviceNetworkEnum(string value) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum Network { get { throw null; } } + public bool Equals(Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum left, Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum right) { throw null; } + public static implicit operator Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum (string value) { throw null; } + public static bool operator !=(Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum left, Azure.Communication.ProgrammableConnectivity.DeviceNetworkEnum right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DeviceNetworkIdentifier + { + public DeviceNetworkIdentifier(string identifierType, string deviceIdentifier) { } + public string DeviceIdentifier { get { throw null; } } + public string IdentifierType { get { throw null; } } + } + public partial class Ipv4Address + { + public Ipv4Address(string ipv4, int port) { } + public string Ipv4 { get { throw null; } } + public int Port { get { throw null; } } + } + public partial class Ipv6Address + { + public Ipv6Address(string ipv6, int port) { } + public string Ipv6 { get { throw null; } } + public int Port { get { throw null; } } + } + public partial class LocationDevice + { + public LocationDevice() { } + public Azure.Communication.ProgrammableConnectivity.Ipv4Address Ipv4Address { get { throw null; } set { } } + public Azure.Communication.ProgrammableConnectivity.Ipv6Address Ipv6Address { get { throw null; } set { } } + public string NetworkAccessIdentifier { get { throw null; } set { } } + public string PhoneNumber { get { throw null; } set { } } + } + public partial class NetworkIdentifier + { + public NetworkIdentifier(string identifierType, string identifier) { } + public string Identifier { get { throw null; } } + public string IdentifierType { get { throw null; } } + } + public partial class NetworkRetrievalResult + { + internal NetworkRetrievalResult() { } + public string NetworkCode { get { throw null; } } + } + public partial class NumberRetrievalResult + { + internal NumberRetrievalResult() { } + public string PhoneNumber { get { throw null; } } + } + public partial class NumberVerification + { + protected NumberVerification() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Retrieve(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum number, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Retrieve(string number, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> RetrieveAsync(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum number, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RetrieveAsync(string number, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response Verify(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum number, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NumberVerificationContent numberVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Verify(string number, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> VerifyAsync(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum number, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NumberVerificationContent numberVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task VerifyAsync(string number, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class NumberVerificationContent + { + public NumberVerificationContent(Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier) { } + public string HashedPhoneNumber { get { throw null; } set { } } + public Azure.Communication.ProgrammableConnectivity.NetworkIdentifier NetworkIdentifier { get { throw null; } } + public string PhoneNumber { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NumberVerificationEnum : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NumberVerificationEnum(string value) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum Number { get { throw null; } } + public bool Equals(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum left, Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum right) { throw null; } + public static implicit operator Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum (string value) { throw null; } + public static bool operator !=(Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum left, Azure.Communication.ProgrammableConnectivity.NumberVerificationEnum right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NumberVerificationResult + { + internal NumberVerificationResult() { } + public bool VerificationResult { get { throw null; } } + } + public partial class ProgrammableConnectivityClient + { + protected ProgrammableConnectivityClient() { } + public ProgrammableConnectivityClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public ProgrammableConnectivityClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.ProgrammableConnectivity.ProgrammableConnectivityClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Communication.ProgrammableConnectivity.DeviceLocation GetDeviceLocationClient(string apiVersion = "v2024_01_09_preview") { throw null; } + public virtual Azure.Communication.ProgrammableConnectivity.DeviceNetwork GetDeviceNetworkClient(string apiVersion = "v2024_01_09_preview") { throw null; } + public virtual Azure.Communication.ProgrammableConnectivity.NumberVerification GetNumberVerificationClient(string apiVersion = "v2024_01_09_preview") { throw null; } + public virtual Azure.Communication.ProgrammableConnectivity.SimSwap GetSimSwapClient(string apiVersion = "v2024_01_09_preview") { throw null; } + } + public partial class ProgrammableConnectivityClientOptions : Azure.Core.ClientOptions + { + public ProgrammableConnectivityClientOptions(Azure.Communication.ProgrammableConnectivity.ProgrammableConnectivityClientOptions.ServiceVersion version = Azure.Communication.ProgrammableConnectivity.ProgrammableConnectivityClientOptions.ServiceVersion.V2024_01_09_Preview) { } + public enum ServiceVersion + { + V2024_01_09_Preview = 1, + } + } + public partial class SimSwap + { + protected SimSwap() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Retrieve(Azure.Communication.ProgrammableConnectivity.SimSwapEnum simSwap, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.SimSwapRetrievalContent simSwapRetrievalContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Retrieve(string simSwap, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> RetrieveAsync(Azure.Communication.ProgrammableConnectivity.SimSwapEnum simSwap, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.SimSwapRetrievalContent simSwapRetrievalContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RetrieveAsync(string simSwap, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response Verify(Azure.Communication.ProgrammableConnectivity.SimSwapEnum simSwap, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.SimSwapVerificationContent simSwapVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Verify(string simSwap, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> VerifyAsync(Azure.Communication.ProgrammableConnectivity.SimSwapEnum simSwap, string apcGatewayId, Azure.Communication.ProgrammableConnectivity.SimSwapVerificationContent simSwapVerificationContent, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task VerifyAsync(string simSwap, string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SimSwapEnum : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SimSwapEnum(string value) { throw null; } + public static Azure.Communication.ProgrammableConnectivity.SimSwapEnum SimSwap { get { throw null; } } + public bool Equals(Azure.Communication.ProgrammableConnectivity.SimSwapEnum other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.ProgrammableConnectivity.SimSwapEnum left, Azure.Communication.ProgrammableConnectivity.SimSwapEnum right) { throw null; } + public static implicit operator Azure.Communication.ProgrammableConnectivity.SimSwapEnum (string value) { throw null; } + public static bool operator !=(Azure.Communication.ProgrammableConnectivity.SimSwapEnum left, Azure.Communication.ProgrammableConnectivity.SimSwapEnum right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SimSwapRetrievalContent + { + public SimSwapRetrievalContent(Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier) { } + public Azure.Communication.ProgrammableConnectivity.NetworkIdentifier NetworkIdentifier { get { throw null; } } + public string PhoneNumber { get { throw null; } set { } } + } + public partial class SimSwapRetrievalResult + { + internal SimSwapRetrievalResult() { } + public System.DateTimeOffset Date { get { throw null; } } + } + public partial class SimSwapVerificationContent + { + public SimSwapVerificationContent(Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier) { } + public int? MaxAgeHours { get { throw null; } set { } } + public Azure.Communication.ProgrammableConnectivity.NetworkIdentifier NetworkIdentifier { get { throw null; } } + public string PhoneNumber { get { throw null; } set { } } + } + public partial class SimSwapVerificationResult + { + internal SimSwapVerificationResult() { } + public bool VerificationResult { get { throw null; } } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class CommunicationProgrammableConnectivityClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddProgrammableConnectivityClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddProgrammableConnectivityClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Azure.Communication.ProgrammableConnectivity.csproj b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Azure.Communication.ProgrammableConnectivity.csproj new file mode 100644 index 0000000000000..a3206b8c2f966 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Azure.Communication.ProgrammableConnectivity.csproj @@ -0,0 +1,19 @@ + + + This is the Azure.Communication.ProgrammableConnectivity client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.Communication.ProgrammableConnectivity for Azure Data Plane + 1.0.0-beta.1 + Azure.Communication.ProgrammableConnectivity + $(RequiredTargetFrameworks) + true + + + + + + + + + + + diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityClientBuilderExtensions.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityClientBuilderExtensions.cs new file mode 100644 index 0000000000000..e5e56416b03cc --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityClientBuilderExtensions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Communication.ProgrammableConnectivity; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class CommunicationProgrammableConnectivityClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + public static IAzureClientBuilder AddProgrammableConnectivityClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new ProgrammableConnectivityClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddProgrammableConnectivityClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityModelFactory.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityModelFactory.cs new file mode 100644 index 0000000000000..9c54b4f933bfb --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/CommunicationProgrammableConnectivityModelFactory.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Model factory for models. + public static partial class CommunicationProgrammableConnectivityModelFactory + { + /// Initializes a new instance of . + /// True if the location is in the specified area, False otherwise. + /// A new instance for mocking. + public static DeviceLocationVerificationResult DeviceLocationVerificationResult(bool verificationResult = default) + { + return new DeviceLocationVerificationResult(verificationResult); + } + + /// Initializes a new instance of . + /// The identifier for the network. This can be used as the networkIdentifier for the service APIs. + /// is null. + /// A new instance for mocking. + public static NetworkRetrievalResult NetworkRetrievalResult(string networkCode = null) + { + if (networkCode == null) + { + throw new ArgumentNullException(nameof(networkCode)); + } + + return new NetworkRetrievalResult(networkCode); + } + + /// Initializes a new instance of . + /// True if number if the phone number matches the device, False otherwise. + /// A new instance for mocking. + public static NumberVerificationResult NumberVerificationResult(bool verificationResult = default) + { + return new NumberVerificationResult(verificationResult); + } + + /// Initializes a new instance of . + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// is null. + /// A new instance for mocking. + public static NumberRetrievalResult NumberRetrievalResult(string phoneNumber = null) + { + if (phoneNumber == null) + { + throw new ArgumentNullException(nameof(phoneNumber)); + } + + return new NumberRetrievalResult(phoneNumber); + } + + /// Initializes a new instance of . + /// Datetime of most recent swap for SIM. + /// A new instance for mocking. + public static SimSwapRetrievalResult SimSwapRetrievalResult(DateTimeOffset date = default) + { + return new SimSwapRetrievalResult(date); + } + + /// Initializes a new instance of . + /// True if the SIM has swapped in the specified period, False otherwise. + /// A new instance for mocking. + public static SimSwapVerificationResult SimSwapVerificationResult(bool verificationResult = default) + { + return new SimSwapVerificationResult(verificationResult); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocation.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocation.cs new file mode 100644 index 0000000000000..2314d2be4def3 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocation.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.ProgrammableConnectivity +{ + // Data plane generated sub-client. + /// The DeviceLocation sub-client. + public partial class DeviceLocation + { + private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com//.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DeviceLocation for mocking. + protected DeviceLocation() + { + } + + /// Initializes a new instance of DeviceLocation. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// The API version to use for this operation. + internal DeviceLocation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify Location. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> VerifyAsync(DeviceLocationEnum location, string apcGatewayId, DeviceLocationVerificationContent deviceLocationVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(deviceLocationVerificationContent, nameof(deviceLocationVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = deviceLocationVerificationContent.ToRequestContent(); + Response response = await VerifyAsync(location.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(DeviceLocationVerificationResult.FromResponse(response), response); + } + + /// Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify Location. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Verify(DeviceLocationEnum location, string apcGatewayId, DeviceLocationVerificationContent deviceLocationVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(deviceLocationVerificationContent, nameof(deviceLocationVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = deviceLocationVerificationContent.ToRequestContent(); + Response response = Verify(location.ToString(), apcGatewayId, content, context); + return Response.FromValue(DeviceLocationVerificationResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "location". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task VerifyAsync(string location, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("DeviceLocation.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(location, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Verifies whether a device is within a specified location area, defined as an accuracy (radius) around a point, specified by longitude and latitude. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "location". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Verify(string location, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("DeviceLocation.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(location, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateVerifyRequest(string location, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/device-location/", false); + uri.AppendPath(location, true); + uri.AppendPath(":verify", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationEnum.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationEnum.cs new file mode 100644 index 0000000000000..192c15e2942ee --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationEnum.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Location static endpoint enum. + public readonly partial struct DeviceLocationEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeviceLocationEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LocationValue = "location"; + + /// Static endpoint. + public static DeviceLocationEnum Location { get; } = new DeviceLocationEnum(LocationValue); + /// Determines if two values are the same. + public static bool operator ==(DeviceLocationEnum left, DeviceLocationEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeviceLocationEnum left, DeviceLocationEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeviceLocationEnum(string value) => new DeviceLocationEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeviceLocationEnum other && Equals(other); + /// + public bool Equals(DeviceLocationEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.Serialization.cs new file mode 100644 index 0000000000000..bb3dd79954b2c --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class DeviceLocationVerificationContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("networkIdentifier"u8); + writer.WriteObjectValue(NetworkIdentifier); + writer.WritePropertyName("latitude"u8); + writer.WriteNumberValue(Latitude); + writer.WritePropertyName("longitude"u8); + writer.WriteNumberValue(Longitude); + writer.WritePropertyName("accuracy"u8); + writer.WriteNumberValue(Accuracy); + writer.WritePropertyName("locationDevice"u8); + writer.WriteObjectValue(LocationDevice); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.cs new file mode 100644 index 0000000000000..c5d4a94b7959d --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationContent.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Request to verify Location. + public partial class DeviceLocationVerificationContent + { + /// Initializes a new instance of . + /// Network to query for this device, or device information to enable network routing. + /// Latitude of location to be verified. + /// Longitude of location to be verified. + /// Accuracy expected for location verification in kilometers. + /// The device to find the location for. + /// or is null. + public DeviceLocationVerificationContent(NetworkIdentifier networkIdentifier, float latitude, float longitude, int accuracy, LocationDevice locationDevice) + { + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + Argument.AssertNotNull(locationDevice, nameof(locationDevice)); + + NetworkIdentifier = networkIdentifier; + Latitude = latitude; + Longitude = longitude; + Accuracy = accuracy; + LocationDevice = locationDevice; + } + + /// Network to query for this device, or device information to enable network routing. + public NetworkIdentifier NetworkIdentifier { get; } + /// Latitude of location to be verified. + public float Latitude { get; } + /// Longitude of location to be verified. + public float Longitude { get; } + /// Accuracy expected for location verification in kilometers. + public int Accuracy { get; } + /// The device to find the location for. + public LocationDevice LocationDevice { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.Serialization.cs new file mode 100644 index 0000000000000..0e19f31eaabc4 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class DeviceLocationVerificationResult + { + internal static DeviceLocationVerificationResult DeserializeDeviceLocationVerificationResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool verificationResult = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verificationResult"u8)) + { + verificationResult = property.Value.GetBoolean(); + continue; + } + } + return new DeviceLocationVerificationResult(verificationResult); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeviceLocationVerificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeviceLocationVerificationResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.cs new file mode 100644 index 0000000000000..5b0246476909e --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceLocationVerificationResult.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Response verifying location. + public partial class DeviceLocationVerificationResult + { + /// Initializes a new instance of . + /// True if the location is in the specified area, False otherwise. + internal DeviceLocationVerificationResult(bool verificationResult) + { + VerificationResult = verificationResult; + } + + /// True if the location is in the specified area, False otherwise. + public bool VerificationResult { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetwork.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetwork.cs new file mode 100644 index 0000000000000..4fed4901c6cba --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetwork.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.ProgrammableConnectivity +{ + // Data plane generated sub-client. + /// The DeviceNetwork sub-client. + public partial class DeviceNetwork + { + private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com//.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of DeviceNetwork for mocking. + protected DeviceNetwork() + { + } + + /// Initializes a new instance of DeviceNetwork. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// The API version to use for this operation. + internal DeviceNetwork(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// The device for which to find the network. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> RetrieveAsync(DeviceNetworkEnum network, string apcGatewayId, DeviceNetworkIdentifier deviceNetworkIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(deviceNetworkIdentifier, nameof(deviceNetworkIdentifier)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = deviceNetworkIdentifier.ToRequestContent(); + Response response = await RetrieveAsync(network.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(NetworkRetrievalResult.FromResponse(response), response); + } + + /// Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// The device for which to find the network. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Retrieve(DeviceNetworkEnum network, string apcGatewayId, DeviceNetworkIdentifier deviceNetworkIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(deviceNetworkIdentifier, nameof(deviceNetworkIdentifier)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = deviceNetworkIdentifier.ToRequestContent(); + Response response = Retrieve(network.ToString(), apcGatewayId, content, context); + return Response.FromValue(NetworkRetrievalResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "network". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RetrieveAsync(string network, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(network, nameof(network)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("DeviceNetwork.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(network, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "network". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Retrieve(string network, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(network, nameof(network)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("DeviceNetwork.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(network, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateRetrieveRequest(string network, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/device-network/", false); + uri.AppendPath(network, true); + uri.AppendPath(":retrieve", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkEnum.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkEnum.cs new file mode 100644 index 0000000000000..04a62fe2343cc --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkEnum.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Network static endpoint enum. + public readonly partial struct DeviceNetworkEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeviceNetworkEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NetworkValue = "network"; + + /// Static endpoint. + public static DeviceNetworkEnum Network { get; } = new DeviceNetworkEnum(NetworkValue); + /// Determines if two values are the same. + public static bool operator ==(DeviceNetworkEnum left, DeviceNetworkEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeviceNetworkEnum left, DeviceNetworkEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeviceNetworkEnum(string value) => new DeviceNetworkEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeviceNetworkEnum other && Equals(other); + /// + public bool Equals(DeviceNetworkEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.Serialization.cs new file mode 100644 index 0000000000000..547726c7fac37 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class DeviceNetworkIdentifier : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("identifierType"u8); + writer.WriteStringValue(IdentifierType); + writer.WritePropertyName("deviceIdentifier"u8); + writer.WriteStringValue(DeviceIdentifier); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.cs new file mode 100644 index 0000000000000..3c1eb1a0843b2 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/DeviceNetworkIdentifier.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// The device for which to find the network. + public partial class DeviceNetworkIdentifier + { + /// Initializes a new instance of . + /// The type of device identifier given: 'IPv4' or 'IPv6'. + /// + /// The device identifier in a format matching the type above: + /// - IPv4 in dotted-quad format. + /// - IPV6 in IETF 5952 format. + /// + /// or is null. + public DeviceNetworkIdentifier(string identifierType, string deviceIdentifier) + { + Argument.AssertNotNull(identifierType, nameof(identifierType)); + Argument.AssertNotNull(deviceIdentifier, nameof(deviceIdentifier)); + + IdentifierType = identifierType; + DeviceIdentifier = deviceIdentifier; + } + + /// The type of device identifier given: 'IPv4' or 'IPv6'. + public string IdentifierType { get; } + /// + /// The device identifier in a format matching the type above: + /// - IPv4 in dotted-quad format. + /// - IPV6 in IETF 5952 format. + /// + public string DeviceIdentifier { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceLocation.xml b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceLocation.xml new file mode 100644 index 0000000000000..9963619fca5ea --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceLocation.xml @@ -0,0 +1,185 @@ + + + + + +This sample shows how to call VerifyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice()); +Response response = await client.VerifyAsync(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); +]]> +This sample shows how to call VerifyAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice +{ + NetworkAccessIdentifier = "", + PhoneNumber = "", + Ipv4Address = new Ipv4Address("", 1234), + Ipv6Address = new Ipv6Address("", 1234), +}); +Response response = await client.VerifyAsync(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); +]]> + + + +This sample shows how to call Verify. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice()); +Response response = client.Verify(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); +]]> +This sample shows how to call Verify with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice +{ + NetworkAccessIdentifier = "", + PhoneNumber = "", + Ipv4Address = new Ipv4Address("", 1234), + Ipv6Address = new Ipv6Address("", 1234), +}); +Response response = client.Verify(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); +]]> + + + +This sample shows how to call VerifyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new object(), +}); +Response response = await client.VerifyAsync("location", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call VerifyAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new + { + networkAccessIdentifier = "", + phoneNumber = "", + ipv4Address = new + { + ipv4 = "", + port = 1234, + }, + ipv6Address = new + { + ipv6 = "", + port = 1234, + }, + }, +}); +Response response = await client.VerifyAsync("location", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + +This sample shows how to call Verify and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new object(), +}); +Response response = client.Verify("location", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call Verify with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new + { + networkAccessIdentifier = "", + phoneNumber = "", + ipv4Address = new + { + ipv4 = "", + port = 1234, + }, + ipv6Address = new + { + ipv6 = "", + port = 1234, + }, + }, +}); +Response response = client.Verify("location", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceNetwork.xml b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceNetwork.xml new file mode 100644 index 0000000000000..077f5067d197b --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/DeviceNetwork.xml @@ -0,0 +1,117 @@ + + + + + +This sample shows how to call RetrieveAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); +Response response = await client.RetrieveAsync(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); +]]> +This sample shows how to call RetrieveAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); +Response response = await client.RetrieveAsync(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); +]]> + + + +This sample shows how to call Retrieve. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); +Response response = client.Retrieve(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); +]]> +This sample shows how to call Retrieve with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); +Response response = client.Retrieve(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); +]]> + + + +This sample shows how to call RetrieveAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + deviceIdentifier = "", +}); +Response response = await client.RetrieveAsync("network", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("networkCode").ToString()); +]]> +This sample shows how to call RetrieveAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + deviceIdentifier = "", +}); +Response response = await client.RetrieveAsync("network", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("networkCode").ToString()); +]]> + + + +This sample shows how to call Retrieve and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + deviceIdentifier = "", +}); +Response response = client.Retrieve("network", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("networkCode").ToString()); +]]> +This sample shows how to call Retrieve with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + deviceIdentifier = "", +}); +Response response = client.Retrieve("network", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("networkCode").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/NumberVerification.xml b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/NumberVerification.xml new file mode 100644 index 0000000000000..381c25bc9afbe --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/NumberVerification.xml @@ -0,0 +1,253 @@ + + + + + +This sample shows how to call VerifyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")); +Response response = await client.VerifyAsync(NumberVerificationEnum.Number, "", numberVerificationContent); +]]> +This sample shows how to call VerifyAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", + HashedPhoneNumber = "", +}; +Response response = await client.VerifyAsync(NumberVerificationEnum.Number, "", numberVerificationContent); +]]> + + + +This sample shows how to call Verify. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")); +Response response = client.Verify(NumberVerificationEnum.Number, "", numberVerificationContent); +]]> +This sample shows how to call Verify with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", + HashedPhoneNumber = "", +}; +Response response = client.Verify(NumberVerificationEnum.Number, "", numberVerificationContent); +]]> + + + +This sample shows how to call VerifyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = await client.VerifyAsync("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call VerifyAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + phoneNumber = "", + hashedPhoneNumber = "", +}); +Response response = await client.VerifyAsync("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + +This sample shows how to call Verify and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = client.Verify("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call Verify with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + phoneNumber = "", + hashedPhoneNumber = "", +}); +Response response = client.Verify("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + +This sample shows how to call RetrieveAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); +Response response = await client.RetrieveAsync(NumberVerificationEnum.Number, "", networkIdentifier); +]]> +This sample shows how to call RetrieveAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); +Response response = await client.RetrieveAsync(NumberVerificationEnum.Number, "", networkIdentifier); +]]> + + + +This sample shows how to call Retrieve. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); +Response response = client.Retrieve(NumberVerificationEnum.Number, "", networkIdentifier); +]]> +This sample shows how to call Retrieve with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); +Response response = client.Retrieve(NumberVerificationEnum.Number, "", networkIdentifier); +]]> + + + +This sample shows how to call RetrieveAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + identifier = "", +}); +Response response = await client.RetrieveAsync("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("phoneNumber").ToString()); +]]> +This sample shows how to call RetrieveAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + identifier = "", +}); +Response response = await client.RetrieveAsync("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("phoneNumber").ToString()); +]]> + + + +This sample shows how to call Retrieve and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + identifier = "", +}); +Response response = client.Retrieve("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("phoneNumber").ToString()); +]]> +This sample shows how to call Retrieve with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + identifierType = "", + identifier = "", +}); +Response response = client.Retrieve("number", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("phoneNumber").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/SimSwap.xml b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/SimSwap.xml new file mode 100644 index 0000000000000..c632bf3f939fb --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Docs/SimSwap.xml @@ -0,0 +1,273 @@ + + + + + +This sample shows how to call RetrieveAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")); +Response response = await client.RetrieveAsync(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); +]]> +This sample shows how to call RetrieveAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", +}; +Response response = await client.RetrieveAsync(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); +]]> + + + +This sample shows how to call Retrieve. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")); +Response response = client.Retrieve(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); +]]> +This sample shows how to call Retrieve with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", +}; +Response response = client.Retrieve(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); +]]> + + + +This sample shows how to call RetrieveAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = await client.RetrieveAsync("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("date").ToString()); +]]> +This sample shows how to call RetrieveAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + phoneNumber = "", + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = await client.RetrieveAsync("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("date").ToString()); +]]> + + + +This sample shows how to call Retrieve and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = client.Retrieve("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("date").ToString()); +]]> +This sample shows how to call Retrieve with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + phoneNumber = "", + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = client.Retrieve("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("date").ToString()); +]]> + + + +This sample shows how to call VerifyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")); +Response response = await client.VerifyAsync(SimSwapEnum.SimSwap, "", simSwapVerificationContent); +]]> +This sample shows how to call VerifyAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", + MaxAgeHours = 1234, +}; +Response response = await client.VerifyAsync(SimSwapEnum.SimSwap, "", simSwapVerificationContent); +]]> + + + +This sample shows how to call Verify. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")); +Response response = client.Verify(SimSwapEnum.SimSwap, "", simSwapVerificationContent); +]]> +This sample shows how to call Verify with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")) +{ + PhoneNumber = "", + MaxAgeHours = 1234, +}; +Response response = client.Verify(SimSwapEnum.SimSwap, "", simSwapVerificationContent); +]]> + + + +This sample shows how to call VerifyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = await client.VerifyAsync("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call VerifyAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + phoneNumber = "", + maxAgeHours = 1234, + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = await client.VerifyAsync("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + +This sample shows how to call Verify and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = client.Verify("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> +This sample shows how to call Verify with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + +using RequestContent content = RequestContent.Create(new +{ + phoneNumber = "", + maxAgeHours = 1234, + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, +}); +Response response = client.Verify("sim-swap", "", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("verificationResult").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.Serialization.cs new file mode 100644 index 0000000000000..8f547ce835d17 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class Ipv4Address : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("ipv4"u8); + writer.WriteStringValue(Ipv4); + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.cs new file mode 100644 index 0000000000000..31d53513a9919 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv4Address.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// IPv4 device indicator. + public partial class Ipv4Address + { + /// Initializes a new instance of . + /// + /// IPv4 address may be specified in form <address/mask> as: + /// - address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule. + /// - address/mask - an IP number as above with a mask width of the form 1.2.3.4/24. + /// In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version. + /// + /// User equipment port. + /// is null. + public Ipv4Address(string ipv4, int port) + { + Argument.AssertNotNull(ipv4, nameof(ipv4)); + + Ipv4 = ipv4; + Port = port; + } + + /// + /// IPv4 address may be specified in form <address/mask> as: + /// - address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule. + /// - address/mask - an IP number as above with a mask width of the form 1.2.3.4/24. + /// In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version. + /// + public string Ipv4 { get; } + /// User equipment port. + public int Port { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.Serialization.cs new file mode 100644 index 0000000000000..3cafc77212080 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class Ipv6Address : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("ipv6"u8); + writer.WriteStringValue(Ipv6); + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.cs new file mode 100644 index 0000000000000..71f22031ac33b --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/Ipv6Address.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// IPv6 device indicator. + public partial class Ipv6Address + { + /// Initializes a new instance of . + /// + /// IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as: + /// - address - The /128 subnet is optional for single addresses: + /// - 2001:db8:85a3:8d3:1319:8a2e:370:7344 + /// - 2001:db8:85a3:8d3:1319:8a2e:370:7344/128 + /// - address/mask - an IP v6 number with a mask: + /// - 2001:db8:85a3:8d3::0/64 + /// - 2001:db8:85a3:8d3::/64 + /// + /// User equipment port. + /// is null. + public Ipv6Address(string ipv6, int port) + { + Argument.AssertNotNull(ipv6, nameof(ipv6)); + + Ipv6 = ipv6; + Port = port; + } + + /// + /// IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as: + /// - address - The /128 subnet is optional for single addresses: + /// - 2001:db8:85a3:8d3:1319:8a2e:370:7344 + /// - 2001:db8:85a3:8d3:1319:8a2e:370:7344/128 + /// - address/mask - an IP v6 number with a mask: + /// - 2001:db8:85a3:8d3::0/64 + /// - 2001:db8:85a3:8d3::/64 + /// + public string Ipv6 { get; } + /// User equipment port. + public int Port { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.Serialization.cs new file mode 100644 index 0000000000000..e50e0f19aaf4d --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class LocationDevice : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkAccessIdentifier)) + { + writer.WritePropertyName("networkAccessIdentifier"u8); + writer.WriteStringValue(NetworkAccessIdentifier); + } + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + if (Optional.IsDefined(Ipv4Address)) + { + writer.WritePropertyName("ipv4Address"u8); + writer.WriteObjectValue(Ipv4Address); + } + if (Optional.IsDefined(Ipv6Address)) + { + writer.WritePropertyName("ipv6Address"u8); + writer.WriteObjectValue(Ipv6Address); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.cs new file mode 100644 index 0000000000000..ae61082981541 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/LocationDevice.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Device information needed by operator to provide location information. Include exactly one of these properties to identify your device. + public partial class LocationDevice + { + /// Initializes a new instance of . + public LocationDevice() + { + } + + /// Initializes a new instance of . + /// External identifier or network access identifier of the device. + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// The Ipv4 address. + /// The Ipv6 address. + internal LocationDevice(string networkAccessIdentifier, string phoneNumber, Ipv4Address ipv4Address, Ipv6Address ipv6Address) + { + NetworkAccessIdentifier = networkAccessIdentifier; + PhoneNumber = phoneNumber; + Ipv4Address = ipv4Address; + Ipv6Address = ipv6Address; + } + + /// External identifier or network access identifier of the device. + public string NetworkAccessIdentifier { get; set; } + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + public string PhoneNumber { get; set; } + /// The Ipv4 address. + public Ipv4Address Ipv4Address { get; set; } + /// The Ipv6 address. + public Ipv6Address Ipv6Address { get; set; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.Serialization.cs new file mode 100644 index 0000000000000..db1e16eacc782 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class NetworkIdentifier : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("identifierType"u8); + writer.WriteStringValue(IdentifierType); + writer.WritePropertyName("identifier"u8); + writer.WriteStringValue(Identifier); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.cs new file mode 100644 index 0000000000000..5183b913a073c --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkIdentifier.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Identifier for the network to be queried. + public partial class NetworkIdentifier + { + /// Initializes a new instance of . + /// The type of identifier for the network. one of: 'IPv4', 'IPv6', 'NetworkCode'. + /// + /// The network identifier in a format matching the type above: + /// - IPv4 of a device in dotted-quad form 1.2.3.4. + /// - IPv6 of a device in IETF 5952 format. + /// - NetworkCode matching our documentation or an output from /Network:retrieve." + /// + /// or is null. + public NetworkIdentifier(string identifierType, string identifier) + { + Argument.AssertNotNull(identifierType, nameof(identifierType)); + Argument.AssertNotNull(identifier, nameof(identifier)); + + IdentifierType = identifierType; + Identifier = identifier; + } + + /// The type of identifier for the network. one of: 'IPv4', 'IPv6', 'NetworkCode'. + public string IdentifierType { get; } + /// + /// The network identifier in a format matching the type above: + /// - IPv4 of a device in dotted-quad form 1.2.3.4. + /// - IPv6 of a device in IETF 5952 format. + /// - NetworkCode matching our documentation or an output from /Network:retrieve." + /// + public string Identifier { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.Serialization.cs new file mode 100644 index 0000000000000..6fee3fa8b60d7 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class NetworkRetrievalResult + { + internal static NetworkRetrievalResult DeserializeNetworkRetrievalResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string networkCode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkCode"u8)) + { + networkCode = property.Value.GetString(); + continue; + } + } + return new NetworkRetrievalResult(networkCode); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NetworkRetrievalResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNetworkRetrievalResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.cs new file mode 100644 index 0000000000000..e480f61bd81a7 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NetworkRetrievalResult.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// The network that the device is on. + public partial class NetworkRetrievalResult + { + /// Initializes a new instance of . + /// The identifier for the network. This can be used as the networkIdentifier for the service APIs. + /// is null. + internal NetworkRetrievalResult(string networkCode) + { + Argument.AssertNotNull(networkCode, nameof(networkCode)); + + NetworkCode = networkCode; + } + + /// The identifier for the network. This can be used as the networkIdentifier for the service APIs. + public string NetworkCode { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.Serialization.cs new file mode 100644 index 0000000000000..64c1564e488ab --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class NumberRetrievalResult + { + internal static NumberRetrievalResult DeserializeNumberRetrievalResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string phoneNumber = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phoneNumber"u8)) + { + phoneNumber = property.Value.GetString(); + continue; + } + } + return new NumberRetrievalResult(phoneNumber); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NumberRetrievalResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumberRetrievalResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.cs new file mode 100644 index 0000000000000..5e4dd87ff193b --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberRetrievalResult.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Response with number of device. + public partial class NumberRetrievalResult + { + /// Initializes a new instance of . + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// is null. + internal NumberRetrievalResult(string phoneNumber) + { + Argument.AssertNotNull(phoneNumber, nameof(phoneNumber)); + + PhoneNumber = phoneNumber; + } + + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + public string PhoneNumber { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerification.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerification.cs new file mode 100644 index 0000000000000..0344448cdb246 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerification.cs @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.ProgrammableConnectivity +{ + // Data plane generated sub-client. + /// + /// Number operations include Frontend Authentication. + /// + /// This means that each operation has 2 responses. + /// + /// The first response is a 302 redirect, which redirects the device to the device's Network + /// to authenticate directly. The Network responds with another 302 redirect and a token. + /// This redirects the device to APC, where the token is used to verify / retrieve + /// the device number. The second response is a 200 containing the result of the query. + /// + /// This flow takes place automatically without user interaction, and so only the result + /// of the entire flow (the 200 response) is included in this document. + /// + public partial class NumberVerification + { + private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com//.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of NumberVerification for mocking. + protected NumberVerification() + { + } + + /// Initializes a new instance of NumberVerification. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// The API version to use for this operation. + internal NumberVerification(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Verifies the phone number (MSISDN) associated with a device. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify number of device. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> VerifyAsync(NumberVerificationEnum number, string apcGatewayId, NumberVerificationContent numberVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(numberVerificationContent, nameof(numberVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = numberVerificationContent.ToRequestContent(); + Response response = await VerifyAsync(number.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(NumberVerificationResult.FromResponse(response), response); + } + + /// Verifies the phone number (MSISDN) associated with a device. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify number of device. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Verify(NumberVerificationEnum number, string apcGatewayId, NumberVerificationContent numberVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(numberVerificationContent, nameof(numberVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = numberVerificationContent.ToRequestContent(); + Response response = Verify(number.ToString(), apcGatewayId, content, context); + return Response.FromValue(NumberVerificationResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Verifies the phone number (MSISDN) associated with a device. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "number". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task VerifyAsync(string number, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(number, nameof(number)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("NumberVerification.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(number, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Verifies the phone number (MSISDN) associated with a device. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "number". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Verify(string number, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(number, nameof(number)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("NumberVerification.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(number, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves the phone number (MSISDN) associated with a device. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Identifier for the network to be queried. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> RetrieveAsync(NumberVerificationEnum number, string apcGatewayId, NetworkIdentifier networkIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = networkIdentifier.ToRequestContent(); + Response response = await RetrieveAsync(number.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(NumberRetrievalResult.FromResponse(response), response); + } + + /// Retrieves the phone number (MSISDN) associated with a device. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Identifier for the network to be queried. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Retrieve(NumberVerificationEnum number, string apcGatewayId, NetworkIdentifier networkIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = networkIdentifier.ToRequestContent(); + Response response = Retrieve(number.ToString(), apcGatewayId, content, context); + return Response.FromValue(NumberRetrievalResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves the phone number (MSISDN) associated with a device. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "number". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RetrieveAsync(string number, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(number, nameof(number)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("NumberVerification.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(number, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves the phone number (MSISDN) associated with a device. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "number". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Retrieve(string number, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(number, nameof(number)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("NumberVerification.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(number, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateVerifyRequest(string number, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/number-verification/", false); + uri.AppendPath(number, true); + uri.AppendPath(":verify", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRetrieveRequest(string number, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/number-verification/", false); + uri.AppendPath(number, true); + uri.AppendPath(":retrieve", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.Serialization.cs new file mode 100644 index 0000000000000..edeb863e996a2 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class NumberVerificationContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("networkIdentifier"u8); + writer.WriteObjectValue(NetworkIdentifier); + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + if (Optional.IsDefined(HashedPhoneNumber)) + { + writer.WritePropertyName("hashedPhoneNumber"u8); + writer.WriteStringValue(HashedPhoneNumber); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.cs new file mode 100644 index 0000000000000..de25fc398c5a7 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Request to verify number of device. + public partial class NumberVerificationContent + { + /// Initializes a new instance of . + /// Identifier for the network to query for this device. + /// is null. + public NumberVerificationContent(NetworkIdentifier networkIdentifier) + { + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + + NetworkIdentifier = networkIdentifier; + } + + /// Initializes a new instance of . + /// Identifier for the network to query for this device. + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile phone number in **E.164 format (starting with country code)**. Optionally prefixed with '+'. + internal NumberVerificationContent(NetworkIdentifier networkIdentifier, string phoneNumber, string hashedPhoneNumber) + { + NetworkIdentifier = networkIdentifier; + PhoneNumber = phoneNumber; + HashedPhoneNumber = hashedPhoneNumber; + } + + /// Identifier for the network to query for this device. + public NetworkIdentifier NetworkIdentifier { get; } + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + public string PhoneNumber { get; set; } + /// Hashed phone number. SHA-256 (in hexadecimal representation) of the mobile phone number in **E.164 format (starting with country code)**. Optionally prefixed with '+'. + public string HashedPhoneNumber { get; set; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationEnum.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationEnum.cs new file mode 100644 index 0000000000000..343bd2c8821e9 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationEnum.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Number static endpoint enum. + public readonly partial struct NumberVerificationEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NumberVerificationEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NumberValue = "number"; + + /// Static endpoint. + public static NumberVerificationEnum Number { get; } = new NumberVerificationEnum(NumberValue); + /// Determines if two values are the same. + public static bool operator ==(NumberVerificationEnum left, NumberVerificationEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NumberVerificationEnum left, NumberVerificationEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NumberVerificationEnum(string value) => new NumberVerificationEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NumberVerificationEnum other && Equals(other); + /// + public bool Equals(NumberVerificationEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.Serialization.cs new file mode 100644 index 0000000000000..99bb7154e1035 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class NumberVerificationResult + { + internal static NumberVerificationResult DeserializeNumberVerificationResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool verificationResult = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verificationResult"u8)) + { + verificationResult = property.Value.GetBoolean(); + continue; + } + } + return new NumberVerificationResult(verificationResult); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NumberVerificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumberVerificationResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.cs new file mode 100644 index 0000000000000..cd9a44e5909b7 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/NumberVerificationResult.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Response verifying number of device. + public partial class NumberVerificationResult + { + /// Initializes a new instance of . + /// True if number if the phone number matches the device, False otherwise. + internal NumberVerificationResult(bool verificationResult) + { + VerificationResult = verificationResult; + } + + /// True if number if the phone number matches the device, False otherwise. + public bool VerificationResult { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClient.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClient.cs new file mode 100644 index 0000000000000..7ae25fd38da9f --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.ProgrammableConnectivity +{ + // Data plane generated client. + /// The ProgrammableConnectivity service client. + public partial class ProgrammableConnectivityClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com//.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ProgrammableConnectivityClient for mocking. + protected ProgrammableConnectivityClient() + { + } + + /// Initializes a new instance of ProgrammableConnectivityClient. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ProgrammableConnectivityClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new ProgrammableConnectivityClientOptions()) + { + } + + /// Initializes a new instance of ProgrammableConnectivityClient. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ProgrammableConnectivityClient(Uri endpoint, TokenCredential credential, ProgrammableConnectivityClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new ProgrammableConnectivityClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Initializes a new instance of DeviceLocation. + /// The API version to use for this operation. + /// is null. + public virtual DeviceLocation GetDeviceLocationClient(string apiVersion = "v2024_01_09_preview") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new DeviceLocation(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of DeviceNetwork. + /// The API version to use for this operation. + /// is null. + public virtual DeviceNetwork GetDeviceNetworkClient(string apiVersion = "v2024_01_09_preview") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new DeviceNetwork(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of NumberVerification. + /// The API version to use for this operation. + /// is null. + public virtual NumberVerification GetNumberVerificationClient(string apiVersion = "v2024_01_09_preview") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new NumberVerification(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of SimSwap. + /// The API version to use for this operation. + /// is null. + public virtual SimSwap GetSimSwapClient(string apiVersion = "v2024_01_09_preview") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new SimSwap(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClientOptions.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClientOptions.cs new file mode 100644 index 0000000000000..9a12e082324be --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/ProgrammableConnectivityClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Client options for ProgrammableConnectivityClient. + public partial class ProgrammableConnectivityClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2024_01_09_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "v2024_01_09_preview". + V2024_01_09_Preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of ProgrammableConnectivityClientOptions. + public ProgrammableConnectivityClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2024_01_09_Preview => "v2024_01_09_preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwap.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwap.cs new file mode 100644 index 0000000000000..0bd987642e481 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwap.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.ProgrammableConnectivity +{ + // Data plane generated sub-client. + /// SIM Swap API provides the customer the ability to obtain information on any recent SIM pairing change related to the User's mobile account. + public partial class SimSwap + { + private static readonly string[] AuthorizationScopes = new string[] { "https://management.azure.com//.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of SimSwap for mocking. + protected SimSwap() + { + } + + /// Initializes a new instance of SimSwap. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// An Azure Programmable Connectivity Endpoint providing access to Network APIs, for example https://{region}.apcgatewayapi.azure.com. + /// The API version to use for this operation. + internal SimSwap(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Provides timestamp of latest SIM swap. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to retrieve SimSwap date. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> RetrieveAsync(SimSwapEnum simSwap, string apcGatewayId, SimSwapRetrievalContent simSwapRetrievalContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(simSwapRetrievalContent, nameof(simSwapRetrievalContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = simSwapRetrievalContent.ToRequestContent(); + Response response = await RetrieveAsync(simSwap.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(SimSwapRetrievalResult.FromResponse(response), response); + } + + /// Provides timestamp of latest SIM swap. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to retrieve SimSwap date. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Retrieve(SimSwapEnum simSwap, string apcGatewayId, SimSwapRetrievalContent simSwapRetrievalContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(simSwapRetrievalContent, nameof(simSwapRetrievalContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = simSwapRetrievalContent.ToRequestContent(); + Response response = Retrieve(simSwap.ToString(), apcGatewayId, content, context); + return Response.FromValue(SimSwapRetrievalResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Provides timestamp of latest SIM swap + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "sim-swap". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RetrieveAsync(string simSwap, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(simSwap, nameof(simSwap)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("SimSwap.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(simSwap, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Provides timestamp of latest SIM swap + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "sim-swap". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Retrieve(string simSwap, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(simSwap, nameof(simSwap)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("SimSwap.Retrieve"); + scope.Start(); + try + { + using HttpMessage message = CreateRetrieveRequest(simSwap, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' attribute). Returns 'True' if a SIM swap has occured. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify SimSwap in period. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> VerifyAsync(SimSwapEnum simSwap, string apcGatewayId, SimSwapVerificationContent simSwapVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(simSwapVerificationContent, nameof(simSwapVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = simSwapVerificationContent.ToRequestContent(); + Response response = await VerifyAsync(simSwap.ToString(), apcGatewayId, content, context).ConfigureAwait(false); + return Response.FromValue(SimSwapVerificationResult.FromResponse(response), response); + } + + /// Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' attribute). Returns 'True' if a SIM swap has occured. + /// Static endpoint. + /// The identifier of the APC Gateway resource which should handle this request. + /// Request to verify SimSwap in period. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response Verify(SimSwapEnum simSwap, string apcGatewayId, SimSwapVerificationContent simSwapVerificationContent, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(simSwapVerificationContent, nameof(simSwapVerificationContent)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = simSwapVerificationContent.ToRequestContent(); + Response response = Verify(simSwap.ToString(), apcGatewayId, content, context); + return Response.FromValue(SimSwapVerificationResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' attribute). Returns 'True' if a SIM swap has occured. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "sim-swap". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task VerifyAsync(string simSwap, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(simSwap, nameof(simSwap)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("SimSwap.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(simSwap, apcGatewayId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Verifies if a SIM swap has been performed during a past period (defined in the request with 'maxAgeHours' attribute). Returns 'True' if a SIM swap has occured. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Static endpoint. Allowed values: "sim-swap". + /// The identifier of the APC Gateway resource which should handle this request. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Verify(string simSwap, string apcGatewayId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(simSwap, nameof(simSwap)); + Argument.AssertNotNull(apcGatewayId, nameof(apcGatewayId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("SimSwap.Verify"); + scope.Start(); + try + { + using HttpMessage message = CreateVerifyRequest(simSwap, apcGatewayId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateRetrieveRequest(string simSwap, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/sim-swap/", false); + uri.AppendPath(simSwap, true); + uri.AppendPath(":retrieve", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateVerifyRequest(string simSwap, string apcGatewayId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/sim-swap/", false); + uri.AppendPath(simSwap, true); + uri.AppendPath(":verify", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("apc-gateway-id", apcGatewayId); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapEnum.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapEnum.cs new file mode 100644 index 0000000000000..4db3e7acfb199 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapEnum.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Number static endpoint enum. + public readonly partial struct SimSwapEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SimSwapEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SimSwapValue = "sim-swap"; + + /// Static endpoint. + public static SimSwapEnum SimSwap { get; } = new SimSwapEnum(SimSwapValue); + /// Determines if two values are the same. + public static bool operator ==(SimSwapEnum left, SimSwapEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SimSwapEnum left, SimSwapEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SimSwapEnum(string value) => new SimSwapEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SimSwapEnum other && Equals(other); + /// + public bool Equals(SimSwapEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.Serialization.cs new file mode 100644 index 0000000000000..b24060df51f46 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class SimSwapRetrievalContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + writer.WritePropertyName("networkIdentifier"u8); + writer.WriteObjectValue(NetworkIdentifier); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.cs new file mode 100644 index 0000000000000..98bc58fd97a88 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalContent.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Request to retrieve SimSwap date. + public partial class SimSwapRetrievalContent + { + /// Initializes a new instance of . + /// Network to query for this device. + /// is null. + public SimSwapRetrievalContent(NetworkIdentifier networkIdentifier) + { + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + + NetworkIdentifier = networkIdentifier; + } + + /// Initializes a new instance of . + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// Network to query for this device. + internal SimSwapRetrievalContent(string phoneNumber, NetworkIdentifier networkIdentifier) + { + PhoneNumber = phoneNumber; + NetworkIdentifier = networkIdentifier; + } + + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + public string PhoneNumber { get; set; } + /// Network to query for this device. + public NetworkIdentifier NetworkIdentifier { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.Serialization.cs new file mode 100644 index 0000000000000..4a84a126bd7bd --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class SimSwapRetrievalResult + { + internal static SimSwapRetrievalResult DeserializeSimSwapRetrievalResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset date = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("date"u8)) + { + date = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SimSwapRetrievalResult(date); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SimSwapRetrievalResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSimSwapRetrievalResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.cs new file mode 100644 index 0000000000000..388250d1c441d --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapRetrievalResult.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Response with SimSwap date. + public partial class SimSwapRetrievalResult + { + /// Initializes a new instance of . + /// Datetime of most recent swap for SIM. + internal SimSwapRetrievalResult(DateTimeOffset date) + { + Date = date; + } + + /// Datetime of most recent swap for SIM. + public DateTimeOffset Date { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.Serialization.cs new file mode 100644 index 0000000000000..53ca16e62e7ea --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class SimSwapVerificationContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + if (Optional.IsDefined(MaxAgeHours)) + { + writer.WritePropertyName("maxAgeHours"u8); + writer.WriteNumberValue(MaxAgeHours.Value); + } + writer.WritePropertyName("networkIdentifier"u8); + writer.WriteObjectValue(NetworkIdentifier); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.cs new file mode 100644 index 0000000000000..5bee9ccd03793 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Request to verify SimSwap in period. + public partial class SimSwapVerificationContent + { + /// Initializes a new instance of . + /// Identifier for the network to query for this device. + /// is null. + public SimSwapVerificationContent(NetworkIdentifier networkIdentifier) + { + Argument.AssertNotNull(networkIdentifier, nameof(networkIdentifier)); + + NetworkIdentifier = networkIdentifier; + } + + /// Initializes a new instance of . + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + /// Maximum lookback for SimSwap verification. + /// Identifier for the network to query for this device. + internal SimSwapVerificationContent(string phoneNumber, int? maxAgeHours, NetworkIdentifier networkIdentifier) + { + PhoneNumber = phoneNumber; + MaxAgeHours = maxAgeHours; + NetworkIdentifier = networkIdentifier; + } + + /// Phone number in E.164 format (starting with country code), and optionally prefixed with '+'. + public string PhoneNumber { get; set; } + /// Maximum lookback for SimSwap verification. + public int? MaxAgeHours { get; set; } + /// Identifier for the network to query for this device. + public NetworkIdentifier NetworkIdentifier { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.Serialization.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.Serialization.cs new file mode 100644 index 0000000000000..bd2b0b6ab199d --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.ProgrammableConnectivity +{ + public partial class SimSwapVerificationResult + { + internal static SimSwapVerificationResult DeserializeSimSwapVerificationResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool verificationResult = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verificationResult"u8)) + { + verificationResult = property.Value.GetBoolean(); + continue; + } + } + return new SimSwapVerificationResult(verificationResult); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SimSwapVerificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSimSwapVerificationResult(document.RootElement); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.cs new file mode 100644 index 0000000000000..a56155746d60e --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Generated/SimSwapVerificationResult.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.ProgrammableConnectivity +{ + /// Response verifying SimSwap in period. + public partial class SimSwapVerificationResult + { + /// Initializes a new instance of . + /// True if the SIM has swapped in the specified period, False otherwise. + internal SimSwapVerificationResult(bool verificationResult) + { + VerificationResult = verificationResult; + } + + /// True if the SIM has swapped in the specified period, False otherwise. + public bool VerificationResult { get; } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Properties/AssemblyInfo.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..6c0244ae17786 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Communication.ProgrammableConnectivity.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Azure.Communication.ProgrammableConnectivity.Tests.csproj b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Azure.Communication.ProgrammableConnectivity.Tests.csproj new file mode 100644 index 0000000000000..4f7e5f50fc342 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Azure.Communication.ProgrammableConnectivity.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceLocation.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceLocation.cs new file mode 100644 index 0000000000000..55236f3c37b87 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceLocation.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.ProgrammableConnectivity; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.ProgrammableConnectivity.Samples +{ + public partial class Samples_DeviceLocation + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceLocation_Verify_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new object(), + }); + Response response = client.Verify("location", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceLocation_Verify_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new object(), + }); + Response response = await client.VerifyAsync("location", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceLocation_Verify_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice()); + Response response = client.Verify(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceLocation_Verify_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice()); + Response response = await client.VerifyAsync(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceLocation_Verify_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new + { + networkAccessIdentifier = "", + phoneNumber = "", + ipv4Address = new + { + ipv4 = "", + port = 1234, + }, + ipv6Address = new + { + ipv6 = "", + port = 1234, + }, + }, + }); + Response response = client.Verify("location", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceLocation_Verify_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + latitude = 123.45F, + longitude = 123.45F, + accuracy = 1234, + locationDevice = new + { + networkAccessIdentifier = "", + phoneNumber = "", + ipv4Address = new + { + ipv4 = "", + port = 1234, + }, + ipv6Address = new + { + ipv6 = "", + port = 1234, + }, + }, + }); + Response response = await client.VerifyAsync("location", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceLocation_Verify_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice + { + NetworkAccessIdentifier = "", + PhoneNumber = "", + Ipv4Address = new Ipv4Address("", 1234), + Ipv6Address = new Ipv6Address("", 1234), + }); + Response response = client.Verify(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceLocation_Verify_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceLocation client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceLocationClient(apiVersion: "v2024_01_09_preview"); + + DeviceLocationVerificationContent deviceLocationVerificationContent = new DeviceLocationVerificationContent(new NetworkIdentifier("", ""), 123.45F, 123.45F, 1234, new LocationDevice + { + NetworkAccessIdentifier = "", + PhoneNumber = "", + Ipv4Address = new Ipv4Address("", 1234), + Ipv6Address = new Ipv6Address("", 1234), + }); + Response response = await client.VerifyAsync(DeviceLocationEnum.Location, "", deviceLocationVerificationContent); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceNetwork.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceNetwork.cs new file mode 100644 index 0000000000000..22e4db43ab02e --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_DeviceNetwork.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.ProgrammableConnectivity; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.ProgrammableConnectivity.Samples +{ + public partial class Samples_DeviceNetwork + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceNetwork_Retrieve_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + deviceIdentifier = "", + }); + Response response = client.Retrieve("network", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("networkCode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceNetwork_Retrieve_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + deviceIdentifier = "", + }); + Response response = await client.RetrieveAsync("network", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("networkCode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceNetwork_Retrieve_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); + Response response = client.Retrieve(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceNetwork_Retrieve_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); + Response response = await client.RetrieveAsync(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceNetwork_Retrieve_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + deviceIdentifier = "", + }); + Response response = client.Retrieve("network", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("networkCode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceNetwork_Retrieve_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + deviceIdentifier = "", + }); + Response response = await client.RetrieveAsync("network", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("networkCode").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeviceNetwork_Retrieve_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); + Response response = client.Retrieve(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeviceNetwork_Retrieve_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "v2024_01_09_preview"); + + DeviceNetworkIdentifier deviceNetworkIdentifier = new DeviceNetworkIdentifier("", ""); + Response response = await client.RetrieveAsync(DeviceNetworkEnum.Network, "", deviceNetworkIdentifier); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_NumberVerification.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_NumberVerification.cs new file mode 100644 index 0000000000000..caccfcf035242 --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_NumberVerification.cs @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.ProgrammableConnectivity; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.ProgrammableConnectivity.Samples +{ + public partial class Samples_NumberVerification + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Verify_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = client.Verify("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Verify_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = await client.VerifyAsync("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Verify_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")); + Response response = client.Verify(NumberVerificationEnum.Number, "", numberVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Verify_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")); + Response response = await client.VerifyAsync(NumberVerificationEnum.Number, "", numberVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Verify_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + phoneNumber = "", + hashedPhoneNumber = "", + }); + Response response = client.Verify("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Verify_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + phoneNumber = "", + hashedPhoneNumber = "", + }); + Response response = await client.VerifyAsync("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Verify_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + HashedPhoneNumber = "", + }; + Response response = client.Verify(NumberVerificationEnum.Number, "", numberVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Verify_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NumberVerificationContent numberVerificationContent = new NumberVerificationContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + HashedPhoneNumber = "", + }; + Response response = await client.VerifyAsync(NumberVerificationEnum.Number, "", numberVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Retrieve_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + identifier = "", + }); + Response response = client.Retrieve("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("phoneNumber").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Retrieve_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + identifier = "", + }); + Response response = await client.RetrieveAsync("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("phoneNumber").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Retrieve_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); + Response response = client.Retrieve(NumberVerificationEnum.Number, "", networkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Retrieve_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); + Response response = await client.RetrieveAsync(NumberVerificationEnum.Number, "", networkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Retrieve_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + identifier = "", + }); + Response response = client.Retrieve("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("phoneNumber").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Retrieve_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + identifierType = "", + identifier = "", + }); + Response response = await client.RetrieveAsync("number", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("phoneNumber").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_NumberVerification_Retrieve_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); + Response response = client.Retrieve(NumberVerificationEnum.Number, "", networkIdentifier); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_NumberVerification_Retrieve_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "v2024_01_09_preview"); + + NetworkIdentifier networkIdentifier = new NetworkIdentifier("", ""); + Response response = await client.RetrieveAsync(NumberVerificationEnum.Number, "", networkIdentifier); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_SimSwap.cs b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_SimSwap.cs new file mode 100644 index 0000000000000..fe2453705190e --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tests/Generated/Samples/Samples_SimSwap.cs @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.ProgrammableConnectivity; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.ProgrammableConnectivity.Samples +{ + public partial class Samples_SimSwap + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Retrieve_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = client.Retrieve("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("date").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Retrieve_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = await client.RetrieveAsync("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("date").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Retrieve_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")); + Response response = client.Retrieve(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Retrieve_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")); + Response response = await client.RetrieveAsync(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Retrieve_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + phoneNumber = "", + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = client.Retrieve("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("date").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Retrieve_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + phoneNumber = "", + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = await client.RetrieveAsync("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("date").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Retrieve_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + }; + Response response = client.Retrieve(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Retrieve_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapRetrievalContent simSwapRetrievalContent = new SimSwapRetrievalContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + }; + Response response = await client.RetrieveAsync(SimSwapEnum.SimSwap, "", simSwapRetrievalContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Verify_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = client.Verify("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Verify_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = await client.VerifyAsync("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Verify_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")); + Response response = client.Verify(SimSwapEnum.SimSwap, "", simSwapVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Verify_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")); + Response response = await client.VerifyAsync(SimSwapEnum.SimSwap, "", simSwapVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Verify_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + phoneNumber = "", + maxAgeHours = 1234, + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = client.Verify("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Verify_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + using RequestContent content = RequestContent.Create(new + { + phoneNumber = "", + maxAgeHours = 1234, + networkIdentifier = new + { + identifierType = "", + identifier = "", + }, + }); + Response response = await client.VerifyAsync("sim-swap", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("verificationResult").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SimSwap_Verify_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + MaxAgeHours = 1234, + }; + Response response = client.Verify(SimSwapEnum.SimSwap, "", simSwapVerificationContent); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SimSwap_Verify_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + SimSwap client = new ProgrammableConnectivityClient(endpoint, credential).GetSimSwapClient(apiVersion: "v2024_01_09_preview"); + + SimSwapVerificationContent simSwapVerificationContent = new SimSwapVerificationContent(new NetworkIdentifier("", "")) + { + PhoneNumber = "", + MaxAgeHours = 1234, + }; + Response response = await client.VerifyAsync(SimSwapEnum.SimSwap, "", simSwapVerificationContent); + } + } +} diff --git a/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tsp-location.yaml b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tsp-location.yaml new file mode 100644 index 0000000000000..502c33357ef9d --- /dev/null +++ b/sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity/tsp-location.yaml @@ -0,0 +1,5 @@ +additionalDirectories: [] +repo: Azure/azure-rest-api-specs +commit: 50eb878bc836c596dbaff7f244c653545f5c4850 +directory: specification/programmableconnectivity/Azure.ProgrammableConnectivity + diff --git a/sdk/programmableconnectivity/ci.yml b/sdk/programmableconnectivity/ci.yml new file mode 100644 index 0000000000000..aeb7233b0c5ff --- /dev/null +++ b/sdk/programmableconnectivity/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/programmableconnectivity + - sdk/programmableconnectivity/ci.yml + - sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/programmableconnectivity + - sdk/programmableconnectivity/ci.yml + - sdk/programmableconnectivity/Azure.Communication.ProgrammableConnectivity + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: programmableconnectivity + ArtifactName: packages + Artifacts: + - name: Azure.Communication.ProgrammableConnectivity + safeName: AzureCommunicationProgrammableConnectivity