Merge branch '10346-rearrange-api-docs' closes #10346
[arvados.git] / doc / sdk / go / example.html.textile.liquid
index 903d367733e89cec7447ec7cf91e0412c0d9e214..5fe202dbfff6a669c81dfd0b187c4f4f8edeac42 100644 (file)
@@ -2,34 +2,75 @@
 layout: default
 navsection: sdk
 navmenu: Python
-title: Python SDK examples
+title: Examples
 ...
 
+See "Arvados GoDoc":https://godoc.org/git.curoverse.com/arvados.git/sdk/go for detailed documentation.
+
+In these examples, the site prefix is @aaaaa@.
+
+h2.  Initialize SDK
+
+<pre>
+import (
+  "git.curoverse.com/arvados.git/sdk/go/arvados"
+  "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
+}
+
+func main() {
+  arv, err := arvadosclient.MakeArvadosClient()
+  if err != nil {
+    log.Fatalf("Error setting up arvados client %s", err.Error())
+  }
+}
+</pre>
+
 h2. create
 
 <pre>
   var collection arvados.Collection
-  err := api.Create("collection", Dict{"collection": Dict{"name": "create example"}}, &collection)
+  err := api.Create("collections", Dict{"collection": Dict{"name": "create example"}}, &collection)
 </pre>
 
 h2. delete
 
 <pre>
   var collection arvados.Collection
-  err := api.Delete("collection", "", Dict{"collection": Dict{"name": "create example"}}, &collection)
+  err := api.Delete("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{}, &collection)
 </pre>
 
 h2. get
 
 <pre>
+  var collection arvados.Collection
+  err := api.Get("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{}, &collection)
 </pre>
 
 h2. list
 
 <pre>
+  var collection arvados.Collection
+  err := api.List("collections", Dict{}, &collection)
 </pre>
 
 h2. update
 
 <pre>
+  var collection arvados.Collection
+  err := api.Update("collections", "aaaaa-4zz18-ccccccccccccccc", Dict{"collection": Dict{"name": "update example"}}, &collection)
+</pre>
+
+h2. Get current user
+
+<pre>
+  var user arvados.User
+  err := api.Get("users", "current", Dict{}, &user)
 </pre>
+
+h2. Example program
+
+You can save this source as a .go file and run it:
+
+<notextile>{% code 'example_sdk_go' as go %}</notextile>
+
+A few more usage examples can be found in the "services/keepproxy":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/services/keepproxy and "sdk/go/keepclient":https://dev.arvados.org/projects/arvados/repository/revisions/master/show/sdk/go/keepclient directories in the arvados source tree.