createOneTime method

Future<void> createOneTime(
  1. String query, {
  2. UserCredentials? userCredentials,
})

Creates a projection that runs until the end of the log and then stops. The query parameter contains the JavaScript you want created as a one time projection. See user-defined projections API. for more information about the query language (javascript).

Implementation

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

    final options = (CreateReq_Options()
      ..oneTime = Empty()
      ..query = query);

    await client.create(
      CreateReq()..options = options,
      options: $getOptions(
        userCredentials: userCredentials,
      ),
    );
  });
}