(cmd, paramsRuntime, resultTypeName)
| 1181 | // required vs. optional is visible in an ordinary hover, matching what Ruby's |
| 1182 | // generator gives for free via real keyword arguments in the method signature. |
| 1183 | function generateCommandJsDoc(cmd, paramsRuntime, resultTypeName) { |
| 1184 | const { methodStr, paramsTypeName, hasParams } = cmd |
| 1185 | const lines = [' /**'] |
| 1186 | if (hasParams) { |
| 1187 | lines.push(` * @param {${paramsTypeName}} params`) |
| 1188 | for (const field of paramsRuntime?.fields ?? []) { |
| 1189 | const tsType = typeNodeToTs(field.type) |
| 1190 | const tag = field.required ? `params.${field.name}` : `[params.${field.name}]` |
| 1191 | lines.push(` * @param {${tsType}} ${tag}`) |
| 1192 | } |
| 1193 | } |
| 1194 | lines.push(` * @returns {Promise<${resultTypeName ?? 'void'}>}`) |
| 1195 | // A vendor-defined command has no section in the spec (specUrl: null). |
| 1196 | const specUrl = cmd.specUrl === undefined ? specSectionUrl(methodStr, 'command') : cmd.specUrl |
| 1197 | if (specUrl) lines.push(` * @see ${specUrl}`) |
| 1198 | lines.push(' */') |
| 1199 | return lines.join('\n') |
| 1200 | } |
| 1201 | |
| 1202 | function generateCommandMethod(cmd, runtimeByTsName) { |
| 1203 | const { methodName, methodStr, paramsTypeName, hasParams, resultTypeName } = cmd |
no test coverage detected