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

@@ -14,7 +14,7 @@ type Project struct {
err error
}
func NewProject(id int) *Project {
func NewProject(id uint) *Project {
// Todoist seems to experience a lot of network issues on their side
// If we can't connect, handle it with an empty project until we can
project, err := todoist.GetProject(id)

View File

@@ -18,7 +18,7 @@ type Settings struct {
common *cfg.Common
apiKey string `help:"Your Todoist API key"`
projects []int
projects []uint
}
// NewSettingsFromYAML creates a new settings instance from a YAML config block
@@ -27,7 +27,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
apiKey: ymlConfig.UString("apiKey", ymlConfig.UString("apikey", os.Getenv("WTF_TODOIST_TOKEN"))),
projects: utils.ToInts(ymlConfig.UList("projects")),
projects: utils.IntsToUints(utils.ToInts(ymlConfig.UList("projects"))),
}
return &settings