new HttpAdapter(opts)
HttpAdapter class.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object |
<optional> |
Configuration options. Properties
|
- Source:
Extends
Members
-
basePath :string
-
Type:
- string
- Source:
-
debug :boolean
-
Whether to log debugging information.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
- Source:
-
forceTrailingSlash :boolean
-
Type:
- boolean
- Default Value:
-
- false
- Source:
-
http :function
-
Type:
- function
- Source:
-
httpConfig :Object
-
Type:
- Object
- Source:
-
raw :boolean
-
Whether to return a more detailed response object.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
- Source:
-
suffix :string
-
Type:
- string
- Source:
-
useFetch :boolean
-
Type:
- boolean
- Default Value:
-
- false
- Source:
Methods
-
<static> extend(instanceProps, classProps)
-
Alternative to ES6 class syntax for extending
HttpAdapter
.Parameters:
Name Type Argument Description instanceProps
Object <optional>
Properties that will be added to the prototype of the subclass.
classProps
Object <optional>
Properties that will be added as static properties to the subclass itself.
- Source:
Returns:
Subclass of
HttpAdapter
.- Type
- Object
Examples
-
afterCount(mapper, props, opts, response)
-
Lifecycle method method called by count.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes count to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the count.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to count.props
Object The
props
argument passed to count.opts
Object The
opts
argument passed to count.response
Object | Response Count or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterCount
-
afterCreate(mapper, props, opts, response)
-
Lifecycle method method called by create.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes create to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the created record.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to create.props
Object The
props
argument passed to create.opts
Object The
opts
argument passed to create.response
Object | Response Created record or Response, depending on the value of
opts.raw
.- Inherited From:
- Overrides:
- Source:
Properties:
Name Type Description opts.op
string afterCreate
-
afterDEL(url, config, opts, response)
-
Parameters:
Name Type Description url
string config
Object opts
Object response
Object - Source:
-
afterDestroy(mapper, id, opts, response)
-
Lifecycle method method called by destroy.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will beundefined
.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to destroy.id
string | number The
id
argument passed to destroy.opts
Object The
opts
argument passed to destroy.response
undefined | Response undefined
or Response, depending on the value ofopts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterDestroy
-
afterDestroyAll(mapper, query, opts, response)
-
Lifecycle method method called by destroyAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will beundefined
.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to destroyAll.query
Object The
query
argument passed to destroyAll.opts
Object The
opts
argument passed to destroyAll.response
undefined | Response undefined
or Response, depending on the value ofopts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterDestroyAll
-
afterFind(mapper, id, opts, response)
-
Lifecycle method method called by find.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes find to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the found record, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to find.id
string | number The
id
argument passed to find.opts
Object The
opts
argument passed to find.response
Object | Response The found record or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterFind
-
afterFindAll(mapper, query, opts, response)
-
Lifecycle method method called by findAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the found records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to findAll.query
Object The
query
argument passed to findAll.opts
Object The
opts
argument passed to findAll.response
Array.<Object> | Response The found records or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterFindAll
-
afterGET(url, config, opts, response)
-
Parameters:
Name Type Description url
string config
Object opts
Object response
Object - Source:
-
afterHTTP(config, opts, response)
-
Parameters:
Name Type Description config
Object opts
Object response
Object - Source:
-
afterPOST(url, data, config, opts, response)
-
Parameters:
Name Type Description url
string data
Object config
Object opts
Object response
Object - Source:
-
afterPUT(url, data, config, opts, response)
-
Parameters:
Name Type Description url
string data
Object config
Object opts
Object response
Object - Source:
-
afterSum(mapper, field, query, opts, response)
-
Lifecycle method method called by sum.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes sum to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the sum.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to sum.field
string The
field
argument passed to sum.query
Object The
query
argument passed to sum.opts
Object The
opts
argument passed to sum.response
Object | Response Count or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterSum
-
afterUpdate(mapper, id, props, opts, response)
-
Lifecycle method method called by update.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes update to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated record.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to update.id
string | number The
id
argument passed to update.props
Object The
props
argument passed to update.opts
Object The
opts
argument passed to update.response
Object | Response The updated record or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterUpdate
-
afterUpdateAll(mapper, props, query, opts, response)
-
Lifecycle method method called by updateAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to updateAll.props
Object The
props
argument passed to updateAll.query
Object The
query
argument passed to updateAll.opts
Object The
opts
argument passed to updateAll.response
Array.<Object> | Response The updated records or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterUpdateAll
-
afterUpdateMany(mapper, records, opts, response)
-
Lifecycle method method called by updateMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to updateMany.records
Array.<Object> The
records
argument passed to updateMany.opts
Object The
opts
argument passed to updateMany.response
Array.<Object> | Response The updated records or Response, depending on the value of
opts.raw
.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string afterUpdateMany
-
beforeCount(mapper, query, opts)
-
Lifecycle method method called by count.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes count to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to count.query
Object The
query
argument passed to count.opts
Object The
opts
argument passed to count.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeCount
-
beforeCreate(mapper, props, opts)
-
Lifecycle method method called by create.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes create to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to create.props
Object The
props
argument passed to create.opts
Object The
opts
argument passed to create.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeCreate
-
beforeCreateMany(mapper, props, opts)
-
Lifecycle method method called by createMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to createMany.props
Array.<Object> The
props
argument passed to createMany.opts
Object The
opts
argument passed to createMany.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeCreateMany
-
beforeDEL(url, config, opts)
-
Parameters:
Name Type Description url
Object config
Object opts
Object - Source:
-
beforeDestroy(mapper, id, opts)
-
Lifecycle method method called by destroy.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to destroy.id
string | number The
id
argument passed to destroy.opts
Object The
opts
argument passed to destroy.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeDestroy
-
beforeDestroyAll(mapper, query, opts)
-
Lifecycle method method called by destroyAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to destroyAll.query
Object The
query
argument passed to destroyAll.opts
Object The
opts
argument passed to destroyAll.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeDestroyAll
-
beforeFind(mapper, id, opts)
-
Lifecycle method method called by find.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes find to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to find.id
string | number The
id
argument passed to find.opts
Object The
opts
argument passed to find.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeFind
-
beforeFindAll(mapper, query, opts)
-
Lifecycle method method called by findAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to findAll.query
Object The
query
argument passed to findAll.opts
Object The
opts
argument passed to findAll.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeFindAll
-
beforeGET(url, config, opts)
-
Parameters:
Name Type Description url
Object config
Object opts
Object - Source:
-
beforeHTTP(config, opts)
-
Parameters:
Name Type Description config
Object opts
Object - Source:
-
beforePOST(url, data, config, opts)
-
Parameters:
Name Type Description url
Object data
Object config
Object opts
Object - Source:
-
beforePUT(url, data, config, opts)
-
Parameters:
Name Type Description url
Object data
Object config
Object opts
Object - Source:
-
beforeSum(mapper, query, opts)
-
Lifecycle method method called by sum.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes sum to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to sum.query
Object The
query
argument passed to sum.opts
Object The
opts
argument passed to sum.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeSum
-
beforeUpdate(mapper, id, props, opts)
-
Lifecycle method method called by update.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes update to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to update.id
string | number The
id
argument passed to update.props
Object The
props
argument passed to update.opts
Object The
opts
argument passed to update.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeUpdate
-
beforeUpdateAll(mapper, props, query, opts)
-
Lifecycle method method called by updateAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to updateAll.props
Object The
props
argument passed to updateAll.query
Object The
query
argument passed to updateAll.opts
Object The
opts
argument passed to updateAll.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeUpdateAll
-
beforeUpdateMany(mapper, props, opts)
-
Lifecycle method method called by updateMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
Parameters:
Name Type Description mapper
Object The
mapper
argument passed to updateMany.props
Array.<Object> The
props
argument passed to updateMany.opts
Object The
opts
argument passed to updateMany.- Inherited From:
- Source:
Properties:
Name Type Description opts.op
string beforeUpdateMany
-
count(mapper, query, opts)
-
Retrieve the number of records that match the selection
query
.Parameters:
Name Type Argument Description mapper
Object The mapper.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
create(mapper, props, opts)
-
Create a new the record from the provided
props
.Parameters:
Name Type Argument Description mapper
Object The mapper.
props
Object Properties to send as the payload.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
createMany(mapper, props, opts)
-
Create multiple new records in batch.
Parameters:
Name Type Argument Description mapper
Object The mapper.
props
Array Array of property objects to send as the payload.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
dbg()
-
Shortcut for
#log('debug'[, arg1[, arg2[, argn]]])
.- Inherited From:
- Source:
-
DEL(url, config, opts)
-
Make an Http request to
url
according to the configuration inconfig
.Parameters:
Name Type Argument Description url
string Url for the request.
config
Object <optional>
Http configuration that will be passed to HttpAdapter#HTTP.
opts
Object <optional>
Configuration options.
- Source:
Returns:
- Type
- Promise
-
deserialize(mapper, response, opts)
-
Transform the server response object into the payload that will be returned to JSData.
Parameters:
Name Type Description mapper
Object The mapper used for the operation.
response
Object Response object from HttpAdapter#HTTP.
opts
Object Configuration options.
- Source:
Returns:
Deserialized data.
- Type
- Object | Array
-
destroy(mapper, id, opts)
-
Destroy the record with the given primary key.
Parameters:
Name Type Argument Description mapper
Object The mapper.
id
string | number Primary key of the record to destroy.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
destroyAll(mapper, query, opts)
-
Destroy the records that match the selection
query
.Parameters:
Name Type Argument Description mapper
Object The mapper.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
error(args)
-
Log an error.
Parameters:
Name Type Argument Description args
* <optional>
<repeatable>
Arguments to log.
- Source:
-
fetch(config, opts)
-
Make an Http request using
window.fetch
.Parameters:
Name Type Argument Description config
Object Request configuration.
Properties
Name Type Description data
Object Payload for the request.
method
string Http method for the request.
headers
Object Headers for the request.
params
Object Querystring for the request.
url
string Url for the request.
opts
Object <optional>
Configuration options.
- Source:
-
find(mapper, id, opts)
-
Retrieve the record with the given primary key.
Parameters:
Name Type Argument Description mapper
Object The mapper.
id
string | number Primary key of the record to retrieve.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
findAll(mapper, query, opts)
-
Retrieve the records that match the selection
query
.Parameters:
Name Type Argument Description mapper
Object The mapper.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
GET(url, config, opts)
-
TODO
Parameters:
Name Type Argument Description url
string The url for the request.
config
Object Request configuration options.
opts
Object <optional>
Configuration options.
- Source:
Returns:
- Type
- Promise
-
getEndpoint(mapper, id, opts)
-
Parameters:
Name Type Description mapper
Object TODO
id
* TODO
opts
boolean TODO
- Source:
Returns:
Full path.
- Type
- string
-
getOpt(opt, opts)
-
Resolve the value of the specified option based on the given options and this adapter's settings. Override with care.
Parameters:
Name Type Argument Description opt
string The name of the option.
opts
Object <optional>
Configuration options.
- Inherited From:
- Source:
Returns:
The value of the specified option.
- Type
- *
-
getPath(method, mapper, id, opts)
-
Parameters:
Name Type Argument Description method
string TODO
mapper
Object TODO
id
string | number <nullable>
TODO
opts
Object Configuration options.
- Source:
-
HTTP(config, opts)
-
Make an Http request.
Parameters:
Name Type Argument Description config
Object Request configuration options.
opts
Object <optional>
Configuration options.
- Source:
Returns:
- Type
- Promise
-
loadBelongsTo()
-
Load a belongsTo relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- Promise
-
loadHasMany()
-
Load a hasMany relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- Promise
-
loadHasOne()
-
Load a hasOne relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- Promise
-
log(level, values)
-
Logging utility method. Override this method if you want to send log messages to something other than the console.
Parameters:
Name Type Argument Description level
string Log level.
values
* <repeatable>
Values to log.
- Inherited From:
- Source:
-
makeBelongsToForeignKey()
-
Return the foreignKey from the given record for the provided relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- *
-
makeHasManyForeignKey()
-
Return the foreignKey from the given record for the provided relationship.
There may be reasons why you may want to override this method, like when the id of the parent doesn't exactly match up to the key on the child.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- *
-
makeHasManyForeignKeys()
-
Return the foreignKeys from the given record for the provided relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- *
-
makeHasManyLocalKeys()
-
Return the localKeys from the given record for the provided relationship.
Override with care.
- Inherited From:
- Source:
Returns:
- Type
- *
-
POST(url, data, config, opts)
-
TODO
Parameters:
Name Type Argument Description url
* TODO
data
Object TODO
config
Object TODO
opts
Object <optional>
Configuration options.
- Source:
Returns:
- Type
- Promise
-
PUT(url, data, config, opts)
-
TODO
Parameters:
Name Type Argument Description url
* TODO
data
Object TODO
config
Object TODO
opts
Object <optional>
Configuration options.
- Source:
Returns:
- Type
- Promise
-
queryTransform(mapper, params, opts)
-
TODO
Parameters:
Name Type Description mapper
Object TODO
params
* TODO
opts
* TODO
- Source:
Returns:
Transformed params.
- Type
- *
-
respond(response, opts)
-
Parameters:
Name Type Description response
Object Response object.
opts
Object Configuration options. return {Object} If
opts.raw == true
then returnresponse
, else returnresponse.data
.- Inherited From:
- Source:
-
responseError(err, config, opts)
-
Error handler invoked when the promise returned by HttpAdapter#http is rejected. Default implementation is to just return the error wrapped in a rejected Promise, aka rethrow the error. HttpAdapter#http is called by HttpAdapter#HTTP.
Parameters:
Name Type Description err
* The error that HttpAdapter#http rejected with.
config
Object The
config
argument that was passed to HttpAdapter#HTTP.opts
* The
opts
argument that was passed to HttpAdapter#HTTP.- Source:
Returns:
- Type
- Promise
-
serialize(mapper, data, opts)
-
TODO
Parameters:
Name Type Description mapper
Object TODO
data
Object TODO
opts
* TODO
- Source:
Returns:
Serialized data.
- Type
- *
-
sum(mapper, field, query, opts)
-
Retrieve the sum of the field of the records that match the selection query.
Parameters:
Name Type Argument Description mapper
Object The mapper.
field
string The field to sum.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise
-
update(mapper, id, props, opts)
-
TODO
Parameters:
Name Type Argument Description mapper
Object TODO
id
* TODO
props
* TODO
opts
Object <optional>
Configuration options.
- Overrides:
- Source:
Returns:
- Type
- Promise
-
updateAll(mapper, props, query, opts)
-
TODO
Parameters:
Name Type Argument Description mapper
Object TODO
props
Object TODO
query
Object TODO
opts
Object <optional>
Configuration options.
- Overrides:
- Source:
Returns:
- Type
- Promise
-
updateMany(mapper, records, opts)
-
Update multiple records in batch.
HttpAdapter#beforeUpdateMany will be called before calling HttpAdapter#PUT. HttpAdapter#afterUpdateMany will be called after calling HttpAdapter#PUT.
Parameters:
Name Type Argument Description mapper
Object The mapper.
records
Array Array of property objects to send as the payload.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
HttpAdapter#suffix TODO
- Overrides:
- Source:
Returns:
- Type
- Promise