instagram-graph-api
Version:
A library to help perform requests to the Instagram Graph API.
36 lines (35 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractGetPageInsightsRequest = void 0;
const AbstractRequest_1 = require("../../AbstractRequest");
/**
* An abstract class to represent Page Insights Get Requests.
*
* @param T the type of the metrics of the request.
* @param R the type of the response.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.2.0
*/
class AbstractGetPageInsightsRequest extends AbstractRequest_1.AbstractRequest {
/**
* The constructor.
*
* @param accessToken the access token.
* @param pageId the page ID.
* @param metrics the metrics definitions.
*/
constructor(accessToken, pageId, metrics) {
super(accessToken);
this.pageId = pageId;
this.params.metric = Array.from(metrics).join(',');
this.params.period = this.period();
}
/**
* @inheritdoc
*/
url() {
return `/${this.pageId}/insights`;
}
}
exports.AbstractGetPageInsightsRequest = AbstractGetPageInsightsRequest;