Git Product home page Git Product logo

soter-sdk-go's Introduction

soter-sdk-go

This is an unofficial go interface to soter HTTP API.

Install

go get -u github.com/TRON-US/soter-sdk-go

Usage

Soter provides a list of HTTP endpoints/services for users to store files in BTFS, but it could be kind of complex if a user is not familiar with Soter. This soter-sdk-go provides users with a handy way to interact with Soter.

Example

Add a file

Add a file named as "hello.txt"

package main

import (
	"fmt"

	"github.com/TRON-US/soter-sdk-go/soter"
)

func main() {
	url := "http://127.0.0.1:8101"
	privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
	userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"

	sh := soter.NewShell(privateKey, userAddress, url)

	out, err := sh.AddFile(userAddress, "go.mod")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%v\n", out)
}

Query user balance

package main

import (
	"fmt"

	"github.com/TRON-US/soter-sdk-go/soter"
)

func main() {
	url := "http://127.0.0.1:8101"
	privateKey := "c8f0884e706c761e80a9227736a4a595f56b43660041920a5e6765a9b8ac3ab7"
	userAddress := "TTCXimHXjen9BdTFW5JvcLKGWNm3SSuECF"

	sh := soter.NewShell(privateKey, userAddress, url)

	out, err := sh.Balance()
	if err != nil {
		panic(err)
	}
	fmt.Printf("%v\n", out)
}

Set autopay subscription

An example about how to set autopay subscription can be checked here.

Update user information

An example about how to update user information can be checked here.

Query user deposit history

An example about how to query user deposit history can be checked here.

Query user order list

An example about how to query user order list can be checked here.

Query user uploaded files

An example about how to query user uploaded files can be checked here.

Query order details

An example about how to query order details can be checked here.

Query user profile

An example about how to query user profile can be checked here.

License

MIT

soter-sdk-go's People

Contributors

kevin-yuhh avatar zyyw avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kevin-yuhh

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.