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. App Processor

  2. getAppsList

  3. getApp

  4. getAppInfo

  5. updateApp

  6. updateAppInfo

  7. createNewApp

  8. 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 gudhub = new GudHub(authkey);
gudhub.getAppsList();

In response we will get an array of applications called apps_list:

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 gudhub = new GudHub(authkey);
gudhub.getApp(app_id);
Argument Name Type Description
app_id number unique application ID

It returns an application object:

{
    "app_id": 26507,
    "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 gudhub = new GudHub(authkey);
gudhub.getAppInfo(app_id);
Argument Name Type Description
app_id number unique application ID

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

{
    "app_id": 39,
    "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 gudhub = new GudHub(authkey);
gudhub.updateApp(app);
Argument Name Type Description
app object contains updated application data

It 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 gudhub = new GudHub(authkey);
let appInfo = {
    app_name: "My Application",
};

gudhub.updateAppInfo(appInfo);
Argument Name Type Description
appInfo object contains only general data about application

This method returns an application object with updated overview.

{...
    "app_name": "My Updated Application",...
}

createNewApp

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

import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.createNewApp(app);
Argument Name Type Description
app object contains new application`s data

It returns a 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 gudhub = new GudHub(authkey);
gudhub.deleteApp(app_id);
Argument Name Type Description
app_id number unique application ID

In return we have a message about successful operation:

delete application with id=26625