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()}Call
 *
 * Create server code for FunctionCall.
 */
export class ${className.toPascalCase()}Call extends m.CallProcessFunctionBase {
  /**
   * @param {string} id
   * Describe the method names used in Functions.
   *
   * Functionsで利用されるメソッド名を記述します。
   */
  id = "${className.toSnakeCase()}_call";
  /**
   * Specify the actual contents of the process.
   *
   * 実際の処理の中身を指定します。
   *
   * @param {any} query
   * Query passed to Functions.
   *
   * Functionsに渡されたクエリ。
   *
   * @param {Record<string, any>} options
   * Options passed to Functions.
   *
   * Functionsに渡されたオプション。
   *
   * @returns {Promise<Record<string, any>>}
   * Return the result of the process.
   *
   * 処理の結果を返します。
   */
  async process(
    query: any,
    options: Record<string, any>
  ): Promise<{[key: string]: any}> {
      // TODO: Implement the process to be executed.
      return {};
  }
}

""";
}