public override async Task<Tuple<bool, INuGetResource>> TryCreate(SourceRepository source, CancellationToken token)
        {
            ApiAppSearchResource resource = null;

            var messageHandlerResource = await source.GetResourceAsync<HttpHandlerResource>(token);
            ServiceIndexResourceV3 serviceIndex = await source.GetResourceAsync<ServiceIndexResourceV3>();

            if (messageHandlerResource != null && serviceIndex != null)
            {
                var endpoints = serviceIndex["ApiAppSearchQueryService"];

                if (endpoints.Any())
                {
                    RawSearchResourceV3 rawSearch = new RawSearchResourceV3(messageHandlerResource.MessageHandler, endpoints);

                    resource = new ApiAppSearchResource(rawSearch);
                }
            }

            return new Tuple<bool, INuGetResource>(resource != null, resource);
        }
Ejemplo n.º 2
0
        public override async Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository source, CancellationToken token)
        {
            ApiAppSearchResource resource = null;

            var messageHandlerResource = await source.GetResourceAsync <HttpHandlerResource>(token);

            ServiceIndexResourceV3 serviceIndex = await source.GetResourceAsync <ServiceIndexResourceV3>();

            if (messageHandlerResource != null && serviceIndex != null)
            {
                var endpoints = serviceIndex["ApiAppSearchQueryService"];

                if (endpoints.Any())
                {
                    RawSearchResourceV3 rawSearch = new RawSearchResourceV3(messageHandlerResource.MessageHandler, endpoints);

                    resource = new ApiAppSearchResource(rawSearch);
                }
            }

            return(new Tuple <bool, INuGetResource>(resource != null, resource));
        }