textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
61 lines (60 loc) • 2.31 kB
TypeScript
import { IBlock, IFilesList, IFiles } from './model';
/**
* Add raw data to a Textile thread
* @param base64 Raw data as a base64 string
* @param threadId The thread id the data will be added to
* @param caption A caption to associate with the data
* @returns A Promise that will resolve with the Block result
*/
export declare function addData(base64: string, threadId: string, caption?: string): Promise<IBlock>;
/**
* Add files to a Textile thread
* @param paths Comma separated list of file paths to add, can be file system paths, IPFS hashes, or existing hashes
* @param threadId The thread id the files will be added to
* @param caption A caption to associate with the files
* @returns A Promise that will resolve with the Block result
*/
export declare function addFiles(paths: string, threadId: string, caption?: string): Promise<IBlock>;
/**
* Share files already aded to a Textile thread to a Textile thread
* @param target The source thread target of the files to share
* @param threadId The thread id the files will be shared to
* @param caption A caption to associate with the files
* @returns A Promise that will resolve with the Block result
*/
export declare function shareFiles(target: string, threadId: string, caption?: string): Promise<IBlock>;
/**
* Get a Files object by block id
* @param blockId The block id of the Files to get
* @returns A Promise that will resolve with the Files result
*/
export declare function file(blockId: string): Promise<IFiles>;
/**
* List all files or files in a known Thread.
* ```typescript
* Textile.files.list(threadId, offset, limit);
* ```
*/
export declare function list(threadId: string, offset: string, limit: number): Promise<IFilesList>;
/**
* Get the raw data for a file at an IPFS hash.
* ```typescript
* Textile.files.content(hash);
* ```
*/
export declare function content(hash: string): Promise<{
data: Uint8Array;
mediaType: string;
}>;
/**
* Get the best size image from a Thread with MEDIA type thread given a minimum width.
*
* Note: pth is <target>/<index>, e.g., "Qm.../0"
* ```typescript
* Textile.files.imageContentForMinWidth(path, minWidth);
* ```
*/
export declare function imageContentForMinWidth(pth: string, minWidth: number): Promise<{
data: Uint8Array;
mediaType: string;
}>;