Skip to main content

CommentApiClient

Contains all the endpoints needed to manage comments.

Constructors

Constructor

new CommentApiClient(): CommentApiClient

Returns

CommentApiClient

Methods

createComment()

static createComment(data, config?): Promise<SCCommentType>

This endpoint creates a comment.

Parameters

ParameterTypeDescription
dataCommentCreateParams
config?AxiosRequestConfig

Returns

Promise<SCCommentType>


deleteComment()

static deleteComment(id, config?): Promise<any>

This endpoint deletes a specific comment using ID. The logged user must be the comment creator.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<any>


flagComment()

static flagComment(id, flagType, config?): Promise<any>

This endpoint flags a specific comment.

Parameters

ParameterTypeDescription
idstring | number
flagTypeSCFlagTypeEnum
config?AxiosRequestConfig

Returns

Promise<any>


getAllComments()

static getAllComments(params, config?): Promise<SCPaginatedResponse<SCCommentType>>

This endpoint retrieves all comments.

Parameters

ParameterTypeDescription
paramsCommentListParams
config?AxiosRequestConfig

Returns

Promise<SCPaginatedResponse<SCCommentType>>


getASpecificComment()

static getASpecificComment(id, config?): Promise<SCCommentType>

This endpoint retrieves a specific comment using ID.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<SCCommentType>


getSpecificCommentFlags()

static getSpecificCommentFlags(id, config?): Promise<SCPaginatedResponse<SCFlagType>>

This endpoint retrieves a List of Flags for a Specific Comment. This operation requires moderation role.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<SCPaginatedResponse<SCFlagType>>


getSpecificCommentFlagStatus()

static getSpecificCommentFlagStatus(id, config?): Promise<SCFlagType>

This endpoint retrieves, if exists, a flag for this contribute created by the user logged.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<SCFlagType>


getSpecificCommentVotesList()

static getSpecificCommentVotesList(id, config?): Promise<SCPaginatedResponse<SCVoteType>>

This endpoint retrieves all votes for a specific comment.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<SCPaginatedResponse<SCVoteType>>


restoreComment()

static restoreComment(id, config?): Promise<any>

This endpoint restores a specific comment using ID. The logged user must be the comment creator.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<any>


updateComment()

static updateComment(id, text, config?): Promise<SCCommentType>

This endpoint updates a specific comment. The logged user must be the comment creator.

Parameters

ParameterTypeDescription
idstring | number
textstring
config?AxiosRequestConfig

Returns

Promise<SCCommentType>


upvoteComment()

static upvoteComment(id, config?): Promise<any>

This endpoint upvotes a specific comment.

Parameters

ParameterTypeDescription
idstring | number
config?AxiosRequestConfig

Returns

Promise<any>