UNPKG

@springtree/eva-core

Version:
134 lines (112 loc) 3.22 kB
declare module EVA.BI { export namespace Errors { export namespace BI { export const UnsupportedLabel = 'BI:UnsupportedLabel'; export const SpecifyLabels = 'BI:SpecifyLabels'; export const SpecifyTimeframe = 'BI:SpecifyTimeframe'; } } /** * Gets BI data based on the given Labels. * * * `OrganizationUnitID` is the organization unit you want data from; this may be a container unit or a shop alike * * `Labels` define the data you want to retrieve; use `GetLabels` to find the available labels in this instance * * `Timeframe` defines the range of dates you want to accumulate, where you have three options available; * * A `Period` with a `Year` and then either a `Month` or a `Week` (ISO) * * A `Range` with a `From` and `To` date and a `Grain` to define the amount of detail within this period * * A `Date` for a single date point in time * * Optionally, you can supply the following parameters; * * * `Series` is an array where you can specify which `Series` to retrieve; current values include `Actual` and `LFL` * * `GroupBy` defines the 'rotation' to view the data in; by default you'll see data per `Label`, but you can rotate for a ranking view using `OrganizationUnit` or a more detailed view using `Name` * * `Mock` allows you to override the base `BI:Mock` setting to switch between mocked- and live data */ export interface GetData { OrganizationUnitID: number; Labels?: string[]; Timeframe?: Timeframe; Series?: Series[]; GroupBy: GroupBy; Mock: boolean; } export interface Timeframe { Period?: Period; Range?: Range; Date?: string; } export interface Period { Year: number; Month: number; Week: number; } export interface Range { From?: string; To?: string; Grain: Grain; } export const enum Grain { None = 0, Days = 1, Weeks = 2, Months = 3 } export const enum Series { Actual = 0, LFL = 1 } export const enum GroupBy { Label = 0, OrganizationUnit = 1, Name = 2 } export interface GetDataResponse { Result: Dataset[]; Error: EVA.Core.ServiceError; } export interface Dataset { Name: string; Label: string; OrganizationUnitID: number; OrganizationUnitName: string; Series: Series; Actual?: number; Target?: number; Data: Data[]; } export interface Data { Label: string; Value?: number; Target?: number; AccumulatedValue?: number; } /** * Retrieves the available labels across all loaded plugins, to be used in the `GetData` service `Labels` parameter array. */ export interface GetLabels { ID: number; } export interface GetLabelsResponse { Result: Label[]; Error: EVA.Core.ServiceError; } export interface Label { Name: string; Type: LabelTypes; AggregationType: AggregationTypes; } export const enum LabelTypes { Default = 0, Singular = 1 } export const enum AggregationTypes { Sum = 0, WeightedAverage = 1, SumLast = 2 } export interface GetSalesBudgets { } export interface UpdateSalesBudgets { Data?: number[]; } }