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()}Request
 *
 * Create server code for HTTP requests.
 */
export class ${className.toPascalCase()}Request extends m.RequestProcessFunctionBase {
  /**
   * @param {string} id
   * Describe the method names used in Functions.
   *
   * Functionsで利用されるメソッド名を記述します。
   */
  id = "${className.toSnakeCase()}_request";
  /**
   * Specify the actual contents of the process.
   *
   * 実際の処理の中身を指定します。
   *
   * @param {Request} reqest
   * Request passed to Functions.
   *
   * Functionsに渡されたRequest。
   *
   * @param {Response<any>} response
   * Response passed to Functions.
   *
   * Functionsに渡されたResponse。
   */
  async process(
    reqest: functions.https.Request,
    response: express.Response<any>
  ): Promise<void> {
      // TODO: Implement the process to be executed.
  }
}

""";
}