Golang sdk for Mixin Network & Mixin Messenger
go get -u github.com/fox-one/mixin-sdk-go/v2
- Comprehensive most of the Mixin Network & Mixin Messenger api supported
- Security verify Response
X-Request-ID
& signature automatically - Flexible initialize Client from
keystore
,ed25519_oauth_token
oraccess_token
See _examples/ for a variety of examples.
Quick Start
package main
import (
"context"
"log"
"github.com/fox-one/mixin-sdk-go/v2"
)
func main() {
ctx := context.Background()
s := &mixin.Keystore{
ClientID: "",
SessionID: "",
PrivateKey: "",
PinToken: "",
}
client, err := mixin.NewFromKeystore(s)
if err != nil {
log.Panicln(err)
}
user, err := client.UserMe(ctx)
if err != nil {
log.Printf("UserMe: %v", err)
return
}
log.Println("user id", user.UserID)
}
check error code by mixin.IsErrorCodes
if _, err := client.UserMe(ctx); err != nil {
switch {
case mixin.IsErrorCodes(err,mixin.Unauthorized,mixin.EndpointNotFound):
// handle unauthorized error
case mixin.IsErrorCodes(err,mixin.InsufficientBalance):
// handle insufficient balance error
default:
}
}