added readme; fetch -> get
6 files changed
tree: f673f678a464d6444ddc106cfa3ff1ab138b1eb2
  1. action.go
  2. activation.go
  3. client.go
  4. namespace.go
  5. package.go
  6. README.md
  7. rule.go
  8. sdk.go
  9. shared.go
  10. trigger.go
  11. util.go
README.md

Go Whisk Client

Simple
import (
  "net/http"
  "net/url"

  whisk "github.ibm.com/Bluemix/go-whisk"
)

func main() {
  httpClient := http.DefaultClient
  whisk, err := whisk.New(httpClient, nil)
  if err != nil {
    fmt.Println(err)
    os.Exit(-1)
  }

  actions, resp, err := whisk.Actions.Get("actionName")
  if err != nil {
    fmt.Println(err)
    os.Exit(-1)
  }

  fmt.Println("Returned with status: ", resp.Status)
  fmt.Println("Returned actions: \n%+v", actions)

}


Configuration

Whisk can be configured by passing in a *whisk.Config object as the second argument to whisk.New( ... ). Its declaration is:

package whisk

type Config struct {
	Namespace string // NOTE :: Default is "_"
	AuthToken string
	BaseURL   *url.URL // NOTE :: Default is "whisk.stage1.ng.bluemix.net"
	Version   string
	Verbose   bool
}