updateConfig method

Future<MmConfig?> updateConfig(
  1. MmConfig mmConfig
)

Update configuration

Submit a new configuration for the server to use. As of server version 4.8, the PluginSettings.EnableUploads setting cannot be modified by this endpoint. Note that the parameters that aren't set in the configuration that you provide will be reset to default values. Therefore, if you want to change a configuration parameter and leave the other ones unchanged, you need to get the existing configuration first, change the field that you want, then put that new configuration. ##### Permissions Must have manage_system permission.

Parameters:

  • MmConfig mmConfig (required): Mattermost configuration

Implementation

Future<MmConfig?> updateConfig(
  MmConfig mmConfig,
) async {
  final response = await updateConfigWithHttpInfo(
    mmConfig,
  );
  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) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'MmConfig',
    ) as MmConfig;
  }
  return null;
}