textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
44 lines (43 loc) • 1.27 kB
TypeScript
import { API } from '../core/api';
import { Comment, CommentList, Block } from '../models';
/**
* Comments is an API module for managing thread/block comments
*
* Comments are added as blocks in a thread, which target another block, usually a file(s).
*
* @extends API
*/
export default class Comments extends API {
/**
* Adds a comment to a block
*
* @param block Target block ID. Usually a file(s) block.
* @param body Comment body
* @returns The generated comment block
*/
add(block: string, body: string): Promise<Comment>;
/**
* Retrieves a comment by ID
*
* @param id ID of the target comment
* @returns The target comment block
*/
get(id: string): Promise<Comment>;
/**
* Retrieves a list of comments on a target block
*
* @param block ID of the target block
* @returns An array of comment blocks
*/
list(block: string): Promise<CommentList>;
/**
* Ignores a block comment by its ID
*
* This adds an 'ignore' thread block targeted at the comment.
* Ignored blocks are by default not returned when listing.
*
* @param id ID of the comment
* @returns The ignored block
*/
ignore(id: string): Promise<Block>;
}