Constructor
new mw.widgets.APIResultsProvider(apiurl, [config])
#
Create an instance of mw.widgets.APIResultsProvider
.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apiurl |
string | The URL to the api |
||||||||||||||||||||||
config |
Object |
optional |
Configuration options Properties:
|
- Mixes in:
- Source:
Methods
getDefaultFetchLimit() → {number}
#
Get fetch limit or 'page' size. This is the number of results per request.
Returns:
limit
- Type
- number
getOffset() → {number}
#
getResults(howMany) → {jQuery.Promise}
#
Get results from the source.
Parameters:
Name | Type | Description |
---|---|---|
howMany |
number | Number of results to ask for |
Returns:
Promise that is resolved into an array of available results, or is rejected if no results are available.
- Type
- jQuery.Promise
getStaticParams() → {Object}
#
getUserParams() → {Object}
#
isDepleted() → {boolean}
#
Check whether the provider is depleted and has no more results to hand off.
Returns:
The provider is depleted
- Type
- boolean
Check whether the provider is depleted and has no more results to hand off.
reset()
#
Reset the provider.
setAjaxSettings(settings)
#
setDefaultFetchLimit(limit)
#
Set limit.
Parameters:
Name | Type | Description |
---|---|---|
limit |
number | Default number of results to fetch from the API |
setLang(lang)
#
setOffset(offset)
#
Set result offset.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Results offset for the upcoming request |
setUserParams(params)
#
Set the data parameters sent to the API.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | User defined data parameters |