update method

Future<void> update(
  1. String name,
  2. String query, {
  3. bool? emitEnabled,
  4. UserCredentials? userCredentials,
})

Updates given projection. The name parameter identifies the projection that is updated. The query parameter contains the updated JavaScript. See user-defined projections API. for more information about the query language (javascript). The emitEnabled parameter controls if projection emits events

Implementation

Future<void> update(
  String name,
  String query, {
  bool? emitEnabled,
  UserCredentials? userCredentials,
}) async {
  return $runRequest(() async {
    final client = await $getClient();

    final options = (UpdateReq_Options()
      ..name = name
      ..query = query);
    if (emitEnabled == null) {
      options.noEmitOptions = Empty();
    } else {
      options.emitEnabled = emitEnabled;
    }

    await client.update(
      UpdateReq()..options = options,
      options: $getOptions(
        userCredentials: userCredentials,
      ),
    );
  });
}