jenkins-bot has submitted this change and it was merged. (
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/ApiQueryCoordinates.php
M includes/api/ApiQueryGeoSearch.php
4 files changed, 38 insertions(+), 9 deletions(-)
Approvals:
jenkins-bot: Verified
Anomie: Looks good to me, approved
diff --git a/i18n/en.json b/i18n/en.json
index 4a6d841..f158af4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -21,27 +21,36 @@
"geodata-unknown-globe-category-desc": "The page uses an unknown value
of the <code>globe</code> parameter for coordinates.",
"geodata-unknown-region-category": "Pages with invalid region value",
"geodata-unknown-region-category-desc": "The page uses an invalid value
of the <code>region</code> parameter for coordinates.",
- "geodata-api-help-coordinates-format": "Format: Latitude and longitude
separated by pipe (\"|\").",
+ "geodata-api-help-coordinates-format": "Format: Latitude and longitude
separated by pipe (<kbd>|</kbd>).",
"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": "Which kind of coordinates
to return.",
+ "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]]",
"apihelp-query+geosearch-description": "Returns pages having
coordinates that are located in a certain area.",
"apihelp-query+geosearch-summary": "Returns pages having coordinates
that are located in a certain area.",
- "apihelp-query+geosearch-param-bbox": "Bounding box to search in: pipe
(|) separated coordinates of top left and bottom right corners.",
+ "apihelp-query+geosearch-param-bbox": "Bounding box to search in: pipe
(<kbd>|</kbd>) separated coordinates of top left and bottom right corners.",
"apihelp-query+geosearch-param-coord": "Coordinate around which to
search.",
"apihelp-query+geosearch-param-page": "Title of page around which to
search.",
"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. 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\").",
+ "apihelp-query+geosearch-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+geosearch-param-primary": "Which kind of coordinates to
return.",
"apihelp-query+geosearch-param-debug": "Whether debug information
should be returned.",
"apihelp-query+geosearch-example-1": "Search around the point with
coordinates 37° 47′ 13.1″ N, 122° 23′ 58.84″ W",
"apihelp-query+geosearch-example-2": "Search in a bounding box",
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/ApiQueryCoordinates.php
b/includes/api/ApiQueryCoordinates.php
index 555f357..67f5214 100644
--- a/includes/api/ApiQueryCoordinates.php
+++ b/includes/api/ApiQueryCoordinates.php
@@ -152,10 +152,12 @@
ApiBase::PARAM_TYPE => [ 'type', 'name', 'dim',
'country', 'region', 'globe' ],
ApiBase::PARAM_DFLT => 'globe',
ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
],
'primary' => [
ApiBase::PARAM_TYPE => [ 'primary',
'secondary', 'all' ],
ApiBase::PARAM_DFLT => 'primary',
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
],
'distancefrompoint' => [
ApiBase::PARAM_TYPE => 'string',
diff --git a/includes/api/ApiQueryGeoSearch.php
b/includes/api/ApiQueryGeoSearch.php
index cf2eb87..5ddbc01 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 ( $i ) use ( $propTypes ) {
+ return
'apihelp-query+coordinates-paramvalue-prop-' . $propTypes[$i];
+ }, array_flip( $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 ( $i ) use ( $primaryTypes ) {
+ return
'apihelp-query+coordinates-paramvalue-primary-' . $primaryTypes[$i];
+ }, array_flip( $primaryTypes ) ),
],
];
if ( $wgGeoDataDebug ) {
--
To view, visit https://gerrit.wikimedia.org/r/389653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I385530c628503441e6a43aff4fc00bc12757ad20
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits