updatePolicy method
Update an existing policy using it's ID.
Implementation
Future<models.BackupPolicy> updatePolicy({
required String policyId,
String? name,
int? retention,
String? schedule,
bool? enabled,
}) async {
final String apiPath = '/backups/policies/{policyId}'.replaceAll(
'{policyId}',
policyId,
);
final Map<String, dynamic> apiParams = {
if (name != null) 'name': name,
if (retention != null) 'retention': retention,
if (schedule != null) 'schedule': schedule,
if (enabled != null) 'enabled': enabled,
};
final Map<String, String> apiHeaders = {
'X-Appwrite-Project': client.config['project'] ?? '',
'content-type': 'application/json',
'accept': 'application/json',
};
final res = await client.call(
HttpMethod.patch,
path: apiPath,
params: apiParams,
headers: apiHeaders,
);
return models.BackupPolicy.fromMap(res.data);
}