aboutsummaryrefslogtreecommitdiff
path: root/protocol.d.ts
blob: 0657cdf5fe8938654361a32cf67ea894aea700c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// { type: "handshake", version: "10"}
// { type: "handshake", data: {version: "10"}}
//! { "handshake": {version: "10"}}

export type ServerboundPacket = Download
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 Task {
    name: string,
    description: string,

    tags: string[],
    priority: number,

    completed?: number,
    scheduled?: number,

    occurence?: Condition,
    deadline?: Condition,
}

/*
    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},
    ]
*/

// should only have one property
interface 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"