803 lines
25 KiB
C#
803 lines
25 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using xCommons.Extensions;
|
|
using xHttpService.Constants;
|
|
using xIdentityModels.Constants;
|
|
using xIdentityModels.Dtos;
|
|
using xIdentityModels.Models;
|
|
using xIdentityModels.Navigations;
|
|
using xIdentityService.Constants;
|
|
|
|
namespace xIdentityService.Providers {
|
|
public partial class XIdentityProvider {
|
|
//
|
|
#region Friendship ...
|
|
/// <summary>
|
|
/// Follow a User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<XFriendshipFollowing> Follow (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.Follow,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollowing> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cancel Following Request
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>a boolean value</returns>
|
|
public async Task<bool> Cancel (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.Cancel,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<bool> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unfollow a Follower
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns></returns>
|
|
public async Task UnFollowFollower (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.UnFollowFollower,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<object> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unfollow Following
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns></returns>
|
|
public async Task UnFollowFollowing (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.UnFollowFollowing,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<object> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Block a Follower
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<XFriendshipFollowing> Block (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.Block,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollowing> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unblock a Blocked User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<XFriendshipFollowing> UnBlock (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.UnBlock,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollowing> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Accept a Following Request
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollower</see></returns>
|
|
public async Task<XFriendshipFollower> AcceptRequest (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.AcceptRequest,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollower> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reject a Following Request
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollower</see></returns>
|
|
public async Task<XFriendshipFollower> RejectRequest (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.RejectRequest,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollower> (
|
|
client,
|
|
request,
|
|
XHttpMethod.POST
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check a User IsFollower of Requested User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>a boolean value</returns>
|
|
public async Task<bool> IsFollower (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.IsFollower,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<bool> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Specific Follower
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollower</see></returns>
|
|
public async Task<XFriendshipFollower> GetFollower (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.Follower,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollower> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Follower State of a User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipState</see></returns>
|
|
public async Task<XFriendshipState> GetFollowerState (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.FollowerState,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipState> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Followers List Of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of <see>XFriendshipFollower</see></returns>
|
|
public async Task<IEnumerable<XFriendshipFollower>> GetFollowers (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.Followers);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<XFriendshipFollower>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get All Followers List Includes Blocked, Requested and etc
|
|
/// of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of <see>XFriendshipFollower</see></returns>
|
|
public async Task<IEnumerable<XFriendshipFollower>> GetAllFollowers (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.AllFollowers);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<XFriendshipFollower>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check a User is in Followings of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>a boolean value</returns>
|
|
public async Task<bool> IsFollowing (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.IsFollowing,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<bool> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Specific Following Model
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<XFriendshipFollowing> GetFollowing (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.Following,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipFollowing> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Following State Relation between Specific User
|
|
/// and Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipState</see></returns>
|
|
public async Task<XFriendshipState> GetFollowingState (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.FollowingState,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipState> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Followings of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<IEnumerable<XFriendshipFollowing>> GetFollowings (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.Followings);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<XFriendshipFollowing>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get All Following List Includes Blocked, Requested and etc
|
|
/// of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of <see>XFriendshipFollowing</see></returns>
|
|
public async Task<IEnumerable<XFriendshipFollowing>> GetAllFollowings (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.AllFollowings);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<XFriendshipFollowing>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return Following UserName's List of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of UserNames</returns>
|
|
public async Task<IEnumerable<string>> GetFollowingList (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.FollowingsList);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<string>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return Followers UserName's List of Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <returns>a collection of UserNames</returns>
|
|
public async Task<IEnumerable<string>> GetFollowersList (
|
|
XTokenResponse tokens
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (tokens.AccessToken)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (XApiAccountEndpoint.FollowersList);
|
|
|
|
//
|
|
var response = await RunRestRequest<IEnumerable<string>> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Friendship Info Model between Specific User and Current User
|
|
/// </summary>
|
|
/// <param name="tokens">Authentication Tokens</param>
|
|
/// <param name="destUser">a user identifier which represent destination user</param>
|
|
/// <returns>an instance of <see>XFriendshipInfoDto</see></returns>
|
|
public async Task<XFriendshipInfoDto> GetFriendshipInfo (
|
|
XTokenResponse tokens,
|
|
string destUser
|
|
) {
|
|
//
|
|
// Validate Args ...
|
|
await validationProvider
|
|
.GroupValidationBuilder ()
|
|
.AddNotNull (tokens)
|
|
.AddNotEmpty (
|
|
destUser,
|
|
tokens.AccessToken
|
|
)
|
|
.ValidateGroupAsync ();
|
|
|
|
//
|
|
var client = GetRestClient (tokens);
|
|
|
|
//
|
|
var request = GetRestRequet (
|
|
XApiAccountEndpoint.FriendshipInfo,
|
|
@params : new Dictionary<string, string> { { XParam.XDestUser.GetStringValue (), destUser }
|
|
}
|
|
);
|
|
|
|
//
|
|
var response = await RunRestRequest<XFriendshipInfoDto> (
|
|
client,
|
|
request,
|
|
XHttpMethod.GET
|
|
);
|
|
return response;
|
|
}
|
|
#endregion
|
|
}
|
|
} |