49 if ( !$this->session ) {
50 $this->session = $this->
getApiMain()->getRequest()->getSession();
69 if ( $this->apiMain ) {
73 $context = RequestContext::getMain();
83 $fauxContext->setRequest( $fauxRequest );
84 $fauxContext->setUser( $context->getUser() );
85 $fauxContext->setLanguage( $context->getLanguage() );
87 $this->apiMain =
new ApiMain( $fauxContext,
true );
99 $this->
getApiMain()->getModuleManager()->addModule(
103 'class' => get_class( $module ),
104 'factory' =>
function () use ( $module ) {
126 foreach ( $params as $key => $value ) {
136 foreach ( $ex->
getStatusValue()->getErrorsByType(
'error' ) as $error ) {
137 $msg = ApiMessage::create( $error );
144 'Unmapped action module error: ' . $ex->getMessage(),
149 $actionModuleResult =
$apiMain->
getResult()->getResultData(
null, [
'Strip' =>
'all' ] );
204 array $actionModuleResult,
239 [
'actionModuleErrorCode' => $msg->
getApiCode() ]
267 if ( is_array( $param ) ) {
268 foreach ( $param as
$type => $value ) {
269 if (
$type ===
'list' ) {
272 foreach ( $value as $v ) {
276 return new ListParam( ParamType::TEXT, $paramList );
This abstract class implements many basic API functions, and is the base of all API classes.
This is the main API class, used for both external and internal processing.
getResult()
Get the ApiResult object associated with current request.
execute()
Execute api request.
Extension of Message implementing IApiMessage @newable.
Exception used to abort API execution with an error.
getStatusValue()
Fetch the error status.
WebRequest clone which takes values from a provided array.
Group all the pieces relevant to the context of a request into one instance @newable.
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack ...
Interface for messages with machine-readable data for use by the API.
getApiCode()
Returns a machine-readable code for use by the API.
getParams()
Returns the message parameters.
getKey()
Returns the message key.