https://github.com/einride/monta-go
Go SDK for accessing the Monta Partner API
https://github.com/einride/monta-go
charging go golang monta
Last synced: about 1 year ago
JSON representation
Go SDK for accessing the Monta Partner API
- Host: GitHub
- URL: https://github.com/einride/monta-go
- Owner: einride
- License: mit
- Created: 2022-09-07T17:59:11.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-04-01T15:43:05.000Z (over 1 year ago)
- Last Synced: 2025-04-03T06:23:35.375Z (over 1 year ago)
- Topics: charging, go, golang, monta
- Language: Go
- Homepage: https://partner-api.monta.app/docs
- Size: 4.96 MB
- Stars: 9
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Monta Go SDK
[](CODE_OF_CONDUCT.md)
A Go SDK for the [Monta](https://monta.app) Partner API.
## Usage
### Client
```go
client := monta.NewClient(monta.WithClientIDAndSecret("", "")
```
#### `GET /v1/auth/me`
```go
me, err := client.GetMe(ctx)
if err != nil {
panic(err)
}
fmt.Println(me)
```
#### `GET /v1/sites`
```go
response, err := client.ListSites(ctx, &monta.ListSitesRequest{
Page: 1,
PerPage: 10,
})
if err != nil {
panic(err)
}
fmt.Println(response)
```
#### `GET /v1/charge-points`
```go
response, err := client.ListChargePoints(ctx, &monta.ListChargePointsRequest{
Page: 1,
PerPage: 10,
})
if err != nil {
panic(err)
}
fmt.Println(response)
```
### CLI
#### Build
First you need to build the CLI - to create the monta CLI executable. Assuming you are on root level of the project:
```
$ cd cmd/monta
$ go build
```
#### Login
```
$ ./monta login --client-id --client-secret
```
#### `GET /v1/auth/me`
```
$ ./monta me
```
#### `GET /v1/sites`
```
$ ./monta sites
```
#### `GET /v1/charge-points`
```
$ ./monta charge-points
```