Ejemplo n.º 1
0
        public async Task <List <Collection> > FindCollections(FindCollectionsRequest request, string asUserKey = null, string bearerToken = null, bool logToConsole = true)
        {
            var foundCollections = await Post <FindCollectionsRequest, List <Collection> >(request, "collections/find", asUserKey, bearerToken);

            if (logToConsole)
            {
                Console.WriteLine($"Found {foundCollections.Count} Collections: {ToJson(foundCollections)}");
            }
            ;
            return(foundCollections);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> FindCollections([FromBody] FindCollectionsRequest request)
        {
            try
            {
                var userKey = _contextAccessor.UserKeyFromContext();

                //TODO: need to filter out collections the user doesn't have access to
                var matchingCollections = await _hiarcDatabase.FindCollections(request);

                return(Ok(matchingCollections));
            }
            catch (Exception ex)
            {
                return(BuildErrorResponse(ex, _logger));
            }
        }