This extends Search and allow make request to any available resource into Opengate North API.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is configuration about Opengate North API.
url
string
❌
this define a specific resource to make the search
filter
object
❌
this is the filter
limit
object
❌
this is the pagination about the search
sort
object
❌
this defined parameters to order the result of search
group
object
❌
this defined the group by
execute()
This invoke a request to OpenGate North API and the callback is managed by promises
Retorna
Tip
Tipo:Promise
Base Search
This is a abstract class, it must be extended to another class that defined the specific search.
This class is responsible to manage execute request 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
serviceBaseURL
string
❌
base of the uri petition
downloadCsv()
This invoke a request to OpenGate North API and the callback is managed by promises
Retorna
Tip
Tipo:Promise
Promise with data with format csv
execute()
This invoke a request to OpenGate North API and the callback is managed by promises
Retorna
Tip
Tipo:Promise
executeWithAsyncPaging(resource)
This invokes a request for asynchronous paging to the OpenGate North API and the return of the pages is managed by promises and its notify object
To cancel the process in the notify method return false or string with custom message for response
In case of canceling the process, the response will be 403: Forbidden -> {data: 'Cancel process'|| custom_message, statusCode: 403}
This is a abstract class, it must be extended to another class that defined the specific search.
This class is responsible to manage execute request to OpenGate North API
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is ogapi instance
timeout
number
✅
timeout on request
execute()
This invoke a request to OpenGate North API and the callback is managed by promises
This is a abstract class. It is a base to make all kind of search request to OpenGate North API.
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
parent
InternalOpenGateAPI
❌
this is ogapi instance
routes
object
❌
this defined the routes. One of those routes must be called on Builder before call build method.
addSortAscendingBy(filterField)
Add ascending param into the sort search object
Parámetros
Nombre
Tipo
Opcional
Descripción
filterField
string
❌
This field must be allowed into the specific resource
Retorna
Tip
Tipo:SearchBuilder
Ejemplos
ogapi.subscriptionsSearchBuilder().addSortAscendingBy('prov.customid') // Order by prov.customid Ascending
addSortBy(filterField, typeSort)
Add ascending/descending param into the sort search object
Parámetros
Nombre
Tipo
Opcional
Descripción
filterField
string
❌
This field must be allowed into the specific resource
typeSort
string
❌
Retorna
Tip
Tipo:SearchBuilder
Ejemplos
ogapi.subscriptionsSearchBuilder().addSortBy('prov.customid','ASCENDING') // Order by prov.customid Ascending
ogapi.devicesSearchBuilder().addSortBy('prov.customid','DESCENDING') // Order by prov.customid Descending
addSortDescendingBy(filterField)
Add descending param into the sort search object
Parámetros
Nombre
Tipo
Opcional
Descripción
filterField
string
❌
This field must be allowed into the specific resource
Retorna
Tip
Tipo:SearchBuilder
Ejemplos
ogapi.devicesSearchBuilder().addSortDescendingBy('prov.customid') // Order by prov.customid Descending
Return a promise which it will contains an array with fields recommended with complete structure
Parámetros
Nombre
Tipo
Opcional
Descripción
input
*
❌
Retorna
Tip
Tipo:Promise
findFieldPath(field)
Return a promise which it will contains an string with the path of a field
Parámetros
Nombre
Tipo
Opcional
Descripción
field
*
❌
Retorna
Tip
Tipo:Promise
findFields(input)
Return a promise which it will contains an array with fields recommended with only identifier
Parámetros
Nombre
Tipo
Opcional
Descripción
input
*
❌
Retorna
Tip
Tipo:Promise
limit(size, start)
Set reponse pagination.
Parámetros
Nombre
Tipo
Opcional
Descripción
size
number
❌
Defined the number of elements on response
start
number
✅
Defined the offset on response
Retorna
Tip
Tipo:SearchBuilder
Ejemplos
ogapi.subscribersSearchBuilder().limit(10) // Without offset
ogapi.subscribersSearchBuilder().limit(25,50) //With offset value 50
removeSortBy(filterField)
Remove sort param from the search object
Parámetros
Nombre
Tipo
Opcional
Descripción
filterField
string
❌
This field must be allowed into the specific resource
Retorna
Tip
Tipo:SearchBuilder
Ejemplos
ogapi.subscriptionsSearchBuilder().removeSortBy('prov.customid') // Remove order by prov.customid
ogapi.subscriptionsSearchBuilder().removeSortBy() // Remove all order by parameters
withTimeout(ms)
The request will have a specific time out if it will be exceeded then the promise throw an exception
This extends Search and it allow make request to any available resource into static resources for Opengate North API
constructor
Constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is configuration about Opengate North API.
url
string
❌
this define a specific resource to make the search
filter
object
❌
this is the filter
execute()
This invoke a dummy request to OpenGate North API and the callback is managed by promises
Retorna
Tip
Tipo:Promise
WP Search
This extends BaseSearch and allow make request to any available resource into Opengate North API.
The resource does not have the ‘search’ prefix. For this, use class Search
constructor
Parámetros
Nombre
Tipo
Opcional
Descripción
ogapi
InternalOpenGateAPI
❌
this is configuration about Opengate North API.
url
string
❌
this define a specific resource to make the search
filter
object
❌
this is the filter
limit
object
❌
this is the pagination about the search
sort
object
❌
this defined parameters to order the result of search