updateDiskResourceInfo method

Future<Resource> updateDiskResourceInfo({
  1. required String path,
  2. String? fields,
  3. Map? customProperties,
})

Update the meta information of the file or the folder.

See: https://yandex.ru/dev/disk/api/reference/meta-add.html

Implementation

Future<Resource> updateDiskResourceInfo({
  required final String path,
  final String? fields,
  final Map? customProperties,
}) async {
  final response = await _dio.patch(
    _diskResources,
    queryParameters: {
      'path': path,
      if (fields != null) 'fields': fields,
    },
    data: ResourcePatch(customProperties: customProperties),
  );
  if (_HttpStatus.accepted == response.statusCode) {
    final operationId = Link.fromJson(response.data).extractOperationId();
    await _wait(operationId);
  }

  return Resource.fromJson(response.data);
}