import * as pb from '@textile/buckets-grpc/buckets_pb';
import CID from 'cids';
import { grpc } from '@improbable-eng/grpc-web';
import { ContextInterface } from '@textile/context';
import { UserAuth, KeyInfo } from '@textile/security';
import { ThreadID } from '@textile/threads-id';
import { Client } from '@textile/hub-threads-client';
/**
 * The expected result format from pushing a path to a bucket
 */
export interface PushPathResult {
    path: {
        path: string;
        cid: CID;
        root: CID;
        remainder: string;
    };
    root: string;
}
/**
 * Buckets is a web-gRPC wrapper client for communicating with the web-gRPC enabled Textile Buckets API.
 * @example
 * Initialize a the Bucket API
 * ```typescript
 * import { Buckets, UserAuth } from '@textile/hub'
 *
 * const init = async (auth: UserAuth) => {
 *     const buckets = Buckets.withUserAuth(auth)
 *     return buckets
 * }
 * ```
 *
 * @example
 * Find an existing Bucket
 * ```typescript
 * import { Buckets } from '@textile/hub'
 *
 * const exists = async (buckets: Buckets, bucketName: string) => {
 *     const roots = await buckets.list();
 *     return roots.find((bucket) => bucket.name === bucketName)
 * }
 * ```
 */
export declare class Buckets {
    context: ContextInterface;
    serviceHost: string;
    rpcOptions: grpc.RpcOptions;
    /**
     * Creates a new gRPC client instance for accessing the Textile Buckets API.
     * @param context The context to use for interacting with the APIs. Can be modified later.
     */
    constructor(context?: ContextInterface);
    /**
     * Creates a new gRPC client instance for accessing the Textile Buckets API.
     * @param auth The user auth object.
     */
    static withUserAuth(auth: UserAuth, host?: string, debug?: boolean): Buckets;
    /**
     * Create a new gRPC client Bucket instance from a supplied key and secret
     * @param key The KeyInfo object containing {key: string, secret: string, type: 0}. 0 === User Group Key, 1 === Account Key
     */
    static withKeyInfo(key: KeyInfo, host?: string, debug?: boolean): Promise<Buckets>;
    /**
     * Create a new gRPC client Bucket instance from a preconfigured threads client
     * @param client a threads client
     */
    static fromClient(client: Client): Promise<Buckets>;
    /**
     * Open a new / existing bucket by bucket name and ThreadID
     * @param name name of bucket
     * @param threadName the name of the thread where the bucket is stored (default 'buckets')
     * @param threadID id of thread where bucket is stored
     * @example
     * Initialize a Bucket called "app-name-files"
     * ```tyepscript
     * import { Buckets, UserAuth } from '@textile/hub'
     *
     * const open = async (auth: UserAuth, name: string) => {
     *     const buckets = Buckets.withUserAuth(auth)
     *     await buckets.open(name)
     *     return buckets
     * }
     * ```
     */
    open(name: string, threadName?: string, threadID?: ThreadID): Promise<pb.Root.AsObject | undefined>;
    /**
     * Initializes a new bucket.
     * @public
     * @param name Human-readable bucket name. It is only meant to help identify a bucket in a UI and is not unique.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @example
     * Initialize a Bucket called "app-name-files"
     * ```tyepscript
     * import { Buckets } from '@textile/hub'
     *
     * const init = async (buckets: Buckets) => {
     *     return buckets.init("app-name-files")
     * }
     * ```
     */
    init(name: string, ctx?: ContextInterface): Promise<pb.InitReply.AsObject>;
    /**
     * Returns a list of all bucket roots.
     * @example
     * Find an existing Bucket named "app-name-files"
     * ```typescript
     * import { Buckets } from '@textile/hub'
     *
     * const exists = async (buckets: Buckets) => {
     *     const roots = await buckets.list();
     *     return roots.find((bucket) => bucket.name ===  "app-name-files")
     * }
     * ````
     */
    list(ctx?: ContextInterface): Promise<pb.Root.AsObject[]>;
    /**
     * Returns a list of bucket links.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @example
     * Generate the HTTP, IPNS, and IPFS links for a Bucket
     * ```tyepscript
     * import { Buckets } from '@textile/hub'
     *
     * const getLinks = async (buckets: Buckets) => {
     *    const links = buckets.links(bucketKey)
     *    return links.ipfs
     * }
     *
     * const getIpfs = async (buckets: Buckets) => {
     *    const links = buckets.links(bucketKey)
     *    return links.ipfs
     * }
     * ```
     */
    links(key: string, ctx?: ContextInterface): Promise<pb.LinksReply.AsObject>;
    /**
     * Returns information about a bucket path.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param path A file/object (sub)-path within a bucket.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    listPath(key: string, path: string, ctx?: ContextInterface): Promise<pb.ListPathReply.AsObject>;
    /**
     * Removes an entire bucket. Files and directories will be unpinned.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    remove(key: string, ctx?: ContextInterface): Promise<void>;
    /**
     * Returns information about a bucket path.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param path A file/object (sub)-path within a bucket.
     * @param ctx Context object containing web-gRPC headers and settings.
     */
    removePath(key: string, path: string, ctx?: ContextInterface): Promise<void>;
    /**
     * Pushes a file to a bucket path.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param path A file/object (sub)-path within a bucket.
     * @param input The input file/stream/object.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @param opts Options to control response stream. Currently only supports a progress function.
     * @remarks
     * This will return the resolved path and the bucket's new root path.
     * @example
     * Push a file to the root of a bucket
     * ```tyepscript
     * import { Buckets } from '@textile/hub'
     *
     * const pushFile = async (content: string, bucketKey: string) => {
     *    const file = { path: '/index.html', content: Buffer.from(content) }
     *    return await buckets.pushPath(bucketKey!, 'index.html', file)
     * }
     * ```
     */
    pushPath(key: string, path: string, input: any, ctx?: ContextInterface, opts?: {
        progress?: (num?: number) => void;
    }): Promise<PushPathResult>;
    /**
     * Pulls the bucket path, returning the bytes of the given file.
     * @param key Unique (IPNS compatible) identifier key for a bucket.
     * @param path A file/object (sub)-path within a bucket.
     * @param ctx Context object containing web-gRPC headers and settings.
     * @param opts Options to control response stream. Currently only supports a progress function.
     */
    pullPath(key: string, path: string, ctx?: ContextInterface, opts?: {
        progress?: (num?: number) => void;
    }): AsyncIterableIterator<Uint8Array>;
    private unary;
}
