Subsections of util

Expression

and(args)

Retorna

Tip

Tipo: object
This returns a json with the query of the logical operator "and" built.

Ejemplos

Ex.and(Ex.like("collected.serialNumber", "SN"), Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"))


returns:

{
  and : [
    {
      like: {
        "collected.serialNumber": "SN"
      }
    },  
    {
      eq: {
        "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
      }
    }
  ]
}

eq(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "eq" built.

Ejemplos

Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25")


returns:

{
  eq : {
    "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
  }
}

gt(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "gt" built.

Ejemplos

Ex.gt("collected.imei", "123456786543210")


returns:

{
  gt : {
    "collected.imei": "123456786543210"
  }
}

gte(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "gte" built.

Ejemplos

Ex.gte("collected.imei", "123456786543210")


{
  gte : {
    "collected.imei": "123456786543210"
  }
}

in(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "in" built.

Ejemplos

Ex.in("entityId", ["e64ccd08-e302-4b65-b19d-e38eeb7b2d24","e64ccd08-e302-4b65-b19d-e38eeb7b2d25"])


{
  in : {
    "entityId": ["e64ccd08-e302-4b65-b19d-e38eeb7b2d24","e64ccd08-e302-4b65-b19d-e38eeb7b2d25"]
  }
}

like(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "like" built.

Ejemplos

Ex.like("collected.serialNumber", "SN")


returns:

{
  like : {
    "collected.serialNumber": "SN"
  }
}

lt(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "lt" built.

Ejemplos

Ex.lt("collected.imei", "123456786543210")


returns:

{
  lt : {
    "collected.imei": "123456786543210"
  }
}

lte(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "lte" built.

Ejemplos

Ex.lte("collected.imei", "123456786543210")


{
  lte : {
    "collected.imei": "123456786543210"
  }
}

neq(key, value)

Parámetros

Nombre Tipo Opcional Descripción
key String This is the name of the field
value String This is the value of the field

Retorna

Tip

Tipo: object
This returns a json with the query of the operator "neq" built.

Ejemplos

Ex.neq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25")


returns:

{
  neq : {
    "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
  }
}

or(args)

Retorna

Tip

Tipo: object
This returns a json with the query of the logical operator "or" built.

Ejemplos

Ex.or(Ex.like("collected.serialNumber", "SN"), Ex.eq("entityId", "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"))


returns:

{
  or : [
    {
      like: {
        "collected.serialNumber": "SN"
      }
    },  
    {
      eq: {
        "entityId": "e64ccd08-e302-4b65-b19d-e38eeb7b2d25"
      }
    }
  ]
}

Subsections of http

Request Spec

constructor

Parámetros

Nombre Tipo Opcional Descripción
method string the HTTP verb.
url string the whole URL, query string included.

abort()

Cancels the request. Works before `end()` too, in which case it never leaves.

Retorna

Tip

Tipo: RequestSpec


accept(type)

Sets Accept, accepting the same shorthands.

Parámetros

Nombre Tipo Opcional Descripción
type string

Retorna

Tip

Tipo: RequestSpec


addEventListener(event, callback)

component-emitter's alias for `on`, which is what superagent's browser request carries. Missed on the first pass because the surface was enumerated from client.js source text, and component-emitter mixes its methods in at runtime rather than assigning them there. Caught in review by Chema.

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


addListener(event, callback)

superagent's alias for `on` in Node, where the request is an EventEmitter.

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


agent()

Inert: there is no Node HTTP agent to configure.


attach(name, file, options)

Adds a multipart file. A string is a path, as it was under superagent.

Parámetros

Nombre Tipo Opcional Descripción
name string
file *
options `(string object)=`

Retorna

Tip

Tipo: RequestSpec


auth(user, pass, options)

Sets an Authorization header. Basic by default, as in a browser; `{ type: 'bearer' }` sends the first argument as a token.

Parámetros

Nombre Tipo Opcional Descripción
user string
pass `(string object)=`
options object=

Retorna

Tip

Tipo: RequestSpec


buffer()

Inert: buffering was a Node response concern.


ca()

Inert: TLS material belonged to the Node agent.


cert()

Inert: TLS material belonged to the Node agent.


clearTimeout()

Cancels the timers without cancelling the request.

Retorna

Tip

Tipo: RequestSpec


emit(event)

Parámetros

Nombre Tipo Opcional Descripción
event string
args ...*

Retorna

Tip

Tipo: boolean
whether anything was listening.


end(callback)

Sends the request.

Parámetros

Nombre Tipo Opcional Descripción
callback function `(error, response)`, superagent's signature.

Retorna

Tip

Tipo: RequestSpec


eventNames()

Retorna

Tip

Tipo: Array<string>
the events with at least one listener.


field(name, value)

Adds a plain multipart field.

Parámetros

Nombre Tipo Opcional Descripción
name string
value *

Retorna

Tip

Tipo: RequestSpec


get(field)

Reads a header back, case-insensitively.

Parámetros

Nombre Tipo Opcional Descripción
field string

Retorna

Tip

Tipo: *


getHeader(field)

superagent's alias for `get`.

Parámetros

Nombre Tipo Opcional Descripción
field string

Retorna

Tip

Tipo: *


getMaxListeners()

Inert, for symmetry with setMaxListeners.

Retorna

Tip

Tipo: number


hasListeners(event)

component-emitter's own predicate.

Parámetros

Nombre Tipo Opcional Descripción
event string

Retorna

Tip

Tipo: boolean
whether anything is listening.


key()

Inert: TLS material belonged to the Node agent.


listenerCount(event)

Parámetros

Nombre Tipo Opcional Descripción
event string

Retorna

Tip

Tipo: number


listeners(event)

Parámetros

Nombre Tipo Opcional Descripción
event string

Retorna

Tip

Tipo: Array<function>


maxResponseSize()

Inert: the response is read whole, as it was in a browser.


off(event, callback)

Removes one listener, or every listener for the event when no function is given – which is what component-emitter's `off(event)` did.

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function=

Retorna

Tip

Tipo: RequestSpec


ok(fn)

Overrides what counts as a successful response.

Parámetros

Nombre Tipo Opcional Descripción
fn function receives the response, returns whether to resolve.

Retorna

Tip

Tipo: RequestSpec


on(event, callback)

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


once(event, callback)

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


parse(fn)

Replaces the parser used on the response body.

Parámetros

Nombre Tipo Opcional Descripción
fn function receives the response text, returns the body.

Retorna

Tip

Tipo: RequestSpec


pfx()

Inert: TLS material belonged to the Node agent.


prependListener(event, callback)

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


prependOnceListener(event, callback)

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function

Retorna

Tip

Tipo: RequestSpec


query(value)

Appends to the query string. Takes an object or an already-encoded string.

Parámetros

Nombre Tipo Opcional Descripción
value `(string object)`

Retorna

Tip

Tipo: RequestSpec


rawListeners(event)

superagent's alias for `listeners`.

Parámetros

Nombre Tipo Opcional Descripción
event string

Retorna

Tip

Tipo: Array<function>


redirects()

Inert: XHR and fetch always follow redirects; superagent could not disable that in a browser.


removeAllListeners(event)

Parámetros

Nombre Tipo Opcional Descripción
event string= every event when omitted.

Retorna

Tip

Tipo: RequestSpec


removeEventListener(event, callback)

component-emitter's alias for `off`.

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function=

Retorna

Tip

Tipo: RequestSpec


removeListener(event, callback)

superagent's alias for `off`.

Parámetros

Nombre Tipo Opcional Descripción
event string
callback function=

Retorna

Tip

Tipo: RequestSpec


responseType(type)

Parámetros

Nombre Tipo Opcional Descripción
type string `blob` is the only value the library uses.

Retorna

Tip

Tipo: RequestSpec


retry()

Inert: retrying is not reproduced, because half a retry policy is worse than none.


send(data)

Attaches a body, and picks the Content-Type the way superagent did – at this point, not at send time, so a `hooks.beforeStart` callback reading `get('Content-Type')` sees what it always saw. Repeated calls merge.

Parámetros

Nombre Tipo Opcional Descripción
data *

Retorna

Tip

Tipo: RequestSpec


serialize(fn)

Replaces the serializer used for an object body.

Parámetros

Nombre Tipo Opcional Descripción
fn function receives the body, returns a string.

Retorna

Tip

Tipo: RequestSpec


set(field, value)

Sets one header, or every header in an object.

Parámetros

Nombre Tipo Opcional Descripción
field `(string object)`
value *

Retorna

Tip

Tipo: RequestSpec
itself, for chaining.


setMaxListeners()

Inert: there is no listener ceiling to raise.

Retorna

Tip

Tipo: RequestSpec


sortQuery()

Inert: the query string is built by the caller, in order.


timeout(options)

Sets the deadline for the whole request, or `{ deadline, response }` for both that and the time allowed before a response starts arriving.

Parámetros

Nombre Tipo Opcional Descripción
options `(number object)`

Retorna

Tip

Tipo: RequestSpec


toJSON()

Retorna

Tip

Tipo: object
the request as data, as superagent's `toJSON` did.


type(type)

Sets Content-Type, accepting superagent's shorthands (`json`, `form`, …).

Parámetros

Nombre Tipo Opcional Descripción
type string

Retorna

Tip

Tipo: RequestSpec


unset(field)

Removes a header, whatever case it was set in.

Parámetros

Nombre Tipo Opcional Descripción
field string

Retorna

Tip

Tipo: RequestSpec


use(fn)

Applies a plugin, superagent's extension point.

Parámetros

Nombre Tipo Opcional Descripción
fn function receives this request.

Retorna

Tip

Tipo: RequestSpec


withCredentials(on)

Sends cookies and HTTP auth on cross-origin requests.

Parámetros

Nombre Tipo Opcional Descripción
on boolean= defaults to true, as superagent's did.

Retorna

Tip

Tipo: RequestSpec


North Amplia REST

This is a JavaScript wrapper around a REST API client.

constructor

Constructor of the REST API client.

Parámetros

Nombre Tipo Opcional Descripción
_options { url: string,port: string,version: string,apiKey: string,JTW: string} this is configuration about Opengate North API.
backend function this is a backend selected to manage a request to Opengate North API.

default()

This return a default configuration object

Retorna

Tip

Tipo: object


delete(url, timeout, headers, parameters, body, serviceBaseURL)

Invoke DELETE action to url specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute DELETE
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
body object body of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


get(url, timeout, headers, parameters, asBlob, serviceBaseURL)

Invoke GET action to url specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute GET
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
asBlob boolean response body as Blob
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


patch(url, data, timeout, headers, parameters, serviceBaseURL)

Invoke PATCH action to url and data specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute PATCH
data object attach data to request PATCH
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


post(url, data, timeout, headers, parameters, serviceBaseURL)

Invoke POST action to url and data specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute POST
data object attach data to request POST
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


post_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL)

Invoke POST multipart action to url and data specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute POST
formData FormData attach data to request POST
events object events allowed, xhr.process
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


put(url, data, timeout, headers, parameters, serviceBaseURL)

Invoke PUT action to url and data specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute PUT
data object attach data to request PUT
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


put_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL)

Invoke put multipart action to url and data specified

Parámetros

Nombre Tipo Opcional Descripción
url string url to execute POST
formData FormData attach data to request POST
events object events allowed, xhr.process
timeout number timeout in milliseconds
headers object headers of request
parameters object parameters of request
serviceBaseURL string base of the uri petition

Retorna

Tip

Tipo: Promise


Subsections of searchingFields

Field Finder

Select Element

element(name, fields)

Parámetros

Nombre Tipo Opcional Descripción
name String Indicates the datastream to show
fields [{field: field, alias:alias}] The fields that you want to show from that datastream

Retorna

Tip

Tipo: Object
This returns a json with the object element built.

Ejemplos

SE.element('provision.device.identifier', ['value'], 'identifier')
 returns:
 {
     name : 'provision.device.identifier',
     fields: ['value'],
     alias: 'identifier
 }

 SE.element('provision.device.identifier', ['value'])
 returns:
 {
     name : 'provision.device.identifier',
     fields: ['value']
 }

South Amplia REST