public async Task <INuGetResource> Create(SourceRepository source)
        {
            V3MetadataResource     curResource = null;
            V3RegistrationResource regResource = await source.GetResource <V3RegistrationResource>();

            if (regResource != null)
            {
                DataClient client = new DataClient((await source.GetResource <HttpHandlerResource>()).MessageHandler);

                curResource = new V3MetadataResource(client, regResource);
            }

            return(curResource);
        }
        /// <summary>
        /// Dependency info resource
        /// </summary>
        /// <param name="client">Http client</param>
        /// <param name="regResource">Registration blob resource</param>
        public V3DependencyInfoResource(HttpClient client, V3RegistrationResource regResource)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (regResource == null)
            {
                throw new ArgumentNullException("regResource");
            }

            _client      = client;
            _cache       = new ConcurrentDictionary <Uri, JObject>();
            _regResource = regResource;
        }
Beispiel #3
0
        public V3MetadataResource(HttpClient client, V3RegistrationResource regResource)
            : base()
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (regResource == null)
            {
                throw new ArgumentNullException("regResource");
            }

            _regResource = regResource;
            _client      = client;
        }
Beispiel #4
0
        public async Task <INuGetResource> Create(SourceRepository source)
        {
            V3RegistrationResource regResource = null;
            var serviceIndex = await source.GetResource <V3ServiceIndexResource>();

            if (serviceIndex != null)
            {
                Uri baseUrl = serviceIndex["RegistrationsBaseUrl"].FirstOrDefault();

                DataClient client = new DataClient((await source.GetResource <HttpHandlerResource>()).MessageHandler);

                // construct a new resource
                regResource = new V3RegistrationResource(client, baseUrl);
            }

            return(regResource);
        }