Skip to content

Add Unified Messaging for private preview #49343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions sdk/communication/Azure.Communication.Messages/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Release History

## 1.2.0-beta.2 (Unreleased)
## 2.0.0-beta.1 (2025-04-09)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- Add Unified Messaging.

## 1.2.0-beta.1 (2025-02-11)

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/communication/Azure.Communication.Messages/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/communication/Azure.Communication.Messages",
"Tag": "net/communication/Azure.Communication.Messages_52c3e6b22c"
"Tag": "net/communication/Azure.Communication.Messages_40c15bc52d"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
This client library enables working with the Microsoft Azure Communication Messages service.
</Description>
<AssemblyTitle>Azure Communication Messages Service</AssemblyTitle>
<Version>1.2.0-beta.2</Version>
<Version>2.0.0-beta.1</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.1.0</ApiCompatVersion>
<PackageTags>Microsoft Azure Communication Messages Service;Microsoft;Azure;Azure Communication Service;Azure Communication Messages Service;Messages;Communication</PackageTags>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
<NoWarn>$(NoWarn);AZC0007</NoWarn>
<NoWarn>$(NoWarn);AZC0030</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\Shared\src\ClientOptionsExtensions.cs" LinkBase="Shared\Communication" />
<Compile Include="..\..\Shared\src\HMACAuthenticationPolicy.cs" LinkBase="Shared\Communication" />
<Compile Include="..\..\Shared\src\CommunicationBearerTokenCredential.cs" LinkBase="Shared\Communication" />
<Compile Include="$(AzureCoreSharedSources)ConnectionString.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared" />
</ItemGroup>
Expand All @@ -25,4 +28,4 @@
<PackageReference Include="Azure.Communication.Common" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Threading.Tasks;
using System.Threading;
using Azure.Communication.Pipeline;
using Azure.Core;
using Azure.Core.Pipeline;

