Skip to content

Add PeopleProvider.get_profile_by_xuid method#108

Merged
tr4nt0r merged 3 commits intotr4nt0r:mainfrom
misiektoja:get_profile_by_xuid
Mar 2, 2026
Merged

Add PeopleProvider.get_profile_by_xuid method#108
tr4nt0r merged 3 commits intotr4nt0r:mainfrom
misiektoja:get_profile_by_xuid

Conversation

@misiektoja
Copy link
Contributor

Adds get_profile_by_xuid to 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.

@github-actions github-actions bot added the 🧪 testing Pull request that adds tests label Mar 2, 2026
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.35%. Comparing base (d03cead) to head (7ec4d1c).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@tr4nt0r tr4nt0r left a comment

Choose a reason for hiding this comment

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

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:
Copy link
Owner

Choose a reason for hiding this comment

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

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

Suggested change
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:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)?

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 tr4nt0r added 🚀 feature New feature or request and removed 🧪 testing Pull request that adds tests labels Mar 2, 2026
@github-actions github-actions bot added the 🧪 testing Pull request that adds tests label Mar 2, 2026
@tr4nt0r tr4nt0r removed the 🧪 testing Pull request that adds tests label Mar 2, 2026
Copy link
Owner

@tr4nt0r tr4nt0r left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

Thanks for your contribution 🤗

@tr4nt0r tr4nt0r merged commit 4bb89d4 into tr4nt0r:main Mar 2, 2026
8 checks passed
@tr4nt0r tr4nt0r changed the title feat(people): add get_profile_by_xuid method Add PeopleProvider.get_profile_by_xuid method Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants