27 $contributionsSegment =
28 $this->contributionsLookup->getContributions( $target, $limit, $this->
getAuthority(), $segment, $tag );
30 $contributions = $this->getContributionsList( $contributionsSegment );
31 $urls = $this->constructURLs( $contributionsSegment );
33 $response = $urls + [
'contributions' => $contributions ];
48 $id = $revision->getId();
51 $tags[] = [
'name' => $tag,
'description' => $message->parse() ];
55 "comment" => $revision->getComment()->text,
56 "timestamp" =>
wfTimestamp( TS_ISO_8601, $revision->getTimestamp() ),
58 "size" => $revision->getSize(),
64 "id" => $revision->getPageId(),
65 "key" => $revision->getPageAsLinkTarget()->getDBkey(),
66 "title" => $revision->getPageAsLinkTarget()->getText()
70 return $revisionsData;
78 private function constructURLs( ContributionsSegment $segment ): array {
79 $limit = $this->getValidatedParams()[
'limit'];
80 $tag = $this->getValidatedParams()[
'tag'];
82 $user = $this->getValidatedParams()[
'user'] ??
null;
83 $name = $user ? $user->getName() :
null;
86 $query = [
'limit' => $limit,
'tag' => $tag ];
87 $pathParams = [
'user' => $name ];
89 if ( $segment->isOldest() ) {
90 $urls[
'older'] =
null;
92 $urls[
'older'] = $this->
getRouteUrl( $pathParams, $query + [
'segment' => $segment->getBefore() ] );
95 $urls[
'newer'] = $this->
getRouteUrl( $pathParams, $query + [
'segment' => $segment->getAfter() ] );
96 $urls[
'latest'] = $this->
getRouteUrl( $pathParams, $query );
103 self::PARAM_SOURCE =>
'query',
104 ParamValidator::PARAM_TYPE =>
'integer',
105 ParamValidator::PARAM_REQUIRED =>
false,
106 ParamValidator::PARAM_DEFAULT => self::MAX_LIMIT,
107 IntegerDef::PARAM_MIN => 1,
108 IntegerDef::PARAM_MAX => self::MAX_LIMIT
111 self::PARAM_SOURCE =>
'query',
112 ParamValidator::PARAM_TYPE =>
'string',
113 ParamValidator::PARAM_REQUIRED =>
false,
114 ParamValidator::PARAM_DEFAULT =>
''
117 self::PARAM_SOURCE =>
'query',
118 ParamValidator::PARAM_TYPE =>
'string',
119 ParamValidator::PARAM_REQUIRED =>
false,
120 ParamValidator::PARAM_DEFAULT => null
123 if ( $this->me ===
false ) {
124 $settings[
'user'] = [
125 self::PARAM_SOURCE =>
'path',
126 ParamValidator::PARAM_REQUIRED =>
true,
127 ParamValidator::PARAM_TYPE =>
'user',
128 UserDef::PARAM_RETURN_OBJECT =>
true,
129 UserDef::PARAM_ALLOWED_USER_TYPES => [
'name',
'ip' ],