Skip to content

Commit

Permalink
minor doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Mar 22, 2023
1 parent 3e146ed commit c58edc0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
13 changes: 10 additions & 3 deletions website/docs/2-editing-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
10 changes: 5 additions & 5 deletions website/docs/4-handling-query-continuation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions website/docs/5-direct-api-calls.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down

0 comments on commit c58edc0

Please sign in to comment.