Added result properties to action=paraminfo
authorPetr Onderka <gsvick@gmail.com>
Wed, 2 May 2012 15:00:30 +0000 (17:00 +0200)
committerPetr Onderka <gsvick@gmail.com>
Wed, 6 Jun 2012 17:24:59 +0000 (19:24 +0200)
Added information about the properties of the results of API calls
to action=paraminfo, including information about "property groups":
what should the prop parameter be set to to get that property.

Uses the same format for types as parameters already do.
The output format of some modules doesn't fit this, so the result
properties for them weren't added, or only partially.

Partially implemented modules:
* expandtemplates:
  parsetree is in its own tag
* protect, allusers, backlinks, deletedrevs, info, imageinfo,
  logevents, querypage, recentchanges, revisions, searchinfo,
  usercontribs, userinfo, users, watchlist, upload:
  response with partially complex structure

Not implemented modules:
* feedcontributions, feedwatchlist, opensearch, rds:
  non-standard reponse
* help:
  error is normal response; not very useful for automated tools anyway
* paraminfo, parse, pageprops, siteinfo, userrights:
  response with complex structure

Change-Id: Iff2a9bef79f994e73eef3062b4dd5461bff968ab

63 files changed:
RELEASE-NOTES-1.20
docs/hooks.txt
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiComparePages.php
includes/api/ApiDelete.php
includes/api/ApiEditPage.php
includes/api/ApiEmailUser.php
includes/api/ApiExpandTemplates.php
includes/api/ApiFileRevert.php
includes/api/ApiImport.php
includes/api/ApiLogin.php
includes/api/ApiLogout.php
includes/api/ApiMove.php
includes/api/ApiOptions.php
includes/api/ApiParamInfo.php
includes/api/ApiPatrol.php
includes/api/ApiProtect.php
includes/api/ApiPurge.php
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllImages.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllMessages.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryFilearchive.php
includes/api/ApiQueryIWBacklinks.php
includes/api/ApiQueryIWLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangBacklinks.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryLinks.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryProtectedTitles.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryRandom.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQuerySearch.php
includes/api/ApiQueryStashImageInfo.php
includes/api/ApiQueryTags.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiRollback.php
includes/api/ApiTokens.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php
includes/api/ApiWatch.php

index 07d93ee..2908a02 100644 (file)
@@ -132,6 +132,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 33224) add variants of content language to meta=siteinfo
 * (bug 36761) "Mark pages as visited" now submits previously established filter options
 * (bug 32643) action=purge with forcelinkupdate no longer crashes when ratelimit is reached
+* The paraminfo module now also contains result properties for most modules
 
 === Languages updated in 1.20 ===
 
index 8d4bdea..a57d1d2 100644 (file)
@@ -331,6 +331,11 @@ descriptions.
 &$module: ApiBase Module object
 &$desc: Array of parameter descriptions
 
+'APIGetResultProperties': use this hook to mofify the properties
+in a module's result.
+&$module: ApiBase Module object
+&$properties: Array of properties
+
 'APIQueryAfterExecute': after calling the execute() method of an
 action=query submodule. Use this to extend core API modules.
 &$module: Module object
