instagram-graph-api
Version:
A library to help perform requests to the Instagram Graph API.
38 lines (37 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetPageLifetimeInsightsRequest = void 0;
const Enums_1 = require("../../../Enums");
const AbstractGetPageInsightsRequest_1 = require("./AbstractGetPageInsightsRequest");
const GetPageLifetimeInsightsResponse_1 = require("./GetPageLifetimeInsightsResponse");
/**
* A Page Insights Get Request that queries a lifetime metric.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.2.0
*/
class GetPageLifetimeInsightsRequest extends AbstractGetPageInsightsRequest_1.AbstractGetPageInsightsRequest {
/**
* The constructor.
* @param accessToken the access token.
* @param pageId the page id.
* @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved.
*/
constructor(accessToken, pageId, ...metrics) {
const metricsSet = metrics.length > 0 ? new Set(metrics) : new Set(Object.values(Enums_1.LifetimeMetric));
super(accessToken, pageId, metricsSet);
}
/**
* @inheritdoc
*/
parseResponse(response) {
return new GetPageLifetimeInsightsResponse_1.GetPageLifetimeInsightsResponse(response.data);
}
/**
* @inheritdoc
*/
period() {
return Enums_1.MetricPeriod.LIFETIME;
}
}
exports.GetPageLifetimeInsightsRequest = GetPageLifetimeInsightsRequest;