From 8bfd7992ada3ce29b94f4d25a1ee4f711e7442cc Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 21 Apr 2021 15:47:25 +0100 Subject: [PATCH 1/4] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 170f6bf..46f1897 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # M3O Go Client -By default the client connects to api.m3o.com/client +By default the client connects to api.m3o.com ```go package main @@ -35,7 +35,7 @@ func main() { } var rsp Response - if err := c.Call("greeter", "Say.Hello", req, &rsp); err != nil { + if err := c.Call("helloworld", "call", req, &rsp); err != nil { fmt.Println(err) return } @@ -52,7 +52,7 @@ If you want to access your local micro: You can also set the api address explicitly: ```go - c := client.NewClient(client.Options{Address: "https://api.yourdomain.com/client"}) + c := client.NewClient(client.Options{Address: "https://api.yourdomain.com"}) ``` ## Streaming @@ -79,7 +79,7 @@ type Response struct { func main() { c := client.NewClient(&client.Options{Local: true}) - stream, err := c.Stream("example", "Streamer.ServerStream", Request{Count: "10"}) + stream, err := c.Stream("streams", "subscribe", Request{Count: "10"}) if err != nil { fmt.Println(err) return From 6d6edbe311adf3e1949da46c5003169c3c290894 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 21 Apr 2021 16:06:06 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 46f1897..0073921 100644 --- a/README.md +++ b/README.md @@ -43,18 +43,6 @@ func main() { } ``` -If you want to access your local micro: - -```go - c := client.NewClient(client.Options{Local: true}) -``` - -You can also set the api address explicitly: - -```go - c := client.NewClient(client.Options{Address: "https://api.yourdomain.com"}) -``` - ## Streaming The client supports streaming @@ -76,9 +64,16 @@ type Response struct { Count string `json:"count"` } -func main() { - c := client.NewClient(&client.Options{Local: true}) +var ( + token, _ = os.Getenv("TOKEN") +) +func main() { + c := client.NewClient(nil) + + // set your api token + c.SetToken(token) + stream, err := c.Stream("streams", "subscribe", Request{Count: "10"}) if err != nil { fmt.Println(err) From 384cfd9411359bab385b91cb21da69d1164eb9d0 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 21 Apr 2021 16:06:25 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0073921..7cd0582 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,14 @@ func main() { req := &Request{ Name: "John", } + var rsp Response if err := c.Call("helloworld", "call", req, &rsp); err != nil { fmt.Println(err) return } + fmt.Println(rsp) } ``` From e3351077869c7e8584be4a32e42c41b52ec7d402 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 21 Apr 2021 16:07:32 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7cd0582..7928610 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # M3O Go Client -By default the client connects to api.m3o.com +This is the Go client to access APIs on the M3O Platform + +## Usage ```go package main