Skip to content

tubuarge/tubuio-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tubu.io logo

Golang SDK for tubu.io

Example Usage

package main

import(
    "io/ioutil"
    "log"
    "fmt"
    
    tubu "github.com/tubuarge/tubuio-sdk-go/api"
) 

func main() {
    //create new api struct with your API Key.
    app := tubu.NewContract("YOUR API KEY")
    contract := app.CreateNewContract("ShortID")

    //make the integration request if there is no error when making the 
    //request callResp variable contains request response as *http.Response. 
    callResp, err := contract.Call("Method", "Tag", "", nil)
    if err != nil {
        log.Fatal(err)
    }
    
    defer callResp.Body.Close()
    
    callRespBody, err := ioutil.ReadAll(callResp.Body)
    if err != nil {
        log.Fatal(err)
    }

    //print the response
    fmt.Println(string(callRespBody))
    
    //make the send request if there is no error when making the request
    //callResp variable contains request response as *http.Response.
    sendResp, err := contract.Call("Method", "Tag", "Account Address", "item", 123, true)
    if err != nil {
        log.Fatal(err)
    }

    defer sendResp.Body.Close()

    sendRespBody, err := ioutil.ReadAll(sendResp.Body)
    if err != nil {
        log.Fatal(err)
    }
    
    //print the response body
    fmt.Println(string(sendRespBody))
}

More examples can be found at examples folder.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages