12use MediaWiki\Rest\TokenAwareHandlerTrait;
63 parent::validate( $restValidator );
73 if ( isset( $data[
'error'] ) ) {
77 if ( !isset( $data[
'edit'] ) || !$data[
'edit'][
'result'] ) {
78 throw new RuntimeException(
'Bad result structure received from ApiEditPage' );
81 if ( $data[
'edit'][
'result'] !==
'Success' ) {
85 new MessageValue(
"rest-edit-conflict", [ $data[
'edit'][
'result'] ] ),
90 $title = $this->titleParser->parseTitle( $data[
'edit'][
'title'] );
94 $revision = $this->revisionLookup->getRevisionById( (
int)$data[
'edit'][
'newrevid'] );
95 $content = $revision->getContent( SlotRecord::MAIN );
98 'id' => $data[
'edit'][
'pageid'],
99 'title' => $this->titleFormatter->getPrefixedText( $title ),
100 'key' => $this->titleFormatter->getPrefixedDBkey( $title ),
102 'id' => $data[
'edit'][
'newrevid'],
103 'timestamp' => $data[
'edit'][
'newtimestamp'],
109 'content_model' => $data[
'edit'][
'contentmodel'],
110 'source' => $content->serialize(),
120 if ( $code ===
'protectedpage' ) {
124 if ( $code ===
'badtoken' ) {
128 if ( $code ===
'missingtitle' ) {
132 if ( $code ===
'articleexists' ) {
136 if ( $code ===
'editconflict' ) {
140 if ( $code ===
'ratelimited' ) {
145 parent::throwHttpExceptionForActionModuleError( $msg, $statusCode );
150 array $actionModuleResult,
153 parent::mapActionModuleResponse(
154 $actionModuleResponse,
159 if ( $actionModuleResult[
'edit'][
'new'] ??
false ) {
167 $spec[
'201'][parent::OPENAPI_DESCRIPTION_KEY] =
'OK';
168 $spec[
'201'][
'content'][
'application/json'][
'schema'] =
169 $spec[
'200'][
'content'][
'application/json'][
'schema'];
A class containing constants representing the names of configuration variables.
const RightsText
Name constant for the RightsText setting, for use with Config::get()
const RightsUrl
Name constant for the RightsUrl setting, for use with Config::get()