rename, useResources(), simple test

This commit is contained in:
2024-09-24 17:56:33 -05:00
parent cae3656551
commit 75ea7d5cd7
2 changed files with 11 additions and 3 deletions

View File

View File

@@ -1,9 +1,10 @@
package develop package main
import ( import (
"fmt" "fmt"
"internal/api" "internal/api"
"os" "os"
"time"
"github.com/joho/godotenv" "github.com/joho/godotenv"
) )
@@ -29,14 +30,21 @@ func main() {
// } // }
client = api.NewSyncClient(os.Getenv("TODOIST_API_KEY")) client = api.NewSyncClient(os.Getenv("TODOIST_API_KEY"))
client.Synchronize(true) client.UseResources(api.Items)
for { for {
changes, err := client.Synchronize(false) _, err := client.Synchronize(false)
fmt.Printf("Items: %d\n", len(client.State.Items))
for _, item := range client.State.Items {
fmt.Println(item)
}
if err != nil { if err != nil {
fmt.Println("Error syncing:", err) fmt.Println("Error syncing:", err)
os.Exit(1) os.Exit(1)
} }
time.Sleep(30 * time.Second)
} }
} }