mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-17 05:14:52 +00:00
Generate clients (#206)
This commit is contained in:
11
examples/user/sendVerificationEmail/curl/sendVerificationEmail.sh
Executable file
11
examples/user/sendVerificationEmail/curl/sendVerificationEmail.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
curl "https://api.m3o.com/v1/user/SendVerificationEmail" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"email": "joe@example.com",
|
||||
"failureRedirectUrl": "https://m3o.com/verification-failed",
|
||||
"fromName": "Awesome Dot Com",
|
||||
"redirectUrl": "https://m3o.com",
|
||||
"subject": "Email verification",
|
||||
"textContent": "Hi there,\n\nPlease verify your email by clicking this link: $micro_verification_link"
|
||||
}'
|
||||
29
examples/user/sendVerificationEmail/go/sendVerificationEmail.go
Executable file
29
examples/user/sendVerificationEmail/go/sendVerificationEmail.go
Executable file
@@ -0,0 +1,29 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/user"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Send a verification email
|
||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
||||
// but you can provide the title and contents.
|
||||
// The verification link will be injected in to the email as a template variable, $micro_verification_link.
|
||||
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
|
||||
// The variable will be replaced with an actual url that will look similar to this:
|
||||
// 'https://user.m3o.com/user/verify?token=a-verification-token&rediretUrl=your-redir-url'
|
||||
func SendVerificationEmail() {
|
||||
userService := user.NewUserService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
|
||||
Email: "joe@example.com",
|
||||
FailureRedirectUrl: "https://m3o.com/verification-failed",
|
||||
FromName: "Awesome Dot Com",
|
||||
RedirectUrl: "https://m3o.com",
|
||||
Subject: "Email verification",
|
||||
TextContent: `Hi there,
|
||||
|
||||
Please verify your email by clicking this link: $micro_verification_link`,
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
24
examples/user/sendVerificationEmail/node/sendVerificationEmail.js
Executable file
24
examples/user/sendVerificationEmail/node/sendVerificationEmail.js
Executable file
@@ -0,0 +1,24 @@
|
||||
import * as user from "m3o/user";
|
||||
|
||||
// Send a verification email
|
||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
||||
// but you can provide the title and contents.
|
||||
// The verification link will be injected in to the email as a template variable, $micro_verification_link.
|
||||
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
|
||||
// The variable will be replaced with an actual url that will look similar to this:
|
||||
// 'https://user.m3o.com/user/verify?token=a-verification-token&rediretUrl=your-redir-url'
|
||||
async function SendVerificationEmail() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.sendVerificationEmail({
|
||||
email: "joe@example.com",
|
||||
failureRedirectUrl: "https://m3o.com/verification-failed",
|
||||
fromName: "Awesome Dot Com",
|
||||
redirectUrl: "https://m3o.com",
|
||||
subject: "Email verification",
|
||||
textContent:
|
||||
"Hi there,\n\nPlease verify your email by clicking this link: $micro_verification_link",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await SendVerificationEmail();
|
||||
Reference in New Issue
Block a user