This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrequests.go
73 lines (53 loc) · 1.84 KB
/
requests.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
package liquidplanner
import (
"strconv"
)
//------------------------------------------------------------------------------
//-- Account
//------------------------------------------------------------------------------
func GetAccount() ( result Person, res LpResponse ) {
res = FetchJson( "GET", "account", nil, &result )
return
}
//------------------------------------------------------------------------------
//-- Workspace
//------------------------------------------------------------------------------
func GetWorkspaces() ( result []Workspace ) {
FetchJson( "GET", "workspaces", nil, &result )
return
}
//------------------------------------------------------------------------------
//-- Project
//------------------------------------------------------------------------------
func GetProjects() ( result []Project ) {
FetchJson( "GET", "workspaces/" + lp_space_id + "/projects", nil, &result)
return
}
//------------------------------------------------------------------------------
//-- Task
//------------------------------------------------------------------------------
// get all
func GetTasks( ) ( result []Task ) {
FetchJson( "GET", "workspaces/" + lp_space_id + "/tasks", nil, &result)
return
}
// create
func CreateTask( task Task ) ( result Task ) {
taskWrap := map[string]Task { "task": task, }
FetchJson( "POST", "workspaces/" + lp_space_id + "/tasks", taskWrap, &result)
return
}
// update
func UpdateTask( task *Task ) {
taskWrap := map[string]Task { "task": *task, }
FetchJson( "PUT", "workspaces/" + lp_space_id +
"/tasks/" + strconv.FormatInt( int64(task.Id), 10 ),
taskWrap, task)
return
}
// delete
func DeleteTask( task *Task ) {
Fetch( "DELETE", "workspaces/" + lp_space_id +
"/treeitems/" + strconv.FormatInt( int64(task.Id), 10 ),
nil )
}