Skip to content

Commit

Permalink
fix ORES querying, and mark it as deprecated
Browse files Browse the repository at this point in the history
The new Lift Wing-backed implementation of ORES service allows only 20 scores to be retrieved in one request. Since ORES service is being deprecated in favour of Lift Wing, marking oresQueryRevisions() as deprecated.
  • Loading branch information
siddharthvp committed Sep 29, 2023
1 parent b83b0ae commit f37a887
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Only breaking changes, deprecations and the like are documented in this change log.

#### 2.0.1

- oresQueryRevisions() has been deprecated, since the [ORES service](https://ores.wikimedia.org/docs) is being deprecated in favour of [Lift Wing](https://wikitech.wikimedia.org/wiki/Machine_Learning/LiftWing).

#### 2.0.0

- Class names now follow the standard PascalCase convention. The older names are deprecated.
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Mwn works with both JavaScript and TypeScript. It is created with a design philo

This library provides TypeScript type definitions for all its functions, as well as for MediaWiki API request objects (MW core + several extensions). API responses are also typed for the common operations.

In addition to the MediaWiki Action API, methods are provided to talk to the Wikimedia Pageviews API, the ORES API, and WikiWho API.

This library uses mocha and chai for tests, and has [extensive test coverage](https://coveralls.io/github/siddharthvp/mwn?branch=master). Testing is automated using a CI workflow on GitHub Actions.

To install, run `npm install mwn`.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mwn",
"version": "2.0.0",
"version": "2.0.1",
"description": "JavaScript & TypeScript MediaWiki bot framework for Node.js",
"main": "./build/bot.js",
"types": "./build/bot.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1872,14 +1872,17 @@ export class Mwn {
* @param {string} endpointUrl
* @param {string[]} models
* @param {string[]|number[]|string|number} revisions ID(s)
* @deprecated as ORES has been deprecated in favours of Lift Wing.
*/
oresQueryRevisions(
endpointUrl: string,
models: string[],
revisions: string[] | number[] | string | number
): Promise<any> {
let response = {};
const chunks = arrayChunk(revisions instanceof Array ? revisions : [revisions], 50);
const revs = revisions instanceof Array ? revisions : [revisions];
const batchSize = Math.floor(20 / models.length);
const chunks = arrayChunk(revs, batchSize);
return this.seriesBatchOperation(
chunks,
(chunk) => {
Expand Down
28 changes: 15 additions & 13 deletions website/docs/11-integration-with-other-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@

Apart from the [MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page), Mwn integrates with a few other APIs for Wikimedia wikis:

### ORES

See <https://ores.wikimedia.org/> for details.
Get ORES scores for revisions:

```js
await bot.oresQueryRevisions(
'https://ores.wikimedia.org/', // ORES endpoint URL
['articlequality', 'drafttopic'], // ORES models
['76923582', '2387429'] // Revision IDs
);
```

### PageViews

See <https://wikitech.wikimedia.org/wiki/Analytics/AQS/Pageviews>
Expand All @@ -41,6 +28,21 @@ const contributorData = await page.queryAuthors();

Return type is Promise<<a href="https://mwn.toolforge.org/docs/api/interfaces/authorshipdata.html">AuthorshipData</a>>.

### ORES

**Deprecated** as of v2.0.1 since ORES service has been deprecated in favour of [Lift Wing](https://wikitech.wikimedia.org/wiki/Machine_Learning/LiftWing).

See <https://ores.wikimedia.org/> for details.
Get ORES scores for revisions:

```js
await bot.oresQueryRevisions(
'https://ores.wikimedia.org/', // ORES endpoint URL
['articlequality', 'drafttopic'], // ORES models
['76923582', '2387429'] // Revision IDs
);
```

### EventStreams

Methods for [EventStreams](https://wikitech.wikimedia.org/wiki/Event_Platform/EventStreams) access have been removed in v2. Consider using the dedicated library <https://www.npmjs.com/package/wikimedia-streams> instead.

0 comments on commit f37a887

Please sign in to comment.