Core API

App Processor

App Processor is responsible for creating, updating and deleting applications, receiving them, their information, and application list.

This article will describe all app methods:

  1. getAppsList

  2. getApp

  3. getAppInfo

  4. updateApp

  5. updateAppInfo

  6. createNewApp

  7. deleteApp

getAppsList

This method is called after logging in to get a list of user`s applications. It has no arguments.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let appList = await gudhub.getAppsList();
console.log(appList);

In response we will get a promise that in turn returns an array of applications called apps_list:

[{
    "app_id": 39,
    "app_name": "My Application",
    "chunks": [],
    "field_list": [],
    "file_list": [],
    "group_id": 42,
    "icon": {},
    "items_list": [],
    "keys_list": [],
    "last_update": 1626443488601,
    "permission": 2,
    "priority": 0,
    "privacy": 0,
    "show": true,
    "trash": false,
    "view_init": 25,
    "views_list": [],
},
{
    "app_id": 49,
    "app_name": "My Application 2",...},...]

getApp

This method is called to get an application by its ID specified as an argument.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let app_id = 23748;

let application = await gudhub.getApp(app_id);
console.log(application);
Argument Name Type Description
app_id number unique application ID

It returns the promise that in turn returns an object pof the certain application:

{
    "app_id": 23748,
    "app_name": "Not My Application",
    "chunks": [],
    "field_list": [{...},...],
    "file_list": [{...},...],
    "group_id": 26478,
    "icon": {...},
    "items_list": [{...},...],
    "keys_list": [{...},...],
    "last_update": 1638795735791,
    "permission": 4,
    "priority": 0,
    "privacy": 0,
    "show": true,
    "trash": false,
    "view_init": 1289987,
    "views_list": [{...},...],
}

getAppInfo

For optimization of the processes was created such methods as getAppInfo. They exclude a need to get all information from server.

This particular one is called to get an application overview.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let app_id = 23748;

let appInfo = await gudhub.getAppInfo(app_id);
console.log(appInfo);
Argument Name Type Description
app_id number unique application ID

As a result, we will get promise that returns an application object with empty arrays, but with information about, for example, icon or permission.

{
    "app_id": 23748,
    "app_name": "My Application",
    "chunks": [],
    "field_list": [],
    "file_list": [],
    "group_id": 42,
    "icon": {
        "id": 25250, 
        "icon_id": "paint", 
        "icon_color": "ffffff", 
        "gradient_up": "89f7fe", 
        "gradient_down": "66a6ff"},
    "items_list": [],
    "keys_list": [],
    "last_update": 1626443488601,
    "permission": 2,
    "priority": 0,
    "privacy": 0,
    "show": true,
    "trash": false,
    "view_init": 25,
    "views_list": [],
}

updateApp

This method is called to update existing application data. As an argument it takes existing application object.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let app = {
    app_id: 26506,
    app_name: "My Application",
    chunks: [],
    field_list: [{...},...],
    file_list: [],
    group_id: 26477,
    icon: {...},
    items_list: [],
    keys_list: [{...}],
    last_update: 1638802007942,
    permission: 4,
    priority: 0,
    privacy: 1,
    show: true,
    trash: false,
    view_init: 1289961,
    views_list: [{...},...],
};

let updatedApp = await gudhub.updateApp(app);
console.log(updatedApp);
Argument Name Type Description
app object contains updated application data

It returns a promise that returns an application object with all updated information.

{
    "app_id": 26506,
    "app_name": "My Application",
    "chunks": [],
    "field_list": [{...},...],
    "file_list": [],
    "group_id": 26477,
    "icon": {...},
    "items_list": [],
    "keys_list": [{...}],
    "last_update": 1638802007942,
    "permission": 4,
    "priority": 0,
    "privacy": 1,
    "show": true,
    "trash": false,
    "view_init": 1289961,
    "views_list": [{...},...],
}

updateAppInfo

As well as getAppInfo, this method works with application overview. Namely, updateAppInfo updates general information.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let appInfo = {
    app_name: "My Application",
};

let updatedAppInfo = await gudhub.updateAppInfo(appInfo);
console.log(updatedAppInfo);
Argument Name Type Description
appInfo object contains only general data about application

This method returns an application object with updated overview. Namely, it returns the promise with an updated application.

{
    "app_id": 26506,
    "app_name": "My Updated Application",
    "chunks": [],
    "field_list": [{...},...],
    "file_list": [],
    "group_id": 26477,
    "icon": {...},
    "items_list": [],
    "keys_list": [{...}],
    "last_update": 1638802007942,
    "permission": 4,
    "priority": 0,
    "privacy": 1,
    "show": true,
    "trash": false,
    "view_init": 1289961,
    "views_list": [{...},...],
}

createNewApp

This method is called for creating a new application with default data.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let app = {
    app_id: 26748,
    app_name: "Template New",
    chunks: [],
    field_list: [],
    file_list: [],
    group_id: 26719,
    icon: {...},
    items_list: [],
    keys_list: [],
    last_update: 1638803480148,
    permission: 4,
    priority: 0,
    privacy: 1,
    show: true,
    trash: false,
    view_init: 1314802,
    views_list: [{...},…],
};

let newApp = await gudhub.createNewApp(app);
console.log(newApp);
Argument Name Type Description
app object contains new application`s data

It returns a promise with new application object:

{
    "app_id": 26748,
    "app_name": "Template New",
    "chunks": [],
    "field_list": [],
    "file_list": [],
    "group_id": 26719,
    "icon": {...},
    "items_list": [],
    "keys_list": [],
    "last_update": 1638803480148,
    "permission": 4,
    "priority": 0,
    "privacy": 1,
    "show": true,
    "trash": false,
    "view_init": 1314802,
    "views_list": [{...},…],
}

deleteApp

This method is called to delete an application.

import GudHub from '@gudhub/core';
const AUTHKEY = "jlCKJDMAKSDOASOPPjk...";
const gudhub = new GudHub(AUTHKEY);

let app_id = 23749;

let deletedList = await gudhub.deleteApp(app_id);
console.log(deletedList);
Argument Name Type Description
app_id number unique application ID

In return, we get a promise that returns a list of applications without the remote application:

[{
    "app_id": 23748,
    "app_name": "Marketing",
    "chunks": [],
    "field_list": [],
    "file_list": [],
    "group_id": 42,
    "icon": {},
    "items_list": [],
    "keys_list": [],
    "last_update": 1626443488601,
    "permission": 2,
    "priority": 0,
    "privacy": 0,
    "show": true,
    "trash": false,
    "view_init": 25,
    "views_list": [],
},{
    "app_id": 23750,
    "app_name": "Programming",
    "chunks": [],
    "field_list": [],
    "file_list": [],
    "group_id": 42,
    "icon": {},
    "items_list": [],
    "keys_list": [],
    "last_update": 1626443488601,
    "permission": 2,
    "priority": 0,
    "privacy": 0,
    "show": true,
    "trash": false,
    "view_init": 25,
    "views_list": [],
}]