Skip to content

Commit a7813ed

Browse files
elavarasidcwangrui-msftramneettung-msft
authored
[ACS Rooms] Public preview DotNet SDK changes. (Azure#30323)
* rooms .net sdk with newest library Revise rooms .net sdk with newest flatten interface and dedpenecies. Live tests succeed. * Change update room method remove the update of participants in updateRoom method. * Make rooms model internal * Add CommunicationUser Creation Create communication user through CommunicationIdentityClient instead of hard code. * Initial rbac based on new version api The rbac feature support SDK based on new version api * Version 2021-04-07 validation * Adding idempotency changes for the dotnet SDK for Rooms. * Adding recordings and making sure tests work with idempotency. * ACS Rooms Public preview changes. * Latest test run recording. * Fixing issue with no sample for GetParticipants being found. * Fixing recordings with new sample. * Removing version from install command. * Adding email project back to sln * Adjusting samples. * Exporting the Rooms API. * Addressed board review comment. Removing standard package import from readme. * Adjusting throwing argument exception when communication identifier is null. * Fixing snippets. * Fixing spelling mistakes. * Added Rooms overview * Removing system imports from snippets. * Addressed review comments * Added note for future to remove this file and refer to shared when rooms support all identifiers. * Updated method to get connectionString. * Added error message. * Using Azure.Core assertion for null check. * Simplify foreach loop. Co-authored-by: Rui Wang <[email protected]> Co-authored-by: Ramneet Tung <[email protected]>
1 parent 4d28253 commit a7813ed

File tree

76 files changed

+9924
-1
lines changed

Some content is hidden

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

76 files changed

+9924
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
- Initial Version of Rooms .net SDK.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Azure Communication Rooms client library for .NET
2+
3+
This package contains a C# SDK for the Rooms Service of Azure Communication Services.
4+
5+
Rooms overview
6+
Azure Communication Services (ACS) Rooms is a set of APIs, used by Contoso server applications to create a server-managed conversation space with fixed set of lifetime and participants, pre-defining rules from server-tier both who and when can communicate (like scheduled meeting creation).
7+
8+
With the Public Preview release of ACS Rooms, Contoso will be able to:
9+
create a meeting space with known time coordinates (start/end time),
10+
join voice/video calls within that meeting space using the ACS web calling SDK or native mobile calling SDKs,
11+
add participants to a room,
12+
assign pre-defined roles to room participants,
13+
set rooms call join policies (e.g., open or closed room), and
14+
consume Event Grid notifications for calling events.
15+
The server-side functionalities can be accessed via a refreshed API and a full set of SDKs (.NET, Java, Python, JavaScript/TypeScript).
16+
17+
The main scenarios where Rooms can best be used:
18+
Virtual Visits (e.g., telemedicine, remote financial advisor, virtual classroom, etc...)
19+
Virtual Events (e.g., live event, company all-hands, live concert, etc...)
20+
Champion scenarios
21+
22+
23+
[Source code][source] | [Package (NuGet)][package] | [Product documentation][product_docs]
24+
## Getting started
25+
26+
### Install the package
27+
Install the Azure Communication Rooms client library for .NET with [NuGet][nuget]:
28+
29+
```PowerShell
30+
dotnet add package Azure.Communication.Rooms
31+
```
32+
33+
### Prerequisites
34+
You need an [Azure subscription][azure_sub] and a [Communication Service Resource][communication_resource_docs] to use this package.
35+
36+
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].
37+
38+
### Key concepts
39+
`RoomsClient` provides the functionality to create room, update room, get room, delete room, add participants, remove participant, update participant and get participants.
40+
41+
### Using statements
42+
```C# Snippet:Azure_Communication_Rooms_Tests_UsingStatements
43+
using Azure.Communication.Rooms
44+
```
45+
46+
### Authenticate the client
47+
Rooms clients can be authenticated using the connection string acquired from an Azure Communication Resource in the [Azure Portal][azure_portal].
48+
49+
```C# Snippet:Azure_Communication_Rooms_Tests_Samples_CreateRoomsClient
50+
var connectionString = Environment.GetEnvironmentVariable("connection_string") // Find your Communication Services resource in the Azure portal
51+
RoomsClient client = new RoomsClient(connectionString);
52+
```
53+
54+
## Examples
55+
56+
The following sections provide several code snippets covering some of the most common tasks, which is available at Sample1_RoomsRequests.md
57+
58+
## Troubleshooting
59+
### Service Responses
60+
A `RequestFailedException` is thrown as a service response for any unsuccessful requests. The exception contains information about what response code was returned from the service.
61+
```C# Snippet:Azure_Communication_RoomsClient_Tests_Troubleshooting
62+
try
63+
{
64+
CommunicationIdentityClient communicationIdentityClient = CreateInstrumentedCommunicationIdentityClient();
65+
var communicationUser1 = communicationIdentityClient.CreateUserAsync().Result.Value.Id;
66+
var communicationUser2 = communicationIdentityClient.CreateUserAsync().Result.Value.Id;
67+
var validFrom = DateTime.UtcNow;
68+
var validUntil = validFrom.AddDays(1);
69+
List<RoomParticipant> createRoomParticipants = new List<RoomParticipant>();
70+
RoomParticipant participant1 = new RoomParticipant(new CommunicationUserIdentifier(communicationUser1), RoleType.Presenter);
71+
RoomParticipant participant2 = new RoomParticipant(new CommunicationUserIdentifier(communicationUser2), RoleType.Attendee);
72+
Response<CommunicationRoom> createRoomResponse = await roomsClient.CreateRoomAsync(validFrom, validUntil, RoomJoinPolicy.InviteOnly, createRoomParticipants);
73+
CommunicationRoom createRoomResult = createRoomResponse.Value;
74+
}
75+
catch (RequestFailedException ex)
76+
{
77+
Console.WriteLine(ex.Message);
78+
}
79+
```
80+
81+
## Next steps
82+
- [Read more about Rooms in Azure Communication Services][nextsteps]
83+
84+
## Contributing
85+
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].
86+
87+
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 [[email protected]][coc_contact] with any additional questions or comments.
88+
89+
<!-- LINKS -->
90+
[azure_sub]: https://azure.microsoft.com/free/dotnet/
91+
[azure_portal]: https://portal.azure.com
92+
[cla]: https://cla.microsoft.com
93+
[coc]: https://opensource.microsoft.com/codeofconduct/
94+
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
95+
[coc_contact]: mailto:[email protected]
96+
[communication_resource_docs]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
97+
[communication_resource_create_portal]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp
98+
[communication_resource_create_power_shell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice
99+
[communication_resource_create_net]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-net
100+
[product_docs]: https://docs.microsoft.com/azure/communication-services/overview
101+
[nuget]: https://www.nuget.org/
102+
103+
<!-- TODO -->
104+
Update the sample code links once the sdk is published
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
namespace Azure.Communication.Rooms
2+
{
3+
public partial class CommunicationRoom
4+
{
5+
internal CommunicationRoom() { }
6+
public System.DateTimeOffset? CreatedOn { get { throw null; } }
7+
public string Id { get { throw null; } }
8+
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Rooms.RoomParticipant> Participants { get { throw null; } }
9+
public Azure.Communication.Rooms.RoomJoinPolicy? RoomJoinPolicy { get { throw null; } }
10+
public System.DateTimeOffset? ValidFrom { get { throw null; } }
11+
public System.DateTimeOffset? ValidUntil { get { throw null; } }
12+
}
13+
public partial class ParticipantsCollection
14+
{
15+
internal ParticipantsCollection() { }
16+
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Rooms.RoomParticipant> Participants { get { throw null; } }
17+
}
18+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
19+
public readonly partial struct RoleType : System.IEquatable<Azure.Communication.Rooms.RoleType>
20+
{
21+
private readonly object _dummy;
22+
private readonly int _dummyPrimitive;
23+
public RoleType(string value) { throw null; }
24+
public static Azure.Communication.Rooms.RoleType Attendee { get { throw null; } }
25+
public static Azure.Communication.Rooms.RoleType Consumer { get { throw null; } }
26+
public static Azure.Communication.Rooms.RoleType Presenter { get { throw null; } }
27+
public bool Equals(Azure.Communication.Rooms.RoleType other) { throw null; }
28+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
29+
public override bool Equals(object obj) { throw null; }
30+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
31+
public override int GetHashCode() { throw null; }
32+
public static bool operator ==(Azure.Communication.Rooms.RoleType left, Azure.Communication.Rooms.RoleType right) { throw null; }
33+
public static implicit operator Azure.Communication.Rooms.RoleType (string value) { throw null; }
34+
public static bool operator !=(Azure.Communication.Rooms.RoleType left, Azure.Communication.Rooms.RoleType right) { throw null; }
35+
public override string ToString() { throw null; }
36+
}
37+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
38+
public readonly partial struct RoomJoinPolicy : System.IEquatable<Azure.Communication.Rooms.RoomJoinPolicy>
39+
{
40+
private readonly object _dummy;
41+
private readonly int _dummyPrimitive;
42+
public RoomJoinPolicy(string value) { throw null; }
43+
public static Azure.Communication.Rooms.RoomJoinPolicy CommunicationServiceUsers { get { throw null; } }
44+
public static Azure.Communication.Rooms.RoomJoinPolicy InviteOnly { get { throw null; } }
45+
public bool Equals(Azure.Communication.Rooms.RoomJoinPolicy other) { throw null; }
46+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47+
public override bool Equals(object obj) { throw null; }
48+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
49+
public override int GetHashCode() { throw null; }
50+
public static bool operator ==(Azure.Communication.Rooms.RoomJoinPolicy left, Azure.Communication.Rooms.RoomJoinPolicy right) { throw null; }
51+
public static implicit operator Azure.Communication.Rooms.RoomJoinPolicy (string value) { throw null; }
52+
public static bool operator !=(Azure.Communication.Rooms.RoomJoinPolicy left, Azure.Communication.Rooms.RoomJoinPolicy right) { throw null; }
53+
public override string ToString() { throw null; }
54+
}
55+
public partial class RoomParticipant
56+
{
57+
public RoomParticipant(Azure.Communication.CommunicationIdentifier communicationIdentifier) { }
58+
public RoomParticipant(Azure.Communication.CommunicationIdentifier communicationIdentifier, Azure.Communication.Rooms.RoleType role) { }
59+
public Azure.Communication.CommunicationIdentifier CommunicationIdentifier { get { throw null; } }
60+
public Azure.Communication.Rooms.RoleType? Role { get { throw null; } set { } }
61+
}
62+
public partial class RoomsClient
63+
{
64+
protected RoomsClient() { }
65+
public RoomsClient(string connectionString) { }
66+
public RoomsClient(string connectionString, Azure.Communication.Rooms.RoomsClientOptions options) { }
67+
public RoomsClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, Azure.Communication.Rooms.RoomsClientOptions options = null) { }
68+
public RoomsClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.Communication.Rooms.RoomsClientOptions options = null) { }
69+
public virtual Azure.Response AddParticipants(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
70+
public virtual System.Threading.Tasks.Task<Azure.Response> AddParticipantsAsync(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
71+
public virtual Azure.Response<Azure.Communication.Rooms.CommunicationRoom> CreateRoom(System.DateTimeOffset? validFrom = default(System.DateTimeOffset?), System.DateTimeOffset? validUntil = default(System.DateTimeOffset?), Azure.Communication.Rooms.RoomJoinPolicy? roomJoinPolicy = default(Azure.Communication.Rooms.RoomJoinPolicy?), System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
72+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Rooms.CommunicationRoom>> CreateRoomAsync(System.DateTimeOffset? validFrom = default(System.DateTimeOffset?), System.DateTimeOffset? validUntil = default(System.DateTimeOffset?), Azure.Communication.Rooms.RoomJoinPolicy? roomJoinPolicy = default(Azure.Communication.Rooms.RoomJoinPolicy?), System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
73+
public virtual Azure.Response DeleteRoom(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
74+
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteRoomAsync(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
75+
public virtual Azure.Response<Azure.Communication.Rooms.ParticipantsCollection> GetParticipants(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
76+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Rooms.ParticipantsCollection>> GetParticipantsAsync(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
77+
public virtual Azure.Response<Azure.Communication.Rooms.CommunicationRoom> GetRoom(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
78+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Rooms.CommunicationRoom>> GetRoomAsync(string roomId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
79+
public virtual Azure.Response RemoveParticipants(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> communicationIdentifiers, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
80+
public virtual System.Threading.Tasks.Task<Azure.Response> RemoveParticipantsAsync(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> communicationIdentifiers, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
81+
public virtual Azure.Response UpdateParticipants(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
82+
public virtual System.Threading.Tasks.Task<Azure.Response> UpdateParticipantsAsync(string roomId, System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
83+
public virtual Azure.Response<Azure.Communication.Rooms.CommunicationRoom> UpdateRoom(string roomId, System.DateTimeOffset? validFrom = default(System.DateTimeOffset?), System.DateTimeOffset? validUntil = default(System.DateTimeOffset?), Azure.Communication.Rooms.RoomJoinPolicy? roomJoinPolicy = default(Azure.Communication.Rooms.RoomJoinPolicy?), System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
84+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Rooms.CommunicationRoom>> UpdateRoomAsync(string roomId, System.DateTimeOffset? validFrom = default(System.DateTimeOffset?), System.DateTimeOffset? validUntil = default(System.DateTimeOffset?), Azure.Communication.Rooms.RoomJoinPolicy? roomJoinPolicy = default(Azure.Communication.Rooms.RoomJoinPolicy?), System.Collections.Generic.IEnumerable<Azure.Communication.Rooms.RoomParticipant> participants = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
85+
}
86+
public partial class RoomsClientOptions : Azure.Core.ClientOptions
87+
{
88+
public RoomsClientOptions(Azure.Communication.Rooms.RoomsClientOptions.ServiceVersion version = Azure.Communication.Rooms.RoomsClientOptions.ServiceVersion.V2022_02_01_Preview) { }
89+
public enum ServiceVersion
90+
{
91+
V2021_04_07_Preview = 1,
92+
V2022_02_01_Preview = 2,
93+
}
94+
}
95+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<Description>
4+
This Client library enables working with the Microsoft Azure Communication Rooms Service.
5+
</Description>
6+
<AssemblyTitle>Azure Communication Rooms Service</AssemblyTitle>
7+
<Version>1.0.0-beta.1</Version>
8+
<PackageTags>Microsoft Azure Communication Rooms Service;Microsoft;Azure;Azure Communication Service;Azure Communication Rooms Service;Rooms;Communication;$(PackageCommonTags)</PackageTags>
9+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
10+
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<None Include="..\README.md" Link="README.md" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="Azure.Core" />
19+
<PackageReference Include="System.Text.Json" />
20+
</ItemGroup>
21+
22+
<!-- Shared source from Azure.Core -->
23+
<ItemGroup>
24+
<Compile Include="..\..\Shared\src\ClientOptionsExtensions.cs" LinkBase="Shared\Communication" />
25+
<Compile Include="..\..\Shared\src\HMACAuthenticationPolicy.cs" LinkBase="Shared\Communication" />
26+
<Compile Include="$(AzureCoreSharedSources)ArrayBufferWriter.cs" LinkBase="Shared" />
27+
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared" />
28+
<Compile Include="$(AzureCoreSharedSources)ConnectionString.cs" LinkBase="Shared" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<PackageReference Include="Azure.Communication.Common" />
33+
</ItemGroup>
34+
</Project>

sdk/communication/Azure.Communication.Rooms/src/Generated/Models/AddParticipantsRequest.Serialization.cs

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)