commit | 41e38e5fc707f1fb6cb5ff2ac443a5207558826c | [log] [tgz] |
---|---|---|
author | Theodore Wilson <theodore.wilson@us.ibm.com> | Wed Feb 03 09:50:57 2016 -0800 |
committer | Theodore Wilson <theodore.wilson@us.ibm.com> | Wed Feb 03 09:50:57 2016 -0800 |
tree | f6a23fce38c4d5976208626010a07f117fbc07d3 | |
parent | b5509cd3286e801788e1926589a337cecd37b12e [diff] |
minor cleanup
go-whisk
is a Go client library for accessing
import "github.ibm.com/Bluemix/go-whisk/whisk"
Construct a new whisk client, then use various services to access different parts of the whisk api. For example to get the hello
action:
client, _ := whisk.NewClient(http.DefaultClient, nil)
action, resp, err := client.Actions.List("hello")
Some API methods have optional parameters that can be passed. For example, to list the first 30 actions, after the 30th action:
client, _ := whisk.NewClient(http.DefaultClient, nil)
options := &whisk.ActionListOptions{
Limit: 30,
Skip: 30,
}
actions, resp, err := client.Actions.List(options)
Whisk can be configured by passing in a *whisk.Config
object as the second argument to whisk.New( ... )
. For example:
u, _ := url.Parse("https://whisk.stage1.ng.bluemix.net:443/api/v1/")
config := &whisk.Config{
Namespace: "_",
AuthKey: "aaaaa-bbbbb-ccccc-ddddd-eeeee",
BaseURL: u
}
client, err := whisk.Newclient(http.DefaultClient, config)
import (
"net/http"
"net/url"
"github.ibm.com/Bluemix/go-whisk/whisk"
)
func main() {
client, err := whisk.NewClient(http.DefaultClient, nil)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
options := &whisk.ActionListOptions{
Limit: 30,
Skip: 30,
}
actions, resp, err := client.Actions.List(options)
if err != nil {
fmt.Println(err)
os.Exit(-1)
}
fmt.Println("Returned with status: ", resp.Status)
fmt.Println("Returned actions: \n%+v", actions)
}