From 8e3eb4c4f44f66593fe50d582ca9b0387cc8c432 Mon Sep 17 00:00:00 2001 From: Prasad Ghangal Date: Wed, 29 Nov 2023 16:38:10 +0530 Subject: [PATCH 1/4] Fix go version in github workflows --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d32844..5905e00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: [ '1.19', '1.20', '1.21.x' ] + go-version: '1.21.x' - name: Gomod run: go mod download - name: Golint From c0e746b10d0cfd2be569c4f20fee048560999f2f Mon Sep 17 00:00:00 2001 From: Prasad Ghangal Date: Wed, 29 Nov 2023 16:39:23 +0530 Subject: [PATCH 2/4] Remove lint checks --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5905e00..447eddf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,8 +18,6 @@ jobs: go-version: '1.21.x' - name: Gomod run: go mod download - - name: Golint - run: hack/verify-golint.sh - name: Gofmt run: hack/verify-gofmt.sh - name: Go vet From 0ecde73bb1a629176c7c3b55e26b7238887725a2 Mon Sep 17 00:00:00 2001 From: Prasad Ghangal Date: Wed, 29 Nov 2023 16:43:33 +0530 Subject: [PATCH 3/4] Fix gofmt issues Signed-off-by: Prasad Ghangal --- connector/auth/doc.go | 3 ++- connector/client/doc.go | 3 ++- core/activity/doc.go | 3 ++- core/doc.go | 3 ++- samples/echobot/doc.go | 18 ++++++++++-------- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/connector/auth/doc.go b/connector/auth/doc.go index 624e790..d074778 100644 --- a/connector/auth/doc.go +++ b/connector/auth/doc.go @@ -17,7 +17,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -/*Package auth provides authentication properties and functionalities for the connector service. +/* +Package auth provides authentication properties and functionalities for the connector service. TokenValidator provides the functionality for authenticating a JWT token in a received request. Others provide the basic structures needed. diff --git a/connector/client/doc.go b/connector/client/doc.go index 1ee97ff..9ad01c4 100644 --- a/connector/client/doc.go +++ b/connector/client/doc.go @@ -17,7 +17,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -/*Package client provides a HTTP client for calls to the connector service. +/* +Package client provides a HTTP client for calls to the connector service. The configuration needed for the call are defined by the struct Config */ diff --git a/core/activity/doc.go b/core/activity/doc.go index 3903dd1..8174e98 100644 --- a/core/activity/doc.go +++ b/core/activity/doc.go @@ -17,7 +17,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -/*Package activity acts as a handler for any received activity and the user defined operation +/* +Package activity acts as a handler for any received activity and the user defined operation on that activity. It then is responsible for sending a reply to the connector service. */ package activity diff --git a/core/doc.go b/core/doc.go index cddfc99..a9b72fa 100644 --- a/core/doc.go +++ b/core/doc.go @@ -17,7 +17,8 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -/*Package core is the entry point and the main interface for a user program. +/* +Package core is the entry point and the main interface for a user program. It provides an adapter to the user program using which all the operations can be made on this SDK. See the example to understand how to use this package to perform operations on the Bot Framwework connector service. diff --git a/samples/echobot/doc.go b/samples/echobot/doc.go index d3300d6..7598165 100644 --- a/samples/echobot/doc.go +++ b/samples/echobot/doc.go @@ -1,17 +1,18 @@ -/*Bot Framework echo bot sample. +/* +Bot Framework echo bot sample. This bot uses msbotbuilder-go: https://github.com/infracloudio/msbotbuilder-go. It shows how to create a simple bot that accepts input from the user and echoes it back. - -Run the example +# Run the example Bring up a terminal and run. Set two variables for the session as APP_ID and APP_PASSWORD to the values of your BotFramework app_id and password. Then, run: - go run main.go -This will start a server which will listen on port 3978 + go run main.go + +This will start a server which will listen on port 3978 -Understanding the example +# Understanding the example The program starts by creating a hanlder struct of type `activity.HandlerFuncs`. This struct contains defination for the `OnMessageFunc` field which is a treated as a callback by the library @@ -23,16 +24,17 @@ on the respective event. }, } - A webserver is started with a hanlder passed the received payload to `adapter.ParseRequest` This methods authenticates the payload, parses the request and returns an Activity value. + activity, err := adapter.ParseRequest(ctx, req) The Activity is then passed to `adapter.ProcessActivity` with the hanlder created to process the activity as per the hanlder functions and send the response to the connector service. + err = adapter.ProcessActivity(ctx, activity, customHandler) -In case of no error, this web responds with a 200 status +# In case of no error, this web responds with a 200 status To expose this local IP outside your local network, a tool like ngrok can be used. From 25477b9e71c76d6eda7f571a1689015a714302d5 Mon Sep 17 00:00:00 2001 From: Prasad Ghangal Date: Wed, 29 Nov 2023 16:44:29 +0530 Subject: [PATCH 4/4] Fix gofmt issue in echobot example Signed-off-by: Prasad Ghangal --- samples/echobot/doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/echobot/doc.go b/samples/echobot/doc.go index 7598165..f4d3bb2 100644 --- a/samples/echobot/doc.go +++ b/samples/echobot/doc.go @@ -10,7 +10,7 @@ your BotFramework app_id and password. Then, run: go run main.go -This will start a server which will listen on port 3978 +# This will start a server which will listen on port 3978 # Understanding the example