| 1 | ( function () { |
| 2 | /** |
| 3 | * @classdesc Abstract base class for posting messages to talk pages. |
| 4 | * |
| 5 | * @abstract |
| 6 | * @class |
| 7 | * @type {mw.messagePoster.MessagePoster} |
| 8 | * |
| 9 | * @constructor |
| 10 | * @description Create an instance of `mw.messagePoster.MessagePoster`. |
| 11 | * @param {mw.Title} title Title to post to |
| 12 | */ |
| 13 | mw.messagePoster.MessagePoster = function MwMessagePoster() {}; |
| 14 | |
| 15 | OO.initClass( mw.messagePoster.MessagePoster ); |
| 16 | |
| 17 | /** |
| 18 | * Post a message (with subject and body) to a talk page. |
| 19 | * |
| 20 | * @abstract |
| 21 | * @param {string} subject Subject/topic title. The amount of wikitext supported is |
| 22 | * implementation-specific. It is recommended to only use basic wikilink syntax for |
| 23 | * maximum compatibility. |
| 24 | * @param {string} body Body, as wikitext. Signature code will automatically be added |
| 25 | * by MessagePosters that require one, unless the message already contains the string |
| 26 | * '~~~'. |
| 27 | * @param {Object} [options] Message options. See MessagePoster implementations for details. |
| 28 | * @return {jQuery.Promise} Promise completing when the post succeeds or fails. |
| 29 | * For failure, will be rejected with three arguments: |
| 30 | * |
| 31 | * - primaryError - Primary error code. For a mw.Api failure, |
| 32 | * this should be 'api-fail'. |
| 33 | * - secondaryError - Secondary error code. For a mw.Api failure, |
| 34 | * this, should be mw.Api's code, e.g. 'http', 'ok-but-empty', or the error passed through |
| 35 | * from the server. |
| 36 | * - details - Further details about the error |
| 37 | * |
| 38 | * @localdoc |
| 39 | * The base class currently does nothing, but could be used for shared analytics or |
| 40 | * something. |
| 41 | */ |
| 42 | mw.messagePoster.MessagePoster.prototype.post = function () {}; |
| 43 | }() ); |