getSectionsWithRevision method
Get mobile-optimized HTML sections for a title.
Retrieve the latest HTML for a page title optimised for viewing with native mobile applications. Note that the output is split by sections. Stability: deprecated Here you can find more information about the endpoint deprecation. Please follow wikitech-l or mediawiki-api-announce for announcements of breaking changes.
Parameters:
-
String title (required): Page title. Use underscores instead of spaces. Use percent-encoding. Example:
Main_Page
. -
int revision (required): Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.
-
bool redirect: Requests for redirect pages return HTTP 302 with a redirect target in
Location
header and content in the body. To get a 200 response instead, supplyfalse
to theredirect
parameter. -
String acceptLanguage: The desired language variant code for wikis where LanguageConverter is enabled. Example:
sr-el
for Latin transcription of the Serbian language.
Implementation
Future<Object?> getSectionsWithRevision(
String title,
int revision, {
bool? redirect,
String? acceptLanguage,
}) async {
final response = await getSectionsWithRevisionWithHttpInfo(
title,
revision,
redirect: redirect,
acceptLanguage: acceptLanguage,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'Object',
) as Object;
}
return null;
}