Initial commit
This commit is contained in:
55
src/models/JmapServiceObject.ts
Normal file
55
src/models/JmapServiceObject.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* JMAP-specific ServiceObject implementation
|
||||
* Extends base ServiceObject with JMAP-specific functionality
|
||||
*/
|
||||
|
||||
import { ServiceObject } from '@KTXM/MailManager/models/service'
|
||||
import type { JmapAuxiliary } from '../types/auxiliary'
|
||||
|
||||
/**
|
||||
* JMAP Service Object
|
||||
* Provides typed access to JMAP-specific auxiliary data
|
||||
*/
|
||||
export class JmapServiceObject extends ServiceObject {
|
||||
/**
|
||||
* Type-safe access to JMAP-specific auxiliary data
|
||||
*/
|
||||
get jmapAuxiliary(): JmapAuxiliary {
|
||||
return (this._data.auxiliary ?? {}) as JmapAuxiliary
|
||||
}
|
||||
|
||||
get hasCore(): boolean {
|
||||
return this.jmapAuxiliary.capable?.core === true;
|
||||
}
|
||||
|
||||
get hasMail(): boolean {
|
||||
return this.jmapAuxiliary.capable?.mail === true;
|
||||
}
|
||||
|
||||
get hasCalendar(): boolean {
|
||||
return this.jmapAuxiliary.capable?.calendar === true;
|
||||
}
|
||||
|
||||
get hasContacts(): boolean {
|
||||
return this.jmapAuxiliary.capable?.contacts === true;
|
||||
}
|
||||
|
||||
get hasDocuments(): boolean {
|
||||
return this.jmapAuxiliary.capable?.documents === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get JMAP session URL
|
||||
*/
|
||||
get sessionUrl(): string | undefined {
|
||||
return this.jmapAuxiliary.sessionUrl
|
||||
}
|
||||
|
||||
/**
|
||||
* Get JMAP account ID
|
||||
*/
|
||||
get accountId(): string | undefined {
|
||||
return this.jmapAuxiliary.accountId
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user