(cmd, paramsRuntime, resultTypeName)
| 1251 | // required vs. optional is visible in an ordinary hover, matching what Ruby's |
| 1252 | // generator gives for free via real keyword arguments in the method signature. |
| 1253 | function generateCommandJsDoc(cmd, paramsRuntime, resultTypeName) { |
| 1254 | const { methodStr, paramsTypeName, hasParams } = cmd |
| 1255 | const lines = [' /**'] |
| 1256 | if (hasParams) { |
| 1257 | lines.push(` * @param {${paramsTypeName}} params`) |
| 1258 | for (const field of paramsRuntime?.fields ?? []) { |
| 1259 | const tsType = typeNodeToTs(field.type) |
| 1260 | const tag = field.required ? `params.${field.name}` : `[params.${field.name}]` |
| 1261 | lines.push(` * @param {${tsType}} ${tag}`) |
| 1262 | } |
| 1263 | } |
| 1264 | lines.push(` * @returns {Promise<${resultTypeName ?? 'void'}>}`) |
| 1265 | // A vendor-defined command has no section in the spec (specUrl: null). |
| 1266 | const specUrl = cmd.specUrl === undefined ? specSectionUrl(methodStr, 'command') : cmd.specUrl |
| 1267 | if (specUrl) lines.push(` * @see ${specUrl}`) |
| 1268 | lines.push(' */') |
| 1269 | return lines.join('\n') |
| 1270 | } |
| 1271 | |
| 1272 | function generateCommandMethod(cmd, runtimeByTsName) { |
| 1273 | const { methodName, methodStr, paramsTypeName, hasParams, resultTypeName } = cmd |
no test coverage detected