MediaWiki  1.28.0
IApiMessage Interface Reference

Interface for messages with machine-readable data for use by the API. More...

Inheritance diagram for IApiMessage:
Collaboration diagram for IApiMessage:

Public Member Functions

 getApiCode ()
 Returns a machine-readable code for use by the API. More...
 
 getApiData ()
 Returns additional machine-readable data about the error condition. More...
 
 setApiCode ($code, array $data=null)
 Sets the machine-readable code for use by the API. More...
 
 setApiData (array $data)
 Sets additional machine-readable data about the error condition. More...
 
- Public Member Functions inherited from MessageSpecifier
 getKey ()
 Returns the message key. More...
 
 getParams ()
 Returns the message parameters. More...
 

Detailed Description

Interface for messages with machine-readable data for use by the API.

The idea is that it's a Message that has some extra data for the API to use when interpreting it as an error (or, in the future, as a warning). Internals of MediaWiki often use messages (or message keys, or Status objects containing messages) to pass information about errors to the user (see e.g. Title::getUserPermissionsErrors()) and the API has to make do with that.

Since
1.25

Definition at line 35 of file ApiMessage.php.

Member Function Documentation

IApiMessage::getApiCode ( )

Returns a machine-readable code for use by the API.

The message key is often sufficient, but sometimes there are multiple messages used for what is really the same underlying condition (e.g. badaccess-groups and badaccess-group0)

Returns
string
IApiMessage::getApiData ( )

Returns additional machine-readable data about the error condition.

Returns
array
IApiMessage::setApiCode (   $code,
array  $data = null 
)

Sets the machine-readable code for use by the API.

Parameters
string | null$codeIf null, the message key should be returned by self::getApiCode()
array | null$dataIf non-null, passed to self::setApiData()
IApiMessage::setApiData ( array  $data)

Sets additional machine-readable data about the error condition.

Parameters
array$data

The documentation for this interface was generated from the following file: