mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-13 19:45:26 +00:00
Commit from GitHub Actions (Generate Clients & Examples)
This commit is contained in:
9
examples/user/sendPasswordResetEmail/curl/sendPasswordResetEmail.sh
Executable file
9
examples/user/sendPasswordResetEmail/curl/sendPasswordResetEmail.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
curl "http://localhost:8080/user/SendPasswordResetEmail" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"email": "joe@example.com",
|
||||
"fromName": "Awesome Dot Com",
|
||||
"subject": "Password reset",
|
||||
"textContent": "Hi there,\n click here to reset your password: myapp.com/reset/code?=$code"
|
||||
}'
|
||||
22
examples/user/sendPasswordResetEmail/go/sendPasswordResetEmail.go
Executable file
22
examples/user/sendPasswordResetEmail/go/sendPasswordResetEmail.go
Executable file
@@ -0,0 +1,22 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/micro/services/clients/go/user"
|
||||
)
|
||||
|
||||
// Send an email with a verification code to reset password.
|
||||
// Call "ResetPassword" endpoint once user provides the code.
|
||||
func SendPasswordResetEmail() {
|
||||
userService := user.NewUserService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
|
||||
Email: "joe@example.com",
|
||||
FromName: "Awesome Dot Com",
|
||||
Subject: "Password reset",
|
||||
TextContent: `Hi there,
|
||||
click here to reset your password: myapp.com/reset/code?=$code`,
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
17
examples/user/sendPasswordResetEmail/node/sendPasswordResetEmail.js
Executable file
17
examples/user/sendPasswordResetEmail/node/sendPasswordResetEmail.js
Executable file
@@ -0,0 +1,17 @@
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Send an email with a verification code to reset password.
|
||||
// Call "ResetPassword" endpoint once user provides the code.
|
||||
async function sendPasswordResetEmail() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.sendPasswordResetEmail({
|
||||
email: "joe@example.com",
|
||||
fromName: "Awesome Dot Com",
|
||||
subject: "Password reset",
|
||||
textContent:
|
||||
"Hi there,\n click here to reset your password: myapp.com/reset/code?=$code",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
sendPasswordResetEmail();
|
||||
Reference in New Issue
Block a user