Skip to content

Commit f185e1f

Browse files
committed
Rename fecher to avoid confusion with manifest itself
This class is used to fetch the authenticated user's JWT claims for syncing. It does not represent the manifest itself, which is something the SL samples showcase how to turn into a proper class if needed. The JWT can be read by any standards-compatible lib.
1 parent 9d037c9 commit f185e1f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Commands/SyncCommand.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ await Status().StartAsync(Sync.FetchingManifests(sponsorables.Count), async ctx
330330
}
331331

332332
using var http = httpFactory.CreateClient();
333-
var (status, jwt) = await Status().StartAsync(Sync.Synchronizing(manifest.Sponsorable), async ctx => await SponsorManifest.FetchAsync(manifest, token, http));
334-
if (status == SponsorManifest.Status.NotSponsoring)
333+
var (status, jwt) = await Status().StartAsync(Sync.Synchronizing(manifest.Sponsorable), async ctx => await SponsorManifestFetcher.FetchAsync(manifest, token, http));
334+
if (status == SponsorManifestFetcher.Status.NotSponsoring)
335335
{
336336
var links = string.Join(", ", manifest.Audience.Select(x => $"[link]{x}[/]"));
337337
MarkupLine(Sync.ConsiderSponsoring(manifest.Sponsorable.PadRight(maxlength), links));
338338
result = ErrorCodes.NotSponsoring;
339339
continue;
340340
}
341341

342-
if (status == SponsorManifest.Status.Success)
342+
if (status == SponsorManifestFetcher.Status.Success)
343343
{
344344
File.WriteAllText(Path.Combine(ghDir, manifest.Sponsorable + ".jwt"), jwt, Encoding.UTF8);
345345
var roles = new JsonWebTokenHandler
@@ -373,14 +373,14 @@ await Status().StartAsync(Sync.Synchronizing(manifest.Sponsorable), async ctx =>
373373
return;
374374

375375
using var http = httpFactory.CreateClient();
376-
var (status, jwt) = await SponsorManifest.FetchAsync(manifest, token, http);
377-
if (status == SponsorManifest.Status.NotSponsoring)
376+
var (status, jwt) = await SponsorManifestFetcher.FetchAsync(manifest, token, http);
377+
if (status == SponsorManifestFetcher.Status.NotSponsoring)
378378
{
379379
var links = string.Join(", ", manifest.Audience.Select(x => $"[link]{x}[/]"));
380380
MarkupLine(Sync.ConsiderSponsoring(manifest.Sponsorable.PadRight(maxlength), links));
381381
result = ErrorCodes.NotSponsoring;
382382
}
383-
else if (status == SponsorManifest.Status.Success)
383+
else if (status == SponsorManifestFetcher.Status.Success)
384384
{
385385
File.WriteAllText(Path.Combine(ghDir, manifest.Sponsorable + ".jwt"), jwt);
386386
var roles = new JsonWebTokenHandler()
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Devlooped.Sponsors;
66
/// <summary>
77
/// Allows synchronizing client sponsor manifests.
88
/// </summary>
9-
public class SponsorManifest
9+
public class SponsorManifestFetcher
1010
{
1111
/// <summary>
1212
/// Status of a manifest refresh operation.
@@ -30,10 +30,10 @@ public enum Status
3030
/// <summary>
3131
/// Refreshes the sponsor manifest for the given sponsorable account.
3232
/// </summary>
33-
/// <param name="accessToken">The access token to use for fetching the manifest, must be an OAuth token issued by GitHub for the sponsorable app..</param>
33+
/// <param name="accessToken">The access token to use for fetching the manifest, must be an OAuth token issued by GitHub for the sponsorable app, representing the sponsoring user.</param>
3434
/// <param name="manifest">The SponsorLink manifest provided by the sponsorable account.</param>
3535
/// <param name="jwt">The sponsor manifest token, if sponsoring.</param>
36-
/// <returns>The status of the manifest synchronization.</returns>
36+
/// <returns>The status of the manifest synchronization and the optional JWT of the authenticated user if validation succeeded.</returns>
3737
public static async Task<(Status, string?)> FetchAsync(SponsorableManifest manifest, string accessToken, HttpClient? http = default)
3838
{
3939
var disposeHttp = http == null;

0 commit comments

Comments
 (0)