Export the initialize method to loopback-datasource-juggler
Name | Type | Description |
---|---|---|
dataSource |
DataSource
|
The loopback data source instance |
[callback] |
function
|
The callback function |
The RestConnector constructor
Name | Type | Description |
---|---|---|
baseURL |
string
|
The base URL |
Hook for defining a model by the data source
Name | Type | Description |
---|---|---|
definition |
object
|
The model description |
Install the post processor
Name | Type | Description |
---|---|---|
definition |
object
|
The model description |
Pre-process the request data
Name | Type | Description |
---|---|---|
data |
|
The request data |
Name | Type | Description |
---|---|---|
result |
[object Object]
|
Post-process the response data
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
data |
|
The response data |
many |
boolean
|
Is it an array |
Get a REST resource client for the given model
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
Name | Type | Description |
---|---|---|
result |
|
Create an instance of the model with the given data
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
data |
object
|
The model instance data |
[callback] |
function
|
The callback function |
Update or create an instance of the model
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
data |
object
|
The model instance data |
[callback] |
function
|
The callback function |
A factory to build callback function for a response
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
[callback] |
function
|
The callback function |
Name | Type | Description |
---|---|---|
result |
function
|
Save an instance of a given model
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
data |
object
|
The model instance data |
[callback] |
function
|
The callback function |
Check the existence of a given model/id
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
id |
|
The id value |
[callback] |
function
|
The callback function |
Find an instance of a given model/id
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
id |
|
The id value |
[callback] |
function
|
The callback function |
Delete an instance for a given model/id
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
id |
|
The id value |
[callback] |
function
|
The callback function |
Query all instances for a given model based on the filter
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
filter |
object
|
The filter object |
[callback] |
function
|
The callback function |
Delete all instances for a given model
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
[callback] |
function
|
The callback function |
Count cannot not be supported efficiently.
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
[callback] |
function
|
The callback function |
where |
object
|
The where object |
Update attributes for a given model/id
Name | Type | Description |
---|---|---|
model |
string
|
The model name |
id |
|
The id value |
data |
object
|
The model instance data |
[callback] |
function
|
The callback function |
Get types associated with the connector
Name | Type | Description |
---|---|---|
result |
Array.<String>
|
The types for the connector |
Build a REST resource client for CRUD operations
Name | Type | Description |
---|---|---|
modelCtor |
function
|
The model constructor |
baseUrl |
string
|
The base URL |
Name | Type | Description |
---|---|---|
result |
RestResource
|
Wrap the callback so that it takes (err, result, response)
Name | Type | Description |
---|---|---|
cb |
function
|
The callback function |
Name | Type | Description |
---|---|---|
result |
|
Map the create operation to HTTP POST /{model}
Name | Type | Description |
---|---|---|
obj |
object
|
The HTTP body |
[cb] |
function
|
The callback function |
Map the update operation to POST /{model}/{id}
Name | Type | Description |
---|---|---|
id |
|
The id value |
obj |
object
|
The HTTP body |
[cb] |
function
|
The callback function |
Map the delete operation to POST /{model}/{id}
Name | Type | Description |
---|---|---|
id |
|
The id value |
[cb] |
function
|
The callback function |
Map the delete operation to POST /{model}
Name | Type | Description |
---|---|---|
id |
|
The id value |
[cb] |
function
|
The callback function |
Map the find operation to GET /{model}/{id}
Name | Type | Description |
---|---|---|
id |
|
The id value |
[cb] |
function
|
The callback function |
Map the all/query operation to GET /{model}
Name | Type | Description |
---|---|---|
q |
object
|
query string |
[cb] |
function
|
callback with (err, results) |