Skip to content

Commit bfa6827

Browse files
authored
Add Unified Messaging for private preview (Azure#49343)
1 parent 51a402c commit bfa6827

File tree

106 files changed

+20866
-1183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+20866
-1183
lines changed

sdk/communication/Azure.Communication.Messages/CHANGELOG.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Release History
22

3-
## 1.2.0-beta.2 (Unreleased)
3+
## 1.3.0-beta.1 (2025-04-14)
44

55
### Features Added
66

7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
7+
- Add Unified Messaging.
128

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

sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.net8.0.cs

+413-14
Large diffs are not rendered by default.

sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs

+413-14
Large diffs are not rendered by default.

sdk/communication/Azure.Communication.Messages/assets.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/communication/Azure.Communication.Messages",
5-
"Tag": "net/communication/Azure.Communication.Messages_52c3e6b22c"
5+
"Tag": "net/communication/Azure.Communication.Messages_b18dc81742"
66
}

sdk/communication/Azure.Communication.Messages/src/Azure.Communication.Messages.csproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
This client library enables working with the Microsoft Azure Communication Messages service.
66
</Description>
77
<AssemblyTitle>Azure Communication Messages Service</AssemblyTitle>
8-
<Version>1.2.0-beta.2</Version>
8+
<Version>1.3.0-beta.1</Version>
99
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
1010
<ApiCompatVersion>1.1.0</ApiCompatVersion>
1111
<PackageTags>Microsoft Azure Communication Messages Service;Microsoft;Azure;Azure Communication Service;Azure Communication Messages Service;Messages;Communication</PackageTags>
1212
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
1313
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
14+
<NoWarn>$(NoWarn);AZC0007</NoWarn>
15+
<NoWarn>$(NoWarn);AZC0030</NoWarn>
1416
</PropertyGroup>
1517

1618
<ItemGroup>
1719
<Compile Include="..\..\Shared\src\ClientOptionsExtensions.cs" LinkBase="Shared\Communication" />
1820
<Compile Include="..\..\Shared\src\HMACAuthenticationPolicy.cs" LinkBase="Shared\Communication" />
21+
<Compile Include="..\..\Shared\src\CommunicationBearerTokenCredential.cs" LinkBase="Shared\Communication" />
1922
<Compile Include="$(AzureCoreSharedSources)ConnectionString.cs" LinkBase="Shared" />
2023
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared" />
2124
</ItemGroup>
@@ -25,4 +28,4 @@
2528
<PackageReference Include="Azure.Communication.Common" />
2629
</ItemGroup>
2730

