-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtaskFile.go
87 lines (81 loc) · 2.29 KB
/
taskFile.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package ganboard
// CreateTaskFile https://docs.kanboard.org/en/latest/api/task_file_procedures.html#createtaskfile
func (c *Client) CreateTaskFile(projectID int, taskID int, filename string, blob string) (int, error) {
query := request{
Client: c,
Method: "createTaskFile",
Params: struct {
ProjectID int `json:"project_id,string"`
TaskID int `json:"task_id,string"`
Filename string `json:"filename"`
Blob string `json:"blob"`
}{
ProjectID: projectID,
TaskID: taskID,
Filename: filename,
Blob: blob,
},
}
response, err := query.decodeInt()
return response, err
}
// GetAllTaskFiles https://docs.kanboard.org/en/latest/api/task_file_procedures.html#getalltaskfiles
func (c *Client) GetAllTaskFiles(taskID int) ([]File, error) {
query := request{
Client: c,
Method: "getAllTaskFiles",
Params: map[string]int{
"task_id": taskID,
},
}
response, err := query.decodeFiles()
return response, err
}
// GetTaskFile https://docs.kanboard.org/en/latest/api/task_file_procedures.html#gettaskfile
func (c *Client) GetTaskFile(fileID int) (File, error) {
query := request{
Client: c,
Method: "getTaskFile",
Params: map[string]int{
"file_id": fileID,
},
}
response, err := query.decodeFile()
return response, err
}
// DownloadTaskFile https://docs.kanboard.org/en/latest/api/task_file_procedures.html#downloadtaskfile
func (c *Client) DownloadTaskFile(fileID int) (string, error) {
query := request{
Client: c,
Method: "downloadTaskFile",
Params: map[string]int{
"file_id": fileID,
},
}
response, err := query.decodeString()
return response, err
}
// RemoveTaskFile https://docs.kanboard.org/en/latest/api/task_file_procedures.html#removetaskfile
func (c *Client) RemoveTaskFile(fileID int) (bool, error) {
query := request{
Client: c,
Method: "removeTaskFile",
Params: map[string]int{
"file_id": fileID,
},
}
response, err := query.decodeBoolean()
return response, err
}
// RemoveAllTaskFiles https://docs.kanboard.org/en/latest/api/task_file_procedures.html#removealltaskfiles
func (c *Client) RemoveAllTaskFiles(taskID int) (bool, error) {
query := request{
Client: c,
Method: "removeAllTaskFiles",
Params: map[string]int{
"task_id": taskID,
},
}
response, err := query.decodeBoolean()
return response, err
}