import { RpcMethod } from './commonTypes'; export type SegmentStatisticsService_Prepare = RpcMethod; export type SegmentStatisticsService_Status = RpcMethod; export type SegmentStatisticsService_GetSegmentSizeChanges = RpcMethod; export interface SegmentStatisticsService { /** Kicks off (or refreshes) background size calculation for the given segments of an application, so their sizes and history can later be read. Call this before get_segment_statistics_status / get_segment_size_changes to make sure the numbers are up to date. */ Prepare: SegmentStatisticsService_Prepare; /** Returns the calculation status (prepared, not_prepared, in_process or failed) and last-updated time for each prepared segment of an application. Use to poll whether a prepare_segment_statistics run has finished before reading sizes. */ Status: SegmentStatisticsService_Status; /** Returns a time series of how one segment's size changed (per-interval increase, decrease and net, plus running totals) over a time range. Use to chart audience growth for a single segment; the segment must have been prepared first. */ GetSegmentSizeChanges: SegmentStatisticsService_GetSegmentSizeChanges; } export type PrepareRequest = { /** Segment (filter) codes to prepare statistics for. */ segments?: string[]; /** Application code (format XXXXX-XXXXX) that owns the segments. */ application?: string; }; export type PrepareResponse = {}; export type StatusRequest = { /** Application code (format XXXXX-XXXXX) whose prepared segments' statuses to return. */ application?: string; }; export type StatusResponse_Status = 'unknown' | 'prepared' | 'not_prepared' | 'in_process' | 'failed'; export type StatusResponse_SegmentStatus = { segment: string; status: StatusResponse_Status; lastUpdatedTime: Date; }; export type StatusResponse = { segments: StatusResponse_SegmentStatus[]; }; export type GetSegmentSizeChangesRequest = { /** Application code (format XXXXX-XXXXX) that owns the segment. */ application?: string; /** Segment (filter) code whose size-change history to return. */ filter?: string; timestampFrom?: Date; timestampTo?: Date; }; export type GetSegmentSizeChangesResponse_PlatformChanges = { increase: number[]; decrease: number[]; net: number[]; }; export type GetSegmentSizeChangesResponse = { timestamps: Date[]; all: GetSegmentSizeChangesResponse_PlatformChanges; totals: number[]; };