-
Notifications
You must be signed in to change notification settings - Fork 4
/
taskMetadata.go
68 lines (64 loc) · 1.83 KB
/
taskMetadata.go
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
package ganboard
// GetTaskMetadata https://docs.kanboard.org/en/latest/api/task_metadata_procedures.html#gettaskmetadata
func (c *Client) GetTaskMetadata(taskID int) (map[string]string, error) {
query := request{
Client: c,
Method: "getTaskMetadata",
Params: map[string]int{
"task_id": taskID,
},
}
response, err := query.decodeMapStringString()
return response, err
}
// GetTaskMetadataByName https://docs.kanboard.org/en/latest/api/task_metadata_procedures.html#gettaskmetadatabyname
func (c *Client) GetTaskMetadataByName(taskID int, name string) (string, error) {
query := request{
Client: c,
Method: "getTaskMetadataByName",
Params: struct {
TaskID int `json:"task_id"`
Name string `json:"name"`
}{
TaskID: taskID,
Name: name,
},
}
response, err := query.decodeString()
return response, err
}
// SaveTaskMetadata https://docs.kanboard.org/en/latest/api/task_metadata_procedures.html#savetaskmetadata
// FIXME metadata model not clear in documentation
func (c *Client) SaveTaskMetadata(taskID int, name string, value string) (bool, error) {
query := request{
Client: c,
Method: "saveTaskMetadata",
Params: struct {
TaskID int `json:"task_id"`
Metadata map[string]string `json:"metadata"`
}{
TaskID: taskID,
Metadata: map[string]string{
name: value,
},
},
}
response, err := query.decodeBoolean()
return response, err
}
// RemoveTaskMetadata https://docs.kanboard.org/en/latest/api/task_metadata_procedures.html#removetaskmetadata
func (c *Client) RemoveTaskMetadata(taskID int, name string) (bool, error) {
query := request{
Client: c,
Method: "removeTaskMetadata",
Params: struct {
TaskID int `json:"task_id"`
Name string `json:"name"`
}{
TaskID: taskID,
Name: name,
},
}
response, err := query.decodeBoolean()
return response, err
}