https://github.com/codehakase/mobius-go
(Deprecated) The Mobius Go (Golang) Client provides simple access to the Mobius API for applications written in Go
https://github.com/codehakase/mobius-go
api go golang mobius sdk
Last synced: 3 months ago
JSON representation
(Deprecated) The Mobius Go (Golang) Client provides simple access to the Mobius API for applications written in Go
- Host: GitHub
- URL: https://github.com/codehakase/mobius-go
- Owner: codehakase
- License: mit
- Archived: true
- Created: 2018-04-03T14:52:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T20:03:34.000Z (almost 8 years ago)
- Last Synced: 2025-01-27T05:34:11.460Z (12 months ago)
- Topics: api, go, golang, mobius, sdk
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mobius Go API Client
[](https://godoc.org/gopkg.in/mailgun/mailgun-go.v1)
The Mobius Go (Golang) Client provides simple access to the Mobius API for applications written in Go
## Installation
Install with `go get`
```shell
$ go get github.com/codehakase/mobius-go
```
## QuickStart
To use the library, you'd need to create a client, with your Mobius `appuid` and `apikey`.
```go
package main
import (
"github.com/codehakase/mobius-go"
"fmt"
)
func main() {
mc := mobius.New(yourApiKey, yourAppUID)
// Retrive a struct to communicate with the DApp store
appStore := mc.AppStore
// Get a user's balance
usrBal, err := appStore.Balance("myemail@example.com")
if err != nil {
log.Fatalf("can't fetch user's balance, err: %+v", err)
return
}
fmt.Println("User got %d mobi credits available", usrBal.NumCredits)
// Credit user with mobi credits
if fundUser, err := appStore.Credit("user@example.com", 1000); err != nil {
log.Fatalf("could not fund user, err: %+v", err)
return
}
// Use 20 Mobi Credits from user@example.com
if charge, err := appStore.Use("user@example.com", 20); err == nil {
if charge.Success {
fmt.Printf("User has been charged, and is left with %d mobi credits", charge.NumCredits)
}
} else {
log.Fatalf("could not charge user, err: %+v", err)
}
}
```
## Methods
- ##### `mobius.AppStore.Balance( email )`
Get balance of credits for email.
- ##### `mobius.AppStore.Use( email, numCredits )`
Use numCredits from user with email.
- ##### `mobius.Tokens.Register( tokenType, name, symbol, address )`
Register a token.
- ##### `mobius.Tokens.Balance( tokenUid, address )`
Query the number of tokens specified by the token.
- ##### `mobius.Tokens.CreateAddress( tokenUid, managed )`
Create an address for the token.
- ##### `mobius.Tokens.RegisterAddress( tokenUid, address )`
Register an address for the token.
- ##### `mobius.Tokens.TransferInfo( tokenAddressTransferUid )`
Get the status and transaction hash of a Mobius managed token transfer.
Other methods can be found in the API reference
## API Reference
https://godoc.org/github.com/codehakase/mobius-go
Mobius API Docs - https://mobius.network/docs/
## TODOs
- Integration Testing
- CLI Tool