import { grpc } from '@improbable-eng/grpc-web';
import CID from 'cids';
import PeerId from 'peer-id';
import { ThreadID, LogID, ThreadInfo, NewThreadOptions, ThreadRecord, LogRecord, Network, Multiaddr, Identity } from '@textile/threads-core';
import { Context, ContextKeys } from '@textile/context';
/**
 * 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 Threads gRPC Network.
 */
export declare class Client implements Network {
    context: Context | ContextKeys;
    /**
     * Controls the remote API settings.
     */
    serviceHost: string;
    rpcOptions: grpc.RpcOptions;
    /**
     * Client creates a new gRPC client instance.
     * @param context The context to use for interacting with the APIs. Can be modified later.
     */
    constructor(context?: Context | ContextKeys);
    /**
     * Obtain a token for interacting with the remote network API.
     * @param identity The generic identity to use for signing and validation.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @note If an identity is not provided, a random PKI identity is used. This might not be what you want!
     * It is not easy/possible to migrate identities after the fact. Please supply an identity argument if
     * you wish to persist/retrieve user data later.
     */
    getToken(identity?: Identity, ctx?: Context): Promise<string>;
    /**
     * getHostID returns the network's (remote) host peer ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getHostID(ctx?: Context): Promise<PeerId>;
    /**
     * createThread with id.
     * @param id The Thread id.
     * @param opts The set of keys to use when creating the Thread. All keys are "optional", though if no replicator key
     * is provided, one will be created (and returned) on the remote network. Similarly, if no LogKey is provided, then
     * a private key will be generated (and returned) on the remote network. If no ReadKey is provided, the remote
     * network will be unable to write records (but it can return records).
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    createThread(id: ThreadID, opts: NewThreadOptions, ctx?: Context): Promise<ThreadInfo>;
    /**
     * addThread from a multiaddress.
     * @param addr The Thread multiaddr.
     * @param opts The set of keys to use when adding the Thread.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    addThread(addr: Multiaddr, opts: NewThreadOptions, ctx?: Context): Promise<ThreadInfo>;
    /**
     * getThread with id.
     * @param id The Thread ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getThread(id: ThreadID, ctx?: Context): Promise<ThreadInfo>;
    /**
     * pullThread for new records.
     * @param id The Thread ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    pullThread(id: ThreadID, ctx?: Context): Promise<void>;
    /**
     * deleteThread with id.
     * @param id The Thread ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    deleteThread(id: ThreadID, ctx?: Context): Promise<void>;
    /**
     * addReplicator to a thread.
     * @param id The Thread ID.
     * @param addr The multiaddress of the replicator peer.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    addReplicator(id: ThreadID, addr: Multiaddr, ctx?: Context): Promise<PeerId>;
    /**
     * createRecord with body.
     * @param id The Thread ID.
     * @param body The body to add as content.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    createRecord(id: ThreadID, body: any, ctx?: Context): Promise<ThreadRecord | undefined>;
    /**
     * addRecord to the given log.
     * @param id The Thread ID.
     * @param logID The Log ID.
     * @param rec The log record to add.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    addRecord(id: ThreadID, logID: LogID, rec: LogRecord, ctx?: Context): Promise<void>;
    /**
     * getRecord returns the record at cid.
     * @param id The Thread ID.
     * @param rec The record's CID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getRecord(id: ThreadID, rec: CID, ctx?: Context): Promise<LogRecord>;
    /**
     * subscribe to new record events in the given threads.
     * @param cb The callback to call on each new thread record.
     * @param threads The variadic set of threads to subscribe to.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    subscribe(cb: (rec?: ThreadRecord, err?: Error) => void, threads?: ThreadID[], ctx?: Context): grpc.Request;
    private unary;
}
