/// <reference types="web" />
/// <reference types="node" />
interface CellType<Value extends BaseValue = any, BaseValue = any> {
    readonly id: string;
    readonly displayName: string;
    readonly defaultValue: Value;
    readonly validate: (value: BaseValue) => value is Value;
    is<ExpectedCellType extends CellType<unknown>>(t: ExpectedCellType): this is ExpectedCellType;
}

declare type BaseType = 'int' | 'str' | 'list' | 'dict';
declare type PyType = BaseType | `typing.List[${BaseType}]`;
declare function matchType(type: PyType): CellType;
declare type FunctionPreview = {
    /**
     * Unique ID that won't make conflict
     */
    id: string;
    name: string;
    description: string;
    path: `/param/${string}`;
};
declare type GetListResponse = {
    list: FunctionPreview[];
};
declare function getList(url: URL, init?: RequestInit): Promise<GetListResponse>;
declare type Param = {
    type: PyType;
    treat_as: 'config' | 'column' | 'cell';
    whitelist?: string[];
    example?: any[];
};
declare type FunctionDetail = {
    /**
     * Unique ID that won't make conflict
     */
    id: string;
    /**
     * Display Name
     */
    name: string;
    destination: null | string;
    /**
     * Params of the function
     */
    params: {
        [key: string]: {
            type: PyType;
            treat_as: 'config' | 'column' | 'cell';
            whitelist?: string[];
            example?: any[];
        };
    };
    /**
     * Output data type
     */
    return_type: {
        [key: string]: PyType;
    };
    /**
     * Description of this function
     */
    description: string;
    /**
     * Json Schema
     *  Refs: https://json-schema.org/
     */
    schema: Record<string, any>;
};
declare function getParam(url: URL, init?: RequestInit): Promise<FunctionDetail>;
declare type CallBody = {
    [x: string]: any;
};
declare type PostCallResponseSuccess = {
    [key: string]: any;
};
declare type PostCallResponseError = {
    'error_type': 'wrapper' | 'function';
    'error_body': string;
};
declare type PostCallResponse = PostCallResponseSuccess | PostCallResponseError;
declare function callFunction(url: URL, body: CallBody, init?: RequestInit): Promise<PostCallResponse>;

export { BaseType, CallBody, FunctionDetail, FunctionPreview, GetListResponse, Param, PostCallResponse, PostCallResponseError, PostCallResponseSuccess, PyType, callFunction, getList, getParam, matchType };
