import ( "github.com/globocom/tsuru/cmd" "fmt" ) func main() { tsuru := cmd.NewClient("http://localhost:8080", "my_token") resp, err := tsuru.Do("GET", "/apps", nil) if err != nil { // handle error } fmt.Println(string(resp)) }
import ( "github.com/globocom/tsuru/cmd" "fmt" ) func main() { tsuru := cmd.NewClient("http://localhost:8080", "my_token") data := map[string]interface{}{ "name": "my_new_app", } resp, err := tsuru.Do("POST", "/apps", data) if err != nil { // handle error } fmt.Println(string(resp)) }In both examples, we are creating a new instance of `cmd.NewClient` using the tsuru server URL and authentication token. The `Do()` method is then used to make a HTTP request to a tsuru API endpoint, with the optional inclusion of data in the request body. We then print out the response body to the console.