Add PeopleProvider.get_profile_by_xuid method#108
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
==========================================
+ Coverage 88.31% 88.35% +0.03%
==========================================
Files 54 54
Lines 2868 2876 +8
==========================================
+ Hits 2533 2541 +8
Misses 335 335 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tr4nt0r
left a comment
There was a problem hiding this comment.
Looks really good, just a little comment
| resp.raise_for_status() | ||
| return PeopleResponse.model_validate_json(resp.text) | ||
|
|
||
| async def get_profile_by_xuid(self, xuid: str, decoration_fields: list[PeopleDecoration] | None = None, **kwargs) -> PeopleResponse: |
There was a problem hiding this comment.
I just realized that in the profile provider we already have a get_profile_by_xuid, so in terms of Xbox API profile seems to be a different thing. What do you think of get_friend_by_xuid (singular)? That should make clear that it returns only a single friend with the same data as the other get_friends_* methods
| async def get_profile_by_xuid(self, xuid: str, decoration_fields: list[PeopleDecoration] | None = None, **kwargs) -> PeopleResponse: | |
| async def get_friend_by_xuid(self, xuid: str, decoration_fields: list[PeopleDecoration] | None = None, **kwargs) -> PeopleResponse: |
There was a problem hiding this comment.
I just realized that in the profile provider we already have a
get_profile_by_xuid, so in terms of Xbox API profile seems to be a different thing. What do you think ofget_friend_by_xuid(singular)?
You're absolutely right and it's a good catch! Having two methods with the same name in different providers would be confusing for users of the library. Fixed!
tr4nt0r
left a comment
There was a problem hiding this comment.
LGTM 👍🏼
Thanks for your contribution 🤗
PeopleProvider.get_profile_by_xuid method
Adds
get_profile_by_xuidto PeopleProvider for single-user profile lookups using the/users/me/people/xuids({xuid})endpoint.Returns relationship metadata (isFriend, canBeFriended etc.) from the caller's perspective, useful for profile lookups and relationship checks.