diff --git a/website/docs/2-editing-pages.md b/website/docs/2-editing-pages.md index 808aee4..a2d04c0 100644 --- a/website/docs/2-editing-pages.md +++ b/website/docs/2-editing-pages.md @@ -20,13 +20,20 @@ bot.edit('Page title', (rev) => { Some more functions associated with editing pages: +Save a page with the given content without loading it first. Simpler version of `edit`. Does not offer any edit conflict detection. + ```js -// Save a page with the given content without loading it first. Simpler verion of `edit`. Does not offer any edit conflict detection. await bot.save('Page title', 'Page content', 'Edit summary'); +``` -// Create a new page. +Create a new page: + +```js await bot.create('Page title', 'Page content', 'Edit summary'); +``` + +Post a new section to a talk page: -// Post a new section to a talk page: +```js await bot.newSection('Page title', 'New section header', 'Section content', additionalOptions); ``` diff --git a/website/docs/4-handling-query-continuation.md b/website/docs/4-handling-query-continuation.md index 0bb0908..6a55947 100644 --- a/website/docs/4-handling-query-continuation.md +++ b/website/docs/4-handling-query-continuation.md @@ -21,10 +21,10 @@ for await (let json of bot.continuedQueryGen({ Specialised derivatives exist to fulfill common needs: -- `new bot.page('Page name').historyGen()` - fetch page history -- `new bot.page('Page name').logsGen()` - fetch page logs -- `new bot.category('Page name').membersGen()` - fetch category members -- `new bot.user('User name').contribsGen()` - fetch user contributions -- `new bot.user('User name').logsGen()` - fetch user logs +- `new bot.page('Page name').historyGen()` - [fetch page history](https://mwn.toolforge.org/docs/api/interfaces/mwnpage.html#historygen) +- `new bot.page('Page name').logsGen()` - [fetch page logs](https://mwn.toolforge.org/docs/api/interfaces/mwnpage.html#logsgen) +- `new bot.category('Page name').membersGen()` - [fetch category members](https://mwn.toolforge.org/docs/api/interfaces/mwncategory.html#membersgen) +- `new bot.user('User name').contribsGen()` - [fetch user contributions](https://mwn.toolforge.org/docs/api/interfaces/mwnuser.html#contribsgen) +- `new bot.user('User name').logsGen()` - [fetch user logs](https://mwn.toolforge.org/docs/api/interfaces/mwnuser.html#logsgen) Every method with a name that ends in `Gen` is an async generator. diff --git a/website/docs/5-direct-api-calls.md b/website/docs/5-direct-api-calls.md index a25842a..f95f4e2 100644 --- a/website/docs/5-direct-api-calls.md +++ b/website/docs/5-direct-api-calls.md @@ -1,6 +1,6 @@ # Direct API calls -The `request` method is for directly querying the API. See [mw:API](https://www.mediawiki.org/wiki/API:Main_page) for options. +The `request` method directly queries the API. See [mw:API](https://www.mediawiki.org/wiki/API:Main_page) for options. You can create and test your queries in [Special:ApiSandbox](https://www.mediawiki.org/wiki/Special:ApiSandbox). However, note that ApiSandbox uses json formatversion=1 by default whereas Mwn defaults to formatversion=2. So you should set formatversion: 2 in the format=json options, otherwise the output can be formatted differently for certain API endpoints. Use of the legacy formatversion is not recommended. @@ -16,7 +16,7 @@ bot.request({ }); ``` -Mwn provides a great number of convenience methods so that you can avoid writing raw API calls, see the later sections. +Mwn provides a great number of convenience methods so that you can avoid writing raw API calls, see the earlier sections. #### Raw web requests