instagram-graph-api
Version:
A library to help perform requests to the Instagram Graph API.
50 lines (49 loc) • 1.82 kB
TypeScript
import { AbstractResponse } from './AbstractResponse';
import { AbstractMetric } from './data/insights/AbstractMetric';
/**
* Abstract class for representing a response from a Page Insights request.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.1.0
*/
export declare abstract class AbstractGetInsightsResponse<T extends AbstractMetric<unknown>> extends AbstractResponse<T[]> {
/**
* Gets the metrics in the response.
*
* @returns the metrics in the response.
*/
getMetrics(): T[];
/**
* Finds the first metric that matches the given expression. Returns undefined if no match is found.
*
* @param expression the expression to match with the metric.
*
* @returns the first metric that matches the given expression or undefined if no match is found.
*/
getMetricByExpression(expression: (metric: T) => boolean): T | undefined;
/**
* Finds all the metrics that match the given expression.
*
* @param expression the expression to match with the metrics.
*
* @returns an array of the metrics that match the expression.
*/
getMetricsByExpression(expression: (metric: T) => boolean): T[];
/**
* Finds the metric with the given name. Returns undefined if not found.
*
* @param name the name of the metric.
* @param ignoreCase whether to ignore the case of the name. True by default.
*
* @returns the metric with the given name or undefined if not found.
*/
getMetricByName(name: string, ignoreCase?: boolean): T | undefined;
/**
* Finds all the metrics whose names match the given regex.
*
* @param name the regex.
*
* @returns the metrics whose names match the given regex.
*/
getMetricsByRegex(regexString: string): T[];
}