commit | e8b7293a5827a4d33137ebcecb3825e4eb6404f5 | [log] [tgz] |
---|---|---|
author | James Dubee <jwdubee@us.ibm.com> | Wed Oct 12 14:33:50 2016 -0400 |
committer | Vincent Hou <shou@us.ibm.com> | Tue Jun 06 12:03:47 2017 -0400 |
tree | 7b5790b95fc6fd4a6383f5a7335f954028e44e2b | |
parent | 499d2f22d5c73bcc58c951b71efde5884d58c4fd [diff] |
Allow JSON to be Input from a File (#1175) - Pass JSON files to parameters and annotations - Refactor parameter and annotation handling - Use KeyValueArr data type to store annotations and parameters - Refactor summaries for get commands - Use KeyValueArr data type to get annotations and parameters - Refactor parameter and annotation tests - Order of params and annots are not guaranteed in Go map data structures - Fixes: #426
go-whisk
is a Go client library for accessing the IBM Whisk API.
import "github.ibm.com/BlueMix-Fabric/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-Fabric/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)
}