dataJavascriptMobileTypeGet method
Get JavaScript for mobileapps
Gets the JavaScript bundle so that clients can have convenient access to that for consuming the page HTML. Amongst other things, * it allows to detect the platform and through that enable platform specific CSS rules, * has code to lazy load images on the page, * code for collapsing and expanding tables. Valid types are pagelib or pcs. Passing pcs will return the JavaScript for the Page Content Service. Passing pagelib will return a deprecated legacy version of the wikimedia-page-library JavaScript to support existing app clients. Stability: unstable Please follow wikitech-l or mediawiki-api-announce for announcements of breaking changes.
Parameters:
- String type (required): The desired JavaScript bundle
Implementation
Future<Object?> dataJavascriptMobileTypeGet(
String type,
) async {
final response = await dataJavascriptMobileTypeGetWithHttpInfo(
type,
);
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;
}