UNPKG

adk-typescript

Version:

TypeScript port of Google's Agent Development Kit (ADK)

112 lines (111 loc) 2.94 kB
/** * Common utility functions and interfaces for OpenAPI tool implementation */ /** * Converts a string to snake_case * @param text The input string * @returns The snake_case version of the string */ export declare function toSnakeCase(text: string): string; /** * Converts a string to camelCase * @param text The input string * @returns The camelCase version of the string */ export declare function toCamelCase(text: string): string; /** * Renames TypeScript keywords by adding a prefix * @param s The input string * @param prefix The prefix to add to the keyword * @returns The renamed string if it's a keyword, otherwise the original string */ export declare function renameTypescriptKeywords(s: string, prefix?: string): string; /** * Schema interface for OpenAPI schema objects */ export interface Schema { type?: string; format?: string; description?: string; properties?: Record<string, Schema>; items?: Schema; required?: string[]; enum?: Array<string | number | boolean>; example?: any; default?: any; anyOf?: Schema[]; allOf?: Schema[]; oneOf?: Schema[]; [key: string]: any; } /** * Interface for operation endpoints */ export interface OperationEndpoint { baseUrl: string; path: string; method: string; } /** * API Parameter */ export declare class ApiParameter { originalName: string; paramLocation: string; paramSchema: Schema; description: string; pyName: string; typeValue: any; typeHint: string; /** * Create a new API parameter */ constructor(originalName: string, paramLocation: string, paramSchema: Schema | string, description?: string, pyName?: string); /** * Convert parameter to string */ toString(): string; /** * Convert parameter to an argument string for function call */ toArgString(): string; /** * Convert parameter to a dictionary property string */ toDictProperty(): string; /** * Convert parameter to JSDoc */ toJSDocString(): string; } /** * Helper class for generating type hints */ export declare class TypeHintHelper { /** * Get the TypeScript type information for a schema * @param schema The OpenAPI schema * @returns Object containing typeValue and typeHint */ static getTypeInfo(schema: Schema): { typeValue: any; typeHint: string; }; } /** * Helper class for generating JSDoc */ export declare class JsDocHelper { /** * Generate JSDoc for a parameter * @param param The API parameter * @returns JSDoc string for the parameter */ static generateParamDoc(param: ApiParameter): string; /** * Generate JSDoc for return value * @param responses The OpenAPI responses object * @returns JSDoc string for the return value */ static generateReturnDoc(responses: Record<string, any>): string; }