Skip to content

Implement user category API endpoints - #922

Merged
jvyden merged 7 commits into
LittleBigRefresh:mainfrom
Toastbrot236:user-cat-api
Aug 10, 2025
Merged

jvyden merged 7 commits into
LittleBigRefresh:mainfrom
Toastbrot236:user-cat-api

Conversation

@Toastbrot236

Copy link
Copy Markdown
Contributor

Refactors API category models and endpoints similarly to how their game counterparts were refactored (dedicated CategoryApiEndpoints class, base ApiCategoryResponse and dedicated namespace for models). Also implements API endpoints for the newly introduced user categories and a few tests for those.

@jvyden
jvyden self-requested a review August 8, 2025 20:57
Comment thread Refresh.Interfaces.APIv3/Endpoints/CategoryApiEndpoints.cs Outdated
Comment thread Refresh.Interfaces.APIv3/Endpoints/CategoryApiEndpoints.cs Outdated
Comment thread Refresh.Interfaces.APIv3/Endpoints/CategoryApiEndpoints.cs Outdated
Comment thread RefreshTests.GameServer/Tests/ApiV3/UserApiTests.cs
Comment thread RefreshTests.GameServer/Tests/ApiV3/UserApiTests.cs
Comment thread Refresh.Interfaces.APIv3/Endpoints/UserApiEndpoints.cs Outdated
Signed-off-by: jvyden <jvyden@jvyden.xyz>
@jvyden
jvyden merged commit de483f0 into LittleBigRefresh:main Aug 10, 2025
3 checks passed
@Toastbrot236
Toastbrot236 deleted the user-cat-api branch August 29, 2025 16:15
Toastbrot236 added a commit that referenced this pull request Feb 9, 2026
This is a refactor which removes `GameLevelCategory`,
`GameUserCategory`, their equivalent game and API serialization classes
and makes all category classes directly extend `GameCategory`.
De-duplicating category code, especially for the API responses, was
suggested in a [previous PR's
review](#922 (comment)),
and this is the easiest and least hacky way I could think of.

While I have tried to implement the suggested strategy of using a
generic type for `ApiCategoryResponse`, it became too complicated for me
due to one of the two `FromOldList` methods needing to call the `Fetch`
method of every category in order to add their preview items to the
responses. I've thought to instead have the preview item attribute be of
type `IApiResultResponse` which both `ApiGameLevelResponse` and
`ApiGameUserResponse` implement.

For LBP3 the `Results` attribute, which used to be in
`SerializedLevelCategory` and `SerializedUserCategory`, is now in
`SerializedCategory` and of type `SerializedCategoryResultsList` so the
categories could include either users or levels as previews. This works
with LBP3.

The overridden `GameCategory.Fetch` method now returns a
`DatabaseResultList`, which references a nullable `DatabaseList` of
`GameLevel`s, `GameUser`s and `GamePlaylist`s each (3 lists in total).
This is so that both level and user categories could override the method
without any problems, while also being a preparation to make searching
users for LBP1-3 and the API (and then maybe also playlists in
LBP1/3/API) alongside levels possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants