UNPKG

instagram-graph-api

Version:

A library to help perform requests to the Instagram Graph API.

34 lines (33 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetMediaCommentsRequest = void 0; const Enums_1 = require("../../../Enums"); const GetObjectCommentsResponse_1 = require("../../common/GetObjectCommentsResponse"); const AbstractMediaCommentsRequest_1 = require("./AbstractMediaCommentsRequest"); /** * A request that gets the comments of a media object. * * @author Tiago Grosso <tiagogrosso99@gmail.com> * @since 0.5.0 */ class GetMediaCommentsRequest extends AbstractMediaCommentsRequest_1.AbstractMediaCommentsRequest { /** * The constructor. * * @param accessToken the access token. * @param mediaId the media object id. * @param fields the fields to retrieve from the API. If no field is specified, all are retrieved. */ constructor(accessToken, mediaId, ...fields) { super(accessToken, mediaId); 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 GetObjectCommentsResponse_1.GetObjectCommentsResponse(response.data); } } exports.GetMediaCommentsRequest = GetMediaCommentsRequest;