blob: 8fa26b2f6b599038c5c89c8716cfe317ed8c9a87 [file] [log] [blame]
class Contact {
constructor(uri) {
this.uri = uri
this.displayName = undefined
this.registeredName = undefined
}
static from(object) {
const contact = new Contact(object.uri)
if (object.registeredName)
contact.setRegisteredName(object.registeredName)
return contact
}
getUri() { return this.uri }
getRegisteredName() { return this.registeredName }
setRegisteredName(name) { this.registeredName = name }
getDisplayName() {
return this.displayName || this.getRegisteredName() || this.getUri()
}
getObject() {
return {
uri: this.uri,
registeredName: this.registeredName
}
}
}
export default Contact