Giter Site home page Giter Site logo

mochi-go-sdk's Introduction

Mochi SDK for Go

Go Reference

The Mochi SDK for Go is a library that provides easy access to the Mochi API from your Go applications. It simplifies the process of making API requests, handling authentication, and processing responses. Use this SDK to integrate Mochi's functionality into your Go projects effortlessly.

Features

Mochi Profile

  • GetByDiscordID: Retrieve a Mochi profile by Discord ID.

Mochi Pay

  • GetAppBalance: Retrieve token balances for your Mochi application.
  • RequestPayment: Request a payment from a user.
  • Transfer: Transfer tokens from your application to a list of user.
  • GetChains: Get the list of supported chain
  • GetTokens: Get the list of token filtered by Chain and Symbol.

Installation

To use the Mochi SDK in your Go project, you can simply install it using:

go get github.com/consolelabs/mochi-go-sdk

Documentation

NOTICE: This library and the Mochi API are unfinished. Because of that there may be major changes to library in the future.

Authorization

From MochiPay, you will receive an application ID, application name, and API key. You can use these to create a new MochiPay client. The client will be used to make requests to the Mochi API.

    config := &mochipay.Config{
	ApplicationID:   "<application-id>",
	ApplicationName: "<application-name>",
	APIKey:          "<api-key>",
    }

Examples

Here's a simple example of how to use the YourAPI SDK:

Mochi Pay

package main

import (
	"fmt"

	"github.com/consolelabs/mochi-go-sdk/mochi"
	"github.com/consolelabs/mochi-go-sdk/mochi/config"
)

func main() {
	config := &config.Config{
		MochiPay: config.MochiPay{
			ApplicationID:   "<application-id>",
			ApplicationName: "<application-name>",
			APIKey:          "<api-key>",
		},
	}

	client := mochi.NewClient(config)
	balances, err := client.GetAppBalance()
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}

	fmt.Println("Balances:")
	for _, balance := range balances {
		fmt.Printf("Token ID: %s, Amount: %s\n", balance.TokenID, balance.Amount)
	}
}

Mochi Profile

package main

import (
	"fmt"

	"github.com/consolelabs/mochi-go-sdk/mochi"
	"github.com/consolelabs/mochi-go-sdk/mochi/config"
)

func main() {
	config := &config.Config{}

	client := mochi.NewClient(config)
	result, err := client.GetByDiscordID("797042642600722473")
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}

	fmt.Println("Profile:", result)
}

mochi-go-sdk's People

Contributors

namnhce avatar

Watchers

Han Ngo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.