Home Manual Reference Source Test Repository
public class | source

DeviceBuilder

Extends:

BaseProvisionSimpleBuilderComplexBuilder → DeviceBuilder

Device builder. This builder give you the necessary tools to create a device using our OpenGate REST.

Constructor Summary

Public Constructor
public

constructor(ogapi: InternalOpenGateAPI, organization: string, allowedDatastreams: array, definedSchemas: array, jsonSchemaValidator: Validator, ms: number)

Constructor

Method Summary

Public Methods
public

This invoke a request to OpenGate North API and the callback is managed by promises This function create a entity of provision

public

This invoke a request to OpenGate North API and the callback is managed by promises This function updates a entity of provision and check if any subscriber/subscription exits or no.

Inherited Summary

From class BaseProvision
public

This invoke a request to OpenGate North API and the callback is managed by promises This function create a entity of provision

public

delete(body: *): Promise

This invoke a request to OpenGate North API and the callback is managed by promises This function deletes a entity of provision

public

This invoke a request to OpenGate North API and the callback is managed by promises This function updates a entity of provision

From class SimpleBuilder
public

This invoke a request to OpenGate North API and the callback is managed by promises This function deletes a entity of provision

public
public
public

initFromFlattened(_flattenedEntityData: *)

public

initFromJson(_jsonEntityData: *)

public

This invoke a request to OpenGate North API and the callback is managed by promises This function patch a entity of provision

public

This invoke a request to OpenGate North API and the callback is managed by promises This function updates a entity of provision

public

with(_id: string, val: objecr): *

Set new datastream value

From class ComplexBuilder
public

initFromFlattened(_flattenedEntityData: *)

public

initFromJson(_jsonEntityData: *)

public

withComplex(_id: string, idCommunicationModules: string, val: object): *

Set a complex value to entity

Public Constructors

public constructor(ogapi: InternalOpenGateAPI, organization: string, allowedDatastreams: array, definedSchemas: array, jsonSchemaValidator: Validator, ms: number) source

Constructor

Override:

ComplexBuilder#constructor

Params:

NameTypeAttributeDescription
ogapi InternalOpenGateAPI
  • nullable: false

this is ogapi instance

organization string
  • nullable: false

this is the organization name where device will be created

allowedDatastreams array
  • optional
  • nullable: false

Allowed datastreams to add into the new device

definedSchemas array
  • optional
  • nullable: false

Jsonschema about all OpenGate specific types

jsonSchemaValidator Validator
  • optional
  • nullable: false

Json schema validator tool

ms number

timeout in milliseconds

Public Methods

public create(): Promise source

This invoke a request to OpenGate North API and the callback is managed by promises This function create a entity of provision

Override:

BaseProvision#create

Return:

Promise

Return Properties:

NameTypeAttributeDescription
then function(result: object, statusCode: number)

When request it is OK

catch function(error: string)

When request it is NOK

Example:

 ogapi.organizationsBuilder().create()

public update(): Promise source

This invoke a request to OpenGate North API and the callback is managed by promises This function updates a entity of provision and check if any subscriber/subscription exits or no. If a subscriber/subscription not exists then this entities will be created and after that will be added to entity box.

Override:

SimpleBuilder#update

Return:

Promise

Return Properties:

NameTypeAttributeDescription
then function(result: object, statusCode: number)

When request it is OK

catch function(error: string)

When request it is NOK

Example:

 ogapi.entityBuilder.devicesBuilder().update()