Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathaningram/sendowl
Sendowl API Go Client Library https://www.sendowl.com/developers/api/introduction
https://github.com/jonathaningram/sendowl
Last synced: about 1 month ago
JSON representation
Sendowl API Go Client Library https://www.sendowl.com/developers/api/introduction
- Host: GitHub
- URL: https://github.com/jonathaningram/sendowl
- Owner: jonathaningram
- License: mit
- Created: 2016-05-11T01:42:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-03T02:29:28.000Z (almost 8 years ago)
- Last Synced: 2024-10-16T00:31:08.020Z (3 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sendowl API Go Client Library
Go client library for the [Sendowl API](https://www.sendowl.com/developers/api/introduction).
> Note: implementation is incomplete. Please submit a PR for improvements.
## Documentation
For full documentation see: [https://godoc.org/github.com/jonathaningram/sendowl](https://godoc.org/github.com/jonathaningram/sendowl).
## Install
```
go get github.com/jonathaningram/sendowl
```## Usage
```go
package mainimport (
"log"
"os""golang.org/x/net/context"
"github.com/jonathaningram/sendowl"
)func main() {
key := "sendowl-key"
secret := "sendowl-secret"client := sendowl.New(*key, *secret)
ctx := context.Background()filename := "file.pdf"
name := filename
t := sendowl.Digital
price := 9.99f, err := os.Open(filename)
if err != nil {
log.Fatal(err)
}
defer f.Close()resp, err := client.CreateProduct(ctx, sendowl.CreateProductRequest{
Name: name,
Price: sendowl.PriceFromFloat64(price),
Type: t,
Attachment: f,
Filename: filename,
})
if err != nil {
log.Fatal(err)
}
log.Printf("%#v", resp)
}
```To log Sendowl API requests, use `WithLogger`:
```go
client := sendowl.New(...).WithLogger(log.New(os.Stderr, "", log.LstdFlags))
```