-
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.
Merge pull request #6 from TGoers-FNSB/dev
v0.1.2
- Loading branch information
Showing
30 changed files
with
1,029 additions
and
163 deletions.
There are no files selected for viewing
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,29 @@ | ||
package wrikego | ||
|
||
import ( | ||
"log" | ||
|
||
params "github.com/TGoers-FNSB/WrikeGo/parameters" | ||
resp "github.com/TGoers-FNSB/WrikeGo/response" | ||
query "github.com/google/go-querystring/query" | ||
) | ||
|
||
func QueryAccount(config Config, params params.QueryAccount) (resp.Account, error) { | ||
path := "/account" | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.AccountFromJSON(response) | ||
} | ||
|
||
func ModifyAccount(config Config, params params.QueryAccount) (resp.Account, error) { | ||
path := "/account" | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return resp.AccountFromJSON(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
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,83 @@ | ||
package wrikego | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
params "github.com/TGoers-FNSB/WrikeGo/parameters" | ||
resp "github.com/TGoers-FNSB/WrikeGo/response" | ||
query "github.com/google/go-querystring/query" | ||
) | ||
|
||
func QueryComments(config Config, params params.QueryComments) (resp.Comments, error) { | ||
path := "/comments" | ||
response, _ := Get(config, path, nil) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func QueryCommentsByFolder(config Config, params params.QueryComments, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/folders/%s/comments", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func QueryCommentsByTask(config Config, params params.QueryComments, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/tasks/%s/comments", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func QueryCommentsByIds(config Config, params params.QueryComments, pathId []string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/comments/%s", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func CreateCommentByFolder(config Config, params params.CreateComments, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/folders/%s/comments", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Post(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func CreateCommentByTask(config Config, params params.CreateComments, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/folders/%s/comments", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Post(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func ModifyCommentById(config Config, params params.ModifyComments, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/comments/%s", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return resp.CommentsFromJSON(response) | ||
} | ||
|
||
func DeleteCommentById(config Config, pathId string) (resp.Comments, error) { | ||
path := fmt.Sprintf("/comments/%s", pathId) | ||
response, _ := Delete(config, path, nil) | ||
return resp.CommentsFromJSON(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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package wrikego | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
params "github.com/TGoers-FNSB/WrikeGo/parameters" | ||
resp "github.com/TGoers-FNSB/WrikeGo/response" | ||
query "github.com/google/go-querystring/query" | ||
) | ||
|
||
func QueryContacts(config Config, params params.QueryContacts) (resp.Contacts, error) { | ||
path := "/contacts" | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.ContactsFromJSON(response) | ||
} | ||
|
||
func QueryContactsByIds(config Config, params params.QueryContacts, pathId []string) (resp.Contacts, error) { | ||
path := fmt.Sprintf("/contacts/%s", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.ContactsFromJSON(response) | ||
} | ||
|
||
func QueryContactsFieldsHistoryByIds(config Config, params params.QueryContacts, pathId []string) (resp.Contacts, error) { | ||
path := fmt.Sprintf("/contacts/%s/contacts_history", strings.Join(pathId, ",")) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Get(config, path, body) | ||
return resp.ContactsFromJSON(response) | ||
} | ||
|
||
func ModifyContactsById(config Config, params params.ModifyFolders, pathId string) (resp.Contacts, error) { | ||
path := fmt.Sprintf("/contacts/%s", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return resp.ContactsFromJSON(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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package wrikego | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
params "github.com/TGoers-FNSB/WrikeGo/parameters" | ||
resp "github.com/TGoers-FNSB/WrikeGo/response" | ||
query "github.com/google/go-querystring/query" | ||
) | ||
|
||
func QueryCustomFields(config Config) (resp.CustomFields, error) { | ||
path := "/customfields" | ||
response, _ := Get(config, path, nil) | ||
return resp.CustomFieldsFromJSON(response) | ||
} | ||
|
||
func QueryCustomFieldsByIds(config Config, pathId []string) (resp.CustomFields, error) { | ||
path := fmt.Sprintf("/customfields/%s", strings.Join(pathId, ",")) | ||
response, _ := Get(config, path, nil) | ||
return resp.CustomFieldsFromJSON(response) | ||
} | ||
|
||
func CreateCustomFields(config Config, params params.CreateCustomFields) (resp.CustomFields, error) { | ||
path := "/customfields" | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Post(config, path, body) | ||
return resp.CustomFieldsFromJSON(response) | ||
} | ||
|
||
func ModifyCustomFieldsById(config Config, params params.ModifyCustomFields, pathId string) (resp.CustomFields, error) { | ||
path := fmt.Sprintf("/customfields/%s", pathId) | ||
body, err := query.Values(params) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
response, _ := Put(config, path, body) | ||
return resp.CustomFieldsFromJSON(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
Oops, something went wrong.