X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/381926c94a3b41d04101f68ec6a33e88fc795254..d47c009c2afd20b86cca083787d238c136e70abd:/doc/sdk/go/index.html.textile.liquid diff --git a/doc/sdk/go/index.html.textile.liquid b/doc/sdk/go/index.html.textile.liquid new file mode 100644 index 0000000000..27c4448469 --- /dev/null +++ b/doc/sdk/go/index.html.textile.liquid @@ -0,0 +1,65 @@ +--- +layout: default +navsection: sdk +navmenu: Go +title: "Go SDK" + +... + +The Go ("Golang":http://golang.org) SDK provides a generic set of wrappers so you can make API calls easily. + +h3. Installation + +You don't need to install anything. Just import the client like this. The go tools will fetch the relevant code and dependencies for you. + + +
import (
+	keepclient    "git.curoverse.com/arvados.git/sdk/go/keepclient"
+	arvadosclient "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
+)
+
+
+ +h3. Examples + +Import the module. (We import the log module here too, so we can use it in the subsequent examples.) + + +
import (
+	keepclient    "git.curoverse.com/arvados.git/sdk/go/keepclient"
+	arvadosclient "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
+	"log"
+)
+
+
+ +Set up an API client user agent: + + +
	arv, err := arvadosclient.MakeArvadosClient()
+	if err != nil {
+		log.Fatalf("Error setting up arvados client %s", err.Error())
+	}
+
+
+ +Get the User object for the current user: + + +
	type user struct {
+		Uuid	     string `json:"uuid"`
+		FullName     int    `json:"full_name"`
+	}
+
+	var u user
+	err := arv.Call("GET", "users", "", "current", nil, &u)
+
+	if err != nil {
+		return err
+	}
+
+	log.Printf("Logged in as %s (uuid %s)", user.Uuid, user.FullName)
+
+
+ +A few more usage examples can be found in the services/keepproxy and sdk/go/keepclient directories in the arvados source tree.