addSharePermission method

Future<List<SharePermission>> addSharePermission({
  1. required int id,
  2. required SharePermissionInputBean body,
})

Add a share permissions to a filter. If you add a global share permission (one for all logged-in users or the public) it will overwrite all share permissions for the filter.

Be aware that this operation uses different objects for updating share permissions compared to Update filter.

Permissions required: Share dashboards and filters global permission and the user must own the filter.

Implementation

Future<List<SharePermission>> addSharePermission(
    {required int id, required SharePermissionInputBean body}) async {
  return (await _client.send(
    'post',
    'rest/api/3/filter/{id}/permission',
    pathParameters: {
      'id': '$id',
    },
    body: body.toJson(),
  ) as List<Object?>)
      .map((i) =>
          SharePermission.fromJson(i as Map<String, Object?>? ?? const {}))
      .toList();
}