Skip to content

Commit 63dd5ad

Browse files
binnclaude
andauthored
fix(examples): read profile fields through getPublicProfile (#42)
Specification v1.21.0 moved bio, bioLinks, badges and the current-avatar fields off CurrentUser and User (only CurrentUser keeps currentAvatar*). They are now served by getPublicProfile, which also gained asSelf for the owner's own view. The AspNetCore example still read them off the user objects, so every repository_dispatch build since that release failed with CS1061 in HomeController. Fetch the public profile alongside the user in both endpoints instead. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 163426a commit 63dd5ad

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

‎examples/VRChat.API.Examples.AspNetCore/Controllers/HomeController.cs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ public async Task<IActionResult> GetCurrentUserAsync()
2525
{
2626
var user = await _vrchat.Authentication.GetCurrentUserAsync();
2727

28+
// Profile fields (bio, bio links, badges, ...) are no longer part of CurrentUser.
29+
// They live behind getPublicProfile; asSelf includes the owner-only view.
30+
var profile = await _vrchat.Users.GetPublicProfileAsync(user.Id, asSelf: true);
31+
2832
return Ok(new
2933
{
3034
user.Id,
3135
user.DisplayName,
3236
user.CurrentAvatarImageUrl,
33-
user.Badges,
34-
user.Bio,
35-
user.BioLinks,
37+
profile.Badges,
38+
profile.Bio,
39+
profile.BioLinks,
3640
user.Tags
3741
});
3842
}
@@ -43,14 +47,18 @@ public async Task<IActionResult> GetUserByIdAsync(string id)
4347
{
4448
var user = await _vrchat.Users.GetUserAsync(id);
4549

50+
// User no longer carries the profile or current-avatar fields; fetch them from the
51+
// public profile instead.
52+
var profile = await _vrchat.Users.GetPublicProfileAsync(id);
53+
4654
return Ok(new
4755
{
4856
user.Id,
4957
user.DisplayName,
50-
user.CurrentAvatarImageUrl,
51-
user.Badges,
52-
user.Bio,
53-
user.BioLinks,
58+
profile.CurrentAvatarImageUrl,
59+
profile.Badges,
60+
profile.Bio,
61+
profile.BioLinks,
5462
user.Tags
5563
});
5664
}

0 commit comments

Comments
 (0)