https://github.com/hotafrika/ebay-common
Golang client for getting Ebay Authorization tokens
https://github.com/hotafrika/ebay-common
ebay ebay-api go golang
Last synced: 5 months ago
JSON representation
Golang client for getting Ebay Authorization tokens
- Host: GitHub
- URL: https://github.com/hotafrika/ebay-common
- Owner: hotafrika
- License: gpl-3.0
- Created: 2021-12-23T22:13:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-27T21:53:14.000Z (over 4 years ago)
- Last Synced: 2024-06-20T08:04:54.774Z (almost 2 years ago)
- Topics: ebay, ebay-api, go, golang
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# ebay-common
The repo contains common tools for using my other eBay libs.
### 1. Auth token generation
```go
package main
import (
"fmt"
"github.com/hotafrika/ebay-common/auth"
)
func main() {
clientID := "xxx"
clientSecret := "xxxx"
service := auth.NewService().
WithScopes(auth.ScopeCredentialCommon).
WithCredentials(clientID, clientSecret)
token, err := service.GetAppToken()
if err != nil {
panic(err)
}
fmt.Println(token)
// or make reusable service for generating tokens by different credentials
reusableService := auth.NewService().WithScopes(auth.ScopeCredentialCommon)
token1, err := reusableService.GetAppTokenWithCredentials("aaa", "aaaaa")
token2, err := reusableService.GetAppTokenWithCredentials("bbb", "bbbb")
fmt.Println(token1, token2)
}
```
### 2. Encoding/decoding eBay datetime values
```go
package main
import (
"fmt"
"github.com/hotafrika/ebay-common/datetime"
)
func main() {
ebayDatetime := "2007-07-24T21:05:05.781Z"
normalDatetime, _ := datetime.FromEbayDateTime(ebayDatetime)
againEbayDatetime := datetime.ToEbayDateTime(normalDatetime)
fmt.Println(againEbayDatetime) // "2007-07-24T21:05:05.781Z"
}
```