update method
Update a video's name, permissions, or both. Only the fields you pass are
changed: omit name to keep the current name and permissions to keep the
current ACL. The caller must hold update permission on the video document.
The source file cannot be replaced; delete the video and create a new one
to point at a different file.
Implementation
Future<models.Video> update({
required String videoId,
String? name,
List<String>? permissions,
}) async {
if (videoId.isEmpty) {
throw AppwriteException(
'Missing required parameter: "videoId"',
);
}
final String apiPath = '/videos/{videoId}'.replaceAll(
'{videoId}',
_encodePath(videoId),
);
final Map<String, dynamic> apiParams = {
if (name != null) 'name': name,
if (permissions != null) 'permissions': permissions,
};
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.Video.fromMap(res.data);
}