mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* start ical types (external deps?) * rework calendar component types * add tests * fix name * fix callback return type * optional index signature * comment
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
// Type definitions for ical 0.6
|
|
// Project: https://github.com/peterbraden/ical.js
|
|
// Definitions by: Nick Clifford <https://github.com/nickbclifford>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.8
|
|
|
|
import request = require('request');
|
|
import { RRule } from 'rrule';
|
|
|
|
export type CalendarComponentType = 'VEVENT' | 'VTODO' | 'VJOURNAL' | 'VFREEBUSY' | 'VTIMEZONE' | 'VALARM';
|
|
|
|
export interface ParamList {
|
|
params: { [key: string]: string };
|
|
val: string;
|
|
}
|
|
|
|
export type FreeBusyType = 'FREE' | 'BUSY';
|
|
|
|
export interface FreeBusy {
|
|
type: FreeBusyType;
|
|
start: Date;
|
|
end: Date;
|
|
}
|
|
|
|
// All properties (except type) are optional
|
|
// Typed as string | ParamList by default, exceptions listed below
|
|
export type CalendarComponent = {
|
|
type: CalendarComponentType;
|
|
summary?: string;
|
|
description?: string;
|
|
url?: string;
|
|
uid?: string;
|
|
location?: string;
|
|
start?: Date;
|
|
end?: Date;
|
|
rrule?: RRule;
|
|
exdate?: { [datestr: string]: Date };
|
|
recurrences?: CalendarComponent[];
|
|
class?: string;
|
|
transparency?: string;
|
|
geo?: Geo;
|
|
completion?: string;
|
|
completed?: Date;
|
|
categories?: string[];
|
|
freebusy?: FreeBusy;
|
|
dtstamp?: Date;
|
|
created?: Date;
|
|
lastmodified?: Date;
|
|
recurrenceid?: Date;
|
|
} & { [prop: string]: string | ParamList | undefined };
|
|
|
|
export interface Geo {
|
|
lat: number;
|
|
long: number;
|
|
}
|
|
|
|
export interface FullCalendar {
|
|
[uid: string]: CalendarComponent;
|
|
}
|
|
|
|
export function parseICS(icsData: string): FullCalendar;
|
|
export function parseFile(filename: string): FullCalendar;
|
|
export function fromURL(url: string, options: request.CoreOptions, callback: (error: any, data: FullCalendar) => void): void;
|