body method
Defines the actual body code. path is passed relative to lib, baseName is the filename, and className is the filename converted to Pascal case.
実際の本体コードを定義します。pathにlibからの相対パス、baseNameにファイル名が渡され、classNameにファイル名をパスカルケースに変換した値が渡されます。
Implementation
@override
String body(String path, String baseName, String className) {
return """
/**
* ${className.toPascalCase()}FirestoreTriggered
*
* Create a server code for Firestore triggers.
*/
export class ${className.toPascalCase()}FirestoreTriggered extends m.FirestoreTriggeredProcessFunctionBase {
/**
* @param {string} id
* Describe the method names used in Functions.
*
* Functionsで利用されるメソッド名を記述します。
*/
id = "${className.toSnakeCase()}_firestore_triggered";
/**
* @param {string} path
* Specify the target path for execution. Include the document ID.
*
* 処理を実行する対象のパスを指定します。ドキュメントIDまで設定してください。
*
* e.g.
* "my-collection/{docId}"
*
* https://firebase.google.com/docs/functions/firestore-events
*/
path = "";
/**
* @param {string} database
* Specifies the database. [null] is the default.
*
* データベースを指定します。[null]の場合デフォルトが利用されます。
*/
database = null;
/**
* Specify the actual contents of the process.
*
* 実際の処理の中身を指定します。
*
* @param {functions.firestore.FirestoreEvent<functions.firestore.Change<functions.firestore.DocumentSnapshot> | undefined, Record<string, string>>} event
* Event Description.
*
* イベントの内容。
*/
async process(event: functions.firestore.FirestoreEvent<functions.firestore.Change<functions.firestore.DocumentSnapshot> | undefined, Record<string, string>>): Promise<void> {
// TODO: Implement the process to be executed.
}
}
""";
}