UNPKG

idea-toolbox

Version:
145 lines (144 loc) 4.28 kB
import { Resource } from './resource.model'; import { epochDateTime } from './epoch'; /** * Representation of a calendar, which can be: * - private (linked to a user) or shared (linked to a team). * - linked to an external service (Microsoft, Google, etc.) or not. * * Table: `idea_calendars`. * * Indexes: * - userId-name-index (GSI, all) * - teamId-name-index (GSI, all) */ export declare class Calendar extends Resource { /** * The id (IUID) of the calendar. */ calendarId: string; /** * The id of the teamId owning the calendar, in case of team calendar (this cannot be changed). */ teamId?: string; /** * The id of the user owning the calendar, in case of private calendar (this cannot be changed). * If `teamId` is set, this attribute is ignored. */ userId?: string; /** * The name of the calendar. Max 100 characters. */ name: string; /** * The description of the calendar. Max 300 characters. */ description: string; /** * An identifying color for the calendar; e.g. `#0010AA`. */ color: string; /** * A default timezone for the calendar. */ timezone: string; /** * Extra info about the calendar, if linked to an external service. */ external?: ExternalCalendarInfo; /** * In case of shared calendar, the IDs of the users that can manage the calendar's appointments. * If `null`, everyone can manage the calendar's appointments; if empty (`[]`), no one can (read-only). */ usersCanManageAppointments?: string[]; /** * In case of shared calendar, the id of the user who created it. */ createdByUserId?: string; load(x: any): void; safeLoad(newData: any, safeData: any): void; validate(): string[]; /** * Check whether the chosen user can edit the appointments of this calendar. */ canUserManageAppointments(userId: string): boolean; /** * Whether the calendar is shared (linked to a team) or not. */ isShared(): boolean; /** * The id to use to represent the calendar, based on the fact the calendar is linked to external sources or not. */ getCalendarIdForAppointments(): string; } /** * Additional info for the calendar, in case it's linked to an external service. */ export declare class ExternalCalendarInfo extends Resource { /** * The external service from which the calendar comes. */ service: ExternalCalendarSources; /** * Id of the external calendar. */ calendarId: string; /** * Name of the calendar in the external service. */ name: string; /** * The time of last synchronisation of the external calendar. */ lastSyncAt: epochDateTime; /** * An optional syncBookmark if the external service supports incremental synchronisation. */ syncBookmark: string; /** * An optional pageBookmark if the external service supports incremental synchronisation. * In case of synchronisation with multiple pages (Google); Microsoft manages this directly through the syncBookmark. */ pageBookmark: string; /** * The access level to the calendar for the user who linked the external service. */ userAccess: ExternalCalendarPermissions; /** * Email address with which the user has registered to the service. */ email: string; load(x: any): void; } /** * Possible permissions for an external calendar. */ export declare enum ExternalCalendarPermissions { FREE_BUSY = 0, READER = 1, WRITER = 2, OWNER = 3 } /** * Additional info on a external calendar, detached from the main object for security reasons. * * Table: `idea_externalCalendarsTokens`. */ export declare class ExternalCalendarToken extends Resource { /** * The id external service calendar. */ calendarId: string; /** * The token to perform API requests to the external service. */ token: string; load(x: any): void; safeLoad(newData: any, safeData: any): void; } /** * Possible services as source for external calendars. */ export declare enum ExternalCalendarSources { GOOGLE = "GOOGLE", MICROSOFT = "MICROSOFT" }