kod-temp
Version:
Workano Communications SDK
29 lines (28 loc) • 747 B
JavaScript
import newFrom from '../utils/new-from';
export default class Incall {
id;
extensions;
extension;
// Useful to compare instead of instanceof with minified code
type = 'Incall';
constructor({ id, extensions } = {}) {
this.id = id;
this.extensions = extensions;
this.extension = extensions?.[0]?.exten;
}
static parse(plain) {
return new Incall({
id: plain.id,
extensions: plain.extensions,
});
}
static newFrom(profile) {
return newFrom(profile, Incall);
}
hasExtension(extension) {
if (!this.extensions) {
return false;
}
return this.extensions.some(ext => ext.exten === extension);
}
}