instagram-graph-api
Version:
A library to help perform requests to the Instagram Graph API.
34 lines (33 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetCommentRequest = void 0;
const Enums_1 = require("../../Enums");
const AbstractCommentRequest_1 = require("./AbstractCommentRequest");
const GetCommentResponse_1 = require("./GetCommentResponse");
/**
* Request to get information about a comment.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.6.0
*/
class GetCommentRequest extends AbstractCommentRequest_1.AbstractCommentRequest {
/**
* The constructor.
*
* @param accessToken the access token.
* @param pageId the id of the comment.
* @param fields the fields to retrieve from the API. If no field is specified, all are retrieved.
*/
constructor(accessToken, commentId, ...fields) {
super(accessToken, commentId);
const fieldsSet = fields.length > 0 ? new Set(fields) : new Set(Object.values(Enums_1.CommentField));
this.params.fields = Array.from(fieldsSet).join(',');
}
/**
* @inheritdoc
*/
parseResponse(response) {
return new GetCommentResponse_1.GetCommentResponse(response.data);
}
}
exports.GetCommentRequest = GetCommentRequest;