getContentWithRevisionMobileHtmlWithHttpInfo method

Future<Response> getContentWithRevisionMobileHtmlWithHttpInfo(
  1. String title,
  2. int revision, {
  3. bool? redirect,
})

Get page content HTML optimized for mobile consumption.

Gets the content HTML optimized for mobile consumption for the given page. This content is derived from Parsoid HTML (see /page/html/{title} endpoint). The difference to Parsoid HTML is roughly: * Some elements and attributes not needed for the reading case are removed. * LeadIntroductionTransform: The introductory paragraph is moved before an infobox. * RedLinks: Red links are flattened (=turned into span elements). * WidenImage: images that should be displayed in gallery are widened. * Section headings are slightly changed by wrapping the headings inside a div and adding a span element inside the new div for the edit buttons. * Additional classes are added to img elements to fix issues with non-white backgrounds. See Theme support below for instructions on how to enable that. * Pagelib CSS files needed to display the content are referenced. * LazyLoadTransform: server-side portion/prep for lazy loading of images. * CollapseTable: server-side portion/prep for collapsing tables. What's not included? What parts of the PageLibrary does a client still have to do? * Theme support: Themes can be turned on by adding a theme class to the root tag. Possible class names are: * pagelib_theme_default * pagelib_theme_dark * pagelib_theme_black * pagelib_theme_sepia The pagelib JS has functionality to do that: ThemeTransform.setTheme(document, theme). * Dim images: DimImagesTransform.dim(window, enable) * PlatformTransform.classify(window) to trigger Android and iOS app specific CSS rules * LazyLoadTransformer: client side companion of LazyLoadTransform (note the extra er here) * FooterTransformer: seems to be more UI than content, requires I18N, too Stability: experimental

Note: This method returns the HTTP Response.

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, supply false to the redirect parameter.

Implementation

Future<Response> getContentWithRevisionMobileHtmlWithHttpInfo(
  String title,
  int revision, {
  bool? redirect,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/page/mobile-html/{title}/{revision}'
      .replaceAll('{title}', title)
      .replaceAll('{revision}', revision.toString());

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (redirect != null) {
    queryParams.addAll(_queryParams('', 'redirect', redirect));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}