namespace Azure.Communication.Messages
{
/// <summary>
/// The Azure Communication Services Conversation Adminstration client.
/// </summary>

public partial class ConversationAdministrationClient
{
#region public constructors

/// <summary>
/// Initializes a new instance of <see cref="ConversationAdministrationClient"/>.
/// </summary>
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
public ConversationAdministrationClient(string connectionString)
: this(
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of <see cref="ConversationAdministrationClient"/>.</summary>
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
public ConversationAdministrationClient(string connectionString, CommunicationMessagesClientOptions options)
: this(
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
options ?? new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of <see cref="ConversationAdministrationClient"/>.</summary>
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
/// <param name="credential">The <see cref="AzureKeyCredential"/> used to authenticate requests.</param>
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
public ConversationAdministrationClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options = default)
: this(
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
Argument.CheckNotNull(credential, nameof(credential)),
options ?? new CommunicationMessagesClientOptions())
{
_keyCredential = credential;
}

/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
public ConversationAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="options"> The options for configuring the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
public ConversationAdministrationClient(Uri endpoint, TokenCredential credential, CommunicationMessagesClientOptions options)
{
Argument.AssertNotNull(endpoint, nameof(endpoint));
Argument.AssertNotNull(credential, nameof(credential));
options ??= new CommunicationMessagesClientOptions();

ClientDiagnostics = new ClientDiagnostics(options, true);
_tokenCredential = credential;
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
_endpoint = endpoint;
_apiVersion = options.Version;
}

#endregion

#region private constructors
private ConversationAdministrationClient(ConnectionString connectionString, CommunicationMessagesClientOptions options)
: this(new Uri(connectionString.GetRequired("endpoint")), options.BuildHttpPipeline(connectionString), options)
{ }

private ConversationAdministrationClient(string endpoint, AzureKeyCredential keyCredential, CommunicationMessagesClientOptions options)
: this(new Uri(endpoint), options.BuildHttpPipeline(keyCredential), options)
{ }

private ConversationAdministrationClient(Uri endpoint, HttpPipeline httpPipeline, CommunicationMessagesClientOptions options)
{
ClientDiagnostics = new ClientDiagnostics(options);
_pipeline = httpPipeline;
_endpoint = endpoint;
_apiVersion = options.Version;
}

#endregion

/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
internal ConversationAdministrationClient(Uri endpoint) : this(endpoint, new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <param name="options"> The options for configuring the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
internal ConversationAdministrationClient(Uri endpoint, CommunicationMessagesClientOptions options)
{
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new CommunicationMessagesClientOptions();

ClientDiagnostics = new ClientDiagnostics(options, true);
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), Array.Empty<HttpPipelinePolicy>(), new ResponseClassifier());
_endpoint = endpoint;
_apiVersion = options.Version;
}

/// <summary>Initializes a new instance of <see cref="ConversationAdministrationClient"/> for mocking.</summary>
protected ConversationAdministrationClient()
{
ClientDiagnostics = null!;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Net;
using Azure.Communication.Pipeline;
using Azure.Core;
using Azure.Core.Pipeline;

namespace Azure.Communication.Messages
{
/// <summary>
/// The Azure Communication Services Conversation Thread client.
/// </summary>

public partial class ConversationThreadClient
{
#region public constructors

/// <summary>
/// Initializes a new instance of <see cref="ConversationThreadClient"/>.
/// </summary>
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
internal ConversationThreadClient(string connectionString)
: this(
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of <see cref="ConversationThreadClient"/>.</summary>
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
internal ConversationThreadClient(string connectionString, CommunicationMessagesClientOptions options)
: this(
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
options ?? new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of <see cref="ConversationThreadClient"/>.</summary>
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
/// <param name="credential">The <see cref="AzureKeyCredential"/> used to authenticate requests.</param>
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
internal ConversationThreadClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options = default)
: this(
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
Argument.CheckNotNull(credential, nameof(credential)),
options ?? new CommunicationMessagesClientOptions())
{
_keyCredential = credential;
}

/// <summary>
/// Initializes a new instance of the <see cref="ConversationThreadClient"/> class.
/// </summary>
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
/// <param name="communicationTokenCredential">The <see cref="CommunicationTokenCredential"/> used to authenticate requests.</param>
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
public ConversationThreadClient(Uri endpoint, CommunicationTokenCredential communicationTokenCredential, CommunicationMessagesClientOptions options = default)
: this(
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
Argument.CheckNotNull(communicationTokenCredential, nameof(communicationTokenCredential)),
options ?? new CommunicationMessagesClientOptions())
{
_tokenCredential = new CommunicationBearerTokenCredential(communicationTokenCredential);
}

#endregion

#region private constructors
private ConversationThreadClient(ConnectionString connectionString, CommunicationMessagesClientOptions options)
: this(new Uri(connectionString.GetRequired("endpoint")), options.BuildHttpPipeline(connectionString), options)
{ }

private ConversationThreadClient(string endpoint, AzureKeyCredential keyCredential, CommunicationMessagesClientOptions options)
: this(new Uri(endpoint), options.BuildHttpPipeline(keyCredential), options)
{ }

private ConversationThreadClient(string endpoint, CommunicationTokenCredential communicationTokenCredential, CommunicationMessagesClientOptions options)
: this(new Uri(endpoint), options.BuildHttpPipeline(new CommunicationBearerTokenCredential(communicationTokenCredential)), options)
{
}

private ConversationThreadClient(Uri endpoint, HttpPipeline httpPipeline, CommunicationMessagesClientOptions options)
{
ClientDiagnostics = new ClientDiagnostics(options);
_pipeline = httpPipeline;
_endpoint = endpoint;
_apiVersion = options.Version;
}

#endregion

/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
internal ConversationThreadClient(Uri endpoint) : this(endpoint, new CommunicationMessagesClientOptions())
{
}

/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <param name="options"> The options for configuring the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
internal ConversationThreadClient(Uri endpoint, CommunicationMessagesClientOptions options)
{
Argument.AssertNotNull(endpoint, nameof(endpoint));
options ??= new CommunicationMessagesClientOptions();

ClientDiagnostics = new ClientDiagnostics(options, true);
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), Array.Empty<HttpPipelinePolicy>(), new ResponseClassifier());
_endpoint = endpoint;
_apiVersion = options.Version;
}

/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
internal ConversationThreadClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions())
{
}

/// <summary>Initializes a new instance of <see cref="ConversationThreadClient"/> for mocking.</summary>
protected ConversationThreadClient()
{
ClientDiagnostics = null!;
}
}
}
Loading
Loading