Core API

Document Manager

Document manager is responsible for creating, receiving, and deleting documents in the application.

All file manipulation is provided by these methods:

  1. createDocument

  2. getDocument

  3. getDocuments

  4. deleteDocument

createDocument

This method is called for creating a new document in the current application. It takes object of general document data.

import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
let documentObject = {
    app_id: "2434",
    field_id: "3245",
    item_id: "2324",
    data: "data",
}

gudhub.createDocument(documentObject);
Argument Name Type Description
documentObject object contains app_id, field_id, item_id, and data

getDocument

The method for getting needed document from the applications documents list. It takes a desired document location object as an argument.

import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
let documentAddress = {
    app_id: "1234", 
    item_id: "4535", 
    element_id: "3535"
};

gudhub.getDocument(documentAddress);
Argument Name Type Description
documentAddress object contains app_id, field_id, and item_id

getDocuments

This method is called to get array of documents from the application. As an argument it takes a array of document locations objects.

import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
let documentsAddresses = [{
    app_id: "5343", 
    item_id: "3455", 
    element_id: "2312"
},...]

gudhub.getDocuments(documentsAddresses);
Argument Name Type Description
documentsAddresses object contains app_id, field_id, and item_id

deleteDocument

Due to this method you can delete document from the application.

import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.deleteDocumentApi(documentAddress);
Argument Name Type Description
documentAddress object contains app_id, field_id, and item_id