openapi.api.TransformsApi

November 22, 2023 ยท View on GitHub

Load the API package

import 'package:wikipedia_api/api.dart';

All URIs are relative to /api/rest_v1

MethodHTTP requestDescription
doDictGET /transform/word/from/{from}/{word}Fetch the dictionary meaning of a word
doDictProviderGET /transform/word/from/{from}/{word}/{provider}Fetch the dictionary meaning of a word
doMTPOST /transform/html/from/{from}Machine-translate content
doMTProviderPOST /transform/html/from/{from}/{provider}Machine-translate content
transformHtmlToWikitextPostPOST /transform/html/to/wikitextTransform HTML to Wikitext
transformHtmlToWikitextTitlePostPOST /transform/html/to/wikitext/{title}Transform HTML to Wikitext
transformHtmlToWikitextTitleRevisionPostPOST /transform/html/to/wikitext/{title}/{revision}Transform HTML to Wikitext
transformWikitextToHtmlPostPOST /transform/wikitext/to/htmlTransform Wikitext to HTML
transformWikitextToHtmlTitlePostPOST /transform/wikitext/to/html/{title}Transform Wikitext to HTML
transformWikitextToHtmlTitleRevisionPostPOST /transform/wikitext/to/html/{title}/{revision}Transform Wikitext to HTML
transformWikitextToLintPostPOST /transform/wikitext/to/lintCheck Wikitext for lint errors
transformWikitextToLintTitlePostPOST /transform/wikitext/to/lint/{title}Check Wikitext for lint errors
transformWikitextToLintTitleRevisionPostPOST /transform/wikitext/to/lint/{title}/{revision}Check Wikitext for lint errors
transformWikitextToMobileHtmlPOST /transform/wikitext/to/mobile-html/{title}Transform Wikitext to Mobile HTML

doDict

CxDict doDict(from, word)

Fetch the dictionary meaning of a word

Fetches the dictionary meaning of a word from a language and displays it in the target language. Stability: unstable

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final from = from_example; // String | The source language code
final word = word_example; // String | The word to lookup

try {
    final result = api_instance.doDict(from, word);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->doDict: $e\n');
}

Parameters

NameTypeDescriptionNotes
fromStringThe source language code
wordStringThe word to lookup

Return type

CxDict

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

doDictProvider

CxDict doDictProvider(from, word, provider)

Fetch the dictionary meaning of a word

Fetches the dictionary meaning of a word from a language and displays it in the target language. Stability: unstable

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final from = from_example; // String | The source language code
final word = word_example; // String | The word to lookup
final provider = provider_example; // String | The dictionary provider id

try {
    final result = api_instance.doDictProvider(from, word, provider);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->doDictProvider: $e\n');
}

Parameters

NameTypeDescriptionNotes
fromStringThe source language code
wordStringThe word to lookup
providerStringThe dictionary provider id

Return type

CxDict

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

doMT

CxMt doMT(from, html)

Machine-translate content

Fetches the machine translation for the posted content from the source to the language of this wiki. Stability: unstable

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final from = from_example; // String | The source language code
final html = html_example; // String | The HTML content to translate

try {
    final result = api_instance.doMT(from, html);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->doMT: $e\n');
}

Parameters

NameTypeDescriptionNotes
fromStringThe source language code
htmlStringThe HTML content to translate

Return type

CxMt

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

doMTProvider

CxMt doMTProvider(from, provider, html)

Machine-translate content

Fetches the machine translation for the posted content from the source to the language of this wiki. Stability: unstable

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final from = from_example; // String | The source language code
final provider = provider_example; // String | The machine translation provider id
final html = html_example; // String | The HTML content to translate

try {
    final result = api_instance.doMTProvider(from, provider, html);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->doMTProvider: $e\n');
}

Parameters

NameTypeDescriptionNotes
fromStringThe source language code
providerStringThe machine translation provider id
htmlStringThe HTML content to translate

Return type

CxMt

Authorization

No authorization required

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformHtmlToWikitextPost

String transformHtmlToWikitextPost(html, ifMatch, scrubWikitext)

Transform HTML to Wikitext

