@bitzonegaming/roleplay-engine-sdk
Version:
Roleplay Engine SDK
51 lines (50 loc) • 2.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiscordApi = void 0;
class DiscordApi {
constructor(client) {
this.client = client;
}
/**
* Retrieves a Discord user with the guild membership information by their unique identifier. This endpoint is used to fetch Discord user details for a specific player.<br/>This endpoint performs server-level operations. The token does not need to be associated with any account or character.<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: read:account
* @summary Get Discord user by id
* @param {string} discordUserId
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getDiscordUserById(discordUserId, options) {
return this.client.get({
url: `discord/users/${discordUserId}`,
options,
});
}
/**
* This endpoint allows players to authenticate with Discord using the implicit flow. It returns a grant access result containing the player\'s account information and access token.<br/>This endpoint performs server-level operations. The token does not need to be associated with any account or character.<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: write:player_auth
* @summary Authorize with implicit Discord flow
* @param {ImplicitDiscordAuthRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
authImplicitFlow(request, options) {
return this.client.post({
url: `discord/auth`,
data: request,
options,
});
}
/**
* This endpoint allows players to authenticate with Discord using OAuth tokens. It returns a grant access result containing the player\'s account information and access token.<br/>This endpoint performs server-level operations. The token does not need to be associated with any account or character.<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: write:player_auth
* @summary Authorize with Discord OAuth token
* @param {DiscordOAuthTokenRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
authOAuthFlow(request, options) {
return this.client.post({
url: `discord/oauth/token`,
data: request,
options,
});
}
}
exports.DiscordApi = DiscordApi;