import { grpc } from '@improbable-eng/grpc-web';
import CID from 'cids';
import { ThreadID, LogID, ThreadInfo, NewThreadOptions, ThreadRecord, LogRecord, Network, Multiaddr, Identity, Libp2pCryptoIdentity } from '@textile/threads-core';
import { ContextInterface } 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: ContextInterface;
    /**
     * Controls the remote API settings.
     */
    serviceHost: string;
    rpcOptions: grpc.RpcOptions;
    /**
     * Creates a new gRPC client instance for accessing the Textile Threads API.
     * @param context The context to use for interacting with the APIs. Can be modified later.
     */
    constructor(context?: ContextInterface);
    /**
     * Create a random user identity.
     */
    static randomIdentity(): Promise<Libp2pCryptoIdentity>;
    /**
     * Obtain a token for interacting with the remote API.
     * @param identity A user identity to use for creating records in the database. A random identity
     * can be created with `Client.randomIdentity(), however, it is not easy/possible to migrate
     * identities after the fact. Please store or otherwise persist any identity information if
     * you wish to retrieve user data later, or use an external identity provider.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getToken(identity: Identity, ctx?: ContextInterface): Promise<string>;
    /**
     * Obtain a token for interacting with the remote API.
     * @param publicKey The public key of a user identity to use for creating records in the database.
     * A random identity can be created with `Client.randomIdentity(), however, it is not
     * easy/possible to migrate identities after the fact. Please store or otherwise persist any
     * identity information if you wish to retrieve user data later, or use an external identity
     * provider.
     * @param callback A callback function that takes a `challenge` argument and returns a signed
     * message using the input challenge and the private key associated with `publicKey`.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @note `publicKey` must be the corresponding public key of the private key used in `callback`.
     */
    getTokenChallenge(publicKey: string, callback: (challenge: Uint8Array) => Uint8Array | Promise<Uint8Array>, ctx?: ContextInterface): Promise<string>;
    /**
     * getHostID returns the network's (remote) host peer ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getHostID(ctx?: ContextInterface): Promise<string>;
    /**
     * 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?: ContextInterface): 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?: ContextInterface): Promise<ThreadInfo>;
    /**
     * getThread with id.
     * @param id The Thread ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    getThread(id: ThreadID, ctx?: ContextInterface): 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?: ContextInterface): Promise<void>;
    /**
     * deleteThread with id.
     * @param id The Thread ID.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    deleteThread(id: ThreadID, ctx?: ContextInterface): 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?: ContextInterface): Promise<string>;
    /**
     * 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?: ContextInterface): 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?: ContextInterface): Promise<undefined>;
    /**
     * 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?: ContextInterface): 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?: ContextInterface): grpc.Request;
    private unary;
}
