patchDataRetentionPolicy method

Future<MmDataRetentionPolicyWithTeamAndChannelCounts?> patchDataRetentionPolicy(
  1. String policyId,
  2. MmDataRetentionPolicyWithTeamAndChannelIds mmDataRetentionPolicyWithTeamAndChannelIds
)

Patch a granular data retention policy

Patches (i.e. replaces the fields of) a granular data retention policy. If any fields are omitted, they will not be changed. Minimum server version: 5.35 ##### Permissions Must have the sysconsole_write_compliance_data_retention permission. ##### License Requires an E20 license.

Parameters:

Implementation

Future<MmDataRetentionPolicyWithTeamAndChannelCounts?> patchDataRetentionPolicy(
  String policyId,
  MmDataRetentionPolicyWithTeamAndChannelIds mmDataRetentionPolicyWithTeamAndChannelIds,
) async {
  final response = await patchDataRetentionPolicyWithHttpInfo(
    policyId,
    mmDataRetentionPolicyWithTeamAndChannelIds,
  );
  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),
      'MmDataRetentionPolicyWithTeamAndChannelCounts',
    ) as MmDataRetentionPolicyWithTeamAndChannelCounts;
  }
  return null;
}