Skip to content

feat(api): add API_GetUserSetRequests#2950

Merged
wescopeland merged 35 commits into
RetroAchievements:masterfrom
drisc:setrequest-api
Jan 2, 2025
Merged

feat(api): add API_GetUserSetRequests#2950
wescopeland merged 35 commits into
RetroAchievements:masterfrom
drisc:setrequest-api

Conversation

@drisc

@drisc drisc commented Dec 18, 2024

Copy link
Copy Markdown
Contributor

This PR adds an endpoint to fetch the current set request list of a user along with their total request count and the amount of points they need to unlock their next request.

@wescopeland wescopeland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @drisc!

Thanks for opening this PR! I've briefly scanned over the implementation and left one comment for you to chew on 🙂

Once it's resolved, I'm happy to do a deeper dive into the patchset implementation details.

In the meantime, I will be temporarily moving this PR to draft. From our latest contributing requirements, any API changes require a sister PR in api-docs. An example of a good one can be found at RetroAchievements/api-docs#68!

Once an api-docs PR is opened, please feel free to move this PR out of draft! Thanks for your understanding 🙏

Comment thread public/API/API_GetUserSetRequests.php Outdated
@wescopeland wescopeland marked this pull request as draft December 18, 2024 02:12
@drisc drisc marked this pull request as ready for review December 18, 2024 02:35
Comment thread app/Models/UserGameListEntry.php Outdated
Comment thread database/factories/UserGameListEntryFactory.php Outdated
Comment thread public/API/API_GetUserSetRequests.php Outdated
Comment thread public/API/API_GetUserSetRequests.php Outdated
Comment thread public/API/API_GetUserSetRequests.php
Comment thread tests/Feature/Api/V1/UserSetRequestsTest.php Outdated
Comment thread public/API/API_GetUserSetRequests.php Outdated
Comment thread public/API/API_GetUserSetRequests.php Outdated
@Jamiras

Jamiras commented Dec 19, 2024

Copy link
Copy Markdown
Member

Users with inflated requests due to April Fools shenanigans are reporting "TotalRequests" as their supposed limit, not the actual number of requests they have.
image

...,"TotalRequests":13,"PointsForNext":4425}

This does match their page, so I think it's probably working as designed.

Comment thread public/API/API_GetUserSetRequests.php Outdated
->where('type', 'achievement_set_request')
->orderBy('GameData.sort_title')
->get()
->toArray();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this is returning completed requests (i.e. the list returned when clicking on "View All User Set Requests"). It should probably only return active requests (where GameData.achievements_published = 0)

Is there any reason we'd want to expose the completed requests? If so, we might want a flag for doing so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The site page allows for viewing all past requests as well so adding a flag for it would be my vote. That way the endpoint can get a list of all a users requests if needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type flag added in latest, I've also updated and added a test to check for achievements_published.

Comment thread public/API/API_GetUserSetRequests.php Outdated
Comment thread public/API/API_GetUserSetRequests.php
Comment thread tests/Feature/Api/V1/UserSetRequestsTest.php Outdated
Comment thread tests/Feature/Api/V1/UserSetRequestsTest.php Outdated
Comment thread tests/Feature/Api/V1/UserSetRequestsTest.php
Comment thread public/API/API_GetUserSetRequests.php Outdated
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.

3 participants