UNPKG

canny-api-js

Version:

Unofficial node API wrapper for Canny's API (https://canny.io/).

53 lines (52 loc) 2.01 kB
import { AxiosInstance } from 'axios'; interface ICannyCommentListArgs { /** The id of the author you'd like to fetch comments for. */ authorID?: string; /** The id of the board you'd like to fetch comments for. */ boardID?: string; /** The number of comments you'd like to fetch. Defaults to 10 if not specified. */ limit?: number; /** The id of the post you'd like to fetch comments for. */ postID?: string; /** The number of comments you'd like to skip before starting to fetch. Defaults to 0 if not specified. */ skip?: number; } interface ICannyCommentListResponse { hasMore: boolean; comments: ICannyComment[]; } interface ICannyCommentCreateArgs { /** The unique identifier of the comment's author. */ authorID: string; /** The unique identifier of the comment's post. */ postID: string; /** The comment value. */ value: string; /** An array of the URLs of comment's images. */ imageURLs?: string[]; /** Whether this comment is only available for internal usage. Default is false. */ internal?: boolean; /** The unique identifier of the comment's parent, if this comment is a reply. */ parentID?: string; /** Whether this comment should be allowed to trigger email notifications. Default is false. */ shouldNotifyVoters?: boolean; } interface ICannyCommentCreateResponse { id: string; } interface ICannyCommentDeleteArgs { commentID: string; } export default class Comments { static COMMENTS_RETRIEVE_ROUTE: string; static COMMENTS_LIST_ROUTE: string; static COMMENTS_CREATE_ROUTE: string; static COMMENTS_DELETE_ROUTE: string; private axios; constructor(axios: AxiosInstance); retrieve(id: string): Promise<ICannyComment>; list(args?: ICannyCommentListArgs): Promise<ICannyCommentListResponse>; create(args: ICannyCommentCreateArgs): Promise<ICannyCommentCreateResponse>; delete(args: ICannyCommentDeleteArgs | string): Promise<string>; } export {};