22 parent::__construct( $mainModule, $moduleName );
23 $this->dataProvider = $dataProvider;
26 public function execute() {
27 $params = $this->extractRequestParams();
29 $graphOpts->bindArray( $params );
31 $language = $this->getLanguage();
33 [ $labels, $data ] = $this->dataProvider->getGraphData( $graphOpts, $language );
39 $this->getResult()->addValue(
null, $this->getModuleName(), $output );
42 protected function getAllowedParams() {
45 ParamValidator::PARAM_TYPE => $this->dataProvider->getGraphTypes(),
46 ParamValidator::PARAM_REQUIRED =>
true,
49 ParamValidator::PARAM_TYPE =>
'integer',
50 ParamValidator::PARAM_REQUIRED =>
true,
51 ParamValidator::PARAM_DEFAULT => 30,
52 IntegerDef::PARAM_MIN => 1,
53 IntegerDef::PARAM_MAX => 10000,
54 ApiBase::PARAM_RANGE_ENFORCE => true
57 ParamValidator::PARAM_TYPE =>
'string',
58 ParamValidator::PARAM_ISMULTI => true
61 ParamValidator::PARAM_TYPE =>
'string',
62 ParamValidator::PARAM_ISMULTI => true
65 ParamValidator::PARAM_TYPE => TranslationStatsGraphOptions::VALID_SCALES,
66 ParamValidator::PARAM_DEFAULT =>
'days'
69 ParamValidator::PARAM_TYPE =>
'timestamp'
74 protected function getExamplesMessages() {
76 'action=translationstats&count=edits&days=30'
77 =>
'apihelp-translationstats-example-1',
78 'action=translationstats&count=edits&days=30&language=en|fr'
79 =>
'apihelp-translationstats-example-2'