mirror of
https://github.com/cubixle/ebay.git
synced 2026-04-30 15:58:39 +01:00
Update README
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/clientcredentials"
|
||||
"github.com/jybp/ebay"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -34,11 +35,12 @@ func main() {
|
||||
TokenURL: ebay.OAuth20SandboxEndpoint.TokenURL,
|
||||
Scopes: []string{ebay.ScopeRoot /* your scopes */},
|
||||
}
|
||||
tc := oauth2.NewClient(context.Background(), ebay.TokenSource(cfg.TokenSource(ctx)))
|
||||
ctx := context.Background()
|
||||
tc := oauth2.NewClient(ctx, ebay.TokenSource(cfg.TokenSource(ctx)))
|
||||
client := ebay.NewSandboxClient(tc)
|
||||
|
||||
// Get an item detail.
|
||||
result, err := client.Buy.Browse.GetItem(context.Background(), "v1|123456789012|0")
|
||||
result, err := client.Buy.Browse.GetItem(ctx, "v1|123456789012|0")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -49,7 +51,7 @@ An example for the [authorization code grant flow](https://developer.ebay.com/ap
|
||||
import (
|
||||
"context"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/clientcredentials"
|
||||
"github.com/jybp/ebay"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -66,6 +68,7 @@ func main() {
|
||||
|
||||
var authCode string /* Retrieve the authorization code. */
|
||||
|
||||
ctx := context.Background()
|
||||
tok, err := oauthConf.Exchange(ctx, authCode)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user