Ejemplo n.º 1
0
        public async Task <IList <MetaField> > GetByIdAsync(IList <string> ids)
        {
            return(await _grpcCallerService.CallService(_metaFieldServiceProvider.GrpcEndpoint, async (grpcChannel) =>
            {
                var client = new MetaFieldService.MetaFieldServiceClient(grpcChannel);
                var response = await client.GetByIdsAsync(new GetByIdsRequest
                {
                    Ids = { ids }
                });

                // Filter out non-public meta-fields
                return response.MetaFields
                .Where(x => x.IsPublic)
                .ToList();
            }));
        }
Ejemplo n.º 2
0
        public async Task <IList <Product> > GetByHandleAsync(IList <string> handles,
                                                              string languageCode)
        {
            return(await _grpcCallerService.CallService(_productServiceProvider.GrpcEndpoint, async (grpcChannel) =>
            {
                var client = new ProductService.ProductServiceClient(grpcChannel);
                var response = await client.GetByHandlesAsync(new GetByHandlesRequest
                {
                    Handles = { handles }
                });

                // Filter out matches in other languages
                return response.Products
                .Where(x => x.Handles
                       .Any(ls => ls.LanguageCode == languageCode && handles.Contains(ls.Value)))
                .ToList();
            }));
        }