예제 #1
0
 public PackageMetadataResourceV3(
     HttpSource client,
     RegistrationResourceV3 regResource,
     ReportAbuseResourceV3 reportAbuseResource,
     PackageDetailsUriResourceV3 packageDetailsUriResource)
 {
     _regResource               = regResource;
     _client                    = client;
     _reportAbuseResource       = reportAbuseResource;
     _packageDetailsUriResource = packageDetailsUriResource;
 }
예제 #2
0
        public override async Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository source, CancellationToken token)
        {
            ReportAbuseResourceV3 resource = null;
            var serviceIndex = await source.GetResourceAsync <ServiceIndexResourceV3>(token);

            if (serviceIndex != null)
            {
                var uriTemplate = serviceIndex.GetServiceEntryUri(ServiceTypes.ReportAbuse)?.AbsoluteUri;

                // construct a new resource
                resource = new ReportAbuseResourceV3(uriTemplate);
            }

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