@trophyso/node
Version:
NodeJS SDK for the Trophy API
38 lines (37 loc) • 1.28 kB
TypeScript
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as TrophyApi from "../../..";
export declare namespace Metrics {
interface Options {
environment?: core.Supplier<environments.TrophyApiEnvironment | string>;
apiKey: core.Supplier<string>;
}
interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}
export declare class Metrics {
protected readonly _options: Metrics.Options;
constructor(_options: Metrics.Options);
/**
* Increment or decrement the value of a metric for a user.
* @throws {@link TrophyApi.BadRequestError}
* @throws {@link TrophyApi.UnauthorizedError}
* @throws {@link TrophyApi.UnprocessableEntityError}
*
* @example
* await trophyApi.metrics.event("words-written", {
* user: {
* email: "user@example.com",
* tz: "Europe/London",
* id: "18"
* },
* value: 750
* })
*/
event(key: string, request: TrophyApi.MetricsEventRequest, requestOptions?: Metrics.RequestOptions): Promise<TrophyApi.EventResponse>;
}