Skip to content

Commit

Permalink
Follow the SoloScoreInfo in the osu.game to move the method into th…
Browse files Browse the repository at this point in the history
…e response class.
  • Loading branch information
andy840119 committed Jan 13, 2024
1 parent 5f019f3 commit 700cd2a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@

namespace osu.Game.Rulesets.Karaoke.Online.API.Requests;

public class GetChangelogBuildRequest : GithubChangeLogAPIRequest<APIChangelogBuild>
public class GetChangelogBuildRequest : GithubAPIRequest<APIChangelogBuild>
{
private readonly APIChangelogBuild originBuild;

public GetChangelogBuildRequest(APIChangelogBuild originBuild)
: base(ChangelogRequestUtils.ORGANIZATION_NAME)
{
this.originBuild = originBuild;
}

protected override async Task<APIChangelogBuild> Perform(IGitHubClient client)
{
string contentString = await ChangelogRequestUtils.GetChangelogContent(client, originBuild.Version).ConfigureAwait(false);
return CreateBuildWithContent(originBuild, contentString);
return originBuild.CreateBuildWithContent(contentString);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@

namespace osu.Game.Rulesets.Karaoke.Online.API.Requests;

public class GetChangelogRequest : GithubChangeLogAPIRequest<APIChangelogIndex>
public class GetChangelogRequest : GithubAPIRequest<APIChangelogIndex>
{
public GetChangelogRequest()
: base(ChangelogRequestUtils.ORGANIZATION_NAME)
{
}

protected override async Task<APIChangelogIndex> Perform(IGitHubClient client)
{
var builds = await getAllBuilds(client).ConfigureAwait(false);
Expand Down Expand Up @@ -60,7 +65,7 @@ private static APIChangelogBuild createBuild(RepositoryContent content)
private static async Task<APIChangelogBuild> createPreviewBuild(IGitHubClient client, APIChangelogBuild originBuild)
{
string contentString = await ChangelogRequestUtils.GetChangelogContent(client, originBuild.Version).ConfigureAwait(false);
return CreateBuildWithContent(originBuild, contentString);
return originBuild.CreateBuildWithContent(contentString);
}

private static int[] generateYears(IEnumerable<APIChangelogBuild> builds)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,21 @@ public class VersionNavigation
}

public override string ToString() => $"Karaoke! {DisplayVersion}";

public APIChangelogBuild CreateBuildWithContent(string content)
{
return new APIChangelogBuild
{
DocumentUrl = DocumentUrl,
RootUrl = RootUrl,
Version = Version,
Content = content,
Versions =
{
Previous = Versions.Previous,
Next = Versions.Next,
},
PublishedAt = PublishedAt,
};
}
}

0 comments on commit 700cd2a

Please sign in to comment.