mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-17 21:34:56 +00:00
Generate clients (#206)
This commit is contained in:
9
examples/user/create/curl/createAnAccount.sh
Executable file
9
examples/user/create/curl/createAnAccount.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
curl "https://api.m3o.com/v1/user/Create" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"email": "joe@example.com",
|
||||
"id": "usrid-1",
|
||||
"password": "mySecretPass123",
|
||||
"username": "usrname-1"
|
||||
}'
|
||||
19
examples/user/create/go/createAnAccount.go
Executable file
19
examples/user/create/go/createAnAccount.go
Executable file
@@ -0,0 +1,19 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/user"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Create a new user account. The email address and username for the account must be unique.
|
||||
func CreateAnAccount() {
|
||||
userService := user.NewUserService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := userService.Create(&user.CreateRequest{
|
||||
Email: "joe@example.com",
|
||||
Id: "usrid-1",
|
||||
Password: "mySecretPass123",
|
||||
Username: "usrname-1",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
15
examples/user/create/node/createAnAccount.js
Executable file
15
examples/user/create/node/createAnAccount.js
Executable file
@@ -0,0 +1,15 @@
|
||||
import * as user from "m3o/user";
|
||||
|
||||
// Create a new user account. The email address and username for the account must be unique.
|
||||
async function CreateAnAccount() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.create({
|
||||
email: "joe@example.com",
|
||||
id: "usrid-1",
|
||||
password: "mySecretPass123",
|
||||
username: "usrname-1",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await CreateAnAccount();
|
||||
Reference in New Issue
Block a user