obf-connector
Version:
An API connector for Open Badge Factory
17 lines (13 loc) • 449 B
JavaScript
const ALLOWED_STATES = Object.freeze(['complete', 'incomplete', 'error']);
class ConnectorResponse {
constructor(status, data, message, targetURL) {
if (!status || !ALLOWED_STATES.includes(status)) {
throw new Error(`status must be one of ${ALLOWED_STATES} but was ${status}`);
}
this.status = status;
this.data = data;
this.message = message;
this.targetURL = targetURL;
}
}
module.exports = ConnectorResponse;