Usage guidance
Closed this issue · 6 comments
Created a .go file from sample in README
This output received :
./go-order-lookup.go:4:5: imported and not used: "github.com/richzw/appstore/api"
./go-order-lookup.go:18:11: undefined: StoreConfig
./go-order-lookup.go:27:10: undefined: NewStoreClient
./go-order-lookup.go:30:46: undefined: context
Seems not accessing imported
Only addition to sample code is :
package main
How should I run this ?
@timconsidine , Sorry for the incorrect README.
Please try this one
import (
"context"
"github.com/richzw/appstore/api"
)
func main() {
c := &api.StoreConfig{
KeyContent: []byte(ACCOUNTPRIVATEKEY),
KeyID: "FAKEKEYID",
BundleID: "fake.bundle.id",
Issuer: "xxxxx-xx-xx-xx-xxxxxxxxxx",
Sandbox: false,
}
invoiceOrderId := "FAKEORDERID"
a := api.NewStoreClient(c)
rsp, err := a.LookupOrderID(context.TODO(), invoiceOrderId)
@timconsidine , to make this API more simple. Please use the latest version 1.5.0
and the README is updated following the new version. Please let me know of any issues you meet.
using v1.5 and the example above, I get an error
no required module provides package github.com/richzw/appstore/api
after commenting it out in import
, I get
./appstore.go:17:8: undefined: api // refers to c := &api.StoreConfig{
./appstore.go:26:7: undefined: api // refers to a := api.NewStoreClient(c)
(line numbers are screwed after adding my private key)
(running on mac in case that's relevant)
(sorry, I am newbie with go
)
@timconsidine , for v1.5, please try
import (
"context"
"github.com/richzw/appstore"
)
func main() {
c := &appstore.StoreConfig{
KeyContent: []byte(ACCOUNTPRIVATEKEY),
KeyID: "FAKEKEYID",
BundleID: "fake.bundle.id",
Issuer: "xxxxx-xx-xx-xx-xxxxxxxxxx",
Sandbox: false,
}
invoiceOrderId := "FAKEORDERID"
a := appstore.NewStoreClient(c)
rsp, err := a.LookupOrderID(context.TODO(), invoiceOrderId)
I remove the redundant api folder after v1.5. Sorry for the inconvenient.
Close it as there is no more comment for one week, feel free to reopen it again if there is any issue.