From 872805b59a20bef3b1a48c03d7da03c7268986c2 Mon Sep 17 00:00:00 2001 From: rhessinger Date: Fri, 27 Feb 2026 14:53:50 -0500 Subject: [PATCH] Added support for multiple feeds and feed groups --- Inedo.ProGet/ApiKeyInfo.cs | 8 +++++--- Inedo.ProGet/ProGetClient.cs | 2 +- pgutil/ApiKeys/Create/FeedCommand.cs | 8 ++++---- pgutil/ApiKeys/ListCommand.cs | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Inedo.ProGet/ApiKeyInfo.cs b/Inedo.ProGet/ApiKeyInfo.cs index 5bd0cac..fd8db1e 100644 --- a/Inedo.ProGet/ApiKeyInfo.cs +++ b/Inedo.ProGet/ApiKeyInfo.cs @@ -58,14 +58,16 @@ public sealed class ApiKeyInfo // * Required when Type is Feed; otherwise must be null public string[]? PackagePermissions { get; set; } - // Name of the feed the feed key applies to + // Name of the feeds the feed key applies to // * Optional when Type is Feed; otherwise must be null // * Must be null when FeedGroup has a value + // * Value is a comma-separated list of feed names public string? Feed { get; set; } - /// Name of the feed group the key applies to + /// Name of the feed groups the key applies to // * Optional when Type is Feed; otherwise must be null - // * Must be null when Feed has a value + // * Must be null when Feeds has a value + // * Value is a comma-separated list of feed group names public string? FeedGroup { get; set; } public DateTime? Expiration { get; set; } diff --git a/Inedo.ProGet/ProGetClient.cs b/Inedo.ProGet/ProGetClient.cs index 837aced..fb16742 100644 --- a/Inedo.ProGet/ProGetClient.cs +++ b/Inedo.ProGet/ProGetClient.cs @@ -430,7 +430,7 @@ public async Task CreateApiKeyAsync(ApiKeyInfo apiKeyInfo, Cancellat { ArgumentNullException.ThrowIfNull(apiKeyInfo); - var versionRequired = apiKeyInfo.Type == ApiKeyType.Feed ? new Version(24, 0, 3) : null; + var versionRequired = apiKeyInfo.Type == ApiKeyType.Feed ? new Version(24, 0, 3) : ((apiKeyInfo.Feed?.Contains(',') ?? false) || (apiKeyInfo.FeedGroup?.Contains(',') ?? false)) ? new Version(25, 0, 23) : null; var editionRequired = apiKeyInfo.Type != ApiKeyType.Personal ? ProGetEdition.Basic : (ProGetEdition?)null; using var response = await this.http.PostAsJsonAsync("api/api-keys/create", apiKeyInfo, ProGetApiJsonContext.Default.ApiKeyInfo, cancellationToken).ConfigureAwait(false); diff --git a/pgutil/ApiKeys/Create/FeedCommand.cs b/pgutil/ApiKeys/Create/FeedCommand.cs index 6147bd7..b71c1e3 100644 --- a/pgutil/ApiKeys/Create/FeedCommand.cs +++ b/pgutil/ApiKeys/Create/FeedCommand.cs @@ -16,9 +16,9 @@ private sealed class FeedCommand : IConsoleCommand public static string Name => "feed"; public static string Description => "Creates a feed API key. The key is the only thing written to stdout on success"; public static string Examples => """ - $> pgutil apikeys create feed --feed=public-npm --permissions="view,add" --key=abcd12345 + $> pgutil apikeys create feed --feed="public-npm,public-nuget" --permissions="view,add" --key=abcd12345 - $> pgutil apikeys create feed --group=production-feeds --key=wxyz67890 --expiration="2024/08/01" + $> pgutil apikeys create feed --group="production-feeds,test-feeds" --key=wxyz67890 --expiration="2024/08/01" $> pgutil apikeys create feed --feed=* @@ -90,14 +90,14 @@ private sealed class FeedNameOption : IConsoleOption { public static bool Required => false; public static string Name => "--feed"; - public static string Description => "Name of the feed to associate with the key, or \"*\" for all feeds"; + public static string Description => "Name of the feeds to associate with the key. Value is a comma-separated list of feed names or \"*\" for all feeds."; } private sealed class FeedGroupOption : IConsoleOption { public static bool Required => false; public static string Name => "--group"; - public static string Description => "Name of the feed group to associate with the key"; + public static string Description => "Name of the feed groups to associate with the key. Value is a comma-separated list of feed group names."; } } } diff --git a/pgutil/ApiKeys/ListCommand.cs b/pgutil/ApiKeys/ListCommand.cs index 64112b5..9975a49 100644 --- a/pgutil/ApiKeys/ListCommand.cs +++ b/pgutil/ApiKeys/ListCommand.cs @@ -38,7 +38,7 @@ public static async Task ExecuteAsync(CommandContext context, CancellationT data.Add((" User:", key.User ?? "(unknown)")); else if (key.Type == ApiKeyType.Feed) { - data.Add(key.FeedGroup is not null ? (" Feed group:", key.FeedGroup) : (" Feed:", key.Feed ?? "* (all)")); + data.Add(key.FeedGroup is not null ? (" Feed groups:", key.FeedGroup) : (" Feeds:", key.Feed ?? "* (all)")); data.Add((" Permissions:", string.Join(", ", key.PackagePermissions ?? []))); } CM.WriteTwoColumnList(data);