1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-781 Todoist project ID conversion (#789)

* WTF-781 Switch Todoist IDs from `int` to `string`

On platforms that convert an `int` to `int32`, like the Raspberry Pi,
an `int` is not large enough to store Todoist project IDs.

Using a `string` ensures this never becomes a problem.

Fixes #781

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer
2019-12-16 20:25:52 -08:00
committed by GitHub
parent 3a388fba23
commit 140dd553e0
9 changed files with 74 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ import (
// Project is a model of todoist project entity
type Project struct {
ID int `json:"id"`
ID uint `json:"id"`
Name string `json:"name"`
CommentCount int `json:"comment_count"`
Order int `json:"order"`
@@ -62,7 +62,7 @@ func ListProject() ([]Project, error) {
// panic(err)
// }
// fmt.Println(project)
func GetProject(id int) (Project, error) {
func GetProject(id uint) (Project, error) {
path := fmt.Sprintf("projects/%d", id)
res, err := makeRequest(http.MethodGet, path, nil)
if err != nil {

View File

@@ -10,7 +10,7 @@ import (
// Task is a model of todoist project entity
type Task struct {
ID int `json:"id"`
ID uint `json:"id"`
CommentCount int `json:"comment_count"`
Completed bool `json:"completed"`
Content string `json:"content"`
@@ -24,10 +24,10 @@ type Task struct {
// Due is a model of todoist project entity
type Due struct {
String string `json:"string"`
Date string `json:"date"`
Datetime time.Time `json:"datetime,omitempty"`
Timezone string `json:"timezone"`
String string `json:"string"`
Date string `json:"date"`
Datetime time.Time `json:"datetime,omitempty"`
Timezone string `json:"timezone"`
}
func (t Task) taskSave() taskSave {
@@ -94,7 +94,7 @@ func ListTask(qp QueryParam) ([]Task, error) {
}
// GetTask return a task by id
func GetTask(id int) (Task, error) {
func GetTask(id uint) (Task, error) {
path := fmt.Sprintf("tasks/%d", id)
res, err := makeRequest(http.MethodGet, path, nil)
if err != nil {

2
vendor/modules.txt vendored
View File

@@ -264,7 +264,7 @@ github.com/spf13/pflag
github.com/stretchr/testify/assert
# github.com/wtfutil/spotigopher v0.0.0-20191127141047-7d8168fe103a
github.com/wtfutil/spotigopher/spotigopher
# github.com/wtfutil/todoist v0.0.1
# github.com/wtfutil/todoist v0.0.2-0.20191216004217-0ec29ceda61a
github.com/wtfutil/todoist
# github.com/xanzy/go-gitlab v0.22.2
github.com/xanzy/go-gitlab