Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vtopc/go-monobank
Golang client for personal and corporate Monobank API.
https://github.com/vtopc/go-monobank
api fintech go golang golang-library jars monobank monobank-api monobank-client monobank-sdk rest rest-api rest-client sdk sdk-go sdk-golang ukraine
Last synced: about 1 month ago
JSON representation
Golang client for personal and corporate Monobank API.
- Host: GitHub
- URL: https://github.com/vtopc/go-monobank
- Owner: vtopc
- License: mit
- Created: 2019-07-04T17:18:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T19:13:13.000Z (10 months ago)
- Last Synced: 2024-04-12T00:06:57.720Z (10 months ago)
- Topics: api, fintech, go, golang, golang-library, jars, monobank, monobank-api, monobank-client, monobank-sdk, rest, rest-api, rest-client, sdk, sdk-go, sdk-golang, ukraine
- Language: Go
- Homepage:
- Size: 85.9 KB
- Stars: 19
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml.example
- License: LICENSE
Awesome Lists containing this project
README
# go-monobank
[![Godoc Reference][godoc-img]][godoc-url] [![CI][ci-img]][ci-url] [![codecov][codecov-img]][codecov-url]
Monobank REST API client.
## Features
- Personal API(with Token authorization).
- API for providers(corporate) with authorization.
- Webhooks(including API for providers).
- Jars(only in Personal API).## Installation
```shell
go get github.com/vtopc/go-monobank@latest
```
This will update yours go.mod file.## Usage examples
NOTE: Do not forget to check errors.#### Public client
```go
package mainimport (
"context"
"fmt""github.com/vtopc/go-monobank"
)func main() {
// Create public client.
client := monobank.NewClient(nil)response, _ := client.Currency(context.Background())
fmt.Println(response)
}
```#### Personal client
```go
package mainimport (
"context"
"fmt"
"os""github.com/vtopc/go-monobank"
)func main() {
token := os.Getenv("TOKEN")// Create authorized client.
client := monobank.NewPersonalClient(nil).WithAuth(monobank.NewPersonalAuthorizer(token))response, _ := client.ClientInfo(context.Background())
fmt.Println(response)
}
```#### Corporate client
```go
package mainimport (
"context"
"fmt""github.com/vtopc/go-monobank"
)var secKey []byte // put here you private key
const webhook = "https://example.com/webhook"
func main() {
// Create auth creator.
authMaker, _ := monobank.NewCorpAuthMaker(secKey)// Create authorized client.
client, _ := monobank.NewCorporateClient(nil, authMaker)// If the user is not authorized yet, do next:
resp, _ := client.Auth(context.Background(), webhook, monobank.PermSt, monobank.PermPI)// Send `resp.AcceptURL` to the user and wait until it will authorize your client
// in Monobank app on mobile, you will get GET request on `webhook` when it will be done.
// See Documentation for details.
// Store `resp.RequestID` somewhere.
requestID := resp.RequestID// If user authorized already:
response, _ := client.ClientInfo(context.Background(), requestID)
fmt.Println(response)
}
```## Documentation
- [Official](https://api.monobank.ua/docs/)
- [Unofficial](https://gist.github.com/Sominemo/8714a82e26a268c30e4a332b0b2fd943)## Similar projects
- https://github.com/shal/mono (last update 16.05.2020)
- https://github.com/artemrys/go-monobank-api (no corporate API)## TODO
- More unit tests[godoc-img]: https://godoc.org/github.com/vtopc/go-monobank?status.svg
[godoc-url]: https://godoc.org/github.com/vtopc/go-monobank[ci-img]: https://github.com/vtopc/go-monobank/workflows/CI/badge.svg
[ci-url]: https://github.com/vtopc/go-monobank/actions?query=workflow%3A%22CI%22[codecov-img]: https://codecov.io/gh/vtopc/go-monobank/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/vtopc/go-monobank