last ...
This commit is contained in:
@@ -64,6 +64,12 @@ namespace xIdentityService.Constants
|
||||
SetAvatar,
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Search ...
|
||||
[StringValue("Account/OpenToSearch/Query")]
|
||||
QueryOpenToSearchProfiles,
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Registration ...
|
||||
[StringValue("Account/CanRegisterUserName/{userName}")]
|
||||
|
||||
@@ -122,6 +122,20 @@ namespace xIdentityService.Interfaces
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Search ...
|
||||
/// <summary>
|
||||
/// Query Open To Search User Profiles ...
|
||||
/// </summary>
|
||||
/// <param name="tokens">requested user's identifiers</param>
|
||||
/// <param name="query">how to filter results based on <see>XQuery</see> structure</param>
|
||||
/// <returns>an instance of <see>XQueryResult</see> of <see>XUserProfileDto</see></returns>
|
||||
Task<XQueryResult<XUserProfileDto>> QueryOpenToSearchUsers(
|
||||
XTokenResponse tokens,
|
||||
XQuery query
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Registration ...
|
||||
Task<bool> CanRegister(string userSelectByParam);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using xHttpService.Constants;
|
||||
using xHttpService.Extensions;
|
||||
using xIdentityModels.Dtos;
|
||||
using xIdentityModels.Models;
|
||||
using xIdentityService.Constants;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xIdentityService.Providers
|
||||
{
|
||||
public partial class XIdentityProvider
|
||||
{
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
/// Query Open To Search User Profiles ...
|
||||
/// </summary>
|
||||
/// <param name="tokens">requested user's identifiers</param>
|
||||
/// <param name="query">how to filter results based on <see>XQuery</see> structure</param>
|
||||
/// <returns>an instance of <see>XQueryResult</see> of <see>XUserProfileDto</see></returns>
|
||||
public async Task<XQueryResult<XUserProfileDto>> QueryOpenToSearchUsers(
|
||||
XTokenResponse tokens,
|
||||
XQuery query
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
await validationProvider
|
||||
.GroupValidationBuilder()
|
||||
.AddNotNull(tokens, query)
|
||||
.AddNotEmpty(tokens.AccessToken)
|
||||
.ValidateGroupAsync();
|
||||
|
||||
//
|
||||
var client = GetRestClient(tokens);
|
||||
|
||||
//
|
||||
var request = GetRestRequet(XApiAccountEndpoint.QueryOpenToSearchProfiles);
|
||||
|
||||
//
|
||||
// Attach XQuery to Request ...
|
||||
request = request.AttachXQuery(query);
|
||||
|
||||
//
|
||||
var response = await RunRestRequest<XQueryResult<XUserProfileDto>>(
|
||||
client,
|
||||
request,
|
||||
XHttpMethod.GET
|
||||
);
|
||||
return response;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user