This class extends SimpleBuilder to allow setting complex values. What is a complex value? It is simply a value
that needs a communications module identifier to be set into the box.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is ogapi instance
resource
string
❌
this is the resource url where can be create/delete/update/read the entity
allowedDatastreams
array
✅
Allowed datastreams to add into the new entity
definedSchemas
array
✅
Jsonschema about all OpenGate specific types
jsonSchemaValidator
Validator
✅
Json schema validator tool
withComplex(_id, idCommunicationModules, val)
Set a complex value to entity
Parámetros
Nombre
Tipo
Opcional
Descripción
_id
string
❌
Datastream identifier
idCommunicationModules
string
❌
Communications module identifier
val
object
❌
Value to set.
Csv Bulk Builder
CSV builder. This builder gives you the necessary tools to run a CSV bulk provisioning operation using the
OpenGate REST API.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
required field. This is ogapi instance
organization
string
❌
required field. This is the organization name where entities will be created, updated or deleted
resource
resource
❌
required field. This is the resource used for the bulk provision
timeout
number
✅
timeout in millisecons. The request will have a specific time out if it will be exceeded then the promise throw an exception
async
boolean
✅
forces async execution for the bulk operation
Device Builder
Device builder. This builder gives you the necessary tools to create a device using the OpenGate REST API.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is ogapi instance
organization
string
❌
this is the organization name where device will be created
allowedDatastreams
array
✅
Allowed datastreams to add into the new device
definedSchemas
array
✅
Jsonschema about all OpenGate specific types
jsonSchemaValidator
Validator
✅
Json schema validator tool
ms
number
❌
timeout in milliseconds
create()
This invoke a request to OpenGate North API and the callback is managed by promises This function creates a
provisioned entity
Retorna
Tip
Tipo:Promise
Ejemplos
ogapi.organizationsBuilder().create()
update()
This invoke a request to OpenGate North API and the callback is managed by promises This function updates a
provisioned entity and checks whether any subscriber/subscription already exists. If a subscriber/subscription
does not exist, it will be created and then added to the entity box.
Retorna
Tip
Tipo:Promise
Ejemplos
ogapi.entityBuilder.devicesBuilder().update()
Entity Builder
This is a base object that gives you access to everything you can do to provision entities.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
Reference to the API object.
assetsBuilder(organization, timeout)
Get an AssetBuilder to operate with entities of type asset
Get a DeviceBuilder to operate with entities of type device.
It resolves a builder rather than returning one, because the allowed datastreams and their
schemas are read from the platform first. Note that `with()` ignores a datastream the
organization does not allow, warning rather than throwing, so a typo in a datastream name
produces an entity missing that value rather than an error.
A device that the platform will accept needs more than an identifier. This is a create that
works, and every line of it was needed:
The platform rejects an omission one field at a time, so finding this set means a round trip
per missing field:
without `plan`: 400 `0x010E10`, "Device plan is mandatory…"
without `serviceGroup`: 400 `0x010000`, "Required field."
These are not validated here on purpose. The plan message ties the requirement to the
state of the organization, so a client-side rule would refuse calls that other organizations
accept. `provision.device.identifier` is different: it is the entity key, and its absence is
refused locally with `OGAPI_ENTITY_KEY_REQUIRED`.
List the plans an organization actually has with
`ogapi.newDevicePlansFinder().findByOrganization(organization)`.