@adoratorio/demetra
Version:
Internal use library for wordpress API request
26 lines • 682 B
JavaScript
import { md5 } from "js-md5";
class DemetraRequest {
id = undefined;
mode;
lang;
site;
version;
md5 = '';
constructor(mode, id, lang = 'en', site = 'default', version = 2) {
this.id = id;
this.mode = mode;
this.lang = lang;
this.site = site;
this.version = version;
if (typeof this.id === 'undefined')
throw new Error('Request id cannot be undefined');
}
get hash() {
if (this.md5.length > 0)
return this.md5;
this.md5 = md5.hex(JSON.stringify(this));
return this.md5;
}
}
export default DemetraRequest;
//# sourceMappingURL=DemetraRequest.js.map