diff --git a/Constants/XApiAccountEndpoint.cs b/Constants/XApiAccountEndpoint.cs index b5084ad..d4ef382 100644 --- a/Constants/XApiAccountEndpoint.cs +++ b/Constants/XApiAccountEndpoint.cs @@ -64,6 +64,12 @@ namespace xIdentityService.Constants SetAvatar, #endregion + // + #region Search ... + [StringValue("Account/OpenToSearch/Query")] + QueryOpenToSearchProfiles, + #endregion + // #region Registration ... [StringValue("Account/CanRegisterUserName/{userName}")] diff --git a/Interfaces/IXIdentityProvider.cs b/Interfaces/IXIdentityProvider.cs index 5d3eb20..5a6d9b3 100644 --- a/Interfaces/IXIdentityProvider.cs +++ b/Interfaces/IXIdentityProvider.cs @@ -122,6 +122,20 @@ namespace xIdentityService.Interfaces ); #endregion + // + #region Search ... + /// + /// Query Open To Search User Profiles ... + /// + /// requested user's identifiers + /// how to filter results based on XQuery structure + /// an instance of XQueryResult of XUserProfileDto + Task> QueryOpenToSearchUsers( + XTokenResponse tokens, + XQuery query + ); + #endregion + // #region Registration ... Task CanRegister(string userSelectByParam); diff --git a/Partial/XIdentityProvider+Search.cs b/Partial/XIdentityProvider+Search.cs new file mode 100644 index 0000000..240efc8 --- /dev/null +++ b/Partial/XIdentityProvider+Search.cs @@ -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 ... + /// + /// Query Open To Search User Profiles ... + /// + /// requested user's identifiers + /// how to filter results based on XQuery structure + /// an instance of XQueryResult of XUserProfileDto + public async Task> 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>( + client, + request, + XHttpMethod.GET + ); + return response; + } + #endregion + } +} \ No newline at end of file