import { grpc } from "@improbable-eng/grpc-web"; import { CidInfoResponse, CidSummaryResponse, LogEntry, ReplaceDataResponse, StageResponse } from "@textile/grpc-powergate-client/dist/powergate/user/v1/user_pb"; import { Config } from "../types"; import { GetFolderOptions, WatchLogsOptions } from "./types"; export { GetFolderOptions, WatchLogsOptions }; export interface Data { /** * A helper method to stage data in IPFS in preparation for storing using storageConfig.apply. * This doesn't actually store data in Powergate, you'll want to call storageConfig.apply for that. * @param input The raw data to add. * @returns The cid of the added data. */ stage: (input: Uint8Array) => Promise; /** * A helper method to stage a folder recursively in IPFS in preparation for storing using storageConfig.apply. * This doesn't actually store data in Powergate, you'll want to call storageConfig.apply for that. * @param path The path to the folder to add. * @returns The cid of the added folder. */ stageFolder: (path: string) => Promise; /** * Applies a StorageConfig for cid2 equal to that of cid1, and removes cid1. This operation * is more efficient than manually removing and adding in two separate operations. * @param cid1 The cid to replace. * @param cid2 The new cid. * @returns The job id of the job executing the storage configuration. */ replaceData: (cid1: string, cid2: string) => Promise; /** * Retrieve data stored by the current user. * @param cid The cid of the data to retrieve. * @returns The raw data. */ get: (cid: string) => Promise; /** * Retrieve a folder stored stored by the current user. * @param cid The root cid of the folder to retrieve. * @param outputPath The location to write the folder to * @param opts Options controlling the behavior of retrieving the folder */ getFolder: (cid: string, output: string, opts?: GetFolderOptions) => Promise; /** * Listen for any updates for a stored cid. * @param handler The callback to receive log updates. * @param cid The cid to watch. * @param opts Options that control the behavior of watching logs. * @returns A function that can be used to cancel watching. */ watchLogs: (handler: (event: LogEntry.AsObject) => void, cid: string, opts?: WatchLogsOptions) => () => void; /** * Get high level information about the current state of cids in Powergate. * @param cids A list of cids to filter the results by. * @returns An object containing a list of cid summary info. */ cidSummary: (...cids: string[]) => Promise; /** * Get detailed information about the current state of a cid in Powergate. * @param cid The cid to get information for. * @returns An object with detailed information about the cid. */ cidInfo: (cid: string) => Promise; } /** * @ignore */ export declare const createData: (config: Config, getMeta: () => grpc.Metadata, getHeaders: () => Record) => Data;