@bitzonegaming/roleplay-engine-sdk
Version:
Roleplay Engine SDK
100 lines (99 loc) • 5.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountApi = void 0;
class AccountApi {
constructor(client) {
this.client = client;
}
/**
* Registers a new account in the game server. This endpoint is used to create a new player account.<br/>This endpoint performs server-level operations. The token does not need to be associated with any account or character.<br/><b>Account Policies</b>: account_policy:write:account<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: write:account<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Register a new account
* @param {RegisterAccountRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
registerAccount(request, options) {
return this.client.post({
url: 'accounts',
data: request,
options,
});
}
/**
* Authenticates a player using their password. This endpoint is used to log in a player to the game server.<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 Authenticate with password
* @param {AccountAuthRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
authWithPassword(request, options) {
return this.client.post({
url: 'accounts/auth',
data: request,
options,
});
}
/**
* Retrieves an account by its unique identifier. This endpoint is used to fetch account 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/><b>Account Policies</b>: account_policy:read:account<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: read:account<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get account by id
* @param {string} accountId
* @param {Object} [query] Query parameters.
* @param {boolean} [query.includeSignInOptions] If `true`, include activated sign-in options in the response.
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getAccountById(accountId, query, options) {
return this.client.get({
url: `accounts/${accountId}`,
query,
options,
});
}
/**
* Retrieves all characters associated with a specific account. This endpoint is used to list characters for a player.<br/>This endpoint performs server-level operations. The token does not need to be associated with any account or character.<br/><b>Account Policies</b>: account_policy:read:character<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: read:character<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get account characters
* @param {string} accountId
* @param {Object} [query] Query parameters.
* @param {boolean} [query.includeAppearance] If `true`, include character appearance details in the response.
* @param {boolean} [query.includeMotives] If `true`, include character motives data in the response.
* @param {boolean} [query.onlyActive] If `true`, return only characters that are currently active.
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getAccountCharacters(accountId, query, options) {
return this.client.get({
url: `accounts/${accountId}/characters`,
query,
options,
});
}
/**
* Pre-authenticates a player for external login. This endpoint is used to initiate the external login flow.<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 External login pre-authentication
* @param {ExternalLoginPreAuthRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
preAuthExternalLogin(request, options) {
return this.client.post({
url: 'accounts/external-login/pre-auth',
data: request,
options,
});
}
/**
* Authenticates a player using external login credentials. This endpoint is used to complete the external login flow.<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 External login authentication
* @param {ExternalLoginAuthRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
authExternalLogin(request, options) {
return this.client.post({
url: 'accounts/external-login/auth',
data: request,
options,
});
}
}
exports.AccountApi = AccountApi;