Transform Parsoid HTML to Wikitext. When converting pre-existing (possibly modified) content, you should pass in the title, revision, and If-Match header. This lets Parsoid preserve small syntactic variations in wikitext, which ensures that diffs are readable. - Stability: stable - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final html = html_example; // String | The HTML to transform
final ifMatch = ifMatch_example; // String | The `ETag` header of the original render indicating it's revision and timeuuid. Required if both `title` and `revision` parameters are present. 
final scrubWikitext = true; // bool | Normalise the DOM to yield cleaner wikitext?

try {
    final result = api_instance.transformHtmlToWikitextPost(html, ifMatch, scrubWikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformHtmlToWikitextPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
htmlStringThe HTML to transform
ifMatchStringThe ETag header of the original render indicating it's revision and timeuuid. Required if both title and revision parameters are present.[optional]
scrubWikitextboolNormalise the DOM to yield cleaner wikitext?[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformHtmlToWikitextTitlePost

String transformHtmlToWikitextTitlePost(title, html, ifMatch, scrubWikitext)

Transform HTML to Wikitext

Transform Parsoid HTML to Wikitext. When converting pre-existing (possibly modified) content, you should pass in the title, revision, and If-Match header. This lets Parsoid preserve small syntactic variations in wikitext, which ensures that diffs are readable. - Stability: stable - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final html = html_example; // String | The HTML to transform
final ifMatch = ifMatch_example; // String | The `ETag` header of the original render indicating it's revision and timeuuid. Required if both `title` and `revision` parameters are present. 
final scrubWikitext = true; // bool | Normalise the DOM to yield cleaner wikitext?

try {
    final result = api_instance.transformHtmlToWikitextTitlePost(title, html, ifMatch, scrubWikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformHtmlToWikitextTitlePost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
htmlStringThe HTML to transform
ifMatchStringThe ETag header of the original render indicating it's revision and timeuuid. Required if both title and revision parameters are present.[optional]
scrubWikitextboolNormalise the DOM to yield cleaner wikitext?[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformHtmlToWikitextTitleRevisionPost

String transformHtmlToWikitextTitleRevisionPost(title, revision, html, ifMatch, scrubWikitext)

Transform HTML to Wikitext

Transform Parsoid HTML to Wikitext. When converting pre-existing (possibly modified) content, you should pass in the title, revision, and If-Match header. This lets Parsoid preserve small syntactic variations in wikitext, which ensures that diffs are readable. - Stability: stable - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final revision = 56; // int | The page revision
final html = html_example; // String | The HTML to transform
final ifMatch = ifMatch_example; // String | The `ETag` header of the original render indicating it's revision and timeuuid. Required if both `title` and `revision` parameters are present. 
final scrubWikitext = true; // bool | Normalise the DOM to yield cleaner wikitext?

try {
    final result = api_instance.transformHtmlToWikitextTitleRevisionPost(title, revision, html, ifMatch, scrubWikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformHtmlToWikitextTitleRevisionPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
revisionintThe page revision
htmlStringThe HTML to transform
ifMatchStringThe ETag header of the original render indicating it's revision and timeuuid. Required if both title and revision parameters are present.[optional]
scrubWikitextboolNormalise the DOM to yield cleaner wikitext?[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToHtmlPost

String transformWikitextToHtmlPost(wikitext, bodyOnly, stash)

Transform Wikitext to HTML

Transform wikitext to HTML. Note that if you set stash: true, you also need to supply the title. - Stability: stable - Rate limit: 25 req/s (5 req/s when stash: true)

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final wikitext = wikitext_example; // String | The Wikitext to transform to HTML
final bodyOnly = true; // bool | Return only `body.innerHTML`
final stash = true; // bool | Whether to temporarily stash the result of the transformation

try {
    final result = api_instance.transformWikitextToHtmlPost(wikitext, bodyOnly, stash);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToHtmlPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
wikitextStringThe Wikitext to transform to HTML
bodyOnlyboolReturn only body.innerHTML[optional]
stashboolWhether to temporarily stash the result of the transformation[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToHtmlTitlePost

String transformWikitextToHtmlTitlePost(title, wikitext, bodyOnly, stash)

Transform Wikitext to HTML

Transform wikitext to HTML. Note that if you set stash: true, you also need to supply the title. - Stability: stable - Rate limit: 25 req/s (5 req/s when stash: true)

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final wikitext = wikitext_example; // String | The Wikitext to transform to HTML
final bodyOnly = true; // bool | Return only `body.innerHTML`
final stash = true; // bool | Whether to temporarily stash the result of the transformation

try {
    final result = api_instance.transformWikitextToHtmlTitlePost(title, wikitext, bodyOnly, stash);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToHtmlTitlePost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
wikitextStringThe Wikitext to transform to HTML
bodyOnlyboolReturn only body.innerHTML[optional]
stashboolWhether to temporarily stash the result of the transformation[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToHtmlTitleRevisionPost

String transformWikitextToHtmlTitleRevisionPost(title, revision, wikitext, bodyOnly, stash)

Transform Wikitext to HTML

Transform wikitext to HTML. Note that if you set stash: true, you also need to supply the title. - Stability: stable - Rate limit: 25 req/s (5 req/s when stash: true)

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final revision = 56; // int | The page revision
final wikitext = wikitext_example; // String | The Wikitext to transform to HTML
final bodyOnly = true; // bool | Return only `body.innerHTML`
final stash = true; // bool | Whether to temporarily stash the result of the transformation

try {
    final result = api_instance.transformWikitextToHtmlTitleRevisionPost(title, revision, wikitext, bodyOnly, stash);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToHtmlTitleRevisionPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
revisionintThe page revision
wikitextStringThe Wikitext to transform to HTML
bodyOnlyboolReturn only body.innerHTML[optional]
stashboolWhether to temporarily stash the result of the transformation[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToLintPost

Object transformWikitextToLintPost(wikitext)

Check Wikitext for lint errors

Parse the supplied wikitext and check it for lint errors. - Stability: experimental - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final wikitext = wikitext_example; // String | The Wikitext to check

try {
    final result = api_instance.transformWikitextToLintPost(wikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToLintPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
wikitextStringThe Wikitext to check

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: multipart/form-data, application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToLintTitlePost

Object transformWikitextToLintTitlePost(title, wikitext)

Check Wikitext for lint errors

Parse the supplied wikitext and check it for lint errors. - Stability: experimental - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final wikitext = wikitext_example; // String | The Wikitext to check

try {
    final result = api_instance.transformWikitextToLintTitlePost(title, wikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToLintTitlePost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
wikitextStringThe Wikitext to check

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToLintTitleRevisionPost

Object transformWikitextToLintTitleRevisionPost(title, revision, wikitext)

Check Wikitext for lint errors

Parse the supplied wikitext and check it for lint errors. - Stability: experimental - Rate limit: 25 req/s

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final revision = 56; // int | The page revision
final wikitext = wikitext_example; // String | The Wikitext to check

try {
    final result = api_instance.transformWikitextToLintTitleRevisionPost(title, revision, wikitext);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToLintTitleRevisionPost: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
revisionintThe page revision
wikitextStringThe Wikitext to check

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

transformWikitextToMobileHtml

String transformWikitextToMobileHtml(title, wikitext, acceptLanguage, outputMode)

Transform Wikitext to Mobile HTML

Transform wikitext to Mobile HTML. - Stability: stable - Rate limit: 25 req/s (5 req/s when stash: true) Please follow wikitech-l or mediawiki-api-announce for announcements of breaking changes.

Example

import 'package:wikipedia_api/api.dart';

final api_instance = TransformsApi();
final title = title_example; // String | Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.
final wikitext = wikitext_example; // String | The Wikitext to transform to HTML
final acceptLanguage = acceptLanguage_example; // String | The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language. 
final outputMode = outputMode_example; // String | Output mode for mobile-html. Default is `editPreview`.

try {
    final result = api_instance.transformWikitextToMobileHtml(title, wikitext, acceptLanguage, outputMode);
    print(result);
} catch (e) {
    print('Exception when calling TransformsApi->transformWikitextToMobileHtml: $e\n');
}

Parameters

NameTypeDescriptionNotes
titleStringPage title. Use underscores instead of spaces. Use percent-encoding. Example: Main_Page.
wikitextStringThe Wikitext to transform to HTML
acceptLanguageStringThe desired language variant code for wikis where LanguageConverter is enabled. Example: sr-el for Latin transcription of the Serbian language.[optional]
outputModeStringOutput mode for mobile-html. Default is editPreview.[optional]

Return type

String

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]