planner/cal/main.go

43 lines
707 B
Go
Raw Normal View History

2024-09-11 07:50:27 +02:00
package main
import (
"fmt"
"os"
"time"
2024-09-18 07:29:48 +02:00
2024-09-20 07:09:30 +02:00
"go-mod.ewintr.nl/planner/item"
2024-09-18 07:29:48 +02:00
"go-mod.ewintr.nl/planner/sync/client"
2024-09-11 07:50:27 +02:00
)
func main() {
fmt.Println("cal")
2024-09-18 07:29:48 +02:00
c := client.NewClient("http://localhost:8092", "testKey")
2024-09-18 07:55:14 +02:00
items, err := c.Updated([]item.Kind{item.KindEvent}, time.Time{})
2024-09-11 07:50:27 +02:00
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("%+v\n", items)
2024-09-18 07:55:14 +02:00
i := item.Item{
2024-09-11 07:50:27 +02:00
ID: "id-1",
2024-09-18 07:55:14 +02:00
Kind: item.KindEvent,
2024-09-11 07:50:27 +02:00
Updated: time.Now(),
Body: "body",
}
2024-09-18 07:55:14 +02:00
if err := c.Update([]item.Item{i}); err != nil {
2024-09-11 07:50:27 +02:00
fmt.Println(err)
os.Exit(1)
}
2024-09-18 07:55:14 +02:00
items, err = c.Updated([]item.Kind{item.KindEvent}, time.Time{})
2024-09-11 07:50:27 +02:00
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("%+v\n", items)
}