Azure.Communication.ProgrammableConnectivity 1.0.0-beta.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Azure.Communication.ProgrammableConnectivity.
dotnet add package Azure.Communication.ProgrammableConnectivity --version 1.0.0-beta.1
NuGet\Install-Package Azure.Communication.ProgrammableConnectivity -Version 1.0.0-beta.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azure.Communication.ProgrammableConnectivity" Version="1.0.0-beta.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Communication.ProgrammableConnectivity --version 1.0.0-beta.1
#r "nuget: Azure.Communication.ProgrammableConnectivity, 1.0.0-beta.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.Communication.ProgrammableConnectivity as a Cake Addin
#addin nuget:?package=Azure.Communication.ProgrammableConnectivity&version=1.0.0-beta.1&prerelease

// Install Azure.Communication.ProgrammableConnectivity as a Cake Tool
#tool nuget:?package=Azure.Communication.ProgrammableConnectivity&version=1.0.0-beta.1&prerelease

Azure ProgrammableConnectivity client library for .NET

This client library allows .NET applications to interact with Azure Programmable Connectivity Gateway, instead of using curl requests. For information on APC, see docs.

Source code | Package (NuGet): https://www.nuget.org/packages/Azure.Communication.ProgrammableConnectivity | API reference documentation | Product documentation

Getting started

Install the package

Install the client library for .NET with NuGet:

dotnet add package Azure.Communication.ProgrammableConnectivity --prerelease

Prerequisites

Before you can use the SDK successfully, you'll need to

  • Follow the guide to create a gateway, or have one already.
  • Note down your endpoint and apc-gateway-id, which is retrieved by following the guide linked.

Authenticate the client

The client library uses Azure.Identity credentials to authenticate with APC. The examples given in this repo use DefaultAzureCredential.

Examples

You can familiarize yourself with different APIs using Samples.

Key concepts

For each call that you make to APC with the SDK, you will follow the same pattern:

  • Create a client and sub-client for your use case (sim-swap/location/number-verification/device-network)
  • Create the content for your request by using the objects given by the SDK
  • Call the client with the content
  • Access the result returned
string apcGatewayId = "/subscriptions/abcdefgh/resourceGroups/.../Microsoft.programmableconnectivity/...";
Uri endpoint = new Uri("https://your-endpoint-here.com");
TokenCredential credential = new DefaultAzureCredential();
ProgrammableConnectivityClient baseClient = new ProgrammableConnectivityClient(endpoint, credential);
SimSwap client = baseClient.GetSimSwapClient();

SimSwapRetrievalContent content = new SimSwapRetrievalContent(
    new NetworkIdentifier("NetworkCode", "Orange_Spain"))
{
    PhoneNumber = "+50000000000",
};

Response<SimSwapRetrievalResult> response = await client.RetrieveAsync(apcGatewayId, content);
Console.WriteLine(response.Value.Date);

When handling an error, catch RequestFailedException, and log the details.

string apcGatewayId = "/subscriptions/abcdefgh/resourceGroups/.../Microsoft.programmableconnectivity/...";
Uri endpoint = new Uri("https://your-endpoint-here.com");
TokenCredential credential = new DefaultAzureCredential();
ProgrammableConnectivityClient baseClient = new ProgrammableConnectivityClient(endpoint, credential);
DeviceNetwork client = baseClient.GetDeviceNetworkClient();

NetworkIdentifier networkIdentifier = new NetworkIdentifier("IPv5", "127.0.0.1");
try
{
    Response<NetworkRetrievalResult> response = await client.RetrieveAsync(apcGatewayId, networkIdentifier);
}
catch (RequestFailedException ex)
{
    Console.WriteLine($"Exception Message: {ex.Message}");
    Console.WriteLine($"Status Code: {ex.Status}");
    Console.WriteLine($"Error Code: {ex.ErrorCode}");
}

Troubleshooting

If your call doesn't work, we recommend logging the exception messages, and progressing from there.

Try sending the request with curl or with HTTP files, using postman for example. This will narrow down the issue you're facing.

Next steps

For more information about Microsoft Azure SDK, see this website.

Contributing

APC is currently not accepting/expecting contributions for this codebase. Suggestions/issues are welcome.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta.1 96 5/13/2024