Adrien BĂ©raud | 0cb76c9 | 2021-04-07 19:59:08 -0400 | [diff] [blame^] | 1 | class Contact { |
| 2 | constructor(uri) { |
| 3 | this.uri = uri |
| 4 | this.displayName = undefined |
| 5 | this.registeredName = undefined |
| 6 | } |
| 7 | |
| 8 | static from(object) { |
| 9 | return new Contact(object.uri) |
| 10 | } |
| 11 | |
| 12 | getUri() { return this.uri } |
| 13 | |
| 14 | getRegisteredName() { this.registeredName } |
| 15 | |
| 16 | getDisplayName() { |
| 17 | return this.displayName || this.getRegisteredName() || this.getUri() |
| 18 | } |
| 19 | |
| 20 | getObject() { |
| 21 | return { |
| 22 | uri: this.uri |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | module.exports = Contact; |