https://github.com/yeexel/go-firepon
Coupons API client with Firestore integration written in Go.
https://github.com/yeexel/go-firepon
client coupons firestore golang
Last synced: 4 months ago
JSON representation
Coupons API client with Firestore integration written in Go.
- Host: GitHub
- URL: https://github.com/yeexel/go-firepon
- Owner: yeexel
- License: mit
- Created: 2021-04-22T15:41:23.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-22T15:42:48.000Z (about 5 years ago)
- Last Synced: 2024-06-20T17:43:35.928Z (about 2 years ago)
- Topics: client, coupons, firestore, golang
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Coupons
[](https://circleci.com/gh/yeexel/go-firepon)
Coupons API client with Firestore integration written in Go.
### Installation
Run command:
`go get github.com/yeexel/go-firepon@v0.1.0`
### Example
```
ctx := context.Background()
client, err := NewClient(ctx, &ClientOpts{
ProjectID: "project-id",
})
if err != nil {
// TODO: Handle error
}
defer client.Close() // Close client when done
// Persist coupon in Firestore collection
json, err := client.GetOne(ctx, "coupon-id")
_ = json // {"created_at":"2021-04-21T13:44:04.447064Z","description":"str2","id":"2uIvxCZpEA","max_allowed":200,"purchases":[],"title":"str"}
```
### Documentation
[](https://pkg.go.dev/github.com/yeexel/go-firepon)
### Development instructions
Run commands:
`docker-compose up -d`
`make test`
### Production setup
Set `GOOGLE_APPLICATION_CREDENTIALS` environment variable which points to your `firebase.json` file, etc.
More info on Firebase Docs page:
[https://firebase.google.com/docs/admin/setup/#initialize-sdk](https://firebase.google.com/docs/admin/setup/#initialize-sdk)