adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
78 lines (77 loc) • 2.14 kB
TypeScript
import { ApiParameter, OperationEndpoint } from '../common/common';
import { AuthCredential, AuthScheme } from '../auth/AuthTypes';
/**
* Represents a parsed operation from an OpenAPI spec
*/
export interface ParsedOperation {
/**
* The name of the operation
*/
name: string;
/**
* The description of the operation
*/
description: string;
/**
* The endpoint information
*/
endpoint: OperationEndpoint;
/**
* The operation object from the OpenAPI spec
*/
operation: any;
/**
* The parameters for the operation
*/
parameters: ApiParameter[];
/**
* The return value of the operation
*/
returnValue: ApiParameter;
/**
* The authentication scheme for the operation
*/
authScheme?: AuthScheme;
/**
* The authentication credential for the operation
*/
authCredential?: AuthCredential;
/**
* Additional context for the operation
*/
additionalContext?: any;
}
/**
* Class that parses OpenAPI specifications into a list of parsed operations
*/
export declare class OpenApiSpecParser {
/**
* Parse an OpenAPI specification into a list of operations
* @param openApiSpecDict The OpenAPI specification as a dictionary
* @returns A list of parsed operations
*/
parse(openApiSpecDict: Record<string, any>): ParsedOperation[];
/**
* Collect operations from an OpenAPI specification
* @param openApiSpec The OpenAPI specification
* @returns A list of parsed operations
*/
private _collectOperations;
/**
* Get the function name from an operation ID
* @param operationId The operation ID
* @returns The function name
*/
private _getFunctionName;
/**
* Resolve references in an OpenAPI specification
* @param openApiSpec The OpenAPI specification
* @returns The resolved OpenAPI specification
*/
private _resolveReferences;
/**
* Deduplicates parameter names to avoid conflicts
* @param params List of parameters to deduplicate
*/
private _dedupeParamNames;
}