instagram-graph-api
Version:
A library to help perform requests to the Instagram Graph API.
176 lines (175 loc) • 5.75 kB
TypeScript
import { AbstractMetric } from './AbstractMetric';
import { MetricValue, BasicInsightsMetricData } from './BasicInsightsMetricData';
/**
* Type to represent a complex metric value.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.2.0
*/
export type ComplexMetricValue = {
[key: string]: number;
};
/**
* Class to represent a complex metric.
*
* As a metric class, it expects to receive an array of values.
* However, for complex metrics that array has a single element.
* This class assumes that to always be true to simplify the access the values.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.1.0
*/
export declare class ComplexMetric extends AbstractMetric<MetricValue<ComplexMetricValue>[]> {
/**
* The value.
*/
private value;
/**
* The end time.
*/
private endTime;
/**
* The constructor.
*
* @param data the metric data.
*/
constructor(data: BasicInsightsMetricData<MetricValue<ComplexMetricValue>[]>);
/**
* Gets the value of the metric.
*
* @returns the value of the metric.
*/
getValue(): ComplexMetricValue;
/**
* Gets the end time of the metric value.
*
* @returns the end time of the metric value.
*/
getEndTime(): Date;
/**
* Gets the keys that match the provided expression.
*
* @param expression expression to match the values to.
*
* @returns the keys that match the provided expression.
*/
getKeysByExpression(expression: (pair: [key: string, value: number]) => boolean): string[];
/**
* Gets the keys of the values that are greater than the provided limit.
*
* @param limit the limit.
*
* @returns the keys of the values that are greater than the provided limit.
*/
getKeysByGreaterThan(limit: number): string[];
/**
* Gets the keys of the values that are greater than or equal to the provided limit.
*
* @param limit the limit.
*
* @returns the keys of the values that are greater than or equal to the provided limit.
*/
getKeysByGreaterThanOrEqualTo(limit: number): string[];
/**
* Gets the keys of the values that are smaller than to the provided limit.
*
* @param limit the limit.
*
* @returns the keys of the values that are smaller than to the provided limit.
*/
getKeysByLessThan(limit: number): string[];
/**
* Gets the keys of the values that are smaller than or equal to the provided limit.
*
* @param limit the limit.
*
* @returns the keys of the values that are smaller than or equal to the provided limit.
*/
getKeysByLessThanOrEqualTo(limit: number): string[];
/**
* Gets the keys of the values that are equal to the provided value.
*
* @param valueToCompare the value to compare to.
*
* @returns the keys of the values that are equal to the provided value.
*/
getKeysByEqualTo(valueToCompare: number): string[];
/**
* Gets the entries that match the provided expression.
*
* @param expression expression to match the values to.
*
* @returns the entries that match the provided expression.
*/
getByExpression(expression: (pair: [key: string, value: number]) => boolean): ComplexMetricValue;
/**
* Gets the entries of the values that are greater than the provided limit.
*
* @param limit the limit.
*
* @returns the entries of the values that are greater than the provided limit.
*/
getByGreaterThan(limit: number): ComplexMetricValue;
/**
* Gets the entries of the values that are greater than or equal to the provided limit.
*
* @param limit the limit.
*
* @returns the entries of the values that are greater than or equal to the provided limit.
*/
getByGreaterThanOrEqualTo(limit: number): ComplexMetricValue;
/**
* Gets the entries of the values that are equal than the provided limit.
*
* @param limit the limit.
*
* @returns the entries of the values that are equal than the provided limit.
*/
getByLessThan(limit: number): ComplexMetricValue;
/**
* Gets the entries of the values that are greater than or equal to the provided limit.
*
* @param limit the limit.
*
* @returns the entries of the values that are greater than or equal to the provided limit.
*/
getByLessThanOrEqualTo(limit: number): ComplexMetricValue;
/**
* Gets the entries of the provided keys.
*
* @param limit the limit.
*
* @returns the entries of the provided keys.
*/
getByKeys(...keys: string[]): ComplexMetricValue;
/**
* Returns the highest value of the metric. In case of a tie, the first value found is returned.
*
* @returns the highest value of the metric.
*/
getHighest(): {
key: string;
value: number;
} | undefined;
/**
* Returns the key of the highest value of the metric. In case of a tie, the key of the first value found is returned.
*
* @returns the key of highest value of the metric.
*/
getHighestKey(): string | undefined;
/**
* Returns the highest value of the metric. In case of a tie, the first value found is returned.
*
* @returns the highest value of the metric.
*/
getLowest(): {
key: string;
value: number;
} | undefined;
/**
* Returns the key of the lowest value of the metric. In case of a tie, the key of the first value found is returned.
*
* @returns the key of lowest value of the metric.
*/
getLowestKey(): string | undefined;
}