/// <reference types="node" />
import { ThreadID } from '@textile/threads-core';
import { Config, BaseConfig, QueryJSON, Instance, InstanceList, Filter, Query, Where, WriteTransaction, ReadTransaction } from './models';
export { ThreadID };
export { BaseConfig, Config, Instance, QueryJSON };
export { Query, Where };
/**
 * Client is a web-gRPC wrapper client for communicating with a webgRPC-enabled Textile server.
 * This client library can be used to interact with a local or remote Textile gRPC-service
 *  It is a wrapper around Textile's 'DB' API, which is defined here: https://github.com/textileio/go-threads/blob/master/api/pb/api.proto.
 */
export declare class Client {
    /**
     * version is the release version.
     */
    static version(): string;
    /**
     * config is the (public) threads config.
     */
    readonly config: Config;
    /**
     * Client creates a new gRPC client instance.
     * @param config A set of configuration settings to control the client.
     */
    constructor(config?: Config | BaseConfig);
    /**
     * newDB creates a new store on the remote node.
     * @param dbID the ID of the database
     */
    newDB(dbID: Buffer): Promise<void>;
    /**
     * newCollection registers a new model schema under the given name on the remote node.
     * The schema must be a valid json-schema.org schema, and can be a JSON string or Javascript object.
     * @param dbID the ID of the database
     * @param name The human-readable name for the model.
     * @param schema The actual json-schema.org compatible schema object.
     */
    newCollection(dbID: Buffer, name: string, schema: any): Promise<void>;
    /**
     * newDBFromAddr initializes the client with the given store, connecting to the given
     * thread address (database). It should be called before any operation on the store, and is an
     * alternative to start, which creates a local store. newDBFromAddr should also include the
     * read and follow keys, which should be Buffer, Uint8Array or base58-encoded strings.
     * See `getDBInfo` for a possible source of the address and keys.
     * @param address The address for the thread with which to connect.
     * Should be of the form /ip4/<url/ip-address>/tcp/<port>/p2p/<peer-id>/thread/<thread-id>
     * @param key The set of keys to use to connect to the database
     * @param collections An array of Name and JSON Schemas for collections in the DB.
     */
    newDBFromAddr(address: string, key: string | Uint8Array, collections: Array<{
        name: string;
        schema: any;
    }>): Promise<unknown>;
    /**
     * getDBInfo returns invite 'links' unseful for inviting other peers to join a given store/thread.
     * @param dbID the ID of the database
     */
    getDBInfo(dbID: Buffer): Promise<{
        address: string;
        key: string;
    }[]>;
    /**
     * Creates a new model instance in the given store.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param values An array of model instances as JSON/JS objects.
     */
    create<T = any>(dbID: Buffer, collectionName: string, values: any[]): Promise<string[]>;
    /**
     * Saves changes to an existing model instance in the given store.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param values An array of model instances as JSON/JS objects. Each model instance must have a valid existing `ID` property.
     */
    save(dbID: Buffer, collectionName: string, values: any[]): Promise<void>;
    /**
     * Deletes an existing model instance from the given store.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param IDs An array of instance ids to delete.
     */
    delete(dbID: Buffer, collectionName: string, IDs: string[]): Promise<void>;
    /**
     * has checks whether a given instance exists in the given store.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param IDs An array of instance ids to check for.
     */
    has(dbID: Buffer, collectionName: string, IDs: string[]): Promise<boolean>;
    /**
     * find queries the store for entities matching the given query parameters.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param query The object that describes the query. User Query class or primitive QueryJSON type.
     */
    find<T = any>(dbID: Buffer, collectionName: string, query: QueryJSON): Promise<InstanceList<T>>;
    /**
     * findByID queries the store for the id of an instance.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     * @param ID The id of the instance to search for.
     */
    findByID<T = any>(dbID: Buffer, collectionName: string, ID: string): Promise<Instance<T>>;
    /**
     * readTransaction creates a new read-only transaction object. See ReadTransaction for details.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     */
    readTransaction(dbID: Buffer, collectionName: string): ReadTransaction;
    /**
     * writeTransaction creates a new writeable transaction object. See WriteTransaction for details.
     * @param dbID the ID of the database
     * @param collectionName The human-readable name of the model to use.
     */
    writeTransaction(dbID: Buffer, collectionName: string): WriteTransaction;
    /**
     * listen opens a long-lived connection with a remote node, running the given callback on each new update to the given instance.
     * The return value is a `close` function, which cleanly closes the connection with the remote node.
     * @param dbID the ID of the database
     * @param filters contains an array of Filters
     * @param callback The callback to call on each update to the given instance.
     */
    listen<T = any>(dbID: Buffer, filters: Filter[], callback: (reply?: Instance<T>, err?: Error) => void): () => void;
    private unary;
}
export default Client;
