body method

  1. @override
String body(
  1. String path,
  2. String baseName,
  3. String className
)
override

Defines the actual body code. path is passed relative to lib, baseName is the filename, and className is the filename converted to Pascal case.

実際の本体コードを定義します。pathlibからの相対パス、baseNameにファイル名が渡され、classNameにファイル名をパスカルケースに変換した値が渡されます。

Implementation

@override
String body(String path, String baseName, String className) {
  return """
/**
 * ${className.toPascalCase()}Schedule
 *
 * Create a server code for the scheduler.
 */
export class ${className.toPascalCase()}Schedule extends m.ScheduleProcessFunctionBase {
  /**
   * @param {string} id
   * Describe the method names used in Functions.
   *
   * Functionsで利用されるメソッド名を記述します。
   */
  id = "${className.toSnakeCase()}_schedule";
  /**
   * @param {string} schedule
   * Specify the schedule to execute the process in cron format.
   *
   * 処理を実行するスケジュールをcron形式で指定します。
   *
   * https://firebase.google.com/docs/functions/schedule-functions
   */
  schedule = "every 60 minutes";
  /**
   * Specify the actual contents of the process.
   *
   * 実際の処理の中身を指定します。
   *
   * @param {Record<string, any>} options
   * Options passed to Functions.
   *
   * Functionsに渡されたオプション。
   */
  async process(options: Record<string, any>): Promise<void> {
      // TODO: Implement the process to be executed.
  }
}

""";
}