@trophyso/node
Version:
NodeJS SDK for the Trophy API
31 lines (30 loc) • 1.59 kB
TypeScript
import type * as TrophyApi from "../index";
/**
* A points trigger to create.
*/
export interface CreatePointsTriggerRequestItem {
/** The type of trigger. */
type: TrophyApi.CreatePointsTriggerRequestItemType;
/** The number of points to award or deduct when the trigger fires. Cannot be zero. */
points: number;
/** The status of the trigger. Defaults to 'inactive'. */
status?: TrophyApi.CreatePointsTriggerRequestItemStatus;
/** Optional user attribute filters for the trigger. */
userAttributes?: TrophyApi.CreatePointsTriggerRequestItemUserAttributesItem[];
/** Required if type is `metric`. The UUID of the metric. */
metricId?: string;
/** Required if type is `metric`. The metric increment that triggers the points. */
metricThreshold?: number;
/** Optional event attribute filters. Only permitted if type is `metric`. */
eventAttributes?: TrophyApi.CreatePointsTriggerRequestItemEventAttributesItem[];
/** Required if type is `achievement`. The UUID of the achievement. */
achievementId?: string;
/** Required if type is `streak`. The number of streak periods that triggers the points. */
streakLength?: number;
/** Required if type is `time`. The unit for the time interval. */
timeUnit?: TrophyApi.CreatePointsTriggerRequestItemTimeUnit;
/** Required if type is `time`. The number of time units between recurring awards. */
timeInterval?: number;
/** Whether to block metric events that would reduce the user's points below zero. Defaults to false. */
blockIfOutOfPoints?: boolean;
}