friend-connect
Version:
**BEFORE YOU USE THIS TOOL, PLEASE READ THE FOLLOWING: WE _AS CONTRIBUTORS_ ARE NOT RESPONSIBLE FOR ANY DAMAGE OR LOSS CAUSED BY THIS APP. USE AN ALT ACCOUNT, JUST IN CASE THERE IS AN ISSUE WITH THIS METHOD.**
35 lines (34 loc) • 1.16 kB
JavaScript
import { parseIdentifier } from "../utils";
export default class PeopleHub {
constructor(xboxLiveClient) {
this.xbox = xboxLiveClient;
}
async getFollowers(identifier) {
const res = await fetch(`${PeopleHub.uri}/users/${parseIdentifier(identifier)}/people/followers`, {
method: "GET",
headers: {
Authorization: this.xbox.authorizationHeader,
"x-xbl-contract-version": "5",
"Accept-Language": "en-us",
},
});
let data = await res.json();
return data;
}
async getPeople(xuids) {
const res = await fetch(`${PeopleHub.uri}/users/me/people/batch/decoration/`, {
method: "POST",
headers: {
Authorization: this.xbox.authorizationHeader,
"x-xbl-contract-version": "5",
"Accept-Language": "en-us",
},
body: JSON.stringify({
xuids,
}),
});
let data = await res.json();
return data;
}
}
PeopleHub.uri = "https://peoplehub.xboxlive.com";