Gergő Tisza has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/389653 )
Change subject: Improve API documentation
......................................................................
Improve API documentation
Change-Id: I385530c628503441e6a43aff4fc00bc12757ad20
---
M i18n/en.json
M i18n/qqq.json
M includes/api/ApiQueryGeoSearch.php
3 files changed, 32 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData
refs/changes/53/389653/1
diff --git a/i18n/en.json b/i18n/en.json
index 4a6d841..3d9335c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -25,8 +25,17 @@
"apihelp-query+coordinates-description": "Returns coordinates of the
given pages.",
"apihelp-query+coordinates-summary": "Returns coordinates of the given
pages.",
"apihelp-query+coordinates-param-limit": "How many coordinates to
return.",
- "apihelp-query+coordinates-param-prop": "Which additional coordinate
properties to return.",
- "apihelp-query+coordinates-param-primary": "Whether to return only
primary coordinates (\"primary\"), secondary (\"secondary\") or both
(\"all\").",
+ "apihelp-query+coordinates-param-prop": "Which additional coordinate
properties to return. (Properties that are always returned: <var>lat</var>,
<var>lon</var>, and either <var>primary</var> or <var>secondary</var> as a
boolean flag.)",
+ "apihelp-query+coordinates-paramvalue-prop-type": "Type of the object
the coordinates point to. See [[mw:Extension:GeoData#Usage]] for details.",
+ "apihelp-query+coordinates-paramvalue-prop-name": "Name of the object.",
+ "apihelp-query+coordinates-paramvalue-prop-dim": "Approximate size of
the object in meters.",
+ "apihelp-query+coordinates-paramvalue-prop-country": "ISO 3166-1
alpha-2 country code (e.g. <samp>US</samp> or <samp>RU</samp>).",
+ "apihelp-query+coordinates-paramvalue-prop-region": "ISO 3166-2 region
code (the part of the ISO 3166-2 code after the dash; e.g. <samp>FL</samp> or
<samp>MOS</samp>).",
+ "apihelp-query+coordinates-paramvalue-prop-globe": "Which terrestrial
body the coordinates are relative to (e.g. <samp>moon</samp> or
<samp>pluto</samp>). Defaults to Earth. See [[mw:Extension:GeoData#Glossary]]
for details.",
+ "apihelp-query+coordinates-param-primary": "What kind of coordinates to
return (primary or secondary).",
+ "apihelp-query+coordinates-paramvalue-primary-primary": "The location
of the subject of the article. There is at most one primary coordinate per
title.",
+ "apihelp-query+coordinates-paramvalue-primary-secondary": "The location
of some object that's mentioned in the article. Any number of secondary
coordinates can be associated with a title.",
+ "apihelp-query+coordinates-paramvalue-primary-all": "Return both
primary and secondary coordinates.",
"apihelp-query+coordinates-param-distancefrompoint": "Return distance
in meters from the geographical coordinates of every valid result from the
given coordinates.",
"apihelp-query+coordinates-param-distancefrompage": "Return distance in
meters from the geographical coordinates of every valid result from the
coordinates of this page.",
"apihelp-query+coordinates-example-1": "Get a list of coordinates of
the [[Main Page]]",
@@ -38,7 +47,7 @@
"apihelp-query+geosearch-param-radius": "Search radius in meters.",
"apihelp-query+geosearch-param-maxdim": "Restrict search to objects no
larger than this, in meters.",
"apihelp-query+geosearch-param-limit": "Maximum number of pages to
return.",
- "apihelp-query+geosearch-param-globe": "Globe to search on (by default
\"earth\").",
+ "apihelp-query+geosearch-param-globe": "Globe to search on (by default
\"earth\"). See [[mw:Extension:GeoData#Glossary]] for details.",
"apihelp-query+geosearch-param-namespace": "Namespaces to search.",
"apihelp-query+geosearch-param-prop": "Which additional coordinate
properties to return.",
"apihelp-query+geosearch-param-primary": "Whether to return only
primary coordinates (\"primary\"), secondary (\"secondary\") or both
(\"all\").",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 78382c2..30c4c66 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -30,7 +30,16 @@
"apihelp-query+coordinates-summary":
"{{doc-apihelp-summary|query+coordinates}}",
"apihelp-query+coordinates-param-limit":
"{{doc-apihelp-param|query+coordinates|limit}}",
"apihelp-query+coordinates-param-prop":
"{{doc-apihelp-param|query+coordinates|prop}}",
+ "apihelp-query+coordinates-paramvalue-prop-type":
"{{doc-apihelp-paramvalue|query+coordinates|prop|type}}",
+ "apihelp-query+coordinates-paramvalue-prop-name":
"{{doc-apihelp-paramvalue|query+coordinates|prop|name}}",
+ "apihelp-query+coordinates-paramvalue-prop-dim":
"{{doc-apihelp-paramvalue|query+coordinates|prop|dim}}",
+ "apihelp-query+coordinates-paramvalue-prop-country":
"{{doc-apihelp-paramvalue|query+coordinates|prop|country}}",
+ "apihelp-query+coordinates-paramvalue-prop-region":
"{{doc-apihelp-paramvalue|query+coordinates|prop|region}}",
+ "apihelp-query+coordinates-paramvalue-prop-globe":
"{{doc-apihelp-paramvalue|query+coordinates|prop|globe}}",
"apihelp-query+coordinates-param-primary":
"[[mw:Extension:GeoData#Glossary|Primary coordinates define the page subject's
location, while secondary coordinates are other coordinates mentioned in the
page]].\n----\n{{doc-apihelp-param|query+coordinates|primary}}",
+ "apihelp-query+coordinates-paramvalue-primary-primary":
"{{doc-apihelp-paramvalue|query+coordinates|primary|primary}}",
+ "apihelp-query+coordinates-paramvalue-primary-secondary":
"{{doc-apihelp-paramvalue|query+coordinates|primary|secondary}}",
+ "apihelp-query+coordinates-paramvalue-primary-all":
"{{doc-apihelp-paramvalue|query+coordinates|primary|all}}",
"apihelp-query+coordinates-param-distancefrompoint":
"{{doc-apihelp-param|query+coordinates|distancefrompoint}}",
"apihelp-query+coordinates-param-distancefrompage":
"{{doc-apihelp-param|query+coordinates|distancefrompage}}",
"apihelp-query+coordinates-example-1":
"{{doc-apihelp-example|query+coordinates}}",
diff --git a/includes/api/ApiQueryGeoSearch.php
b/includes/api/ApiQueryGeoSearch.php
index cf2eb87..e48527f 100644
--- a/includes/api/ApiQueryGeoSearch.php
+++ b/includes/api/ApiQueryGeoSearch.php
@@ -132,6 +132,9 @@
public function getAllowedParams() {
global $wgMaxGeoSearchRadius, $wgDefaultGlobe, $wgGeoDataDebug;
+ $propTypes = [ 'type', 'name', 'dim', 'country', 'region',
'globe' ];
+ $primaryTypes = [ 'primary', 'secondary', 'all' ];
+
$params = [
'coord' => [
ApiBase::PARAM_TYPE => 'string',
@@ -173,13 +176,19 @@
ApiBase::PARAM_ISMULTI => true,
],
'prop' => [
- ApiBase::PARAM_TYPE => [ 'type', 'name', 'dim',
'country', 'region', 'globe' ],
+ ApiBase::PARAM_TYPE => $propTypes,
ApiBase::PARAM_DFLT => 'globe',
ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => array_map(
function ( $type ) {
+ return
'apihelp-query+coordinates-paramvalue-prop-' . $type;
+ }, $propTypes ),
],
'primary' => [
- ApiBase::PARAM_TYPE => [ 'primary',
'secondary', 'all' ],
+ ApiBase::PARAM_TYPE => $primaryTypes,
ApiBase::PARAM_DFLT => 'primary',
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => array_map(
function ( $type ) {
+ return
'apihelp-query+coordinates-paramvalue-primary-' . $type;
+ }, $primaryTypes ),
],
];
if ( $wgGeoDataDebug ) {
--
To view, visit https://gerrit.wikimedia.org/r/389653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I385530c628503441e6a43aff4fc00bc12757ad20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits