Expand all

mw.widgets.MediaUserUploadsProvider

User uploads provider.

Extends

Constructor

new mw.widgets.MediaUserUploadsProvider(apiurl, [config]) #

Create an instance of mw.widgets.MediaUserUploadsProvider.

Parameters:

Name Type Attributes Description
apiurl string

The API url

config Object optional

Configuration options

Source:

Methods

fetchAPIresults(howMany) → {jQuery.Promise} #

Call the API for search results.

Parameters:

Name Type Description
howMany number

The number of results to retrieve

Inherited from:
Source:

Returns:

Promise that resolves with an array of objects that contain the fetched data.

Type
jQuery.Promise
Call the API for search results.

getAPIurl() → {string} #

Get API URL.

getAjaxSettings() → {Object} #

Get the default ajax settings.

Inherited from:
Source:

Returns:

Ajax settings

Type
Object
Get the default ajax settings.

getContinueData(howMany) → {Object} #

Get continuation API data.

Parameters:

Name Type Description
howMany number

The number of results to retrieve

Overrides:
Source:

Returns:

API request data

Type
Object
Get continuation API data.

getDefaultFetchLimit() → {number} #

Get fetch limit or 'page' size. This is the number of results per request.

Inherited from:
Source:

Returns:

limit

Type
number
Get fetch limit or 'page' size.

getFetchProp() → {string} #

Get prop.

getImageSizes() → {Array.<number>} #

Get image sizes.

Inherited from:
Source:

Returns:

sizes Available image sizes

Type
Array.<number>
Get image sizes.

getLang() → {string} #

Get provider API language.

Inherited from:
Source:

Returns:

Provider API language

Type
string
Get provider API language.

getName() → {string} #

Get name.

getOffset() → {number} #

Get result offset.

Inherited from:
Source:

Returns:

Offset Results offset for the upcoming request

Type
number
Get result offset.

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

Inherited from:
Source:

Returns:

Promise that is resolved into an array of available results, or is rejected if no results are available.

Type
jQuery.Promise
Override parent method and get results from the source.

getStandardWidth() → {number|undefined} #

Get standard width, based on the provider source's thumb sizes.

Inherited from:
Source:

Returns:

fetchWidth

Type
number | undefined
Get standard width, based on the provider source's thumb sizes.

getStaticParams() → {Object} #

Get the static, non-changing data parameters sent to the API.

Inherited from:
Source:

Returns:

Data parameters

Type
Object
Get the static, non-changing data parameters sent to the API.

getThumbSizes() → {Array.<number>} #

Get thumb sizes.

Inherited from:
Source:

Returns:

sizes Available thumbnail sizes

Type
Array.<number>
Get thumb sizes.

getUserParams() → {Object} #

Get the user-inputted dynamic data parameters sent to the API.

Inherited from:
Source:

Returns:

Data parameters

Type
Object
Get the user-inputted dynamic data parameters sent to the API.

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.

isValid() → {boolean} #

Check if this source is valid.

Overrides:
Source:

Returns:

Source is valid

Type
boolean
Check if this source is valid.

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.

Inherited from:
Source:

Returns:

Promise that resolves when the class properties are set.

Type
jQuery.Promise
Initialize the source and get the site info.

reset() #

Reset the provider.

setAPIurl(apiurl) #

Set API URL.

Parameters:

Name Type Description
apiurl string

API URL

Inherited from:
Source:
Set API URL.

setAjaxSettings(settings) #

Set the default ajax settings.

Parameters:

Name Type Description
settings Object

Ajax settings

Inherited from:
Source:
Set the default ajax settings.

setContinue(continueData) #

Set continuation data for the next page.

Parameters:

Name Type Description
continueData Object

Continuation data

Overrides:
Source:
Set continuation data for the next page.

setDefaultFetchLimit(limit) #

Set limit.

Parameters:

Name Type Description
limit number

Default number of results to fetch from the API

Inherited from:
Source:
Set limit.

setFetchProp(prop) #

Set prop.

setImageSizes(sizes) #

Set image sizes.

Parameters:

Name Type Description
sizes Array.<number>

Available image sizes

Inherited from:
Source:
Set image sizes.

setLang(lang) #

Set provider API language.

Parameters:

Name Type Description
lang string

Provider API language

Inherited from:
Source:
Set provider API language.

setName(name) #

Set name.

setOffset(offset) #

Set result offset.

Parameters:

Name Type Description
offset number

Results offset for the upcoming request

Inherited from:
Source:
Set result offset.

setThumbSizes(sizes) #

Set thumb sizes.

Parameters:

Name Type Description
sizes Array.<number>

Available thumbnail sizes

Inherited from:
Source:
Set thumb sizes.

setUserParams(params) #

Set the data parameters sent to the API.

Parameters:

Name Type Description
params Object

User defined data parameters

Inherited from:
Source:
Set the data parameters sent to the API.

sort(results) → {Array.<Object>} #

Sort the results.

Parameters:

Name Type Description
results Array.<Object>

API results

Overrides:
Source:

Returns:

Sorted results

Type
Array.<Object>
Sort the results.

toggleDepleted(isDepleted) #

Toggle depleted state.

Parameters:

Name Type Description
isDepleted boolean

The provider is depleted

Inherited from:
Source:
Toggle depleted state.