diff --git a/src/Cronofy/Responses/UserInfoResponse.cs b/src/Cronofy/Responses/UserInfoResponse.cs
index fa9ff56..5724fd1 100644
--- a/src/Cronofy/Responses/UserInfoResponse.cs
+++ b/src/Cronofy/Responses/UserInfoResponse.cs
@@ -1,4 +1,4 @@
-namespace Cronofy.Responses
+namespace Cronofy.Responses
{
using System;
using System.Linq;
@@ -46,6 +46,7 @@ public UserInfo ToUserInfo()
Sub = this.Sub,
CronofyType = this.CronofyType,
Profiles = this.Data?.Profiles?.Select((p) => p.ToProfile()).ToArray(),
+ ConferencingProfiles = this.Data?.ConferencingProfiles?.Select((cp) => cp.ToConferencingProfile()).ToArray(),
ServiceAccountInfo = this.Data?.ServiceAccount?.ToServiceAccount(),
AuthorizationInfo = this.Data?.Authorization?.ToAuthorization(),
Email = this.Email,
@@ -77,7 +78,14 @@ internal sealed class CronofyData
/// The profiles.
[JsonProperty("profiles")]
public ProfileResponse[] Profiles { get; set; }
- }
+
+ ///
+ /// Gets or sets the profiles.
+ ///
+ /// The conferencing profiles.
+ [JsonProperty("conferencing_profiles")]
+ public ConferencingProfileResponse[] ConferencingProfiles { get; set; }
+ }
///
/// Class for the deserialization of a service account within a UserProfile.
@@ -264,5 +272,76 @@ public UserInfo.Profile ToProfile()
};
}
}
- }
+
+ ///
+ /// Class for the deserialization of a conferencing profile response.
+ ///
+ internal sealed class ConferencingProfileResponse
+ {
+ ///
+ /// Gets or sets the name of the provider.
+ ///
+ ///
+ /// The name of the provider.
+ ///
+ [JsonProperty("provider_name")]
+ public string ProviderName { get; set; }
+
+ ///
+ /// Gets or sets the ID of the profile.
+ ///
+ ///
+ /// The ID of the profile.
+ ///
+ [JsonProperty("profile_id")]
+ public string ProfileId { get; set; }
+
+ ///
+ /// Gets or sets the name of the profile.
+ ///
+ ///
+ /// The name of the profile.
+ ///
+ [JsonProperty("profile_name")]
+ public string ProfileName { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether this profile is
+ /// connected.
+ ///
+ ///
+ /// true if the profile is connected; otherwise,
+ /// false.
+ ///
+ [JsonProperty("profile_connected")]
+ public bool ProfileConnected { get; set; }
+
+ ///
+ /// Gets or sets the relink URL for the profile.
+ ///
+ ///
+ /// The relink URL for the profile.
+ ///
+ [JsonProperty("profile_relink_url")]
+ public string ProfileRelinkUrl { get; set; }
+
+ ///
+ /// Converts the response into a .
+ ///
+ ///
+ /// A based upon the response.
+ ///
+ public UserInfo.ConferencingProfile ToConferencingProfile()
+ {
+ return new UserInfo.ConferencingProfile
+ {
+ ProviderName = this.ProviderName,
+ Id = this.ProfileId,
+ Name = this.ProfileName,
+ Connected = this.ProfileConnected,
+ RelinkUrl = this.ProfileRelinkUrl,
+ };
+ }
+ }
+ }
}
diff --git a/src/Cronofy/UserInfo.cs b/src/Cronofy/UserInfo.cs
index 1938be8..008d7aa 100644
--- a/src/Cronofy/UserInfo.cs
+++ b/src/Cronofy/UserInfo.cs
@@ -1,4 +1,4 @@
-namespace Cronofy
+namespace Cronofy
{
using System.Linq;
@@ -29,6 +29,12 @@ public class UserInfo
/// The profiles.
public Profile[] Profiles { get; set; }
+ ///
+ /// Gets or sets the profiles.
+ ///
+ /// The conferencing profiles.
+ public ConferencingProfile[] ConferencingProfiles { get; set; }
+
///
/// Gets or sets the authorization of the account.
///
@@ -85,6 +91,7 @@ public bool Equals(UserInfo other)
&& this.Sub == other.Sub
&& this.CronofyType == other.CronofyType
&& EnumerableUtils.NullTolerantSequenceEqual(this.Profiles, other.Profiles)
+ && EnumerableUtils.NullTolerantSequenceEqual(this.ConferencingProfiles, other.ConferencingProfiles)
&& object.Equals(this.AuthorizationInfo, other.AuthorizationInfo)
&& object.Equals(this.ServiceAccountInfo, other.ServiceAccountInfo)
&& this.Email == other.Email;
@@ -225,85 +232,189 @@ public override string ToString()
}
///
- /// Class representing an authorization for an account.
+ /// Class representing a conferencing profile for an account.
///
- public sealed class Authorization
+ public sealed class ConferencingProfile
{
- ///
- /// Gets or sets the scope of the authorization of the account.
- ///
- ///
- /// The scope of the authorization for the account.
- ///
- public string Scope { get; set; }
-
- ///
- /// Gets or sets the status of the authorization of the account.
- ///
- ///
- /// The status of the authorization for the account.
- ///
- public string Status { get; set; }
-
- ///
- /// Gets or sets the delegated scope of the account.
- ///
- ///
- /// The delegated scope of the account.
- ///
- public string DelegatedScope { get; set; }
+ ///
+ /// Gets or sets the name of the provider of the profile.
+ ///
+ ///
+ /// The name of the provider for the profile.
+ ///
+ public string ProviderName { get; set; }
+
+ ///
+ /// Gets or sets the ID of the profile.
+ ///
+ ///
+ /// The ID of the profile.
+ ///
+ public string Id { get; set; }
+
+ ///
+ /// Gets or sets the name of the profile.
+ ///
+ ///
+ /// The name of the profile.
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether this profile is connected.
+ ///
+ ///
+ /// true if this profile is connected; otherwise, false.
+ ///
+ public bool Connected { get; set; }
+
+ ///
+ /// Gets or sets the relink URL for the profile.
+ ///
+ ///
+ /// The relink URL for the profile.
+ ///
+ ///
+ /// null unless is false.
+ ///
+ public string RelinkUrl { get; set; }
+
+ ///
+ public override int GetHashCode()
+ {
+ return this.Id.GetHashCode();
+ }
+
+ ///
+ public override bool Equals(object obj)
+ {
+ var other = obj as ConferencingProfile;
- ///
- public override int GetHashCode()
+ if (other == null)
{
- return this.Scope.GetHashCode();
+ return false;
}
- ///
- public override bool Equals(object obj)
- {
- var other = obj as Authorization;
+ return this.Equals(other);
+ }
+
+ ///
+ /// Determines whether the specified is
+ /// equal to the current .
+ ///
+ ///
+ /// The to compare with the current
+ /// .
+ ///
+ ///
+ /// true if the specified is equal
+ /// to the current ; otherwise,
+ /// false.
+ ///
+ public bool Equals(ConferencingProfile other)
+ {
+ return other != null
+ && this.Id == other.Id
+ && this.Name == other.Name
+ && this.ProviderName == other.ProviderName
+ && this.Connected == other.Connected
+ && this.RelinkUrl == other.RelinkUrl;
+ }
+
+ ///
+ public override string ToString()
+ {
+ return string.Format(
+ "<{0} ProviderName={1}, Id={2}, Name={3}, Connected={4}, RelinkUrl={5}>",
+ this.GetType(),
+ this.ProviderName,
+ this.Id,
+ this.Name,
+ this.Connected,
+ this.RelinkUrl);
+ }
+ }
- if (other == null)
+ ///
+ /// Class representing an authorization for an account.
+ ///
+ public sealed class Authorization
+ {
+ ///
+ /// Gets or sets the scope of the authorization of the account.
+ ///
+ ///
+ /// The scope of the authorization for the account.
+ ///
+ public string Scope { get; set; }
+
+ ///
+ /// Gets or sets the status of the authorization of the account.
+ ///
+ ///
+ /// The status of the authorization for the account.
+ ///
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets the delegated scope of the account.
+ ///
+ ///
+ /// The delegated scope of the account.
+ ///
+ public string DelegatedScope { get; set; }
+
+ ///
+ public override int GetHashCode()
{
- return false;
+ return this.Scope.GetHashCode();
}
- return this.Equals(other);
- }
+ ///
+ public override bool Equals(object obj)
+ {
+ var other = obj as Authorization;
- ///
- /// Determines whether the specified is
- /// equal to the current .
- ///
- ///
- /// The to compare with the current
- /// .
- ///
- ///
- /// true if the specified is equal
- /// to the current ; otherwise,
- /// false.
- ///
- public bool Equals(Authorization other)
- {
- return other != null
- && this.Scope == other.Scope
- && this.Status == other.Status
- && this.DelegatedScope == other.DelegatedScope;
- }
+ if (other == null)
+ {
+ return false;
+ }
- ///
- public override string ToString()
- {
- return string.Format(
- "<{0} Scope={1}, Status={2}, DelegatedScope={3}>",
- this.GetType(),
- this.Scope,
- this.Status,
- this.DelegatedScope);
+ return this.Equals(other);
+ }
+
+ ///
+ /// Determines whether the specified is
+ /// equal to the current .
+ ///
+ ///
+ /// The to compare with the current
+ /// .
+ ///
+ ///
+ /// true if the specified is equal
+ /// to the current ; otherwise,
+ /// false.
+ ///
+ public bool Equals(Authorization other)
+ {
+ return other != null
+ && this.Scope == other.Scope
+ && this.Status == other.Status
+ && this.DelegatedScope == other.DelegatedScope;
+ }
+
+ ///
+ public override string ToString()
+ {
+ return string.Format(
+ "<{0} Scope={1}, Status={2}, DelegatedScope={3}>",
+ this.GetType(),
+ this.Scope,
+ this.Status,
+ this.DelegatedScope);
+ }
}
- }
///
/// Class representing additional information from the service account authorization.
diff --git a/test/Cronofy.Test/CronofyAccountClientTests/GetUserInfo.cs b/test/Cronofy.Test/CronofyAccountClientTests/GetUserInfo.cs
index ce6b3ab..a38e55e 100644
--- a/test/Cronofy.Test/CronofyAccountClientTests/GetUserInfo.cs
+++ b/test/Cronofy.Test/CronofyAccountClientTests/GetUserInfo.cs
@@ -1,4 +1,4 @@
-namespace Cronofy.Test.CronofyAccountClientTests
+namespace Cronofy.Test.CronofyAccountClientTests
{
using NUnit.Framework;
@@ -74,7 +74,22 @@ public void CanGetUserInfoForAccount()
""calendar_attachments_available"": true,
""permission_level"": ""sandbox""
}
- ]
+ ],
+ }
+ ],
+ ""conferencing_profiles"": [
+ {
+ ""provider_name"": ""zoom"",
+ ""profile_id"": ""pro_jknsdfk234"",
+ ""profile_name"": ""example@cronofy.com"",
+ ""profile_connected"": true
+ },
+ {
+ ""provider_name"": ""go_to"",
+ ""profile_id"": ""pro_gfmdsg51qa"",
+ ""profile_name"": ""example@cronofy.com"",
+ ""profile_connected"": false,
+ ""profile_relink_url"": ""https://app.cronofy.com/v2/relink/go_to?email=example%40cronofy.com""
}
]
}
@@ -161,6 +176,24 @@ public void CanGetUserInfoForAccount()
},
},
},
+ ConferencingProfiles = new UserInfo.ConferencingProfile[]
+ {
+ new UserInfo.ConferencingProfile
+ {
+ Connected = true,
+ Id = "pro_jknsdfk234",
+ Name = "example@cronofy.com",
+ ProviderName = "zoom",
+ },
+ new UserInfo.ConferencingProfile
+ {
+ Connected = false,
+ Id = "pro_gfmdsg51qa",
+ Name = "example@cronofy.com",
+ RelinkUrl = "https://app.cronofy.com/v2/relink/go_to?email=example%40cronofy.com",
+ ProviderName = "go_to",
+ },
+ },
Email = "janed@company.com",
};