[MediaWiki-commits] [Gerrit] move wikibase.api into own module - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: move wikibase.api into own module .. move wikibase.api into own module Bug: T68419 Change-Id: I97ceba76ba17bfe266dd4541520ef47ed457d1dc --- M composer.json M lib/resources/Resources.php D lib/resources/api/FormatValueCaller.js D lib/resources/api/ParseValueCaller.js D lib/resources/api/RepoApi.js D lib/resources/api/RepoApiError.js D lib/resources/api/getLocationAgnosticMwApi.js D lib/resources/api/namespace.js D lib/resources/api/resources.php D lib/tests/qunit/api/RepoApi.tests.js D lib/tests/qunit/api/RepoApiError.tests.js M lib/tests/qunit/resources.php 12 files changed, 1 insertion(+), 1,663 deletions(-) Approvals: Henning Snater: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.json b/composer.json index 063d098..ba34747 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ wikibase/data-model: ~2.4, wikibase/data-model-javascript: ~1.0, wikibase/data-model-serialization: ~1.2, + wikibase/javascript-api: ~1.0, wikibase/internal-serialization: ~1.3, wikibase/serialization-javascript: ~2.0, diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php index 61eeceb..fd3e2ec 100644 --- a/lib/resources/Resources.php +++ b/lib/resources/Resources.php @@ -83,7 +83,6 @@ $modules = array_merge( $modules, - include( __DIR__ . '/api/resources.php' ), include( __DIR__ . '/deprecated/resources.php' ), include( __DIR__ . '/jquery.wikibase/resources.php' ), include( __DIR__ . '/jquery.wikibase-shared/resources.php' ) diff --git a/lib/resources/api/FormatValueCaller.js b/lib/resources/api/FormatValueCaller.js deleted file mode 100644 index 9836a1f..000 --- a/lib/resources/api/FormatValueCaller.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @licence GNU GPL v2+ - * @author H. Snater mediaw...@snater.com - */ -( function( wb, $ ) { - 'use strict'; - - var MODULE = wb.api; - - /** -* @constructor -* -* @param {wikibase.api.RepoApi} api -* @param {dataTypes.DataTypeStore} dataTypeStore -*/ - var SELF = MODULE.FormatValueCaller = function( api, dataTypeStore ) { - this._api = api; - this._dataTypeStore = dataTypeStore; - }; - - $.extend( SELF.prototype, { - - /** -* @type {wikibase.api.RepoApi} -*/ - _api: null, - - /** -* @type {dataTypes.DataTypeStore} -*/ - _dataTypeStore: null, - - /** -* Makes a request to the API to format values on the server side. Will return a jQuery.Promise -* which will be resolved if formatting is successful or rejected if it fails or the API cannot -* be reached. -* @since 0.5 -* -* @param {dataValues.DataValue} dataValue -* @param {string} [dataType] -* @param {string} [outputFormat] -* @param {Object} [options] -* @return {jQuery.Promise} -* Resolved parameters: -* - {string} Formatted DataValue. -* Rejected parameters: -* - {wikibase.api.RepoApiError} -*/ - formatValue: function( dataValue, dataType, outputFormat, options ) { - - // Evaluate optional arguments: - if( outputFormat === undefined ) { - if( $.isPlainObject( dataType ) ) { - options = dataType; - dataType = undefined; - } else if( !this._dataTypeStore.hasDataType( dataType ) ) { - outputFormat = dataType; - dataType = undefined; - } - } else if( options === undefined ) { - if( $.isPlainObject( outputFormat ) ) { - options = outputFormat; - outputFormat = undefined; - } - } - - var deferred = $.Deferred(); - - this._api.formatValue( - { - value: dataValue.toJSON(), - type: dataValue.getType() - }, - options, - dataType, -
[MediaWiki-commits] [Gerrit] move wikibase.api into own module - change (mediawiki...Wikibase)
Adrian Lang has uploaded a new change for review. https://gerrit.wikimedia.org/r/175987 Change subject: move wikibase.api into own module .. move wikibase.api into own module Change-Id: I97ceba76ba17bfe266dd4541520ef47ed457d1dc --- M composer.json M lib/resources/Resources.php D lib/resources/api/FormatValueCaller.js D lib/resources/api/ParseValueCaller.js D lib/resources/api/RepoApi.js D lib/resources/api/RepoApiError.js D lib/resources/api/getLocationAgnosticMwApi.js D lib/resources/api/namespace.js D lib/resources/api/resources.php D lib/tests/qunit/api/RepoApi.tests.js D lib/tests/qunit/api/RepoApiError.tests.js M lib/tests/qunit/resources.php 12 files changed, 1 insertion(+), 1,663 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/87/175987/1 diff --git a/composer.json b/composer.json index 063d098..ba34747 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ wikibase/data-model: ~2.4, wikibase/data-model-javascript: ~1.0, wikibase/data-model-serialization: ~1.2, + wikibase/javascript-api: ~1.0, wikibase/internal-serialization: ~1.3, wikibase/serialization-javascript: ~2.0, diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php index 61eeceb..fd3e2ec 100644 --- a/lib/resources/Resources.php +++ b/lib/resources/Resources.php @@ -83,7 +83,6 @@ $modules = array_merge( $modules, - include( __DIR__ . '/api/resources.php' ), include( __DIR__ . '/deprecated/resources.php' ), include( __DIR__ . '/jquery.wikibase/resources.php' ), include( __DIR__ . '/jquery.wikibase-shared/resources.php' ) diff --git a/lib/resources/api/FormatValueCaller.js b/lib/resources/api/FormatValueCaller.js deleted file mode 100644 index 9836a1f..000 --- a/lib/resources/api/FormatValueCaller.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @licence GNU GPL v2+ - * @author H. Snater mediaw...@snater.com - */ -( function( wb, $ ) { - 'use strict'; - - var MODULE = wb.api; - - /** -* @constructor -* -* @param {wikibase.api.RepoApi} api -* @param {dataTypes.DataTypeStore} dataTypeStore -*/ - var SELF = MODULE.FormatValueCaller = function( api, dataTypeStore ) { - this._api = api; - this._dataTypeStore = dataTypeStore; - }; - - $.extend( SELF.prototype, { - - /** -* @type {wikibase.api.RepoApi} -*/ - _api: null, - - /** -* @type {dataTypes.DataTypeStore} -*/ - _dataTypeStore: null, - - /** -* Makes a request to the API to format values on the server side. Will return a jQuery.Promise -* which will be resolved if formatting is successful or rejected if it fails or the API cannot -* be reached. -* @since 0.5 -* -* @param {dataValues.DataValue} dataValue -* @param {string} [dataType] -* @param {string} [outputFormat] -* @param {Object} [options] -* @return {jQuery.Promise} -* Resolved parameters: -* - {string} Formatted DataValue. -* Rejected parameters: -* - {wikibase.api.RepoApiError} -*/ - formatValue: function( dataValue, dataType, outputFormat, options ) { - - // Evaluate optional arguments: - if( outputFormat === undefined ) { - if( $.isPlainObject( dataType ) ) { - options = dataType; - dataType = undefined; - } else if( !this._dataTypeStore.hasDataType( dataType ) ) { - outputFormat = dataType; - dataType = undefined; - } - } else if( options === undefined ) { - if( $.isPlainObject( outputFormat ) ) { - options = outputFormat; - outputFormat = undefined; - } - } - - var deferred = $.Deferred(); - - this._api.formatValue( - { - value: dataValue.toJSON(), - type: dataValue.getType() - }, - options, -