From cdd1eea406e45eb9f5aa0ea191bc461ba33cbc78 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Fri, 29 Oct 2021 11:58:04 +0100 Subject: [PATCH] update readme --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bafcc62..99c30f2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,35 @@ This is the Go client to access APIs on the M3O Platform ## Usage +Call a service using the generated client. Populate the `M3O_API_TOKEN` environment variable. + +Import the package and initialise the service with your API token. + +```go +package main + +import( + "fmt" + "os" + + "go.m3o.com/helloworld" +) + +// Call returns a personalised "Hello $name" response +func main() { + helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN")) + rsp, err := helloworldService.Call(&helloworld.CallRequest{ + Name: "John", + + }) + fmt.Println(rsp, err) +} +``` + +## Generic Client + +The generic client enables you to call any endpoint by name with freeform request/response types. + ```go package main @@ -49,8 +78,8 @@ func main() { ## Streaming -The client supports streaming - +The client supports streaming but is not yet code generated. Use the following for streaming endpoints. + ```go package main