From dcdbccd54fcd4f9c4e5408b6fe0db115e555d2bd Mon Sep 17 00:00:00 2001 From: crufter Date: Tue, 16 Nov 2021 15:09:36 +0000 Subject: [PATCH] Commit from GitHub Actions (Generate Clients & Examples) --- examples/db/create/go/createARecord.go | 2 +- examples/event/publish/go/publishAnEvent.go | 2 +- .../user/resetPassword/curl/resetPassword.sh | 8 ++++++++ .../user/resetPassword/go/resetPassword.go | 19 +++++++++++++++++++ .../user/resetPassword/node/resetPassword.js | 14 ++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100755 examples/user/resetPassword/curl/resetPassword.sh create mode 100755 examples/user/resetPassword/go/resetPassword.go create mode 100755 examples/user/resetPassword/node/resetPassword.js diff --git a/examples/db/create/go/createARecord.go b/examples/db/create/go/createARecord.go index 283dd5d..0f23082 100755 --- a/examples/db/create/go/createARecord.go +++ b/examples/db/create/go/createARecord.go @@ -12,10 +12,10 @@ func CreateArecord() { dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN")) rsp, err := dbService.Create(&db.CreateRequest{ Record: map[string]interface{}{ + "isActive": true, "id": "1", "name": "Jane", "age": 42, - "isActive": true, }, Table: "users", }) diff --git a/examples/event/publish/go/publishAnEvent.go b/examples/event/publish/go/publishAnEvent.go index a6a3b0e..cd945dc 100755 --- a/examples/event/publish/go/publishAnEvent.go +++ b/examples/event/publish/go/publishAnEvent.go @@ -12,9 +12,9 @@ func PublishAnEvent() { eventService := event.NewEventService(os.Getenv("MICRO_API_TOKEN")) rsp, err := eventService.Publish(&event.PublishRequest{ Message: map[string]interface{}{ + "id": "1", "type": "signup", "user": "john", - "id": "1", }, Topic: "user", }) diff --git a/examples/user/resetPassword/curl/resetPassword.sh b/examples/user/resetPassword/curl/resetPassword.sh new file mode 100755 index 0000000..9f59818 --- /dev/null +++ b/examples/user/resetPassword/curl/resetPassword.sh @@ -0,0 +1,8 @@ +curl "http://localhost:8080/user/ResetPassword" \ +-H "Content-Type: application/json" \ +-H "Authorization: Bearer $MICRO_API_TOKEN" \ +-d '{ + "code": "some-code-from-email", + "confirmPassword": "newpass123", + "newPassword": "newpass123" +}' \ No newline at end of file diff --git a/examples/user/resetPassword/go/resetPassword.go b/examples/user/resetPassword/go/resetPassword.go new file mode 100755 index 0000000..1cff34f --- /dev/null +++ b/examples/user/resetPassword/go/resetPassword.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + "os" + + "github.com/micro/services/clients/go/user" +) + +// Reset password with the code sent by the "SendPasswordResetEmail" endoint. +func ResetPassword() { + userService := user.NewUserService(os.Getenv("MICRO_API_TOKEN")) + rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{ + Code: "some-code-from-email", + ConfirmPassword: "newpass123", + NewPassword: "newpass123", + }) + fmt.Println(rsp, err) +} diff --git a/examples/user/resetPassword/node/resetPassword.js b/examples/user/resetPassword/node/resetPassword.js new file mode 100755 index 0000000..78791bd --- /dev/null +++ b/examples/user/resetPassword/node/resetPassword.js @@ -0,0 +1,14 @@ +const { UserService } = require("m3o/user"); + +// Reset password with the code sent by the "SendPasswordResetEmail" endoint. +async function resetPassword() { + let userService = new UserService(process.env.MICRO_API_TOKEN); + let rsp = await userService.resetPassword({ + code: "some-code-from-email", + confirmPassword: "newpass123", + newPassword: "newpass123", + }); + console.log(rsp); +} + +resetPassword();