This is an abstract class; it must be extended by another class that defines the specific actions of a given
provision. This class is responsible for managing requests to OpenGate North API.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is ogapi instance
resource
string
❌
this is a base url resource
timeout
number
✅
timeout on request
requiredParameters
array
❌
serviceBaseURL
string
❌
base of the uri petition
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()
delete(body)
This invoke a request to OpenGate North API and the callback is managed by promises This function deletes a
provisioned entity
Instead of creating a bulk process, returns the provision process planning for the specified entries. This is a
synchronous process that does not cause changes in the database.
This class allows making GET requests to the countries catalog resource in OpenGate North API.
It needs the _internalCountriesFilter client option, and there is no default. It is built that way on purpose: the catalogue is not an endpoint but an asset entity with
entityType WIRE and an identifier of the form DOMAIN_<domain>, so the caller has to say which
entity to read, the same way it says which api key to use. There is an intention to
replace this with a real catalogue endpoint and drop the option again.
Without it, getCountries() used to die with
Cannot read properties of undefined (reading 'organization'), which said nothing about the
option that was missing.
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)`.