0.0.7-DEV • Published 2 years ago

clean.ui-api v0.0.7-DEV

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

CleanUI

An API UI for connecting the other API's to the CleanUI UI's as module manager to fast up your API!

Requirements

Requires an Supported API Handler, Recommended(Definery).

Requires installing axios package.

Storing Data

Usages:

Data with expire time

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Definery.definer;

CleanUI.get("Your API URL", res => {
   const response = define(res, {expires: true, expireTime: "Set expiration time as millie second without a string", res: res, data: "Enter your API data that you want to store using Object() with JSON strings, arrays, objects, etc"});
   CleanUI.send.<send_option>("Your API URL", response, {api: true, expires: true, expireTime: "Enter the expiration time again"});
})

Data without expire time

CleanUI.get("Your API URL", res => {
   const response = define(res, {expires: false, res: res, data: "Enter your API data that you want to store using Object() with JSON strings, arrays, objects, etc"});
   CleanUI.send.<send_option>("Your API URL", response, {api: true, expires: false});
})

Another usage

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Definery.definer;

axios.get("Your API URL").then(res => {
    let realData = define(res, data => data.send("https//cleanui.gq/api/send_option").exiseUI("https://cleanui.gq/api/intents", intent => data.selectIntent("select your intent")));
    CleanUI.send.<send_option>(realData, res);
});
})

Send options

OptionsInfo
UIsend the API data to the UI as Peura data
JSONSend the API data as JSON data
JSON_VALUESend the API data as JSON Value data
PRIMARE_CONSOLESend the API data as Primare Console data
EMIT_LIMITERSend the API data as Emit Limiter data
RESPANDBLESend the API data as Respandble data
JSON_OBJECTSend the API data as JSON Object data
DBA_DATASend the API data as Direct Base Address(DBA) data

Returned To The UI Database(As Peura Language):

@data: "Current selected send option"::"API URL"@"Successful or failure send">>"<PROMISE%DATA@SEND>".
@author: "Main adminsitrator"@"<PROMISE%AUTHOR_PERMISSION@FETCH>".
@time: "TIME_OF_SENDING"@"<PROMISE%TIMESTAMP@FETCH>".
@axios_data: "Current axios data cache"@"<PROMISE%AXIOS_DATA@CACHE>".
@userCount: "current users count with permissions"::permisson?"each user permission and permission number"main_admin@"<PERMISSION_ADDRESS%USERS_EACH@FETCH>".

Console options

OptionsInfo
sendSend some text/number message to API's UI manager
replyReply to User/API/Data/Context/Manager some data
addAdd some user to your API console
removeRemove some user from your API console
permissionsUsers permissions

Users

Usages:

Add user:

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;

const main_user = CleanUI.console.add("username", ["permission"]);

Remove user:

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;

const someuser = CleanUI.console.add("username", ["permission"])
CleanUI.console.remove(someuser);

Users Permissions

Zone Level / PermissionsInfo
DANGER / ADMINISTRATORGiving the user all the access of editing, managing, Your API
HIGH / CONSOLE_MANAGERGiving the user all the access of editing, managing... Your Console
HIGH / DATA_MANAGERGiving the user all the access of editing, managing, removing... Your API Data
MEDIUM / CONTEXT_MANAGERGiving the user all the access of editing, managing, removing... Your API Context
MEDIUM / SUPERVISORGiving the user access to supervise, use... Your API
LOW / GUESTGiving the user access to use, send an specified data to Your API, WON'T IMPACT YOUR API
DEFAULT / USERGiving the user access to use Your API

Permissions options

OptionInfo
editEdit some user permission
countPermissions count
listPermissions list

Usages:

Edit user permission:

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;

const main_user = CleanUI.console.add("username", ]"permission"]);

CleanUI.console.permissions.edit(main_user, ["new permission"]);

API

API options

OptionInfo
nameDisplays your API name
urlDisplays your API url
dataDisplays your stored API data
expiresDisplays if your API with expiration or not
expiresTimeDisplays your API expiration Time, ONLY WORKS IF YOUR API HAS EXPIRATION

Usages:

Add your API:

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;

const myAPI = new CleanUI.api("Your API name", "your API URL", {"Your API Data that you want to be stored, inside JSON object"}, "expiration: true for expiration, false for no expiration", "if expiration, enter the expiration time");

Errors center

Errors options