28-
</Project>
31+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Threading.Tasks;
6+
using System.Threading;
7+
using Azure.Communication.Pipeline;
8+
using Azure.Core;
9+
using Azure.Core.Pipeline;
10+
11+
namespace Azure.Communication.Messages
12+
{
13+
/// <summary>
14+
/// The Azure Communication Services Conversation Adminstration client.
15+
/// </summary>
16+
17+
public partial class ConversationAdministrationClient
18+
{
19+
#region public constructors
20+
21+
/// <summary>
22+
/// Initializes a new instance of <see cref="ConversationAdministrationClient"/>.
23+
/// </summary>
24+
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
25+
public ConversationAdministrationClient(string connectionString)
26+
: this(
27+
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
28+
new CommunicationMessagesClientOptions())
29+
{
30+
}
31+
32+
/// <summary> Initializes a new instance of <see cref="ConversationAdministrationClient"/>.</summary>
33+
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
34+
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
35+
public ConversationAdministrationClient(string connectionString, CommunicationMessagesClientOptions options)
36+
: this(
37+
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
38+
options ?? new CommunicationMessagesClientOptions())
39+
{
40+
}
41+
42+
/// <summary> Initializes a new instance of <see cref="ConversationAdministrationClient"/>.</summary>
43+
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
44+
/// <param name="credential">The <see cref="AzureKeyCredential"/> used to authenticate requests.</param>
45+
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
46+
public ConversationAdministrationClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options = default)
47+
: this(
48+
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
49+
Argument.CheckNotNull(credential, nameof(credential)),
50+
options ?? new CommunicationMessagesClientOptions())
51+
{
52+
_keyCredential = credential;
53+
}
54+
55+
/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
56+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
57+
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
58+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
59+
public ConversationAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions())
60+
{
61+
}
62+
63+
/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
64+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
65+
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
66+
/// <param name="options"> The options for configuring the client. </param>
67+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
68+
public ConversationAdministrationClient(Uri endpoint, TokenCredential credential, CommunicationMessagesClientOptions options)
69+
{
70+
Argument.AssertNotNull(endpoint, nameof(endpoint));
71+
Argument.AssertNotNull(credential, nameof(credential));
72+
options ??= new CommunicationMessagesClientOptions();
73+
74+
ClientDiagnostics = new ClientDiagnostics(options, true);
75+
_tokenCredential = credential;
76+
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier());
77+
_endpoint = endpoint;
78+
_apiVersion = options.Version;
79+
}
80+
81+
#endregion
82+
83+
#region private constructors
84+
private ConversationAdministrationClient(ConnectionString connectionString, CommunicationMessagesClientOptions options)
85+
: this(new Uri(connectionString.GetRequired("endpoint")), options.BuildHttpPipeline(connectionString), options)
86+
{ }
87+
88+
private ConversationAdministrationClient(string endpoint, AzureKeyCredential keyCredential, CommunicationMessagesClientOptions options)
89+
: this(new Uri(endpoint), options.BuildHttpPipeline(keyCredential), options)
90+
{ }
91+
92+
private ConversationAdministrationClient(Uri endpoint, HttpPipeline httpPipeline, CommunicationMessagesClientOptions options)
93+
{
94+
ClientDiagnostics = new ClientDiagnostics(options);
95+
_pipeline = httpPipeline;
96+
_endpoint = endpoint;
97+
_apiVersion = options.Version;
98+
}
99+
100+
#endregion
101+
102+
/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
103+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
104+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
105+
internal ConversationAdministrationClient(Uri endpoint) : this(endpoint, new CommunicationMessagesClientOptions())
106+
{
107+
}
108+
109+
/// <summary> Initializes a new instance of ConversationManagementClient. </summary>
110+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
111+
/// <param name="options"> The options for configuring the client. </param>
112+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
113+
internal ConversationAdministrationClient(Uri endpoint, CommunicationMessagesClientOptions options)
114+
{
115+
Argument.AssertNotNull(endpoint, nameof(endpoint));
116+
options ??= new CommunicationMessagesClientOptions();
117+
118+
ClientDiagnostics = new ClientDiagnostics(options, true);
119+
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), Array.Empty<HttpPipelinePolicy>(), new ResponseClassifier());
120+
_endpoint = endpoint;
121+
_apiVersion = options.Version;
122+
}
123+
124+
/// <summary>Initializes a new instance of <see cref="ConversationAdministrationClient"/> for mocking.</summary>
125+
protected ConversationAdministrationClient()
126+
{
127+
ClientDiagnostics = null!;
128+
}
129+
}
130+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Net;
6+
using Azure.Communication.Pipeline;
7+
using Azure.Core;
8+
using Azure.Core.Pipeline;
9+
10+
namespace Azure.Communication.Messages
11+
{
12+
/// <summary>
13+
/// The Azure Communication Services Conversation Thread client.
14+
/// </summary>
15+
16+
public partial class ConversationThreadClient
17+
{
18+
#region public constructors
19+
20+
/// <summary>
21+
/// Initializes a new instance of <see cref="ConversationThreadClient"/>.
22+
/// </summary>
23+
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
24+
internal ConversationThreadClient(string connectionString)
25+
: this(
26+
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
27+
new CommunicationMessagesClientOptions())
28+
{
29+
}
30+
31+
/// <summary> Initializes a new instance of <see cref="ConversationThreadClient"/>.</summary>
32+
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
33+
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
34+
internal ConversationThreadClient(string connectionString, CommunicationMessagesClientOptions options)
35+
: this(
36+
ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))),
37+
options ?? new CommunicationMessagesClientOptions())
38+
{
39+
}
40+
41+
/// <summary> Initializes a new instance of <see cref="ConversationThreadClient"/>.</summary>
42+
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
43+
/// <param name="credential">The <see cref="AzureKeyCredential"/> used to authenticate requests.</param>
44+
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
45+
internal ConversationThreadClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options = default)
46+
: this(
47+
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
48+
Argument.CheckNotNull(credential, nameof(credential)),
49+
options ?? new CommunicationMessagesClientOptions())
50+
{
51+
_keyCredential = credential;
52+
}
53+
54+
/// <summary>
55+
/// Initializes a new instance of the <see cref="ConversationThreadClient"/> class.
56+
/// </summary>
57+
/// <param name="endpoint">The URI of the Azure Communication Services resource.</param>
58+
/// <param name="communicationTokenCredential">The <see cref="CommunicationTokenCredential"/> used to authenticate requests.</param>
59+
/// <param name="options">Client options exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
60+
public ConversationThreadClient(Uri endpoint, CommunicationTokenCredential communicationTokenCredential, CommunicationMessagesClientOptions options = default)
61+
: this(
62+
Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri,
63+
Argument.CheckNotNull(communicationTokenCredential, nameof(communicationTokenCredential)),
64+
options ?? new CommunicationMessagesClientOptions())
65+
{
66+
_tokenCredential = new CommunicationBearerTokenCredential(communicationTokenCredential);
67+
}
68+
69+
#endregion
70+
71+
#region private constructors
72+
private ConversationThreadClient(ConnectionString connectionString, CommunicationMessagesClientOptions options)
73+
: this(new Uri(connectionString.GetRequired("endpoint")), options.BuildHttpPipeline(connectionString), options)
74+
{ }
75+
76+
private ConversationThreadClient(string endpoint, AzureKeyCredential keyCredential, CommunicationMessagesClientOptions options)
77+
: this(new Uri(endpoint), options.BuildHttpPipeline(keyCredential), options)
78+
{ }
79+
80+
private ConversationThreadClient(string endpoint, CommunicationTokenCredential communicationTokenCredential, CommunicationMessagesClientOptions options)
81+
: this(new Uri(endpoint), options.BuildHttpPipeline(new CommunicationBearerTokenCredential(communicationTokenCredential)), options)
82+
{
83+
}
84+
85+
private ConversationThreadClient(Uri endpoint, HttpPipeline httpPipeline, CommunicationMessagesClientOptions options)
86+
{
87+
ClientDiagnostics = new ClientDiagnostics(options);
88+
_pipeline = httpPipeline;
89+
_endpoint = endpoint;
90+
_apiVersion = options.Version;
91+
}
92+
93+
#endregion
94+
95+
/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
96+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
97+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
98+
internal ConversationThreadClient(Uri endpoint) : this(endpoint, new CommunicationMessagesClientOptions())
99+
{
100+
}
101+
102+
/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
103+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
104+
/// <param name="options"> The options for configuring the client. </param>
105+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> is null. </exception>
106+
internal ConversationThreadClient(Uri endpoint, CommunicationMessagesClientOptions options)
107+
{
108+
Argument.AssertNotNull(endpoint, nameof(endpoint));
109+
options ??= new CommunicationMessagesClientOptions();
110+
111+
ClientDiagnostics = new ClientDiagnostics(options, true);
112+
_pipeline = HttpPipelineBuilder.Build(options, Array.Empty<HttpPipelinePolicy>(), Array.Empty<HttpPipelinePolicy>(), new ResponseClassifier());
113+
_endpoint = endpoint;
114+
_apiVersion = options.Version;
115+
}
116+
117+
/// <summary> Initializes a new instance of ConversationMessagesClient. </summary>
118+
/// <param name="endpoint"> The communication resource, for example https://my-resource.communication.azure.com. </param>
119+
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
120+
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
121+
internal ConversationThreadClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions())
122+
{
123+
}
124+
125+
/// <summary>Initializes a new instance of <see cref="ConversationThreadClient"/> for mocking.</summary>
126+
protected ConversationThreadClient()
127+
{
128+
ClientDiagnostics = null!;
129+
}
130+
}
131+
}

0 commit comments

Comments
 (0)