From 3238f8517097745032e19b3e26f57f0465a00b28 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 10 Jun 2022 10:47:16 +0200 Subject: move to workspace --- karld/protocol.d.ts | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 karld/protocol.d.ts (limited to 'karld/protocol.d.ts') diff --git a/karld/protocol.d.ts b/karld/protocol.d.ts new file mode 100644 index 0000000..a592146 --- /dev/null +++ b/karld/protocol.d.ts @@ -0,0 +1,75 @@ + +// { type: "handshake", version: "10"} +// { type: "handshake", data: {version: "10"}} +//! { "handshake": {version: "10"}} + +export type ServerboundPacket = Download | UpdateTask | RemoveTask +export type ClientboundPacket = Handshake | DownloadResponse + +interface Handshake { + type: "handshake" + data: { version: string } +} + +interface Download { + type: "download", + data: null +} +interface DownloadResponse { + type: "download_response", + data: { tasks: Task[] } +} + +interface UpdateTask { + type: "update_task", + data: Task +} +interface RemoveTask { + type: "remove_task", + data: Task +} + +interface Task { + id: number + name: string, + description: string, + + tags: string[], + priority: number, + + completed?: number, + scheduled?: number, + + occurence?: Condition, + deadline?: Condition, +} + +export type Condition = { from?: Condition } + | { or?: Condition[] } + | { and?: Condition[] } + | { equal?: { prop: Thing, value: number, mod?: number } } + | { range?: { prop: Thing, min: number, max: number, mod?: number } } + +type Thing = "year" + | "monthofyear" + | "weekofmonth" + | "dayofyear" + | "dayofmonth" + | "dayofweek" + | "hour" + | "minute" + | "second" + | "unix" + +/* + examples: + + 11:00 - 12:00 every first monday of the month + + and: [ + { range: { prop: "hour", min: 11, max: 12 } }, + { equal: { prop: "dayofweek", value: 0 } }, + { equal: { prop: "weekofmonth", value: 0 } } + ] + +*/ -- cgit v1.2.3-70-g09d2