Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -27,6 +27,128 @@ |
28 | 28 | return $this->mDb; |
29 | 29 | } |
30 | 30 | |
| 31 | + /** |
| 32 | + * @return array |
| 33 | + */ |
| 34 | + public function getAllowedFilters() { |
| 35 | + return array(); |
| 36 | + } |
| 37 | + |
| 38 | + public function getAllowedParams() { |
| 39 | + $params = array( |
| 40 | + 'months' => 'string', |
| 41 | + 'normalized' => 'bool', |
| 42 | + 'data' => array( |
| 43 | + ApiBase::PARAM_ISMULTI => true, |
| 44 | + ApiBase::PARAM_TYPE => array( |
| 45 | + 'timeseries', |
| 46 | + 'timeseriesindexed', |
| 47 | + 'percentagegrowthlastmonth', |
| 48 | + 'percentagegrowthlasyyear', |
| 49 | + 'percentagegrowthfullperiod', |
| 50 | + ), |
| 51 | + ), |
| 52 | + 'reportlanguage' => array( |
| 53 | + ApiBase::PARAM_DFLT => 'en', |
| 54 | + ApiBase::PARAM_TYPE => array( |
| 55 | + 'en', |
| 56 | + ), |
| 57 | + ), |
| 58 | + ); |
| 59 | + |
| 60 | + $select = array( |
| 61 | + 'selectregions' => array( |
| 62 | + ApiBase::PARAM_ISMULTI => true, |
| 63 | + ApiBase::PARAM_TYPE => array( |
| 64 | + 'as', |
| 65 | + 'c', |
| 66 | + 'eu', |
| 67 | + 'i', |
| 68 | + 'la', |
| 69 | + 'ma', |
| 70 | + 'na', |
| 71 | + 'us', |
| 72 | + 'w', |
| 73 | + ), |
| 74 | + ), |
| 75 | + 'selectcountries' => array( |
| 76 | + ApiBase::PARAM_ISMULTI => false, |
| 77 | + ApiBase::PARAM_TYPE => 'string', |
| 78 | + ), |
| 79 | + 'selectwebproperties' => array( |
| 80 | + ApiBase::PARAM_ISMULTI => false, |
| 81 | + ApiBase::PARAM_TYPE => 'string', |
| 82 | + ), |
| 83 | + 'selectprojects' => array( |
| 84 | + ApiBase::PARAM_ISMULTI => false, |
| 85 | + ApiBase::PARAM_TYPE => array( |
| 86 | + 'wb', |
| 87 | + 'wk', |
| 88 | + 'wm', |
| 89 | + 'wp', |
| 90 | + 'wq', |
| 91 | + 'ws', |
| 92 | + 'wv', |
| 93 | + 'co', |
| 94 | + 'wx', |
| 95 | + ), |
| 96 | + ), |
| 97 | + 'selectwikis' => array( |
| 98 | + ApiBase::PARAM_ISMULTI => false, |
| 99 | + ApiBase::PARAM_TYPE => 'string', |
| 100 | + ), |
| 101 | + 'selecteditors' => array( |
| 102 | + ApiBase::PARAM_ISMULTI => false, |
| 103 | + ApiBase::PARAM_TYPE => array( |
| 104 | + 'a', |
| 105 | + 'r', |
| 106 | + 'b', |
| 107 | + ), |
| 108 | + ), |
| 109 | + 'selectedits' => array( |
| 110 | + ApiBase::PARAM_ISMULTI => false, |
| 111 | + ApiBase::PARAM_TYPE => array( |
| 112 | + 'm', |
| 113 | + 'b', |
| 114 | + ), |
| 115 | + ), |
| 116 | + 'selectplatforms' => array( |
| 117 | + ApiBase::PARAM_ISMULTI => false, |
| 118 | + ApiBase::PARAM_TYPE => array( |
| 119 | + 'm', |
| 120 | + 'n' |
| 121 | + ), |
| 122 | + ), |
| 123 | + ); |
| 124 | + |
| 125 | + return array_merge( $params, array_intersect_key( $select, $this->getAllowedFilters() ) ); |
| 126 | + } |
| 127 | + |
| 128 | + public function getParamDescription() { |
| 129 | + return array( |
| 130 | + 'months' => 'First and last month to include in time series', |
| 131 | + 'normalized' => array( |
| 132 | + |
| 133 | + ), |
| 134 | + 'data' => array( |
| 135 | + |
| 136 | + ), |
| 137 | + 'reportlanguage' => '', |
| 138 | + 'selectregions' => '', |
| 139 | + 'selectcountries' => '', |
| 140 | + 'selectwebproperties' => '', |
| 141 | + 'selectprojects' => '', |
| 142 | + 'selectwikis' => '', |
| 143 | + 'selecteditors' => '', |
| 144 | + 'selectedits' => '', |
| 145 | + 'selectplatform' => '', |
| 146 | + ); |
| 147 | + } |
| 148 | + |
| 149 | + //public abstract function getDescription(); |
| 150 | + |
| 151 | + //protected abstract function getExamples(); |
| 152 | + |
31 | 153 | /*public function getPossibleErrors() { |
32 | 154 | return array_merge( parent::getPossibleErrors(), array( |
33 | 155 | ) ); |
Index: trunk/extensions/MetricsReporting/ApiAnalytics.php |
— | — | @@ -45,7 +45,8 @@ |
46 | 46 | return array( |
47 | 47 | 'metric' => array( |
48 | 48 | ApiBase::PARAM_ISMULTI => false, |
49 | | - ApiBase::PARAM_TYPE => $this->metricModuleNames |
| 49 | + ApiBase::PARAM_TYPE => $this->metricModuleNames, |
| 50 | + ApiBase::PARAM_REQUIRED => true, |
50 | 51 | ), |
51 | 52 | ); |
52 | 53 | } |
— | — | @@ -54,7 +55,8 @@ |
55 | 56 | return array( |
56 | 57 | 'metric' => array( |
57 | 58 | 'Type of data to collect', |
58 | | - 'About metric names: these include source of data, to allow for alternate sources of similar metrics, which likely are defined differently or have other intrinsic issues (e.g. precision/reliability).' |
| 59 | + 'About metric names: these include source of data, to allow for alternate sources of similar metrics,', |
| 60 | + 'which likely are defined differently or have other intrinsic issues (e.g. precision/reliability).', |
59 | 61 | ), |
60 | 62 | ); |
61 | 63 | } |