-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
239 additions
and
12 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
|
||
# Go workspace file | ||
go.work | ||
test/main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[Section][Wrike Method[s]][In[(folder / space)]][ById[s]] | ||
|
||
- Add trailing "s" if function will change multiple items at once. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module "github.com/TGoers-FNSB/WrikeGo" | ||
module github.com/TGoers-FNSB/WrikeGo | ||
|
||
go 1.21.1 | ||
|
||
require github.com/google/go-querystring v1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= | ||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= | ||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package wrikeparams | ||
|
||
type DateOrRange struct { | ||
Start string `url:"start,omitempty"` | ||
End string `url:"end,omitempty"` | ||
Equal string `url:"equal,omitempty"` | ||
} | ||
type TaskDates struct { | ||
Type string `url:"type,omitempty"` | ||
Duration int `url:"duration,omitempty"` | ||
Start string `url:"start,omitempty"` | ||
Due string `url:"due,omitempty"` | ||
WorkOnWeekends bool `url:"workOnWeekends,omitempty"` | ||
} | ||
|
||
type Metadata struct { | ||
Key string `url:"key,omitempty"` | ||
Value string `url:"value,omitempty"` | ||
} | ||
|
||
type CustomField struct { | ||
ID string `url:"id,omitempty"` | ||
Comparator string `url:"comparator,omitempty"` | ||
Value string `url:"value,omitempty"` | ||
MinValue string `url:"minValue,omitempty"` | ||
MaxValue string `url:"maxValue,omitempty"` | ||
Values []string `url:"values,omitempty"` | ||
} | ||
|
||
type EffortAllocation struct { | ||
AllocatedEffort int `url:"allocatedEffort,omitempty"` | ||
DailyAllocationPercentage int `url:"dailyAllocationPercentage,omitempty"` | ||
Mode string `url:"mode,omitempty"` | ||
TotalEffort int `url:"totalEffort,omitempty"` | ||
} | ||
|
||
type QueryTasks struct { | ||
Descendants bool `url:"descendants,omitempty"` | ||
Title string `url:"title,omitempty"` | ||
Status []string `url:"status,omitempty"` | ||
Importance string `url:"importance,omitempty"` | ||
StartDate DateOrRange `url:"startDate,omitempty"` | ||
DueDate DateOrRange `url:"dueDate,omitempty"` | ||
ScheduledDate DateOrRange `url:"scheduledDate,omitempty"` | ||
CreatedDate DateOrRange `url:"createdDate,omitempty"` | ||
UpdatedDate DateOrRange `url:"updatedDate,omitempty"` | ||
CompletedDate DateOrRange `url:"completedDate,omitempty"` | ||
Authors []string `url:"authors,omitempty"` | ||
Responsibles []string `url:"responsibles,omitempty"` | ||
Permalink string `url:"permalink,omitempty"` | ||
Type string `url:"type,omitempty"` | ||
Limit int `url:"limit,omitempty"` | ||
SortField string `url:"sortField,omitempty"` | ||
SortOrder string `url:"sortOrder,omitempty"` | ||
SubTasks bool `url:"subTasks,omitempty"` | ||
PageSize int `url:"pageSize,omitempty"` | ||
NextPageToken string `url:"nextPageToken,omitempty"` | ||
Metadata Metadata `url:"metadata,omitempty"` | ||
CustomField CustomField `url:"customField,omitempty"` | ||
CustomStatuses []string `url:"customStatuses,omitempty"` | ||
BillingTypes []string `url:"billingTypes,omitempty"` | ||
Fields []string `url:"fields,omitempty"` | ||
} | ||
|
||
type CreateTasks struct { | ||
Title string `url:"title,omitempty"` | ||
Description string `url:"description,omitempty"` | ||
Status string `url:"status,omitempty"` | ||
Importance string `url:"importance,omitempty"` | ||
Dates TaskDates `url:"dates,omitempty"` | ||
Shareds []string `url:"shareds,omitempty"` | ||
Parents []string `url:"parents,omitempty"` | ||
Responsibles []string `url:"responsibles,omitempty"` | ||
ResponsiblePlaceholders []string `url:"resopnsiblePlaceholders,omitempty"` | ||
Followers []string `url:"followers,omitempty"` | ||
Follow bool `url:"follow,omitempty"` | ||
PriorityBefore string `url:"priorityBefore,omitempty"` | ||
PriorityAfter string `url:"priorityAfter,omitempty"` | ||
SuperTasks []string `url:"superTasks,omitempty"` | ||
Metadata []Metadata `url:"metadata,omitempty"` | ||
CustomFields []CustomField `url:"customFields,omitempty"` | ||
CustomStatus string `url:"customStatus,omitempty"` | ||
EffortAllocation EffortAllocation `url:"effortAllocation,omitempty"` | ||
BillingType string `url:"billingType,omitempty"` | ||
Fields []string `url:"fields,omitempty"` | ||
} | ||
|
||
type ModifyTasks struct { | ||
Title string `url:"title,omitempty"` | ||
Description string `url:"description,omitempty"` | ||
Status string `url:"status,omitempty"` | ||
Importance string `url:"importance,omitempty"` | ||
Dates TaskDates `url:"dates,omitempty"` | ||
AddParents []string `url:"addParents,omitempty"` | ||
RemoveParents []string `url:"removeParents,omitempty"` | ||
AddShareds []string `url:"addShareds,omitempty"` | ||
RemoveShareds []string `url:"removeShareds,omitempty"` | ||
AddResponsibles []string `url:"addResponsibles,omitempty"` | ||
RemoveResponsibles []string `url:"removeResponsibles,omitempty"` | ||
AddResponsiblePlaceholders []string `url:"addResopnsiblePlaceholders,omitempty"` | ||
RemoveResponsiblePlaceholders []string `url:"removeResopnsiblePlaceholders,omitempty"` | ||
AddFollowers []string `url:"addFollowers,omitempty"` | ||
Follow bool `url:"follow,omitempty"` | ||
PriorityBefore string `url:"priorityBefore,omitempty"` | ||
PriorityAfter string `url:"priorityAfter,omitempty"` | ||
AddSuperTasks []string `url:"addSuperTasks,omitempty"` | ||
RemoveSuperTasks []string `url:"removeSuperTasks,omitempty"` | ||
Metadata []Metadata `url:"metadata,omitempty"` | ||
CustomFields []CustomField `url:"customFields,omitempty"` | ||
CustomStatus string `url:"customStatus,omitempty"` | ||
Restore bool `url:"restore,omitempty"` | ||
EffortAllocation EffortAllocation `url:"effortAllocation,omitempty"` | ||
BillingType string `url:"billingType,omitempty"` | ||
Fields []string `url:"fields,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,97 @@ | ||
package wrikego | ||
|
||
import ( | ||
"net/url" | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
params "github.com/TGoers-FNSB/WrikeGo/parameters" | ||
types "github.com/TGoers-FNSB/WrikeGo/types" | ||
query "github.com/google/go-querystring/query" | ||
) | ||
|
||
func QueryTasks_Get_Tasks(config Config, params url.Values) (types.Tasks, error) { | ||
func QueryTasks(config Config, params params.QueryTasks) (types.Tasks, error) { | ||
path := "/tasks" | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
response, _ := Get(config, path, params) | ||
func QueryTasksInFolder(config Config, params params.QueryTasks, pathId string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/folders/%s/tasks", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func QueryTasksInSpace(config Config, params params.QueryTasks, pathId string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/spaces/%s/tasks", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return types.TasksFromJSON(response) | ||
// Comments9 | ||
} | ||
|
||
func QueryTasksByIDs(config Config, params params.QueryTasks, pathId []string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/tasks/%s", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func QueryTasksFieldsHistoryByIds(config Config, params params.QueryTasks, pathId []string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/tasks/%s/tasks_history", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func CreateTaskInFolder(config Config, params params.CreateTasks, pathId string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/folders/%s/tasks", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Post(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func ModifyTaskById(config Config, params params.ModifyTasks, pathId string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/tasks/%s", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func ModifyTasksByIds(config Config, params params.ModifyTasks, pathId []string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/tasks/%s", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return types.TasksFromJSON(response) | ||
} | ||
|
||
func DeleteTaskById(config Config, pathId string) (types.Tasks, error) { | ||
path := fmt.Sprintf("/tasks/%s", pathId) | ||
response, _ := Delete(config, path) | ||
return types.TasksFromJSON(response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,4 @@ type Tasks struct { | |
Value string `json:"value"` | ||
} `json:"customFields"` | ||
} `json:"data"` | ||
} | ||
} |