getMarketplacePlugins method

Future<List<MmMarketplacePlugin>?> getMarketplacePlugins({
  1. int? page,
  2. int? perPage,
  3. String? filter,
  4. String? serverVersion,
  5. bool? localOnly,
})

Gets all the marketplace plugins

Gets all plugins from the marketplace server, merging data from locally installed plugins as well as prepackaged plugins shipped with the server. ##### Permissions Must have manage_system permission. Minimum server version: 5.16

Parameters:

  • int page: Page number to be fetched. (not yet implemented)

  • int perPage: Number of item per page. (not yet implemented)

  • String filter: Set to filter plugins by ID, name, or description.

  • String serverVersion: Set to filter minimum plugin server version. (not yet implemented)

  • bool localOnly: Set true to only retrieve local plugins.

Implementation

Future<List<MmMarketplacePlugin>?> getMarketplacePlugins({
  int? page,
  int? perPage,
  String? filter,
  String? serverVersion,
  bool? localOnly,
}) async {
  final response = await getMarketplacePluginsWithHttpInfo(
    page: page,
    perPage: perPage,
    filter: filter,
    serverVersion: serverVersion,
    localOnly: localOnly,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(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) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<MmMarketplacePlugin>') as List)
        .cast<MmMarketplacePlugin>()
        .toList();
  }
  return null;
}