@bitzonegaming/roleplay-engine-sdk
Version:
Roleplay Engine SDK
110 lines (109 loc) • 6.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReferenceApi = void 0;
class ReferenceApi {
constructor(client) {
this.client = client;
}
/**
* It returns a paginated list of references based on the provided filters.<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]<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get references
* @param {Object} [query] Query parameters
* @param {ReferenceCategory} [query.category] Filter by reference category.
* @param {string} [query.name] Filter references by name.
* @param {boolean} [query.enabled] Filter by enabled status.
* @param {number} [query.pageIndex] Page index for pagination.
* @param {number} [query.pageSize] Page size for pagination.
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getReferences(query, options) {
return this.client.get({
url: 'references',
query,
options,
});
}
/**
* It returns a reference by its ID.<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]<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get reference by ID
* @param {string} categoryReferenceId
* @param {Object} [query] Query parameters
* @param {boolean} [query.noCache]
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getReferenceById(categoryReferenceId, query, options) {
return this.client.get({
url: `references/${categoryReferenceId}`,
query,
options,
});
}
/**
* It returns a list of metrics for a reference based on the provided filters.<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:metric<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: read:metric<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get reference metrics
* @param {string} [categoryReferenceId] Category reference ID
* @param {Object} [query] Query parameters
* @param {boolean} [query.localized] If `true`, return localized metric names.
* @param {boolean} [query.fullKeys] Filter metrics by full keys.
* @param {boolean} [query.scope] Filter metrics by scope.
* @param {ApiOptions} [options] Override HTTP request options.
* @throws {EngineError}
*/
getReferenceMetrics(categoryReferenceId, query, options) {
return this.client.get({
url: `references/${categoryReferenceId}/metrics`,
query,
options,
});
}
/**
* It returns the segments of a reference.<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]<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Get reference segments
* @param {string} categoryReferenceId
* @param {Object} [query] Query parameters
* @param {boolean} [query.noCache]
* @param {boolean} [query.visible] If 'true', it only returns visible segments
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
getReferenceSegments(categoryReferenceId, query, options) {
return this.client.get({
url: `references/${categoryReferenceId}/segments`,
query,
options,
});
}
/**
* It applies a segment to the reference. The segment definition type must be MANUAL. Auto segments cannot be applied to references manually.<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:segment<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: write:segment<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Apply segment to reference
* @param {string} categoryReferenceId
* @param {string} segmentDefinitionId
* @param {ApplySegmentToReferenceRequest} request
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
applySegmentToReference(categoryReferenceId, segmentDefinitionId, request, options) {
return this.client.put({
url: `references/${categoryReferenceId}/segments/${segmentDefinitionId}`,
data: request,
options,
});
}
/**
* It removes a segment from the reference. The segment definition type must be MANUAL. Auto segments cannot be removed from references manually.<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:segment<br/><br/> This endpoint requires authorization, and supports following token types:<br/>🔓 [API Key] <b>Required Scopes</b>: write:segment<br/>🔓 [SSO Token]<br/>🔓 [Access Token]<br/>🔓 [Session Token]
* @summary Remove segment from reference
* @param {string} categoryReferenceId
* @param {string} segmentDefinitionId
* @param {*} [options] Override http request option.
* @throws {EngineError}
*/
removeSegmentFromReference(categoryReferenceId, segmentDefinitionId, options) {
return this.client.delete({
url: `references/${categoryReferenceId}/segments/${segmentDefinitionId}`,
options,
});
}
}
exports.ReferenceApi = ReferenceApi;