public static string GetRequiredResourceUrl(this ServiceIndexResponse serviceIndex, string[] types, string resourceName) { // For more information on required resources, // see: https://docs.microsoft.com/en-us/nuget/api/overview#resources-and-schema var resourceUrl = serviceIndex.GetResourceUrl(types); if (string.IsNullOrEmpty(resourceUrl)) { throw new InvalidOperationException( $"The service index does not have a resource named '{resourceName}'"); } return(resourceUrl); }
public static string GetResourceUrl(this ServiceIndexResponse serviceIndex, string[] types) { var resource = types.SelectMany(t => serviceIndex.Resources.Where(r => r.Type == t)).FirstOrDefault(); return(resource?.ResourceUrl.Trim('/')); }
public static string GetSearchAutocompleteResourceUrl(this ServiceIndexResponse serviceIndex) { return(serviceIndex.GetResourceUrl(SearchAutocompleteService)); }
public static string GetSearchQueryResourceUrl(this ServiceIndexResponse serviceIndex) { return(serviceIndex.GetResourceUrl(SearchQueryService)); }
public static string GetCatalogResourceUrl(this ServiceIndexResponse serviceIndex) { return(serviceIndex.GetResourceUrl(Catalog)); }
public static string GetPackageMetadataResourceUrl(this ServiceIndexResponse serviceIndex) { return(serviceIndex.GetResourceUrl(RegistrationsBaseUrl)); }
public static string GetPackageContentResourceUrl(this ServiceIndexResponse serviceIndex) { return(serviceIndex.GetResourceUrl(PackageBaseAddress)); }
private UrlGeneratorClient(ServiceIndexResponse serviceIndex) { _serviceIndex = serviceIndex ?? throw new ArgumentNullException(nameof(serviceIndex)); }