Home Manual Reference Source Test Repository
public class | source

SimpleBuilder

Extends:

BaseProvision → SimpleBuilder

Indirect Subclass:

DeviceBuilder

This class allow set simple values.

Constructor Summary

Public Constructor
public

constructor(ogapi: InternalOpenGateAPI, resource: string, allowedDatastreams: array, definedSchemas: array, jsonSchemaValidator: Validator)

Constructor

Method Summary

Public Methods
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

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

Public Constructors

public constructor(ogapi: InternalOpenGateAPI, resource: string, allowedDatastreams: array, definedSchemas: array, jsonSchemaValidator: Validator) source

Constructor

Override:

BaseProvision#constructor

Params:

NameTypeAttributeDescription
ogapi InternalOpenGateAPI
  • nullable: false

this is ogapi instance

resource string
  • nullable: false

this is the resource url where can be create/delete/update/read the entity

allowedDatastreams array
  • optional
  • nullable: false

Allowed datastreams to add into the new entity

definedSchemas array
  • optional
  • nullable: false

Jsonschema about all OpenGate specific types

jsonSchemaValidator Validator
  • optional
  • nullable: false

Json schema validator tool

Public Methods

public deleteAll(): Promise source

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

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

public getAllowedDatastreams(): array source

Return:

array

Allowed Datastream definition array

public getEntityKey(): string source

Return:

string

Entity identifier

public initFromFlattened(_flattenedEntityData: *) source

Params:

NameTypeAttributeDescription
_flattenedEntityData *

public initFromJson(_jsonEntityData: *) source

Params:

NameTypeAttributeDescription
_jsonEntityData *

public patch(): Promise source

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

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().update()

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

Override:

BaseProvision#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.organizationsBuilder().update()

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

Set new datastream value

Params:

NameTypeAttributeDescription
_id string
  • nullable: false

Datastream identifier

val objecr
  • nullable: false

Datastream value. If this value is null then datastream value will be removed.

Return:

*