mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
Change build setup of JS clients, reintroduce beta publishing after losing it due to unmerged code (#238)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("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);
|
||||
async function createAnAccount() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.create({
|
||||
email: "joe@example.com",
|
||||
id: "usrid-1",
|
||||
@@ -12,4 +12,4 @@ async function CreateAnAccount() {
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await CreateAnAccount();
|
||||
createAnAccount();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Delete an account by id
|
||||
async function DeleteUserAccount() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function deleteUserAccount() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.delete({
|
||||
id: "fdf34f34f34-f34f34-f43f43f34-f4f34f",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await DeleteUserAccount();
|
||||
deleteUserAccount();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Login using username or email. The response will return a new session for successful login,
|
||||
// 401 in the case of login failure and 500 for any other error
|
||||
async function LogAuserIn() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function logAuserIn() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.login({
|
||||
email: "joe@example.com",
|
||||
password: "mySecretPass123",
|
||||
@@ -11,4 +11,4 @@ async function LogAuserIn() {
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await LogAuserIn();
|
||||
logAuserIn();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Logout a user account
|
||||
async function LogAuserOut() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function logAuserOut() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.logout({
|
||||
sessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await LogAuserOut();
|
||||
logAuserOut();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Read an account by id, username or email. Only one need to be specified.
|
||||
async function ReadAccountByEmail() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function readAccountByEmail() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.read({
|
||||
email: "joe@example.com",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await ReadAccountByEmail();
|
||||
readAccountByEmail();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Read an account by id, username or email. Only one need to be specified.
|
||||
async function ReadAccountByUsernameOrEmail() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function readAccountByUsernameOrEmail() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.read({
|
||||
username: "usrname-1",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await ReadAccountByUsernameOrEmail();
|
||||
readAccountByUsernameOrEmail();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Read an account by id, username or email. Only one need to be specified.
|
||||
async function ReadAnAccountById() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function readAnAccountById() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.read({
|
||||
id: "usrid-1",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await ReadAnAccountById();
|
||||
readAnAccountById();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||
async function ReadAsessionByTheSessionId() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function readAsessionByTheSessionId() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.readSession({
|
||||
sessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await ReadAsessionByTheSessionId();
|
||||
readAsessionByTheSessionId();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Send a verification email
|
||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
||||
@@ -7,8 +7,8 @@ import * as user from "m3o/user";
|
||||
// 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&redirectUrl=your-redir-url'
|
||||
async function SendVerificationEmail() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function sendVerificationEmail() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.sendVerificationEmail({
|
||||
email: "joe@example.com",
|
||||
failureRedirectUrl: "https://m3o.com/verification-failed",
|
||||
@@ -21,4 +21,4 @@ async function SendVerificationEmail() {
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await SendVerificationEmail();
|
||||
sendVerificationEmail();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Update the account username or email
|
||||
async function UpdateAnAccount() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function updateAnAccount() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.update({
|
||||
email: "joeotheremail@example.com",
|
||||
id: "usrid-1",
|
||||
@@ -10,4 +10,4 @@ async function UpdateAnAccount() {
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await UpdateAnAccount();
|
||||
updateAnAccount();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Update the account password
|
||||
async function UpdateTheAccountPassword() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function updateTheAccountPassword() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.updatePassword({
|
||||
confirmPassword: "myEvenMoreSecretPass123",
|
||||
id: "usrid-1",
|
||||
@@ -12,4 +12,4 @@ async function UpdateTheAccountPassword() {
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await UpdateTheAccountPassword();
|
||||
updateTheAccountPassword();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as user from "m3o/user";
|
||||
const { UserService } = require("m3o/user");
|
||||
|
||||
// Verify the email address of an account from a token sent in an email to the user.
|
||||
async function VerifyEmail() {
|
||||
let userService = new user.UserService(process.env.MICRO_API_TOKEN);
|
||||
async function verifyEmail() {
|
||||
let userService = new UserService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await userService.verifyEmail({
|
||||
token: "t2323t232t",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await VerifyEmail();
|
||||
verifyEmail();
|
||||
|
||||
Reference in New Issue
Block a user