fix(people): correct friends list API endpoints and contract version #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I switched my project from xbox-webapi-python to python-xbox and noticed that my code for fetching the list of friends was not working anymore.
It turned out the
get_friends_by_xuid()method was not working correctly:It had a broken URL path
/users/me/people/xuids({xuid})/...which returns the authenticated user's info, not the target user's friends list. The correct path is/users/xuid({xuid})/people/social/...Contract version 7 returns empty results for
get_friends_by_xuid(). When querying another user's friends list, contract v7 returns{"people": []}while v5 returns the actual friends list.I compared behavior across contract versions:
get_friends_ownget_friends_by_xuidI noticed contract v7 was introduced in PR #1 to provide additional relationship fields (
isFriend,canBeFriendedetc.). However, these fields are only returned when querying your OWN friends list -get_friends_by_xuid()returns empty with v7 when querying another user.I implemented usage of different contract versions per method to get the best of both worlds:
get_friends_ownget_friends_by_xuid