danielwerg / r6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs
https://npm.im/r6api.js
MIT License
109 stars 19 forks source link

What the difference of id and userId ? #41

Closed SugiKent closed 3 years ago

SugiKent commented 4 years ago

Thanks for useful library ! I want to know the difference of id and userId that would be fetch by getId. Because, I can't fetch the correct Stats with 'psn' by using userId.

For example,

> r6api.getId(platform, 'kent_ear').then(res => {console.log(res)})
[ { id: '37fa24c5-7e7a-4135-a4fe-3b6a00d7da97',
    userId: '63ad54db-5e31-4ab6-9122-dc08a75603ca',
    username: 'kent_ear',
    platform: 'psn' } ]

By using userId, It's not correct.

> r6api.getLevel(platform, [userId]).then(res => {console.log(res)})
[ { id: 'hoge',
    level: 0,
    xp: 0,
    lootboxProbability: { raw: 5000, percent: '50.00%' } } ]

By using id, It's correct.

> r6api.getLevel(platform, [id]).then(res => {console.log(res)})
[ { id: '37fa24c5-7e7a-4135-a4fe-3b6a00d7da97',
    level: 181,
    xp: 71917,
    lootboxProbability: { raw: 1150, percent: '11.50%' } } ]

The behavior is different from example code in README.md. Which id should we use ?

danielwerg commented 4 years ago

If you are reading README.md in master branch then it's probably wrong/outdated.

I never cared for consoles since I don't own one so that's why example code was only tested for pc players. But If I got it right userId is account id and id is id for player in specific platform. So you should use id here.

SugiKent commented 4 years ago

Thanks for your answer ! I plan to update README.md and create PR later to use of.

danielwerg commented 3 years ago

I think you only need userId if you want to find linked accounts (steam, uplay for example), but to check stats you want to use id.