Esempio n. 1
0
 public UIMetadataResourceV3(DataClient client, RegistrationResourceV3 regResource, ReportAbuseResourceV3 reportAbuseResource)
     : base()
 {
     _regResource = regResource;
     _client = client;
     _reportAbuseResource = reportAbuseResource;
 }
        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[ServiceTypes.ReportAbuse].FirstOrDefault()?.AbsoluteUri;

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

            return(new Tuple <bool, INuGetResource>(resource != null, resource));
        }
        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)
            {
                resource = new ReportAbuseResourceV3();

                //IEnumerable<Uri> templateUrls = serviceIndex[ServiceTypes.ReportAbuse];
                //if (templateUrls != null && templateUrls.Any())
                //{
                //    resource = new ReportAbuseResourceV3(templateUrls);
                //}
            }

            return new Tuple<bool, INuGetResource>(resource != null, resource);
        }
        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)
            {
                resource = new ReportAbuseResourceV3();

                //IEnumerable<Uri> templateUrls = serviceIndex[ServiceTypes.ReportAbuse];
                //if (templateUrls != null && templateUrls.Any())
                //{
                //    resource = new ReportAbuseResourceV3(templateUrls);
                //}
            }

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