new DSHttpAdapter(opts)
DSHttpAdapter class.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object |
<optional> |
Configuration options. Properties
|
Members
-
<static> version :Object
-
Details of the current version of the
js-data-http
module.Type:
- Object
- Source:
Properties:
Name Type Description version.full
string The full semver value.
version.major
number The major version number.
version.minor
number The minor version number.
version.patch
number The patch version number.
version.alpha
string | boolean The alpha version value, otherwise
false
if the current version is not alpha.version.beta
string | boolean The beta version value, otherwise
false
if the current version is not beta. -
basePath :string
-
Type:
- string
-
debug :boolean
-
Type:
- boolean
- Default Value:
-
- false
- Source:
-
forceTrailingSlash :boolean
-
Type:
- boolean
- Default Value:
-
- false
- Source:
-
http :function
-
Type:
- function
-
httpConfig :Object
-
Type:
- Object
-
suffix :string
-
Type:
- string
-
useFetch :boolean
-
Type:
- boolean
- Default Value:
-
- false
- Source:
Methods
-
<static> addAction(name, opts)
-
Add an Http actions to a Model.
Parameters:
Name Type Argument Description name
string Name of the new action.
opts
Object <optional>
Action configuration
Properties
Name Type Argument Description adapter
string <optional>
pathname
string <optional>
request
function <optional>
response
function <optional>
responseError
function <optional>
Returns:
Decoration function, which should be passed the Model to decorate when invoked.
- Type
- function
-
<static> addActions(opts)
-
Add multiple Http actions to a Model. See DSHttpAdapter.addAction for action configuration options.
Parameters:
Name Type Description opts
Object.<string, Object> Object where the key is an action name and the value is the configuration for the action.
Returns:
Decoration function, which should be passed the Model to decorate when invoked.
- Type
- function
-
<static> extend(instanceProps, classProps)
-
Alternative to ES6 class syntax for extending
DSHttpAdapter
.ES6:
class MyHttpAdapter extends DSHttpAdapter { deserialize (Model, data, opts) { const data = super.deserialize(Model, data, opts) data.foo = 'bar' return data } }
ES5:
var instanceProps = { // override deserialize deserialize: function (Model, data, opts) { var Ctor = this.constructor var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize // call the super deserialize var data = superDeserialize(Model, data, opts) data.foo = 'bar' return data }, say: function () { return 'hi' } } var classProps = { yell: function () { return 'HI' } } var MyHttpAdapter = DSHttpAdapter.extend(instanceProps, classProps) var adapter = new MyHttpAdapter() adapter.say() // "hi" MyHttpAdapter.yell() // "HI"
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.
Returns:
Subclass of
DSHttpAdapter
.- Type
- Object
-
afterCreate(Model, props, opts, data)
-
Lifecycle hook called by DSHttpAdapter#create. If this method returns a promise then DSHttpAdapter#create will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#create.props
Object The
props
argument passed to DSHttpAdapter#create.opts
Object The
opts
argument passed to DSHttpAdapter#create.data
Object The
data
value that DSHttpAdapter#create will return. -
afterCreateMany(Model, models, opts, data)
-
Lifecycle hook called by DSHttpAdapter#createMany. If this method returns a promise then DSHttpAdapter#createMany will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#createMany will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#createMany.models
Object The
models
argument passed to DSHttpAdapter#createMany.opts
Object The
opts
argument passed to DSHttpAdapter#createMany.data
Object The
data
value that DSHttpAdapter#createMany will return. -
afterDEL(url, config, opts, response)
-
Lifecycle hook called by DSHttpAdapter#DEL. If this method returns a promise then DSHttpAdapter#DEL will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#DEL will resolve with that same value.
Parameters:
Name Type Description url
string The
url
argument passed to DSHttpAdapter#DEL.config
Object The
config
argument passed to DSHttpAdapter#DEL.opts
Object The
opts
argument passed to DSHttpAdapter#DEL.response
Object The
response
value that DSHttpAdapter#DEL will return. -
afterDestroy(Model, id, opts, data)
-
Lifecycle hook called by DSHttpAdapter#destroy. If this method returns a promise then DSHttpAdapter#destroy will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#destroy will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#destroy.id
string | number The
id
argument passed to DSHttpAdapter#destroy.opts
Object The
opts
argument passed to DSHttpAdapter#destroy.data
Object The
data
value that DSHttpAdapter#destroy will return. -
afterDestroyAll(Model, id, opts, data)
-
Lifecycle hook called by DSHttpAdapter#destroyAll. If this method returns a promise then DSHttpAdapter#destroyAll will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#destroyAll will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#destroyAll.id
string | number The
id
argument passed to DSHttpAdapter#destroyAll.opts
Object The
opts
argument passed to DSHttpAdapter#destroyAll.data
Object The
data
value that DSHttpAdapter#destroyAll will return. -
afterFind(Model, id, opts, data)
-
Lifecycle hook called by DSHttpAdapter#find. If this method returns a promise then DSHttpAdapter#find will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#find will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#find.id
string | number The
id
argument passed to DSHttpAdapter#find.opts
Object The
opts
argument passed to DSHttpAdapter#find.data
Object The
data
value that DSHttpAdapter#find will return. -
afterFindAll(Model, id, opts, data)
-
Lifecycle hook called by DSHttpAdapter#findAll. If this method returns a promise then DSHttpAdapter#findAll will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#findAll will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#findAll.id
string | number The
id
argument passed to DSHttpAdapter#findAll.opts
Object The
opts
argument passed to DSHttpAdapter#findAll.data
Object The
data
value that DSHttpAdapter#findAll will return. -
afterGET(url, config, opts, response)
-
Lifecycle hook called by DSHttpAdapter#GET. If this method returns a promise then DSHttpAdapter#GET will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#GET will resolve with that same value.
Parameters:
Name Type Description url
string The
url
argument passed to DSHttpAdapter#GET.config
Object The
config
argument passed to DSHttpAdapter#GET.opts
Object The
opts
argument passed to DSHttpAdapter#GET.response
Object The
response
value that DSHttpAdapter#GET will return. -
afterHTTP(config, opts, response)
-
Lifecycle hook called by DSHttpAdapter#HTTP. If this method returns a promise then DSHttpAdapter#HTTP will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#HTTP will resolve with that same value.
Parameters:
Name Type Description config
Object The
config
argument passed to DSHttpAdapter#HTTP.opts
Object The
opts
argument passed to DSHttpAdapter#HTTP.response
Object The
response
value that DSHttpAdapter#HTTP will return. -
afterPOST(url, data, config, opts, response)
-
Lifecycle hook called by DSHttpAdapter#POST. If this method returns a promise then DSHttpAdapter#POST will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#POST will resolve with that same value.
Parameters:
Name Type Description url
string The
url
argument passed to DSHttpAdapter#POST.data
Object The
data
argument passed to DSHttpAdapter#POST.config
Object The
config
argument passed to DSHttpAdapter#POST.opts
Object The
opts
argument passed to DSHttpAdapter#POST.response
Object The
response
value that DSHttpAdapter#POST will return. -
afterPUT(url, data, config, opts, response)
-
Lifecycle hook called by DSHttpAdapter#PUT. If this method returns a promise then DSHttpAdapter#PUT will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#PUT will resolve with that same value.
Parameters:
Name Type Description url
string The
url
argument passed to DSHttpAdapter#PUT.data
Object The
data
argument passed to DSHttpAdapter#PUT.config
Object The
config
argument passed to DSHttpAdapter#PUT.opts
Object The
opts
argument passed to DSHttpAdapter#PUT.response
Object The
response
value that DSHttpAdapter#PUT will return. -
afterUpdate(Model, id, props, opts, data)
-
Lifecycle hook called by DSHttpAdapter#update. If this method returns a promise then DSHttpAdapter#update will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#update will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#update.id
string | number The
id
argument passed to DSHttpAdapter#update.props
Object The
props
argument passed to DSHttpAdapter#update.opts
Object The
opts
argument passed to DSHttpAdapter#update.data
Object The
data
value that DSHttpAdapter#update will return. -
afterUpdateAll(Model, props, query, opts, data)
-
Lifecycle hook called by DSHttpAdapter#updateAll. If this method returns a promise then DSHttpAdapter#updateAll will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#updateAll will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#updateAll.props
Object The
props
argument passed to DSHttpAdapter#updateAll.query
Object The
query
argument passed to DSHttpAdapter#updateAll.opts
Object The
opts
argument passed to DSHttpAdapter#updateAll.data
Object The
data
value that DSHttpAdapter#updateAll will return. -
afterUpdateMany(Model, models, opts, data)
-
Lifecycle hook called by DSHttpAdapter#updateMany. If this method returns a promise then DSHttpAdapter#updateMany will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#updateMany will resolve with that same value.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#updateMany.models
Object The
models
argument passed to DSHttpAdapter#updateMany.opts
Object The
opts
argument passed to DSHttpAdapter#updateMany.data
Object The
data
value that DSHttpAdapter#updateMany will return. -
beforeCreate(Model, props, opts)
-
Lifecycle hook called by DSHttpAdapter#create. If this method returns a promise then DSHttpAdapter#create will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#create.props
Object The
props
argument passed to DSHttpAdapter#create.opts
Object The
opts
argument passed to DSHttpAdapter#create. -
beforeCreateMany(Model, models, opts)
-
Lifecycle hook called by DSHttpAdapter#createMany. If this method returns a promise then DSHttpAdapter#createMany will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#createMany.models
Object The
models
argument passed to DSHttpAdapter#createMany.opts
Object The
opts
argument passed to DSHttpAdapter#createMany. -
beforeDEL(url, config, opts)
-
Lifecycle hook called by DSHttpAdapter#DEL. If this method returns a promise then DSHttpAdapter#DEL will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value, then the
config
argument passed to DSHttpAdapter#DEL will be replaced by the value.Parameters:
Name Type Description url
Object The
url
argument passed to DSHttpAdapter#DEL.config
Object The
config
argument passed to DSHttpAdapter#DEL.opts
Object The
opts
argument passed to DSHttpAdapter#DEL. -
beforeDestroy(Model, id, opts)
-
Lifecycle hook called by DSHttpAdapter#destroy. If this method returns a promise then DSHttpAdapter#destroy will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#destroy.id
string | number The
id
argument passed to DSHttpAdapter#destroy.opts
Object The
opts
argument passed to DSHttpAdapter#destroy. -
beforeDestroyAll(Model, query, opts)
-
Lifecycle hook called by DSHttpAdapter#destroyAll. If this method returns a promise then DSHttpAdapter#destroyAll will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#destroyAll.query
Object The
query
argument passed to DSHttpAdapter#destroyAll.opts
Object The
opts
argument passed to DSHttpAdapter#destroyAll. -
beforeFind(Model, id, opts)
-
Lifecycle hook called by DSHttpAdapter#find. If this method returns a promise then DSHttpAdapter#find will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#find.id
string | number The
id
argument passed to DSHttpAdapter#find.opts
Object The
opts
argument passed to DSHttpAdapter#find. -
beforeFindAll(Model, query, opts)
-
Lifecycle hook called by DSHttpAdapter#findAll. If this method returns a promise then DSHttpAdapter#findAll will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#findAll.query
Object The
query
argument passed to DSHttpAdapter#findAll.opts
Object The
opts
argument passed to DSHttpAdapter#findAll. -
beforeGET(url, config, opts)
-
Lifecycle hook called by DSHttpAdapter#GET. If this method returns a promise then DSHttpAdapter#GET will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value, then the
config
argument passed to DSHttpAdapter#GET will be replaced by the value.Parameters:
Name Type Description url
Object The
url
argument passed to DSHttpAdapter#GET.config
Object The
config
argument passed to DSHttpAdapter#GET.opts
Object The
opts
argument passed to DSHttpAdapter#GET. -
beforeHTTP(config, opts)
-
Lifecycle hook called by DSHttpAdapter#HTTP. If this method returns a promise then DSHttpAdapter#HTTP will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value, then the
config
argument passed to DSHttpAdapter#HTTP will be replaced by the value.Parameters:
Name Type Description config
Object The
config
argument passed to DSHttpAdapter#HTTP.opts
Object The
opts
argument passed to DSHttpAdapter#HTTP. -
beforePOST(url, data, config, opts)
-
Lifecycle hook called by DSHttpAdapter#POST. If this method returns a promise then DSHttpAdapter#POST will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value, then the
config
argument passed to DSHttpAdapter#POST will be replaced by the value.Parameters:
Name Type Description url
Object The
url
argument passed to DSHttpAdapter#POST.data
Object The
data
argument passed to DSHttpAdapter#POST.config
Object The
config
argument passed to DSHttpAdapter#POST.opts
Object The
opts
argument passed to DSHttpAdapter#POST. -
beforePUT(url, data, config, opts)
-
Lifecycle hook called by DSHttpAdapter#PUT. If this method returns a promise then DSHttpAdapter#PUT will wait for the promise to resolve before continuing. If this method returns any other value or the promise resolves with a value, then DSHttpAdapter#create will resolve with that same value, then the
config
argument passed to DSHttpAdapter#PUT will be replaced by the value.Parameters:
Name Type Description url
Object The
url
argument passed to DSHttpAdapter#PUT.data
Object The
data
argument passed to DSHttpAdapter#PUT.config
Object The
config
argument passed to DSHttpAdapter#PUT.opts
Object The
opts
argument passed to DSHttpAdapter#PUT. -
beforeUpdate(Model, id, props, opts)
-
Lifecycle hook called by DSHttpAdapter#update. If this method returns a promise then DSHttpAdapter#update will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#update.id
string | number The
id
argument passed to DSHttpAdapter#update.props
Object The
props
argument passed to DSHttpAdapter#update.opts
Object The
opts
argument passed to DSHttpAdapter#update. -
beforeUpdateAll(Model, props, query, opts)
-
Lifecycle hook called by DSHttpAdapter#updateAll. If this method returns a promise then DSHttpAdapter#updateAll will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#updateAll.props
Object The
props
argument passed to DSHttpAdapter#updateAll.query
Object The
query
argument passed to DSHttpAdapter#updateAll.opts
Object The
opts
argument passed to DSHttpAdapter#updateAll. -
beforeUpdateMany(Model, models, opts)
-
Lifecycle hook called by DSHttpAdapter#updateMany. If this method returns a promise then DSHttpAdapter#updateMany will wait for the promise to resolve before continuing.
Parameters:
Name Type Description Model
Object The
Model
argument passed to DSHttpAdapter#updateMany.models
Object The
models
argument passed to DSHttpAdapter#updateMany.opts
Object The
opts
argument passed to DSHttpAdapter#updateMany. -
create(Model, props, opts)
-
Create a new the entity from the provided
props
.DSHttpAdapter#beforeCreate will be called before calling DSHttpAdapter#POST. DSHttpAdapter#afterCreate will be called after calling DSHttpAdapter#POST.
Parameters:
Name Type Argument Description Model
Object The Model.
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>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
createMany(Model, models, opts)
-
Create multiple new entities in batch.
DSHttpAdapter#beforeCreateMany will be called before calling DSHttpAdapter#POST. DSHttpAdapter#afterCreateMany will be called after calling DSHttpAdapter#POST.
Parameters:
Name Type Argument Description Model
Object The Model.
models
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>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
dbg(args)
-
Call DSHttpAdapter#log at the "debug" level.
Parameters:
Name Type Argument Description args
* <optional>
<repeatable>
Args passed to DSHttpAdapter#log.
-
DEL(url, config, opts)
-
Make an Http request to
url
according to the configuration inconfig
.DSHttpAdapter#beforeDEL will be called before calling DSHttpAdapter#HTTP. DSHttpAdapter#afterDEL will be called after calling DSHttpAdapter#HTTP.
Parameters:
Name Type Argument Description url
string Url for the request.
config
Object <optional>
Http configuration that will be passed to DSHttpAdapter#HTTP.
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
deserialize(Model, response, opts)
-
Transform the server response object into the payload that will be returned to JSData.
Parameters:
Name Type Description Model
Object The Model used for the operation.
response
Object Response object from DSHttpAdapter#HTTP.
opts
Object Configuration options.
Returns:
Deserialized data.
- Type
- Object | Array
-
destroy(Model, id, opts)
-
Destroy the entity with the given primary key.
DSHttpAdapter#beforeDestroy will be called before calling DSHttpAdapter#DEL. DSHttpAdapter#afterDestroy will be called after calling DSHttpAdapter#DEL.
Parameters:
Name Type Argument Description Model
Object The Model.
id
string | number Primary key of the entity to destroy.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
destroyAll(Model, query, opts)
-
Destroy the entities that match the selection
query
.DSHttpAdapter#beforeDestroyAll will be called before calling DSHttpAdapter#DEL. DSHttpAdapter#afterDestroyAll will be called after calling DSHttpAdapter#DEL.
Parameters:
Name Type Argument Description Model
Object The Model.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
error(args)
-
Log an error.
Parameters:
Name Type Argument Description args
* <optional>
<repeatable>
Arguments to log.
-
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.
-
find(Model, id, opts)
-
Retrieve the entity with the given primary key.
DSHttpAdapter#beforeFind will be called before calling DSHttpAdapter#GET. DSHttpAdapter#afterFind will be called after calling DSHttpAdapter#GET.
Parameters:
Name Type Argument Description Model
Object The Model.
id
string | number Primary key of the entity to retrieve.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
findAll(Model, query, opts)
-
Retrieve the entities that match the selection
query
.DSHttpAdapter#beforeFindAll will be called before calling DSHttpAdapter#GET. DSHttpAdapter#afterFindAll will be called after calling DSHttpAdapter#GET.
Parameters:
Name Type Argument Description Model
Object The Model.
query
Object Selection query.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description params
string <optional>
TODO
suffix
string <optional>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise
-
GET(url, config, opts)
-
{ function_description }
Parameters:
Name Type Argument Description url
string The url for the request.
config
Object Request configuration options.
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
getEndpoint(Model, id, opts)
-
Parameters:
Name Type Description Model
* { description }
id
* { description }
opts
boolean { description }
Returns:
Full path.
- Type
- string
-
getPath(method, Model, id, opts)
-
Parameters:
Name Type Argument Description method
string TODO
Model
* TODO
id
string | number <nullable>
TODO
opts
Object Configuration options.
-
HTTP(config, opts)
-
Make an Http request.
Parameters:
Name Type Argument Description config
Object Request configuration options.
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
log(level, args)
-
Log the provided arguments at the specified leve.
Parameters:
Name Type Argument Description level
string Log level.
args
* <optional>
<repeatable>
Arguments to log.
-
POST(url, data, config, opts)
-
{ function_description }
Parameters:
Name Type Argument Description url
* { description }
data
* { description }
config
* { description }
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
PUT(url, data, config, opts)
-
{ function_description }
Parameters:
Name Type Argument Description url
* { description }
data
* { description }
config
* { description }
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
queryTransform(Model, params, opts)
-
{ function_description }
Parameters:
Name Type Description Model
* { description }
params
* { description }
opts
* { description }
Returns:
Transformed params.
- Type
- *
-
responseError(err, config, opts)
-
Error handler invoked when the promise returned by DSHttpAdapter#http is rejected. Default implementation is to just return the error wrapped in a rejected Promise, aka rethrow the error. DSHttpAdapter#http is called by DSHttpAdapter#HTTP.
Parameters:
Name Type Description err
* The error that DSHttpAdapter#http rejected with.
config
* The
config
argument that was passed to DSHttpAdapter#HTTP.opts
* The
opts
argument that was passed to DSHttpAdapter#HTTP.Returns:
- Type
- Promise
-
serialize(Model, data, opts)
-
{ function_description }
Parameters:
Name Type Description Model
* { description }
data
* { description }
opts
* { description }
Returns:
Serialized data.
- Type
- *
-
update(Model, id, props, opts)
-
{ function_description }
Parameters:
Name Type Argument Description Model
* { description }
id
* { description }
props
* { description }
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
updateAll(Model, props, query, opts)
-
{ function_description }
Parameters:
Name Type Argument Description Model
* { description }
props
* { description }
query
* { description }
opts
Object <optional>
Configuration options.
Returns:
- Type
- Promise
-
updateMany(Model, models, opts)
-
Update multiple entities in batch.
DSHttpAdapter#beforeUpdateMany will be called before calling DSHttpAdapter#PUT. DSHttpAdapter#afterUpdateMany will be called after calling DSHttpAdapter#PUT.
Parameters:
Name Type Argument Description Model
Object The Model.
models
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>
DSHttpAdapter#suffix TODO
Returns:
- Type
- Promise