betach
Version:
Node.js Character.AI Unofficial API
59 lines (53 loc) • 1.01 kB
JavaScript
/**
* @file Config.js
* @description Config class for Character AI
* @exports Config
* @class Config
*/
export default class Config {
/**
* Config constructor
* @param {string} key
* @param {string} characterID
*/
constructor (key, characterID) {
this.key = key;
this.characterID = characterID;
this.baseURL = "https://beta.character.ai";
}
/**
* getKey
* @returns {string} key
*/
getKey() {
return this.key;
}
/**
* getBase
* @returns {string} baseURL
*/
getBase() {
return this.baseURL;
}
/**
* getCharacter
* @returns {string} characterID
* @memberof Config
*/
getCharacter() {
return this.characterID;
}
/**
* getHeaders
* @param {Object} headers
* @param {string} contentType
* @returns headers
*/
getHeaders(headers, contentType = "application/json") {
return {
...headers,
"Content-Type": contentType,
"Authorization": `Token ${this.key}`,
};
}
}