share method

Future<void> share(
  1. List<String> nodeIds,
  2. String email
)

Shares nodes with another user.

Takes list of node ids to share and a single email to share them with.

Implementation

Future<void> share(List<String> nodeIds, String email) async {
  final uri = _urlBase.getPath(_nodeSharing);

  final body = await JsonIsolate().encodeJson({
    'nodes': nodeIds,
    'email': email,
  });

  final resp = await put(
    uri,
    body: body,
    headers: {
      URLBase.authHeader: accessToken,
    },
  );
  final Map<String, dynamic> bodyResp =
      await JsonIsolate().decodeJson(resp.body);
  if (resp.statusCode != 200) {
    throw bodyResp['description'];
  }
}