OpenVeo server API for plugins

API Docs for: 7.0.0
Show:

EntityController

Summary

Defines base controller for all controllers which need to provide HTTP route actions for all requests relative to entities.

Constructor

EntityController

Syntax

EntityController

()

Summary

Methods

addEntitiesAction

Syntax

addEntitiesAction

(
  • request
  • response
  • next
)
async

Summary

Adds entities.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • body Array

      The list of entities to add with for each entity the fields with their values

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "entities": [ ... ],
  "total": 42
}

getEntitiesAction

Syntax

getEntitiesAction

(
  • request
  • response
  • next
)
async

Summary

Gets entities.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • [query] Object optional

      Request query

      • [include] String | Array optional
        The list of fields to include from returned entities
      • [exclude] String | Array optional
        The list of fields to exclude from returned entities. Ignored if include is also specified.
      • [limit] Number optional
        A limit number of entities to retrieve per page (default to 10)
      • [page] Number optional
        The page number started at 0 for the first page (default to 0)
      • [sortBy] String optional
        The entity field to sort by
      • [sortOrder] String optional
        Either "asc" for ascendant or "desc" for descendant
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "entities" : [ ... ],
  "pagination" : {
    "limit": ..., // The limit number of entities by page
    "page": ..., // The actual page
    "pages": ..., // The total number of pages
    "size": ... // The total number of entities
}

getEntityAction

Syntax

getEntityAction

(
  • request
  • response
  • next
)
async

Summary

Gets a specific entity.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The entity id to retrieve
    • query Object

      Request query

      • [include] String | Array optional
        The list of fields to include from returned entity
      • [exclude] String | Array optional
        The list of fields to exclude from returned entity. Ignored if include is also specified.
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "entity" : { ... }
}

getProvider

Syntax

getProvider

() EntityProvider

Summary

Gets an instance of the entity provider associated to the controller.

Returns:

EntityProvider:

The entity provider

removeEntitiesAction

Syntax

removeEntitiesAction

(
  • request
  • response
  • next
)
async

Summary

Removes entities.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        A comma separated list of entity ids to remove
  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 42
}

updateEntityAction

Syntax

updateEntityAction

(
  • request
  • response
  • next
)
async

Summary

Updates an entity.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • params Object

      Request parameters

      • id String
        The id of the entity to update
    • body Object

      The fields to update with their values

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware

Example:

// Response example
{
  "total": 1
}