mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
Commit from GitHub Actions (Generate Clients & Examples)
This commit is contained in:
@@ -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",
|
||||
})
|
||||
|
||||
@@ -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",
|
||||
})
|
||||
|
||||
8
examples/user/resetPassword/curl/resetPassword.sh
Executable file
8
examples/user/resetPassword/curl/resetPassword.sh
Executable file
@@ -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"
|
||||
}'
|
||||
19
examples/user/resetPassword/go/resetPassword.go
Executable file
19
examples/user/resetPassword/go/resetPassword.go
Executable file
@@ -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)
|
||||
}
|
||||
14
examples/user/resetPassword/node/resetPassword.js
Executable file
14
examples/user/resetPassword/node/resetPassword.js
Executable file
@@ -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();
|
||||
Reference in New Issue
Block a user