( client: Client, flags: ParsedFlags, tag: string, operationId: string )
| 216 | } |
| 217 | |
| 218 | export async function printOperationHelpForTagCommand( |
| 219 | client: Client, |
| 220 | flags: ParsedFlags, |
| 221 | tag: string, |
| 222 | operationId: string |
| 223 | ): Promise<number> { |
| 224 | const openApi = createOpenApiCache(client, flags['--spec-url']); |
| 225 | const loaded = await openApi.loadWithSpinner(flags['--refresh'] ?? false); |
| 226 | if (!loaded) { |
| 227 | output.error(openApi.loadError ?? 'Could not load API specification'); |
| 228 | return 1; |
| 229 | } |
| 230 | |
| 231 | const allEndpoints = openApi.getEndpoints(); |
| 232 | const resolved = resolveEndpointByTagAndOperationId( |
| 233 | allEndpoints, |
| 234 | tag, |
| 235 | operationId |
| 236 | ); |
| 237 | |
| 238 | if (!resolved.ok) { |
| 239 | printTagOperationResolveError(resolved, allEndpoints); |
| 240 | return 1; |
| 241 | } |
| 242 | |
| 243 | const ep = resolved.endpoint; |
| 244 | const bodyFields = openApi.getBodyFields(ep); |
| 245 | printOperationHelpDetails(ep, bodyFields, tag); |
| 246 | return 2; |
| 247 | } |
| 248 | |
| 249 | function printOperationHelpDetails( |
| 250 | ep: EndpointInfo, |
no test coverage detected