import axios from 'axios'; import {parse} from 'ts-command-line-args'; interface Arguments { // sourcePath: String, // targetPath: String, verbose: boolean; help: boolean; api: string; name: string; email: string; password: string; // resetPermissions: Boolean, // filter: { type: String, optional: true }, // excludePaths: { type: String, multiple: true, optional: true }, } export class Signup { apiUrl = 'https://api.florafi.net' async executeArgv(): Promise { const args = parse( { name: {type: String, alias: 'n', description: 'your name'}, email: {type: String, alias: 'e', description: 'your email'}, password: {type: String, alias: 'p', description: 'your password'}, verbose: {type: Boolean, alias: 'v'}, api: {type: String, defaultValue: this.apiUrl, description: `API URL (default: ${this.apiUrl})`}, help: {type: Boolean, alias: 'h'}, }, { helpArg: 'help', headerContentSections: [ {header: 'Flora-fi Cloud Sign-up', content: 'Create a Florafy Cloud account'}, ] }, ); console.log("args", args) const {api, name, email, password} = args this.apiUrl = api // singup const res = await axios.post(`${api}/auth/sign-up`, {email, name, password}) console.log(res) // save access token // request refresh token // save } } /** * Commands: login Cloud sign-in using password sub Show selected state pub Publish data log timeline Global options: -v, --verbose Be verbosive --api-url Set API URL (default: https://api.florafi.net) --farm-url Farm URL (Ex. mqtt://) */