Skip to content
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

[Communication] - Simplify identifier json models #18389

Merged
merged 2 commits into from
Feb 3, 2021
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
namespace Azure.Communication
{
public partial class CallingApplicationIdentifier : Azure.Communication.CommunicationIdentifier
{
public CallingApplicationIdentifier(string id) { }
public string Id { get { throw null; } }
public override bool Equals(Azure.Communication.CommunicationIdentifier other) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct CommunicationCloudEnvironment : System.IEquatable<Azure.Communication.CommunicationCloudEnvironment>
{
Expand Down Expand Up @@ -56,20 +48,20 @@ public CommunicationUserIdentifier(string id) { }
}
public partial class MicrosoftTeamsUserIdentifier : Azure.Communication.CommunicationIdentifier
{
public MicrosoftTeamsUserIdentifier(string userId, bool isAnonymous = false, string id = null, Azure.Communication.CommunicationCloudEnvironment? cloud = default(Azure.Communication.CommunicationCloudEnvironment?)) { }
public MicrosoftTeamsUserIdentifier(string userId, bool isAnonymous = false, Azure.Communication.CommunicationCloudEnvironment? cloud = default(Azure.Communication.CommunicationCloudEnvironment?), string rawId = null) { }
public Azure.Communication.CommunicationCloudEnvironment Cloud { get { throw null; } }
public string Id { get { throw null; } }
public bool IsAnonymous { get { throw null; } }
public string RawId { get { throw null; } }
public string UserId { get { throw null; } }
public override bool Equals(Azure.Communication.CommunicationIdentifier other) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public partial class PhoneNumberIdentifier : Azure.Communication.CommunicationIdentifier
{
public PhoneNumberIdentifier(string phoneNumber, string id = null) { }
public string Id { get { throw null; } }
public PhoneNumberIdentifier(string phoneNumber, string rawId = null) { }
public string PhoneNumber { get { throw null; } }
public string RawId { get { throw null; } }
public override bool Equals(Azure.Communication.CommunicationIdentifier other) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Azure.Communication
/// <summary>Represents a Microsoft Teams user.</summary>
public class MicrosoftTeamsUserIdentifier : CommunicationIdentifier
{
/// <summary>The full id of the Microsoft Teams User identifier.</summary>
public string Id { get; }
/// <summary>The optional raw id of the Microsoft Teams User identifier.</summary>
public string RawId { get; }

/// <summary>The id of the Microsoft Teams user. If the user isn't anonymous, the id is the AAD object id of the user.</summary>
public string UserId { get; }
Expand All @@ -25,21 +25,21 @@ public class MicrosoftTeamsUserIdentifier : CommunicationIdentifier
/// </summary>
/// <param name="userId">Id of the Microsoft Teams user. If the user isn't anonymous, the id is the AAD object id of the user.</param>
/// <param name="isAnonymous">Set this to true if the user is anonymous, for example when joining a meeting with a share link.</param>
/// <param name="id">Full id of the Microsoft Teams user, optional.</param>
/// <param name="cloud">The cloud that the Microsoft Team user belongs to. A null value translates to the Public cloud.</param>
/// <param name="rawId">Full id of the Microsoft Teams user, optional.</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when the <paramref name="userId"/> is null.
/// </exception>
/// <exception cref="System.ArgumentException">
/// Thrown when the <paramref name="userId"/> is empty.
/// </exception>
public MicrosoftTeamsUserIdentifier(string userId, bool isAnonymous = false, string id = null, CommunicationCloudEnvironment? cloud = null)
public MicrosoftTeamsUserIdentifier(string userId, bool isAnonymous = false, CommunicationCloudEnvironment? cloud = null, string rawId = null)
{
Argument.AssertNotNullOrEmpty(userId, nameof(userId));
UserId = userId;
IsAnonymous = isAnonymous;
Cloud = cloud ?? CommunicationCloudEnvironment.Public;
Id = id;
RawId = rawId;
}

/// <inheritdoc />
Expand All @@ -54,6 +54,6 @@ public override bool Equals(CommunicationIdentifier other)
&& otherId.UserId == UserId
&& otherId.IsAnonymous == IsAnonymous
&& otherId.Cloud == Cloud
&& (Id is null || otherId.Id is null || Id == otherId.Id);
&& (RawId is null || otherId.RawId is null || RawId == otherId.RawId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ namespace Azure.Communication
/// <summary>Represents a Phone Number.</summary>
public class PhoneNumberIdentifier : CommunicationIdentifier
{
/// <summary>The full id of the phone number.</summary>
public string Id { get; }
/// <summary>The optional raw id of the phone number.</summary>
public string RawId { get; }

/// <summary>The phone number in E.164 format.</summary>
public string PhoneNumber { get; }

/// <summary> Initializes a new instance of <see cref="PhoneNumberIdentifier"/>.</summary>
/// <param name="phoneNumber">The phone number in E.164 format.</param>
/// <param name="id">Full id of the phone number.</param>
/// <param name="rawId">Full id of the phone number, optional.</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when the <paramref name="phoneNumber"/> is null.
/// </exception>
/// <exception cref="System.ArgumentException">
/// Thrown when the <paramref name="phoneNumber"/> is empty.
/// </exception>
public PhoneNumberIdentifier(string phoneNumber, string id = null)
public PhoneNumberIdentifier(string phoneNumber, string rawId = null)
{
Argument.AssertNotNullOrEmpty(phoneNumber, nameof(phoneNumber));
PhoneNumber = phoneNumber;
Id = id;
RawId = rawId;
}

/// <inheritdoc />
Expand All @@ -38,6 +38,6 @@ public PhoneNumberIdentifier(string phoneNumber, string id = null)

/// <inheritdoc />
public override bool Equals(CommunicationIdentifier other)
=> other is PhoneNumberIdentifier otherId && otherId.PhoneNumber == PhoneNumber && (Id is null || otherId.Id is null || Id == otherId.Id);
=> other is PhoneNumberIdentifier otherId && otherId.PhoneNumber == PhoneNumber && (RawId is null || otherId.RawId is null || RawId == otherId.RawId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<Compile Include="$(AzureCoreSharedSources)ConnectionString.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\HMACAuthenticationPolicy.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\CommunicationBearerTokenCredential.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\CommunicationIdentifierKind.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\CommunicationIdentifierModel.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\CommunicationIdentifierSerializer.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="..\..\Shared\src\CommunicationCloudEnvironmentModel.cs" Link="Shared\Communication\%(RecursiveDir)\%(Filename)%(Extension)" />
Expand Down
Loading