measurely-js
Version:
A client library for interacting with the Measurely API to manage and track custom metrics easily.
28 lines (27 loc) • 930 B
TypeScript
type CapturePayload = {
value: number;
filters?: {
[category: string]: string;
};
};
type CaptureResult = {
success: boolean;
message: string;
};
export default class Measurely {
private static API_KEY;
/**
* Initializes the Measurely library with an API key.
* This key is required for authentication when interacting with the API.
* @param NEW_API_KEY - The API key provided by Measurely.
*/
static init(NEW_API_KEY: string): void;
/**
* Sends a metric to the Measurely API.
* @param metric_identifier - The metric id or metric name to be tracked.
* @param payload - The data payload containing the metric value and optional filters.
* @returns A Promise resolving to a CaptureResult object indicating the operation's outcome.
*/
static capture(metric_identifier: string, payload: CapturePayload): Promise<CaptureResult>;
}
export {};