Extends
Constructor
new mw.widgets.MediaResourceProvider(apiurl, [config])
#
Methods
fetchAPIresults(howMany) → {jQuery.Promise}
#
Call the API for search results.
Parameters:
Name | Type | Description |
---|---|---|
howMany |
number | The number of results to retrieve |
Returns:
Promise that resolves with an array of objects that contain the fetched data.
- Type
- jQuery.Promise
getAjaxSettings() → {Object}
#
getContinueData(howMany) → {Object}
#
getDefaultFetchLimit() → {number}
#
Get fetch limit or 'page' size. This is the number of results per request.
- Inherited from:
- Source:
Returns:
limit
- Type
- number
getLang() → {string}
#
getOffset() → {number}
#
Get result offset.
- Inherited from:
- Source:
Returns:
Offset Results offset for the upcoming request
- Type
- number
getResults([howMany]) → {jQuery.Promise}
#
Override parent method and get results from the source.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
howMany |
number |
optional |
The number of items to pull from the API |
- Overrides:
- Source:
Returns:
Promise that is resolved into an array of available results, or is rejected if no results are available.
- Type
- jQuery.Promise
getStandardWidth() → {number|undefined
}
#
undefined
}
#
Get standard width, based on the provider source's thumb sizes.
Returns:
fetchWidth
- Type
-
number
|
undefined
getStaticParams() → {Object}
#
Get the static, non-changing data parameters sent to the API.
- Overrides:
- Source:
Returns:
Data parameters
- Type
- Object
getUserParams() → {Object}
#
Get the user-inputted dynamic data parameters sent to the API.
- Inherited from:
- Source:
Returns:
Data parameters
- Type
- Object
isDepleted() → {boolean}
#
Check whether the provider is depleted and has no more results to hand off.
- Inherited from:
- Source:
Returns:
The provider is depleted
- Type
- boolean
Check whether the provider is depleted and has no more results to hand off.
loadSiteInfo() → {jQuery.Promise}
#
Initialize the source and get the site info.
Connect to the api url and retrieve the siteinfo parameters that are required for fetching results.
Returns:
Promise that resolves when the class properties are set.
- Type
- jQuery.Promise
reset()
#
Reset the provider.
- Inherited from:
- Source:
setAPIurl(apiurl)
#
setAjaxSettings(settings)
#
setContinue(continueData)
#
Set continuation data for the next page.
Parameters:
Name | Type | Description |
---|---|---|
continueData |
Object | Continuation data |
setDefaultFetchLimit(limit)
#
Set limit.
Parameters:
Name | Type | Description |
---|---|---|
limit |
number | Default number of results to fetch from the API |
setImageSizes(sizes)
#
Set image sizes.
Parameters:
setLang(lang)
#
Set provider API language.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | Provider API language |
- Inherited from:
- Source:
setOffset(offset)
#
Set result offset.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Results offset for the upcoming request |
setThumbSizes(sizes)
#
Set thumb sizes.
Parameters:
setUserParams(params)
#
Set the data parameters sent to the API.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | User defined data parameters |