3pl/examples/kiotviet/main.go

40 lines
771 B
Go
Raw Permalink Normal View History

2023-10-06 10:12:11 +00:00
package main
import (
"fmt"
"git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/3pl/partnerapi/kiotviet"
"git.selly.red/Selly-Modules/3pl/util/pjson"
)
func main() {
var (
client = "45575d3e-5785-***"
secret = "65ACE104EC4232***"
retailer = "****"
)
if err := natsio.Connect(natsio.Config{URL: "localhost:4222"}); err != nil {
panic(err)
}
c, err := kiotviet.New(client, secret, retailer, natsio.GetServer())
if err != nil {
panic(err)
}
data, err := c.GetBranches(kiotviet.ListBranchesReq{})
if err != nil {
panic(err)
}
fmt.Println(pjson.ToJSONString(data))
prod, err := c.GetProductOnHands(kiotviet.ListProductOnHandsReq{
PageSize: 10,
})
if err != nil {
panic(err)
}
fmt.Println(pjson.ToJSONString(prod))
}