corrected SnipcartItem

This commit is contained in:
Bastian de Byl
2023-02-26 14:11:55 -05:00
parent 13f482e50a
commit 2d91d1d122
3 changed files with 81 additions and 11 deletions

33
example_get_order.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"github.com/debyltech/go-snipcart/snipcart"
)
func main() {
snipcartApiKey := flag.String("key", "", "Snipcart API Key")
flag.Parse()
if *snipcartApiKey == "" {
log.Fatal("missing -key flag")
}
snipcartProvider := snipcart.NewSnipcartProvider(*snipcartApiKey)
response, err := snipcartProvider.GetOrder("b35990df-c0ca-4014-94de-1caa7bd7bb51")
if err != nil {
log.Fatal(err)
}
byteResponse, err := json.Marshal(response)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(byteResponse))
}