diff --git a/sdk/communication/Azure.Communication.Administration/CHANGELOG.md b/sdk/communication/Azure.Communication.Administration/CHANGELOG.md deleted file mode 100644 index 41d1bf85ae1a0..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/CHANGELOG.md +++ /dev/null @@ -1,58 +0,0 @@ -# Release History - -## 1.0.0-beta.4 (Unreleased) - -### Breaking -- CommunicationIdentityClient is moved to a new NuGet package, `Azure.Communication.Identity`. -- PhoneNumberAdministrationClient is moved to a new NuGet package, `Azure.Communication.PhoneNumbers`. - - -## 1.0.0-beta.3 (2020-11-16) - -### Added -- Support for mocking all client methods that use models with internal constructors. -- Added support for long-running operations. More detail under Breaking Changes. - -### Breaking - -#### Model Types -- Renamed `CreateSearchOptions` to `CreateReservationOptions`. -- Renamed `CreateSearchResponse` to `CreateReservationResponse`. -- Renamed `ReleaseResponse` to `PhoneNumberReleaseResponse`. -- Renamed `SearchStatus` to `ReservationStatus`. -- Added `PhoneNumberReservationOperation`. -- Added `PhoneNumberReservationPurchaseOperation`. -- Added `ReleasePhoneNumberOperation`. -- Renamed `PhoneNumberSearch` to `PhoneNumberReservation`. - -#### PhoneNumberReservation -- Renamed `searchId` to `reservationId`. - -#### PhoneNumberAdministrationClient -- Renamed `CancelSearch` to `CancelReservation`. -- Renamed `CancelSearchAsync` to `CancelReservationAsync`. -- Renamed `GetAllSearches` to `GetAllReservations`. -- Renamed `GetAllSearchesAsync` to `GetAllReservationsAsync`. -- Renamed `GetSearchByIdAsync` to `GetReservationByIdAsync`. -- Renamed `GetSearchById` to `GetReservationById`. -- Renamed `CancelSearch` to `CancelReservation`. -- Renamed `CancelSearchAsync` to `CancelReservationAsync`. -- Replaced `CreateSearchAsync` with `StartReservationAsync` which returns a poller for the long-running operation. -- Replaced `CreateSearch` with `StartReservation` which is a long-running operation. -- Replaced `PurchaseSearchAsync` with `StartPurchaseReservationAsync` which returns a poller for the long-running operation. -- Replaced `PurchaseSearch` with `StartPurchaseReservation` which is a long-running operation. -- Replaced `ReleasePhoneNumbersAsync` with `StartReleasePhoneNumbersAsync` which returns a poller for the long-running operation. -- Replaced `ReleasePhoneNumbers` with `StartReleasePhoneNumbers` which is a long-running operation. - - -## 1.0.0-beta.2 (2020-10-06) -Added phone number administration. For more information, please see the [README][read_me] and [documentation][documentation]. - -## 1.0.0-beta.1 (2020-09-22) -This is the first release of Azure Communication Administration, which manages users, tokens, and phone numbers for Azure Communication Services. For more information, please see the [README][read_me] and [documentation][documentation]. - -This is a Public Preview version, so breaking changes are possible in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). - - -[read_me]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md -[documentation]: https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-csharp diff --git a/sdk/communication/Azure.Communication.Administration/README.md b/sdk/communication/Azure.Communication.Administration/README.md deleted file mode 100644 index 0830588b209d1..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/README.md +++ /dev/null @@ -1,223 +0,0 @@ -# Azure Communication Administration client library for .NET - -> Server Version: - -> Phone number administration client: 2020-07-20-preview1 - -Azure Communication Administration is managing phone numbers for Azure Communication Services. - -[Source code][source] | [Package (NuGet)][package] | [Product documentation][product_docs] | [Samples][source_samples] - -## Getting started - -### Install the package - -Install the Azure Communication Administration client library for .NET with [NuGet][nuget]: - -```Powershell -dotnet add package Azure.Communication.Administration --version 1.0.0-beta.3 -``` - -### Prerequisites - -You need an [Azure subscription][azure_sub] and a [Communication Service Resource][communication_resource_docs] to use this package. - -To create a new Communication Service, you can use the [Azure Portal][communication_resource_create_portal], the [Azure PowerShell][communication_resource_create_power_shell], or the [.NET management client library][communication_resource_create_net]. - - - -### Key concepts - -Phone plans come in two types; Geographic and Toll-Free. Geographic phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888. - -All geographic phone plans within the same country are grouped into a phone plan group with a Geographic phone number type. All Toll-Free phone plans within the same country are grouped into a phone plan group. - -### Authenticate the client - -Phone Number Administration clients can be authenticated using connection string acquired from an Azure Communication Resources in the [Azure Portal][azure_portal]. - -```C# Snippet:CreatePhoneNumberAdministrationClient -// Get a connection string to our Azure Communication resource. -var connectionString = ""; -var client = new PhoneNumberAdministrationClient(connectionString); -``` - -Phone Number Administration clients also have the option to authenticate with Azure Active Directory Authentication. With this option, -`AZURE_CLIENT_SECRET`, `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` environment variables need to be set up for authentication. - -```C# Snippet:CreatePhoneNumberWithTokenCredential -var endpoint = ""; -TokenCredential tokenCredential = new DefaultAzureCredential(); -var client = new PhoneNumberAdministrationClient(new Uri(endpoint), tokenCredential); -``` - -### Reserving and acquiring numbers - -Phone numbers reservation can be performed through the reservation creation API by providing a phone plan id, an area code and quantity of phone numbers. The provided quantity of phone numbers will be reserved for ten minutes. This reservation of phone numbers can either be cancelled or purchased. If the reservation is cancelled, then the phone numbers will become available to others. If the reservation is purchased, then the phone numbers are acquired for the Azure resources. - -### Configuring / Assigning numbers - -Phone numbers can be assigned to a callback URL via the configure number API. As part of the configuration, you will need an acquired phone number, callback URL and application id. - -### 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/master/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | -[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | -[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | -[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | -[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Diagnostics.md) | -[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/master/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 - -### Get list of the countries that are supported by the service - -```C# -string connectionString = ""; -PhoneNumberAdministrationClient client = new PhoneNumberAdministrationClient(connectionString); -Pageable countries = client.GetAllSupportedCountries(); - -foreach (var country in countries) -{ - Console.WriteLine($"Country code {country.CountryCode}, Country name: {country.LocalizedName}"); -} -``` - -### Get phone plan groups - -Phone plan groups come in two types, Geographic and Toll-Free. - -```C# -var phonePlanGroups = client.GetPhonePlanGroups(countryCode); - -foreach (var group in phonePlanGroups) -{ - Console.WriteLine($"PhonePlanGroupId {group.PhonePlanGroupId}, Name: {group.LocalizedName}, PhoneNumberType: {group.PhoneNumberType}"); -} -``` - -### Get phone plans - -Unlike Toll-Free phone plans, area codes for Geographic Phone Plans are empty. Area codes are found in the Area Codes API. - -```C# -var phonePlans = client.GetPhonePlans(countryCode, planGroupId); - -foreach (var plan in phonePlans) -{ - Console.WriteLine($"PhonePlanId {plan.PhonePlanId}, Name: {plan.LocalizedName}"); - Console.WriteLine("Top 10 area codes"); - foreach (var areaCode in plan.AreaCodes.Take(10).ToList()) - { - Console.WriteLine($"Area code: {areaCode}"); - } -} -``` - -### Get location options - -For Geographic phone plans, you can query the available geographic locations. The locations options are structured like the geographic hierarchy of a country. For example, the US has states and within each state are cities. - -```C# -var locationOptionsResponse = client.GetPhonePlanLocationOptions(countryCode, phonePlanGroupId, phonePlanId); -var locationOprions = locationOptionsResponse.Value.LocationOptions; - -Console.WriteLine($"LabelId: {locationOprions.LabelId}, LabelName: {locationOprions.LabelName}"); -foreach(var locationOption in locationOprions.Options) -{ - Console.WriteLine($"Name: {locationOption.Name}, Value: {locationOption.Value}"); -} -``` - -### Get area codes - -Fetching area codes for geographic phone plans will require the the location options queries set. You must include the chain of geographic locations traversing down the location options object returned by the GetLocationOptions API. - -```C# -var areaCodesResponse = client.GetAllAreaCodes(locationType, countryCode, planId, locationOptionsQueries); -var areaCodes = areaCodesResponse.Value; - -foreach(var primaryAreaCode in areaCodes.PrimaryAreaCodes) -{ - Console.WriteLine("Primary area code" + primaryAreaCode); -} - -foreach (var secondaryAreaCode in areaCodes.SecondaryAreaCodes) -{ - Console.WriteLine("Secondary area code" + secondaryAreaCode); -} -``` - -### Create reservation - -```C# -var reservationOptions = new CreateReservationOptions(displayName, description, plans, areaCode) { Quantity = 1 }; -var reservationOperation = await client.StartReservationAsync(reservationOptions).ConfigureAwait(false); -var reservationResponse = await reservationOperation.WaitForCompletionAsync().ConfigureAwait(false); - -Console.WriteLine($"ReservationId: {reservationResponse.Value.ReservationId}, Status {reservationResponse.Value.Status}"); -``` - -### Purchase reservation - -```C# -var reservationPurchaseOperation = await client.StartPurchaseReservationAsync(reservationId).ConfigureAwait(false); -await reservationPurchaseOperation.WaitForCompletionAsync().ConfigureAwait(false); -``` - -### Configure phone number - -```C# -var pstnConfiguration = new PstnConfiguration(""); -var phoneNumber = new PhoneNumber(""); -client.ConfigureNumber(pstnConfiguration, phoneNumber); -``` - -### Release phone numbers - -```C# -var releasePhoneNumberOperation = await client.StartReleasePhoneNumbersAsync(numbers).ConfigureAwait(false); -await releasePhoneNumberOperation.WaitForCompletionAsync().ConfigureAwait(false); - -Console.WriteLine($"ReleaseId: {releasePhoneNumberOperation.Value.ReleaseId}, Status: {releasePhoneNumberOperation.Value.Status}"); -``` -## Troubleshooting - -## Next steps - -[Read more about Communication user access tokens][user_access_token] - -## Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla]. - -This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. - - - -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[source]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/communication/Azure.Communication.Administration/src -[source_samples]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/samples -[cla]: https://cla.microsoft.com -[coc]: https://opensource.microsoft.com/codeofconduct/ -[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ -[coc_contact]: mailto:opencode@microsoft.com -[package]: https://www.nuget.org/packages/Azure.Communication.Administration -[product_docs]: https://docs.microsoft.com/azure/communication-services/overview -[nuget]: https://www.nuget.org/ -[communication_resource_docs]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp -[communication_resource_create_portal]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp -[communication_resource_create_power_shell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice -[communication_resource_create_net]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-net diff --git a/sdk/communication/Azure.Communication.Administration/api/Azure.Communication.Administration.netstandard2.0.cs b/sdk/communication/Azure.Communication.Administration/api/Azure.Communication.Administration.netstandard2.0.cs deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/sdk/communication/Azure.Communication.Administration/samples/README.md b/sdk/communication/Azure.Communication.Administration/samples/README.md deleted file mode 100644 index 427df6f6d3de5..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/samples/README.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -page_type: sample -languages: -- csharp -products: -- azure -- azure-communication -name: Azure Communication Administration samples for .NET -description: Samples for the Azure.Communication.Administration client library ---- - -# Azure Communication Administration SDK samples - -Azure Communication Administration is a client library that is used to do operations necessary for using different services offered by Azure Communication Services, such as calling, chat, SMS, PSTN etc. -To get started you will need to have an Azure Subscription. Once you have this you can go into the Azure portal and create Azure Communication Services resource. The page will give you necessary information to be able to use the sample codes here such as connections string, shared access key, etc. - -This client library allows to do following operations: - - Generate user tokens that allows the holders to access Azure Communication Services. - - Purchase, configure and release phone numbers. - - #### You can find samples for each of these functions below. - - Manage phone numbers [synchronously][sample_admin] or [asynchronously][sample_admin_async] - - -[sample_admin]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md -[sample_admin_async]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md diff --git a/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md b/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md deleted file mode 100644 index 735ae2f75734f..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md +++ /dev/null @@ -1,200 +0,0 @@ -# Searching, reserving, purchasing, releasing phone numbers - -This sample demonstrates how to search, reserve, purchase and release phone numbers in Azure Communication Services. -To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md) for links and instructions. - -## Creating a PhoneNumberAdministrationClient - -To create a new `PhoneNumberAdministrationClient` you need a connection string to the Azure Communication Services resource that you can get from the Azure Portal once you have created the resource. - -You can set `connectionString` based on an environment variable, a configuration setting, or any way that works for your application. - -```C# Snippet:CreatePhoneNumberAdministrationClient -// Get a connection string to our Azure Communication resource. -var connectionString = ""; -var client = new PhoneNumberAdministrationClient(connectionString); -``` - -## Listing all supported countries - -In order to acquire a phone number you will need to know if Azure Communication Services are available in a particular country. You can find out by retrieving a list of supported countries. - -```C# Snippet:GetAllSupportedCountries -var supportedCountries = client.GetAllSupportedCountries(locale); -foreach (var country in supportedCountries) -{ - Console.WriteLine($"Supported country code: {country.CountryCode}, name: {country.LocalizedName}"); -} -``` - -## Listing phone plan groups - -Phone plan groups come in two types, Geographic and Toll-Free. - -```C# Snippet:GetPhonePlanGroups -var phonePlanGroups = client.GetPhonePlanGroups(countryCode, locale); - -foreach (var phonePlanGroup in phonePlanGroups) -{ - Console.WriteLine($"Plan group: {phonePlanGroup.LocalizedName}, type: {phonePlanGroup.PhoneNumberType}"); -} -``` - -## Listing phone plans - -Unlike Toll-Free phone plans, area codes for Geographic phone plans are empty. Area codes are found in the Area Codes API. - -```C# Snippet:GetPhonePlans -var phonePlans = client.GetPhonePlans(countryCode, phonePlanGroupId, locale); -foreach (var phonePlan in phonePlans) -{ - Console.WriteLine($"Plan: {phonePlan.LocalizedName}, {phonePlan.LocationType}"); -} -``` - -## Get location options - -For Geographic phone plans, you can query the available geographic locations. The locations options are structured like the geographic hierarchy of a country. For example, the US has states and within each state are cities. - -```C# Snippet:GetPhonePlanLocationOptions -var locationOptionsResponse = client.GetPhonePlanLocationOptions(countryCode, geographicPhonePlanGroup.PhonePlanGroupId, phonePlanId); - -void PrintLocationOption(LocationOptions locationOptions) -{ - Console.WriteLine($"LabelId: {locationOptions.LabelId}, LabelName: {locationOptions.LabelName}"); - - foreach (var locationOption in locationOptions.Options) - { - Console.WriteLine($"Name: {locationOption.Name}, Value: {locationOption.Value}"); - - foreach (var subLocationOption in locationOption.LocationOptions) - PrintLocationOption(subLocationOption); - } -} -PrintLocationOption(locationOptionsResponse.Value.LocationOptions); -``` - -## Get area codes - -Fetching area codes for geographic phone plans will require the location options queries set. You must include the chain of geographic locations traversing down the location options object returned by the `GetPhonePlanLocationOptions`. - -```C# Snippet:GeographicalAreaCodes -var locationOptionsResponse = client.GetPhonePlanLocationOptions(countryCode, geographicPhonePlanGroupId, geographicPhonePlanId); -var state = locationOptionsResponse.Value.LocationOptions.Options.First(); - -var locationOptionsQueries = new List -{ - new LocationOptionsQuery - { - LabelId = "state", - OptionsValue = state.Value - }, - new LocationOptionsQuery - { - LabelId = "city", - OptionsValue = state.LocationOptions.First().Options.First().Value - } -}; - -var areaCodes = client.GetAllAreaCodes(geographicPhonePlan.LocationType.ToString(), countryCode, geographicPhonePlan.PhonePlanId, locationOptionsQueries); - -foreach (var areaCode in areaCodes.Value.PrimaryAreaCodes) -{ - Console.WriteLine($"Primary area code: {areaCode}"); -} -``` - -Area codes for toll-free phone plans can be found in the plan. - -```C# Snippet:TollFreePlanAreaCodes -var phonePlans = client.GetPhonePlans(countryCode, tollFreePhonePlanGroupId, locale); -var tollFreePhonePlan = phonePlans.First(); - -foreach (var areaCode in tollFreePhonePlan.AreaCodes) -{ - Console.WriteLine($"Area code: {areaCode}"); -} -``` - -## Reserve phone numbers - -Phone numbers need to be reserved before they can be purchased. Reservation is a long running operation that can be started by `CreateReservationOptions` function that returns an `PhoneNumberReservationOperation` object. `PhoneNumberReservationOperation` can be used to update status of the operation and to check for completeness. - -```C# Snippet:ReservePhoneNumbers -var reservationName = "My reservation"; -var reservationDescription = "reservation description"; -var reservationOptions = new CreateReservationOptions(reservationName, reservationDescription, new[] { phonePlanId }, areaCode); -reservationOptions.Quantity = 1; - -var reserveOperation = client.StartReservation(reservationOptions); - -while (!reserveOperation.HasCompleted) -{ - Thread.Sleep(2000); - - reserveOperation.UpdateStatus(); -} -``` - -## Persist reserve phone numbers operation - -You can persist the operation Id of the phone number reservation so that you can come back and check the operation status later. - -```C# Snippet:PersistReservePhoneNumbersOperation -var reservationId = reserveOperation.Id; - -// persist reservationId and then continue with a new operation - -var reserveOperation = new PhoneNumberReservationOperation(client, reservationId); - -while (!reserveOperation.HasCompleted) -{ - Thread.Sleep(2000); - - reserveOperation.UpdateStatus(); -} -``` - -## Purchase phone numbers - -Phone numbers can be acquired through purchasing a reservation. - -```C# Snippet:StartPurchaseReservation -var purchaseOperation = client.StartPurchaseReservation(reservationId); - -while (!purchaseOperation.HasCompleted) -{ - Thread.Sleep(2000); - - purchaseOperation.UpdateStatus(); -} -``` - -## Listing acquired phone numbers - -You can list all phone numbers that have been acquired for your resource. - -```C# Snippet:ListAcquiredPhoneNumbers -var acquiredPhoneNumbers = client.GetAllPhoneNumbers(locale); - -foreach (var phoneNumber in acquiredPhoneNumbers) -{ - Console.WriteLine($"Phone number: {phoneNumber.PhoneNumber}, activation state: {phoneNumber.ActivationState}"); -} -``` - -## Release phone numbers - -If you no longer need a phone number you can release it. - -```C# Snippet:ReleasePhoneNumbers -var acquiredPhoneNumber = ""; -var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumberIdentifier(acquiredPhoneNumber)); - -while (!releaseOperation.HasCompleted) -{ - Thread.Sleep(2000); - - releaseOperation.UpdateStatus(); -} -``` diff --git a/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md b/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md deleted file mode 100644 index b1a61d932e592..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md +++ /dev/null @@ -1,176 +0,0 @@ -# Searching, reserving, purchasing, releasing phone numbers (Async) - -This sample demonstrates how to search, reserve, purchase and release phone numbers in Azure Communication Services. -To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md) for links and instructions. - -## Creating a PhoneNumberAdministrationClient - -To create a new `PhoneNumberAdministrationClient` you need a connection string to the Azure Communication Services resource that you can get from the Azure Portal once you have created the resource. - -You can set `connectionString` based on an environment variable, a configuration setting, or any way that works for your application. - -```C# Snippet:CreatePhoneNumberAdministrationClient -// Get a connection string to our Azure Communication resource. -var connectionString = ""; -var client = new PhoneNumberAdministrationClient(connectionString); -``` - -## Listing all supported countries - -In order to acquire a phone number you will need to know if Azure Communication Services are available in a particular country. You can find out by retrieving a list of supported countries. - -```C# Snippet:GetAllSupportedCountriesAsync -var supportedCountries = client.GetAllSupportedCountriesAsync(locale); -await foreach (var country in supportedCountries) -{ - Console.WriteLine($"Supported country code: {country.CountryCode}, name: {country.LocalizedName}"); -} -``` - -## Listing phone plan groups - -Phone plan groups come in two types, Geographic and Toll-Free. - -```C# Snippet:GetPhonePlanGroupsAsync -var phonePlanGroups = client.GetPhonePlanGroupsAsync(countryCode, locale); - -await foreach (var phonePlanGroup in phonePlanGroups) -{ - Console.WriteLine($"Plan group: {phonePlanGroup.LocalizedName}, type: {phonePlanGroup.PhoneNumberType}"); -} -``` - -## Listing phone plans - -Unlike Toll-Free phone plans, area codes for Geographic phone plans are empty. Area codes are found in the Area Codes API. - -```C# Snippet:GetPhonePlansAsync -var phonePlans = client.GetPhonePlansAsync(countryCode, phonePlanGroupId, locale); -await foreach (var phonePlan in phonePlans) -{ - Console.WriteLine($"Plan: {phonePlan.LocalizedName}, {phonePlan.LocationType}"); -} -``` - -## Get location options - -For Geographic phone plans, you can query the available geographic locations. The locations options are structured like the geographic hierarchy of a country. For example, the US has states and within each state are cities. - -```C# Snippet:GetPhonePlanLocationOptionsAsync -var locationOptionsResponse = await client.GetPhonePlanLocationOptionsAsync(countryCode, geographicPhonePlanGroupId, phonePlanId); - -void PrintLocationOption(LocationOptions locationOptions) -{ - Console.WriteLine($"LabelId: {locationOptions.LabelId}, LabelName: {locationOptions.LabelName}"); - - foreach (var locationOption in locationOptions.Options) - { - Console.WriteLine($"Name: {locationOption.Name}, Value: {locationOption.Value}"); - - foreach (var subLocationOption in locationOption.LocationOptions) - PrintLocationOption(subLocationOption); - } -} -PrintLocationOption(locationOptionsResponse.Value.LocationOptions); -``` - -## Get area codes - -Fetching area codes for geographic phone plans will require the location options queries set. You must include the chain of geographic locations traversing down the location options object returned by the `GetPhonePlanLocationOptions`. - -```C# Snippet:GeographicalAreaCodesAsync -var locationOptionsResponse = await client.GetPhonePlanLocationOptionsAsync(countryCode, geographicPhonePlanGroupId, geographicPhonePlanId); -var state = locationOptionsResponse.Value.LocationOptions.Options.First(); - -var locationOptionsQueries = new List -{ - new LocationOptionsQuery - { - LabelId = "state", - OptionsValue = state.Value - }, - new LocationOptionsQuery - { - LabelId = "city", - OptionsValue = state.LocationOptions.First().Options.First().Value - } -}; - -var areaCodes = await client.GetAllAreaCodesAsync(geographicPhonePlan.LocationType.ToString(), countryCode, geographicPhonePlan.PhonePlanId, locationOptionsQueries); - -foreach (var areaCode in areaCodes.Value.PrimaryAreaCodes) -{ - Console.WriteLine($"Primary area code: {areaCode}"); -} -``` - -Area codes for toll-free phone plans can be found in the plan. - -```C# Snippet:TollFreePlanAreaCodesAsync -var phonePlans = client.GetPhonePlansAsync(countryCode, tollFreePhonePlanGroup.PhonePlanGroupId, locale); -var tollFreePhonePlan = (await phonePlans.ToEnumerableAsync()).First(); - -foreach (var areaCode in tollFreePhonePlan.AreaCodes) -{ - Console.WriteLine($"Area code: {areaCode}"); -} -``` - -## Reserve phone numbers - -Phone numbers need to be reserved before they can be purchased. Reservation is a long running operation that can be started by `CreateReservationOptions` function that returns an `PhoneNumberReservationOperation` object. `PhoneNumberReservationOperation` can be used to update status of the operation and to check for completeness. - -```C# Snippet:ReservePhoneNumbersAsync -var reservationName = "My reservation"; -var reservationDescription = "reservation description"; -var reservationOptions = new CreateReservationOptions(reservationName, reservationDescription, new[] { phonePlanId }, areaCode); -reservationOptions.Quantity = 1; - -var reserveOperation = await client.StartReservationAsync(reservationOptions); -await reserveOperation.WaitForCompletionAsync(); -``` - -## Persist reserve phone numbers operation - -You can persist the operation Id of the phone number reservation so that you can come back and check the operation status later. - -```C# Snippet:PersistReservePhoneNumbersOperationAsync -var reservationId = reserveOperation.Id; - -// persist reservationId and then continue with a new operation - -var reserveOperation = new PhoneNumberReservationOperation(client, reservationId); -await reserveOperation.WaitForCompletionAsync(); -``` - -## Purchase phone numbers - -Phone numbers can be acquired through purchasing a reservation. - -```C# Snippet:StartPurchaseReservationAsync -var purchaseOperation = await client.StartPurchaseReservationAsync(reservationId); -await purchaseOperation.WaitForCompletionAsync(); -``` - -## Listing acquired phone numbers - -You can list all phone numbers that have been acquired for your resource. - -```C# Snippet:ListAcquiredPhoneNumbersAsync -var acquiredPhoneNumbers = client.GetAllPhoneNumbersAsync(locale); - -await foreach (var phoneNumber in acquiredPhoneNumbers) -{ - Console.WriteLine($"Phone number: {phoneNumber.PhoneNumber}, activation state: {phoneNumber.ActivationState}"); -} -``` - -## Release phone numbers - -If you no longer need a phone number you can release it. - -```C# Snippet:ReleasePhoneNumbersAsync -var acquiredPhoneNumber = ""; -var releaseOperation = client.StartReleasePhoneNumber(new PhoneNumberIdentifier(acquiredPhoneNumber)); -await releaseOperation.WaitForCompletionAsync(); -``` diff --git a/sdk/communication/Azure.Communication.Administration/src/Azure.Communication.Administration.csproj b/sdk/communication/Azure.Communication.Administration/src/Azure.Communication.Administration.csproj deleted file mode 100644 index 67294a0cdd949..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/src/Azure.Communication.Administration.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - This client library enables working with the Microsoft Azure Communication Administration service. - For this release, see notes - https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md and https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/CHANGELOG.md. - Microsoft Azure Communication Administration quickstart - https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-csharp - - Azure Communication Administration Service - 1.0.0-beta.4 - Microsoft Azure Communication Administration Service;Microsoft;Azure;Azure Communication Service;Azure Communication Administration Service;Administration;Communication;$(PackageCommonTags) - $(RequiredTargetFrameworks) - false - enable - - - - - - - - - diff --git a/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj b/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj deleted file mode 100644 index f466ed5048eca..0000000000000 --- a/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - $(RequiredTargetFrameworks) - enable - - - - - - - - - - - - - - - - - - - diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/samples/README.md b/sdk/communication/Azure.Communication.PhoneNumbers/samples/README.md index 4fb861baa23c7..da1ed0f1d0d2d 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/samples/README.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/samples/README.md @@ -5,21 +5,21 @@ languages: products: - azure - azure-communication -name: Azure Communication Administration samples for .NET -description: Samples for the Azure.Communication.Administration client library +name: Azure Communication Phone Number samples for .NET +description: Samples for the Azure.Communication.PhoneNumber client library --- -# Azure Communication Administration SDK samples +# Azure Communication Phone Number SDK samples -Azure Communication Administration is a client library that is used to do operations necessary for using different services offered by Azure Communication Services, such as calling, chat, SMS, PSTN etc. +Azure Communication Phone Number is a client library that is used to do operations necessary for using different services offered by Azure Communication Services, such as calling, chat, SMS, PSTN etc. To get started you will need to have an Azure Subscription. Once you have this you can go into the Azure portal and create Azure Communication Services resource. The page will give you necessary information to be able to use the sample codes here such as connections string, shared access key, etc. This client library allows to do following operations: - Purchase, configure and release phone numbers. #### You can find samples for each of these functions below. - - Manage phone numbers [synchronously][sample_admin] or [asynchronously][sample_admin_async] + - Manage phone numbers [synchronously][sample_phonenumbers] or [asynchronously][sample_phonenumbers_async] -[sample_admin]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClient.md -[sample_admin_async]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/samples/Sample2_PhoneNumberAdministrationClientAsync.md +[sample_phonenumbers]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClient.md +[sample_phonenumbers_async]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClientAsync.md diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClient.md b/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClient.md index 735ae2f75734f..2f04cdb87766e 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClient.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClient.md @@ -1,7 +1,7 @@ # Searching, reserving, purchasing, releasing phone numbers This sample demonstrates how to search, reserve, purchase and release phone numbers in Azure Communication Services. -To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md) for links and instructions. +To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.PhoneNumbers/README.md) for links and instructions. ## Creating a PhoneNumberAdministrationClient diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClientAsync.md b/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClientAsync.md index b1a61d932e592..c66611c5172c2 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClientAsync.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/samples/Sample2_PhoneNumberAdministrationClientAsync.md @@ -1,7 +1,7 @@ # Searching, reserving, purchasing, releasing phone numbers (Async) This sample demonstrates how to search, reserve, purchase and release phone numbers in Azure Communication Services. -To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.Administration/README.md) for links and instructions. +To get started, you'll need a URI to an Azure Communication Services. See the [README](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/communication/Azure.Communication.PhoneNumbers/README.md) for links and instructions. ## Creating a PhoneNumberAdministrationClient diff --git a/sdk/communication/Azure.Communication.sln b/sdk/communication/Azure.Communication.sln index 90f2510bcf800..e3cec90443838 100644 --- a/sdk/communication/Azure.Communication.sln +++ b/sdk/communication/Azure.Communication.sln @@ -21,10 +21,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Communication.Common" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Communication.Common.Tests", "Azure.Communication.Common\tests\Azure.Communication.Common.Tests.csproj", "{2C4BDD98-F38F-48D6-BAC0-B8BB88D1621A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Communication.Administration", "Azure.Communication.Administration\src\Azure.Communication.Administration.csproj", "{47775D65-5CDC-4ACE-AFB5-533D2214C6BF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Communication.Administration.Tests", "Azure.Communication.Administration\tests\Azure.Communication.Administration.Tests.csproj", "{059E62B7-9149-4293-BA3E-378E56733712}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Communication", "Azure.ResourceManager.Communication\src\Azure.ResourceManager.Communication.csproj", "{86776D3F-0ACA-4933-9318-21B9E35AA689}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Communication.Tests", "Azure.ResourceManager.Communication\tests\Azure.ResourceManager.Communication.Tests.csproj", "{D3FD90BB-3B91-45F0-920B-68ED33634FFE}" @@ -67,14 +63,6 @@ Global {2C4BDD98-F38F-48D6-BAC0-B8BB88D1621A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2C4BDD98-F38F-48D6-BAC0-B8BB88D1621A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2C4BDD98-F38F-48D6-BAC0-B8BB88D1621A}.Release|Any CPU.Build.0 = Release|Any CPU - {47775D65-5CDC-4ACE-AFB5-533D2214C6BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {47775D65-5CDC-4ACE-AFB5-533D2214C6BF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {47775D65-5CDC-4ACE-AFB5-533D2214C6BF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {47775D65-5CDC-4ACE-AFB5-533D2214C6BF}.Release|Any CPU.Build.0 = Release|Any CPU - {059E62B7-9149-4293-BA3E-378E56733712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {059E62B7-9149-4293-BA3E-378E56733712}.Debug|Any CPU.Build.0 = Debug|Any CPU - {059E62B7-9149-4293-BA3E-378E56733712}.Release|Any CPU.ActiveCfg = Release|Any CPU - {059E62B7-9149-4293-BA3E-378E56733712}.Release|Any CPU.Build.0 = Release|Any CPU {86776D3F-0ACA-4933-9318-21B9E35AA689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {86776D3F-0ACA-4933-9318-21B9E35AA689}.Debug|Any CPU.Build.0 = Debug|Any CPU {86776D3F-0ACA-4933-9318-21B9E35AA689}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/sdk/communication/Shared/CHANGELOG.md b/sdk/communication/Shared/CHANGELOG.md deleted file mode 100644 index d48cf19f29ca9..0000000000000 --- a/sdk/communication/Shared/CHANGELOG.md +++ /dev/null @@ -1,4 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (2020-09-22) - diff --git a/sdk/communication/Shared/README.md b/sdk/communication/Shared/README.md deleted file mode 100644 index 1a2bea915f063..0000000000000 --- a/sdk/communication/Shared/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Azure Communication client library for .NET -Content forthcoming - -## Getting started -Content forthcoming - -### Install the package -Content forthcoming - -### Prerequisites -Content forthcoming - -### Authenticate the client -Content forthcoming - -### Key concepts -Content forthcoming - -## Examples -Content forthcoming - -## Troubleshooting -Content forthcoming - -## Next steps -Content forthcoming - -## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla]. - -This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. diff --git a/sdk/communication/ci.yml b/sdk/communication/ci.yml index f2b9907208c61..3382c44055703 100644 --- a/sdk/communication/ci.yml +++ b/sdk/communication/ci.yml @@ -26,8 +26,6 @@ extends: ServiceDirectory: communication ArtifactName: packages Artifacts: - - name: Azure.Communication.Administration - safeName: AzureCommunicationAdministration - name: Azure.Communication.Chat safeName: AzureCommunicationChat - name: Azure.Communication.Common