OptionInfo
DEFAULT_ERRORDefault Error
UI_ERRORUser Interface(UI) Error
INTERACTION_ERRORInteraction Error
RUNNER_ERRORRunner Error
EXTRACT_ERRORExtract Error
ROUTER_ERRORRouter Error
CONSOLE_ERRORConsole Error
CLOUD_ERRORCloud Error
REQUEST_ERRORRequest Error
SOKET_ERRORSoket Error
SYSTEM_ERRORSystem Error
OS_ERROROperating System(OS) Error
COUNTER_ERRORCounter Error
CONTEXT_ERRORAPI Context Error
DEBUG_ERRORDebug Error
API_ERRORApplication Programming interface(API) Error

usage

const { CleanUI, Database, error } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;
const axios = require("axios");

const something = {hello: "hello", world: "world"};

if(something.hello !== "hello") {
   return new error("DEFAULT_ERROR", "Hello is undefined or unfetched")
} else if(something.hello == "hello") {
   return console.log("*hello* world!!!!!")
};

// using axios:
axios.get("https://cleanui.gq/api/ui", response => {
   if(response.data.interaction_status !== "200") {
      return new error("INTERACTION_ERROR", "Interaction status is not 200")
   } else {
      return console.log("Success interaction")
   }
})

CleanUI set settings file

Note: Only using peurest(peura settings) language file

Note: File name must be settings.peurest

Note: File must be exists in the project files and not inside any folder

Faq:

Can i use CleanUI without any settings file? yes, you can use CleanUI without any settings file, but you won't edit any settings

Can i use JSON instead? no, why? Peurest is the only language that supporting all the programming(Most of popular) Languages instead of JSON that only letting you edit Javascript or else.

How do i use Peurest?:

Step 1: you must create a file called settings.peurest in the project files without putting it in any folder. Step 2: Import the file in the main JavaScript file:

const { CleanUI, Database } = require("cleanui");
const Defnery = require("definery");
const define = Defnery.definer;

CleanUI.setSettingsFile(); // File must be settings.peurest

Step 3: start entering the packages that you want to use, if the package:

using system.config;
using "package without string" from "author/file/package manager";

Set 4: Enter your languages that you're using in the project,

using system.config;

Lang: enter_full_language_name:: {
   # now here set the settings of the language, even an file, example:
   Strings: {
      hello: "hello";
      world: "world"
   };
   Numbers: {
      zero: 0;
      one: 1;
      two: 2;
      three: 3
   };
   Booleans: {
      true: true;
      false: false
   };
   Objects: {
      object1: {
         hello: "hello";
         world: "world"
      };
      object2: {
         hello: "hello";
         world: "world"
      };
   }
}

# Full language example:

using Exit.System from "./commander/secet/ports/secretUse.js";

Lang: JavaScript:: {
   Console: {
      Adduser: {
         username: "username";
         id: "id";
         permission: ["permission"];
      };
      EditConsoleName: Exit.System.Console.EditName("Old name", "New name");
      }
   }

# Edit An file settings:

File: "./file":: {
   Path: {
      FilePath: ".../file";
   }
};

# Full File example:

File "./commander/paths/jsonData/database.json":: {
   Path: {
      FilePath: "./commander/paths/jsonData/database.json";
   };
   Info: {
      CreatedAt: "4/26/2022";
      LatestUpdatedAt: "4/29/2022";
      CreatedBy: "CleanUI";
      UpdatedBy: "CleanUI"
   };
   Updates: {
      History: {
         "4/29/2022": {
            UpdatedBy: "CleanUI";
            UpdatedAt: "4/29/2022";
            UpdatedAtTime: "12:34:21 PM";
            UpdateInfo: {
               Language: "JSON";
               File: "database.json";
               DataType: "JSON_VALUE";
               Packages: {
                  "clean.ui-api": "0.0.5-DEV";
                  "axios": "0.19.2";
                  "definery": "0.0.1-DEV";
               };
            }
         }
      }
   }
   }
};
}

Step 5: You all done!

CleanUI public info

Info options

OptionInfo
versionDisplays CleanUI package version
packageDisplays CleanUI package name
websiteDisplays CleanUI website API data
website_api_urlsDisplays CleanUI all API URL's
current_recomended_handlerDisplays CleanUI recomended handler
current_broken_flewerDisplays current broken flewer export
current_supported_processDisplays current supported process
current_site_exportDisplays current site exporter
current_database_exportDisplays current database exporter
current_data_fetcher_packageDisplays current data fetcher package
0.0.7-DEV

2 years ago

0.0.5-DEV

2 years ago

0.0.6-DEV

2 years ago

0.0.4-DEV

2 years ago

0.0.3-DEV

2 years ago

0.0.2-DEV

2 years ago

0.0.1-DEV

2 years ago