index f0386a1..6a9be24 100644 (file)
@@ -56,6 +56,11 @@ abstract class ApiBase extends ContextSource {
        /// @since 1.17
        const PARAM_RANGE_ENFORCE = 9; // Boolean, if MIN/MAX are set, enforce (die) these? Only applies if TYPE='integer' Use with extreme caution
 
+       const PROP_ROOT = 'ROOT'; // Name of property group that is on the root element of the result, i.e. not part of a list
+       const PROP_LIST = 'LIST'; // Boolean, is the result multiple items? Defaults to true for query modules, to false for other modules
+       const PROP_TYPE = 0; // Type of the property, uses same format as PARAM_TYPE
+       const PROP_NULLABLE = 1; // Boolean, can the property be not included in the result? Defaults to false
+
        const LIMIT_BIG1 = 500; // Fast query, std user limit
        const LIMIT_BIG2 = 5000; // Fast query, bot/sysop limit
        const LIMIT_SML1 = 50; // Slow query, std user limit
@@ -572,6 +577,51 @@ abstract class ApiBase extends ContextSource {
                return $desc;
        }
 
+       /**
+        * Returns possible properties in the result, grouped by the value of the prop parameter
+        * that shows them.
+        *
+        * Properties that are shown always are in a group with empty string as a key.
+        * Properties that can be shown by several values of prop are included multiple times.
+        * If some properties are part of a list and some are on the root object (see ApiQueryQueryPage),
+        * those on the root object are under the key PROP_ROOT.
+        * The array can also contain a boolean under the key PROP_LIST,
+        * indicating whether the result is a list.
+        *
+        * Don't call this functon directly: use getFinalResultProperties() to
+        * allow hooks to modify descriptions as needed.
+        *
+        * @return array|bool False on no properties
+        */
+       protected function getResultProperties() {
+               return false;
+       }
+
+       /**
+        * Get final possible result properties, after hooks have had a chance to tweak it as
+        * needed.
+        *
+        * @return array
+        */
+       public function getFinalResultProperties() {
+               $properties = $this->getResultProperties();
+               wfRunHooks( 'APIGetResultProperties', array( $this, &$properties ) );
+               return $properties;
+       }
+
+       /**
+        * Add token properties to the array used by getResultProperties,
+        * based on a token functions mapping.
+        */
+       protected static function addTokenProperties( &$props, $tokenFunctions ) {
+               foreach ( array_keys( $tokenFunctions ) as $token ) {
+                       $props[''][$token . 'token'] = array(
+                               ApiBase::PROP_TYPE => 'string',
+                               ApiBase::PROP_NULLABLE => true
+                       );
+               }
+       }
+
        /**
         * Get final module description, after hooks have had a chance to tweak it as
         * needed.
index e229ef0..6cd31ae 100644 (file)
@@ -186,6 +186,44 @@ class ApiBlock extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'blocktoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'user' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'userID' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'expiry' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'id' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'reason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'anononly' => 'boolean',
+                               'nocreate' => 'boolean',
+                               'autoblock' => 'boolean',
+                               'noemail' => 'boolean',
+                               'hidename' => 'boolean',
+                               'allowusertalk' => 'boolean',
+                               'watchuser' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Block a user';
        }
index 87f0967..ed72b29 100644 (file)
@@ -124,6 +124,25 @@ class ApiComparePages extends ApiBase {
                        'torev' => 'Second revision to compare',
                );
        }
+
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'fromtitle' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'fromrevid' => 'integer',
+                               'totitle' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'torevid' => 'integer',
+                               '*' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Get the difference between 2 pages',
index cefdaac..1927490 100644 (file)
@@ -221,6 +221,15 @@ class ApiDelete extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'reason' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Delete a page';
        }
index 0b7ac41..9a16007 100644 (file)
@@ -494,6 +494,41 @@ class ApiEditPage extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'new' => 'boolean',
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'Failure'
+                                       ),
+                               ),
+                               'pageid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'title' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'nochange' => 'boolean',
+                               'oldrevid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'newrevid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'newtimestamp' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function needsToken() {
                return true;
        }
index 0032bd8..4b6ba00 100644 (file)
@@ -113,6 +113,23 @@ class ApiEmailUser extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'Failure'
+                                       ),
+                               ),
+                               'message' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Email a user.';
        }
index d570534..2ed118f 100644 (file)
@@ -103,6 +103,14 @@ class ApiExpandTemplates extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               '*' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Expands all templates in wikitext';
        }
index 5ea2571..7cac0eb 100644 (file)
@@ -132,15 +132,29 @@ class ApiFileRevert extends ApiBase {
        }
 
        public function getParamDescription() {
-               $params = array(
+               return array(
                        'filename' => 'Target filename without the File: prefix',
                        'token' => 'Edit token. You can get one of these through prop=info',
                        'comment' => 'Upload comment',
                        'archivename' => 'Archive name of the revision to revert to',
                );
+       }
 
-               return $params;
-
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'Failure'
+                                       )
+                               ),
+                               'errors' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
        }
 
        public function getDescription() {
index 5093b6b..6663d97 100644 (file)
@@ -126,6 +126,17 @@ class ApiImport extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => true,
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'revisions' => 'integer'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Import a page from another wiki, or an XML file.' ,
@@ -187,11 +198,11 @@ class ApiImportReporter extends ImportReporter {
                // Add a result entry
                $r = array();
 
-               if ( $title === null ) {\r
+               if ( $title === null ) {
                        # Invalid or non-importable title
                        $r['title'] = $pageInfo['title'];
-                       $r['invalid'] = '';\r
-               } else {\r
+                       $r['invalid'] = '';
+               } else {
                        ApiQueryBase::addTitleInfo( $r, $title );
                        $r['revisions'] = intval( $successCount );
                }
index aa570cb..0bdaa1b 100644 (file)
@@ -181,6 +181,66 @@ class ApiLogin extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'NeedToken',
+                                               'WrongToken',
+                                               'NoName',
+                                               'Illegal',
+                                               'WrongPluginPass',
+                                               'NotExists',
+                                               'WrongPass',
+                                               'EmptyPass',
+                                               'CreateBlocked',
+                                               'Throttled',
+                                               'Blocked',
+                                               'Aborted'
+                                       )
+                               ),
+                               'lguserid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'lgusername' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'lgtoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'cookieprefix' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'sessionid' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'token' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'details' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'wait' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'reason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Log in and get the authentication tokens. ',
index 81a054a..cab2430 100644 (file)
@@ -54,6 +54,10 @@ class ApiLogout extends ApiBase {
                return array();
        }
 
+       public function getResultProperties() {
+               return array();
+       }
+
        public function getParamDescription() {
                return array();
        }
index f0a25e4..c89f59b 100644 (file)
@@ -224,6 +224,33 @@ class ApiMove extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'from' => 'string',
+                               'to' => 'string',
+                               'reason' => 'string',
+                               'redirectcreated' => 'boolean',
+                               'talkfrom' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'talkto' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'talkmove-error-code' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'talkmove-error-info' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Move a page';
        }
index 7bcfe1e..2b3d5e3 100644 (file)
@@ -107,6 +107,18 @@ class ApiOptions extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               '*' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'success'
+                                       )
+                               )
+                       )
+               );
+       }
+
        public function getParamDescription() {
                return array(
                        'token' => 'An options token previously obtained through the action=tokens',
index f226347..dffce5b 100644 (file)
@@ -251,6 +251,62 @@ class ApiParamInfo extends ApiBase {
                }
                $result->setIndexedTagName( $retval['parameters'], 'param' );
 
+               $props = $obj->getFinalResultProperties();
+               $listResult = null;
+               if ( $props !== false ) {
+                       $retval['props'] = array();
+
+                       foreach ( $props as $prop => $properties ) {
+                               $propResult = array();
+                               if ( $prop == ApiBase::PROP_LIST ) {
+                                       $listResult = $properties;
+                                       continue;
+                               }
+                               if ( $prop != ApiBase::PROP_ROOT ) {
+                                       $propResult['name'] = $prop;
+                               }
+                               $propResult['properties'] = array();
+
+                               foreach ( $properties as $name => $p ) {
+                                       $propertyResult = array();
+
+                                       $propertyResult['name'] = $name;
+
+                                       if ( !is_array( $p ) ) {
+                                               $p = array( ApiBase::PROP_TYPE => $p );
+                                       }
+
+                                       $propertyResult['type'] = $p[ApiBase::PROP_TYPE];
+
+                                       if ( is_array( $propertyResult['type'] ) ) {
+                                               $propertyResult['type'] = array_values( $propertyResult['type'] );
+                                               $result->setIndexedTagName( $propertyResult['type'], 't' );
+                                       }
+
+                                       $nullable = null;
+                                       if ( isset( $p[ApiBase::PROP_NULLABLE] ) ) {
+                                               $nullable = $p[ApiBase::PROP_NULLABLE];
+                                       }
+
+                                       if ( $nullable === true ) {
+                                               $propertyResult['nullable'] = '';
+                                       }
+
+                                       $propResult['properties'][] = $propertyResult;
+                               }
+
+                               $result->setIndexedTagName( $propResult['properties'], 'property' );
+                               $retval['props'][] = $propResult;
+                       }
+
+                       // default is true for query modules, false for other modules, overriden by ApiBase::PROP_LIST
+                       if ( $listResult === true || ( $listResult !== false && $obj instanceof ApiQueryBase ) ) {
+                               $retval['listresult'] = '';
+                       }
+
+                       $result->setIndexedTagName( $retval['props'], 'prop' );
+               }
+
                // Errors
                $retval['errors'] = $this->parseErrors( $obj->getPossibleErrors() );
                $result->setIndexedTagName( $retval['errors'], 'error' );
index 1332f26..45d19d0 100644 (file)
@@ -80,6 +80,16 @@ class ApiPatrol extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'rcid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Patrol a page or revision';
        }
index 286f191..0fcaf42 100644 (file)
@@ -184,6 +184,16 @@ class ApiProtect extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'reason' => 'string',
+                               'cascade' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Change the protection level of a page';
        }
index 8e9c198..e27068d 100644 (file)
@@ -135,6 +135,34 @@ class ApiPurge extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => true,
+                       '' => array(
+                               'ns' => array(
+                                       ApiBase::PROP_TYPE => 'namespace',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'title' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'pageid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'revid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'invalid' => 'boolean',
+                               'missing' => 'boolean',
+                               'purged' => 'boolean',
+                               'linkupdate' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array( 'Purge the cache for the given titles.',
                        'Requires a POST request if the user is not logged in.'
index 233ea75..60b57bf 100644 (file)
@@ -192,6 +192,23 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               '*' => 'string'
+                       ),
+                       'size' => array(
+                               'size' => 'integer',
+                               'pages' => 'integer',
+                               'files' => 'integer',
+                               'subcats' => 'integer'
+                       ),
+                       'hidden' => array(
+                               'hidden' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all categories';
        }
index 87e7024..ce5aac2 100644 (file)
@@ -230,6 +230,19 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
 
        private $propertyFilter = array( 'archivename' );
 
+       public function getResultProperties() {
+               return array_merge(
+                       array(
+                               '' => array(
+                                       'name' => 'string',
+                                       'ns' => 'namespace',
+                                       'title' => 'string'
+                               )
+                       ),
+                       ApiQueryImageInfo::getResultPropertiesFiltered( $this->propertyFilter )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all images sequentially';
        }
index f04d5b2..6b8fe57 100644 (file)
@@ -205,6 +205,18 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       'ids' => array(
+                               'fromid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all links that point to a given namespace';
        }
index dedd3e5..ac000bf 100644 (file)
@@ -256,6 +256,27 @@ class ApiQueryAllMessages extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'name' => 'string',
+                               'customised' => 'boolean',
+                               'missing' => 'boolean',
+                               '*' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'default' => array(
+                               'defaultmissing' => 'boolean',
+                               'default' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Return messages from this site';
        }
index 7e89a95..cfc22ff 100644 (file)
@@ -296,6 +296,16 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'pageid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all pages sequentially in a given namespace';
        }
index e110e67..dda8c72 100644 (file)
@@ -377,6 +377,48 @@ class ApiQueryAllUsers extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'userid' => 'integer',
+                               'name' => 'string',
+                               'recenteditcount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'blockinfo' => array(
+                               'blockid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedby' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedbyid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedreason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedexpiry' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'hidden' => 'boolean'
+                       ),
+                       'editcount' => array(
+                               'editcount' => 'integer'
+                       ),
+                       'registration' => array(
+                               'registration' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all registered users';
        }
index 5505692..fcb9c4b 100644 (file)
@@ -481,6 +481,17 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                ) );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'pageid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'redirect' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                switch ( $this->getModuleName() ) {
                        case 'backlinks':
index 8c287d6..49cd590 100644 (file)
@@ -324,6 +324,60 @@ class ApiQueryBlocks extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       'id' => array(
+                               'id' => 'integer'
+                       ),
+                       'user' => array(
+                               'user' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'userid' => array(
+                               'userid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'by' => array(
+                               'by' => 'string'
+                       ),
+                       'byid' => array(
+                               'byid' => 'integer'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'expiry' => array(
+                               'expiry' => 'timestamp'
+                       ),
+                       'reason' => array(
+                               'reason' => 'string'
+                       ),
+                       'range' => array(
+                               'rangestart' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'rangeend' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'flags' => array(
+                               'automatic' => 'boolean',
+                               'anononly' => 'boolean',
+                               'nocreate' => 'boolean',
+                               'autoblock' => 'boolean',
+                               'noemail' => 'boolean',
+                               'hidden' => 'boolean',
+                               'allowusertalk' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all blocked users and IP addresses';
        }
index cbda6ab..283eb13 100644 (file)
@@ -240,6 +240,25 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'sortkey' => array(
+                               'sortkey' => 'string',
+                               'sortkeyprefix' => 'string'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'hidden' => array(
+                               'hidden' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all categories the page(s) belong to';
        }
index c5070e8..e5eca85 100644 (file)
@@ -106,6 +106,34 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => false,
+                       '' => array(
+                               'size' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'pages' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'files' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'subcats' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'hidden' => array(
+                                       ApiBase::PROP_TYPE => 'boolean',
+                                       ApiBase::PROP_NULLABLE => false
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Returns information about the given categories';
        }
index 35b5645..9f66f22 100644 (file)
@@ -364,6 +364,36 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                return $desc;
        }
 
+       public function getResultProperties() {
+               return array(
+                       'ids' => array(
+                               'pageid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'sortkey' => array(
+                               'sortkey' => 'string'
+                       ),
+                       'sortkeyprefix' => array(
+                               'sortkeyprefix' => 'string'
+                       ),
+                       'type' => array(
+                               'type' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'page',
+                                               'subcat',
+                                               'file'
+                                       )
+                               )
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all pages in a given category';
        }
index 6912ddc..06f649d 100644 (file)
@@ -366,6 +366,18 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'token' => array(
+                               'token' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                $p = $this->getModulePrefix();
                return array(
index 6fb3ea3..856d0fd 100644 (file)
@@ -165,6 +165,16 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'name' => 'string',
+                               'user' => 'string',
+                               'timestamp' => 'timestamp'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all files that are duplicates of the given file(s)';
        }
index 93c71e2..221ffac 100644 (file)
@@ -232,6 +232,21 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                return $desc;
        }
 
+       public function getResultProperties() {
+               return array(
+                       'ids' => array(
+                               'pageid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'url' => array(
+                               'url' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate pages that contain a given URL';
        }
index a9fbc83..999ddc8 100644 (file)
@@ -133,6 +133,14 @@ class ApiQueryExternalLinks extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               '*' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Returns all external urls (not interwikies) from the given page(s)';
        }
index 4d99055..07d5b41 100644 (file)
@@ -274,6 +274,67 @@ class ApiQueryFilearchive extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'name' => 'string',
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'filehidden' => 'boolean',
+                               'commenthidden' => 'boolean',
+                               'userhidden' => 'boolean',
+                               'suppressed' => 'boolean'
+                       ),
+                       'sha1' => array(
+                               'sha1' => 'string'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'user' => array(
+                               'userid' => 'integer',
+                               'user' => 'string'
+                       ),
+                       'size' => array(
+                               'size' => 'integer',
+                               'pagecount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'height' => 'integer',
+                               'width' => 'integer'
+                       ),
+                       'dimensions' => array(
+                               'size' => 'integer',
+                               'pagecount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'height' => 'integer',
+                               'width' => 'integer'
+                       ),
+                       'description' => array(
+                               'description' => 'string'
+                       ),
+                       'parseddescription' => array(
+                               'description' => 'string',
+                               'parseddescription' => 'string'
+                       ),
+                       'metadata' => array(
+                               'metadata' => 'string'
+                       ),
+                       'bitdepth' => array(
+                               'bitdepth' => 'integer'
+                       ),
+                       'mime' => array(
+                               'mime' => 'string'
+                       ),
+                       'mediatype' => array(
+                               'mediatype' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Enumerate all deleted files sequentially';
        }
index 2ffe479..d2837e9 100644 (file)
@@ -195,6 +195,23 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'pageid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'redirect' => 'boolean'
+                       ),
+                       'iwprefix' => array(
+                               'iwprefix' => 'string'
+                       ),
+                       'iwtitle' => array(
+                               'iwtitle' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array( 'Find all pages that link to the given interwiki link.',
                        'Can be used to find all links with a prefix, or',
index f39835a..7e69513 100644 (file)
@@ -167,6 +167,19 @@ class ApiQueryIWLinks extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'prefix' => 'string',
+                               'url' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               '*' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Returns all interwiki links from the given page(s)';
        }
index 135979a..969293b 100644 (file)
@@ -547,6 +547,114 @@ class ApiQueryImageInfo extends ApiQueryBase {
                );
        }
 
+       public static function getResultPropertiesFiltered( $filter = array() ) {
+               $props = array(
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'user' => array(
+                               'userhidden' => 'boolean',
+                               'user' => 'string',
+                               'anon' => 'boolean'
+                       ),
+                       'userid' => array(
+                               'userhidden' => 'boolean',
+                               'userid' => 'integer',
+                               'anon' => 'boolean'
+                       ),
+                       'size' => array(
+                               'size' => 'integer',
+                               'width' => 'integer',
+                               'height' => 'integer',
+                               'pagecount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'comment' => array(
+                               'commenthidden' => 'boolean',
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'commenthidden' => 'boolean',
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'url' => array(
+                               'filehidden' => 'boolean',
+                               'thumburl' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'thumbwidth' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'thumbheight' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'thumberror' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'url' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'descriptionurl' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'sha1' => array(
+                               'filehidden' => 'boolean',
+                               'sha1' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'mime' => array(
+                               'filehidden' => 'boolean',
+                               'mime' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'mediatype' => array(
+                               'filehidden' => 'boolean',
+                               'mediatype' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'archivename' => array(
+                               'filehidden' => 'boolean',
+                               'archivename' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'bitdepth' => array(
+                               'filehidden' => 'boolean',
+                               'bitdepth' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+               );
+               return array_diff_key( $props, array_flip( $filter ) );
+       }
+
+       public function getResultProperties() {
+               return self::getResultPropertiesFiltered();
+       }
+
        public function getDescription() {
                return 'Returns image information and upload history';
        }
index 6f488cd..147ab67 100644 (file)
@@ -174,6 +174,15 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Returns all images contained on the given page(s)';
        }
index e5db4d8..2ff6197 100644 (file)
@@ -721,6 +721,59 @@ class ApiQueryInfo extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               $props = array(
+                       ApiBase::PROP_LIST => false,
+                       '' => array(
+                               'touched' => 'timestamp',
+                               'lastrevid' => 'integer',
+                               'counter' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'length' => 'integer',
+                               'redirect' => 'boolean',
+                               'new' => 'boolean',
+                               'starttimestamp' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'watched' => array(
+                               'watched' => 'boolean'
+                       ),
+                       'talkid' => array(
+                               'talkid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'subjectid' => array(
+                               'subjectid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'url' => array(
+                               'fullurl' => 'string',
+                               'editurl' => 'string'
+                       ),
+                       'readable' => array(
+                               'readable' => 'boolean'
+                       ),
+                       'preload' => array(
+                               'preload' => 'string'
+                       ),
+                       'displaytitle' => array(
+                               'displaytitle' => 'string'
+                       )
+               );
+
+               self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+               return $props;
+       }
+
        public function getDescription() {
                return 'Get basic page information such as namespace, title, last touched date, ...';
        }
index efc2e81..f423719 100644 (file)
@@ -195,6 +195,23 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'pageid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'redirect' => 'boolean'
+                       ),
+                       'lllang' => array(
+                               'lllang' => 'string'
+                       ),
+                       'lltitle' => array(
+                               'lltitle' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array( 'Find all pages that link to the given language link.',
                        'Can be used to find all links with a language code, or',
index b6f9a99..e477b2f 100644 (file)
@@ -159,6 +159,19 @@ class ApiQueryLangLinks extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'lang' => 'string',
+                               'url' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       Apibase::PROP_NULLABLE => true
+                               ),
+                               '*' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Returns all interlanguage links from the given page(s)';
        }
index 4dea419..5cf9068 100644 (file)
@@ -227,6 +227,15 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return "Returns all {$this->description}s from the given page(s)";
        }
index e017c4b..bb4b429 100644 (file)
@@ -447,6 +447,62 @@ class ApiQueryLogEvents extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               global $wgLogTypes;
+               return array(
+                       'ids' => array(
+                               'logid' => 'integer',
+                               'pageid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'type' => array(
+                               'type' => array(
+                                       ApiBase::PROP_TYPE => $wgLogTypes
+                               ),
+                               'action' => 'string'
+                       ),
+                       'details' => array(
+                               'actionhidden' => 'boolean'
+                       ),
+                       'user' => array(
+                               'userhidden' => 'boolean',
+                               'user' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'anon' => 'boolean'
+                       ),
+                       'userid' => array(
+                               'userhidden' => 'boolean',
+                               'userid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'anon' => 'boolean'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'comment' => array(
+                               'commenthidden' => 'boolean',
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'commenthidden' => 'boolean',
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Get events from logs';
        }
index 44cc1d3..360183c 100644 (file)
@@ -214,6 +214,40 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               global $wgRestrictionLevels;
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'user' => array(
+                               'user' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'userid' => 'integer'
+                       ),
+                       'comment' => array(
+                               'comment' => 'string'
+                       ),
+                       'parsedcomment' => array(
+                               'parsedcomment' => 'string'
+                       ),
+                       'expiry' => array(
+                               'expiry' => 'timestamp'
+                       ),
+                       'level' => array(
+                               'level' => array(
+                                       ApiBase::PROP_TYPE => array_diff( $wgRestrictionLevels, array( '' ) )
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List all titles protected from creation';
        }
index 8efe65d..dab4ab2 100644 (file)
@@ -173,6 +173,38 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_ROOT => array(
+                               'name' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'disabled' => array(
+                                       ApiBase::PROP_TYPE => 'boolean',
+                                       ApiBase::PROP_NULLABLE => false
+                               ),
+                               'cached' => array(
+                                       ApiBase::PROP_TYPE => 'boolean',
+                                       Apibase::PROP_NULLABLE => false
+                               ),
+                               'cachedtimestamp' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       '' => array(
+                               'value' => 'string',
+                               'timestamp' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Get a list provided by a QueryPage-based special page';
        }
index 2e9e2dd..ddf5841 100644 (file)
@@ -161,6 +161,16 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'id' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Get a set of random pages',
index 931af08..f9025c4 100644 (file)
@@ -629,6 +629,97 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               global $wgLogTypes;
+               $props = array(
+                       '' => array(
+                               'type' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'edit',
+                                               'new',
+                                               'move',
+                                               'log',
+                                               'move over redirect'
+                                       )
+                               )
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'new_ns' => array(
+                                       ApiBase::PROP_TYPE => 'namespace',
+                                       Apibase::PROP_NULLABLE => true
+                               ),
+                               'new_title' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       Apibase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'ids' => array(
+                               'rcid' => 'integer',
+                               'pageid' => 'integer',
+                               'revid' => 'integer',
+                               'old_revid' => 'integer'
+                       ),
+                       'user' => array(
+                               'user' => 'string',
+                               'anon' => 'boolean'
+                       ),
+                       'userid' => array(
+                               'userid' => 'integer',
+                               'anon' => 'boolean'
+                       ),
+                       'flags' => array(
+                               'bot' => 'boolean',
+                               'new' => 'boolean',
+                               'minor' => 'boolean'
+                       ),
+                       'sizes' => array(
+                               'oldlen' => 'integer',
+                               'newlen' => 'integer'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'comment' => array(
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       Apibase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       Apibase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'redirect' => array(
+                               'redirect' => 'boolean'
+                       ),
+                       'patrolled' => array(
+                               'patrolled' => 'boolean'
+                       ),
+                       'loginfo' => array(
+                               'logid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       Apibase::PROP_NULLABLE => true
+                               ),
+                               'logtype' => array(
+                                       ApiBase::PROP_TYPE => $wgLogTypes,
+                                       Apibase::PROP_NULLABLE => true
+                               ),
+                               'logaction' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       Apibase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+
+               self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+               return $props;
+       }
+
        public function getDescription() {
                return 'Enumerate recent changes';
        }
index 44cb46e..1a5ad17 100644 (file)
@@ -648,6 +648,66 @@ class ApiQueryRevisions extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               $props = array(
+                       '' => array(),
+                       'ids' => array(
+                               'revid' => 'integer',
+                               'parentid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'flags' => array(
+                               'minor' => 'boolean'
+                       ),
+                       'user' => array(
+                               'userhidden' => 'boolean',
+                               'user' => 'string',
+                               'anon' => 'boolean'
+                       ),
+                       'userid' => array(
+                               'userhidden' => 'boolean',
+                               'userid' => 'integer',
+                               'anon' => 'boolean'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'size' => array(
+                               'size' => 'integer'
+                       ),
+                       'sha1' => array(
+                               'sha1' => 'string'
+                       ),
+                       'comment' => array(
+                               'commenthidden' => 'boolean',
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'commenthidden' => 'boolean',
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'content' => array(
+                               '*' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'texthidden' => 'boolean'
+                       )
+               );
+
+               self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+               return $props;
+       }
+
        public function getDescription() {
                return array(
                        'Get revision information',
index 40aac05..ed6c3cb 100644 (file)
@@ -280,6 +280,63 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'snippet' => array(
+                               'snippet' => 'string'
+                       ),
+                       'size' => array(
+                               'size' => 'integer'
+                       ),
+                       'wordcount' => array(
+                               'wordcount' => 'integer'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'score' => array(
+                               'score' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'titlesnippet' => array(
+                               'titlesnippet' => 'string'
+                       ),
+                       'redirecttitle' => array(
+                               'redirecttitle' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'redirectsnippet' => array(
+                               'redirectsnippet' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'sectiontitle' => array(
+                               'sectiontitle' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'sectionsnippet' => array(
+                               'sectionsnippet' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'hasrelated' => array(
+                               'hasrelated' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Perform a full text search';
        }
index 4501ec5..02484ae 100644 (file)
@@ -123,6 +123,10 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
                );
        }
 
+       public function getResultProperties() {
+               return ApiQueryImageInfo::getResultPropertiesFiltered( $this->propertyFilter );
+       }
+
        public function getDescription() {
                return 'Returns image information for stashed images';
        }
index 12cea1d..edd1553 100644 (file)
@@ -169,6 +169,23 @@ class ApiQueryTags extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'name' => 'string'
+                       ),
+                       'displayname' => array(
+                               'displayname' => 'string'
+                       ),
+                       'description' => array(
+                               'description' => 'string'
+                       ),
+                       'hitcount' => array(
+                               'hitcount' => 'integer'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'List change tags';
        }
index 097d3e1..ab5acf5 100644 (file)
@@ -448,6 +448,55 @@ class ApiQueryContributions extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'userid' => 'integer',
+                               'user' => 'string',
+                               'userhidden' => 'boolean'
+                       ),
+                       'ids' => array(
+                               'pageid' => 'integer',
+                               'revid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'flags' => array(
+                               'new' => 'boolean',
+                               'minor' => 'boolean',
+                               'top' => 'boolean'
+                       ),
+                       'comment' => array(
+                               'commenthidden' => 'boolean',
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'commenthidden' => 'boolean',
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'patrolled' => array(
+                               'patrolled' => 'boolean'
+                       ),
+                       'size' => array(
+                               'size' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Get all edits by a user';
        }
index e3bc775..e4617d9 100644 (file)
@@ -234,6 +234,63 @@ class ApiQueryUserInfo extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => false,
+                       '' => array(
+                               'id' => 'integer',
+                               'name' => 'string',
+                               'anon' => 'boolean'
+                       ),
+                       'blockinfo' => array(
+                               'blockid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedby' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedbyid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedreason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'hasmsg' => array(
+                               'messages' => 'boolean'
+                       ),
+                       'preferencestoken' => array(
+                               'preferencestoken' => 'string'
+                       ),
+                       'editcount' => array(
+                               'editcount' => 'integer'
+                       ),
+                       'realname' => array(
+                               'realname' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'email' => array(
+                               'email' => 'string',
+                               'emailauthenticated' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'registrationdate' => array(
+                               'registrationdate' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Get information about the current user';
        }
index 83872a5..02fcf01 100644 (file)
@@ -315,6 +315,73 @@ class ApiQueryUsers extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               $props = array(
+                       '' => array(
+                               'userid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'name' => 'string',
+                               'invalid' => 'boolean',
+                               'hidden' => 'boolean',
+                               'interwiki' => 'boolean',
+                               'missing' => 'boolean'
+                       ),
+                       'editcount' => array(
+                               'editcount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'registration' => array(
+                               'registration' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'blockinfo' => array(
+                               'blockid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedby' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedbyid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedreason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedexpiry' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'emailable' => array(
+                               'emailable' => 'boolean'
+                       ),
+                       'gender' => array(
+                               'gender' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'male',
+                                               'female',
+                                               'unknown'
+                                       ),
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+
+               self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+               return $props;
+       }
+
        public function getDescription() {
                return 'Get information about a list of users';
        }
index 77f6ce9..a93f94f 100644 (file)
@@ -418,6 +418,76 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               global $wgLogTypes;
+               return array(
+                       'ids' => array(
+                               'pageid' => 'integer',
+                               'revid' => 'integer',
+                               'old_revid' => 'integer'
+                       ),
+                       'title' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'user' => array(
+                               'user' => 'string',
+                               'anon' => 'boolean'
+                       ),
+                       'userid' => array(
+                               'userid' => 'integer',
+                               'anon' => 'boolean'
+                       ),
+                       'flags' => array(
+                               'new' => 'boolean',
+                               'minor' => 'boolean',
+                               'bot' => 'boolean'
+                       ),
+                       'patrol' => array(
+                               'patrolled' => 'boolean'
+                       ),
+                       'timestamp' => array(
+                               'timestamp' => 'timestamp'
+                       ),
+                       'sizes' => array(
+                               'oldlen' => 'integer',
+                               'newlen' => 'integer'
+                       ),
+                       'notificationtimestamp' => array(
+                               'notificationtimestamp' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'comment' => array(
+                               'comment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'parsedcomment' => array(
+                               'parsedcomment' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'loginfo' => array(
+                               'logid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'logtype' => array(
+                                       ApiBase::PROP_TYPE => $wgLogTypes,
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'logaction' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return "Get all recent changes to pages in the logged in user's watchlist";
        }
index 5e96dd5..1b1eee0 100644 (file)
@@ -192,6 +192,21 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'changed' => array(
+                               'changed' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return "Get all pages on the logged in user's watchlist";
        }
index 436c392..4de49ea 100644 (file)
@@ -116,6 +116,19 @@ class ApiRollback extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'pageid' => 'integer',
+                               'summary' => 'string',
+                               'revid' => 'integer',
+                               'old_revid' => 'integer',
+                               'last_revid' => 'integer'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Undo the last edit to the page. If the last user who edited the page made multiple edits in a row,',
index c56d646..2c9b482 100644 (file)
@@ -84,6 +84,57 @@ class ApiTokens extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'patroltoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'edittoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'deletetoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'protecttoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'movetoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blocktoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'unblocktoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'emailtoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'importtoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'watchtoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'optionstoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getParamDescription() {
                return array(
                        'type' => 'Type of token(s) to request'
index 49353b6..40a6d44 100644 (file)
@@ -119,6 +119,33 @@ class ApiUnblock extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'unblocktoken' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'id' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'user' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'userid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'reason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Unblock a user';
        }
index 856e2ac..c89f49a 100644 (file)
@@ -122,6 +122,17 @@ class ApiUndelete extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'revisions' => 'integer',
+                               'filerevisions' => 'integer',
+                               'reason' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Restore certain revisions of a deleted page. A list of deleted revisions (including timestamps) can be',
index e58a1ca..db1ee16 100644 (file)
@@ -623,6 +623,41 @@ class ApiUpload extends ApiBase {
 
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'Warning',
+                                               'Continue',
+                                               'Queued'
+                                       ),
+                               ),
+                               'filekey' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'sessionkey' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'offset' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'statuskey' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'filename' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Upload a file, or get the status of pending uploads. Several methods are available:',
index fa382b3..c923c6d 100644 (file)
@@ -100,6 +100,17 @@ class ApiWatch extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'title' => 'string',
+                               'unwatched' => 'boolean',
+                               'watched' => 'boolean',
+                               'message' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Add or remove a page from/to the current user\'s watchlist';
        }