Sports Lib API - v17.3.0
    Preparing search index...

    Interface ActivityInterface

    A recorded activity within an event. Activities own time-indexed streams, metrics, laps, and source metadata.

    interface ActivityInterface {
        creator: CreatorInterface;
        endDate: Date;
        intensityZones: IntensityZonesInterface[];
        name: string;
        parseOptions: ActivityParsingOptions;
        powerCurve?: DataPowerCurve;
        startDate: Date;
        type: ActivityTypes;
        addDataToStream(type: string, date: Date, value: number): this;
        addEvent(event: DataEvent): this;
        addLap(lap: LapInterface): this;
        addStat(stat: DataInterface<unknown>): void;
        addStream(stream: StreamInterface): this;
        addStreams(streams: StreamInterface[]): this;
        addSwimLength(swimLength: SwimLengthInterface): this;
        clearStats(): void;
        clearStreams(): this;
        createStream(type: string): StreamInterface;
        generateDurationStream(streamTypes?: string[]): StreamInterface;
        generateTimeStream(streamTypes?: string[]): StreamInterface;
        getAllEvents(): DataEvent[];
        getAllExportableStreams(): StreamInterface[];
        getAllRiderPositionChangeEvents(): DataRiderPositionChangeEvent[];
        getAllStreams(): StreamInterface[];
        getDateIndex(date: Date): number;
        getDistance(): DataDistance;
        getDuration(): DataDuration;
        getID(): string | null;
        getLaps(): LapInterface[];
        getMovingTime(): DataMovingTime;
        getPause(): DataPause;
        getPositionData(
            startDate?: Date,
            endDate?: Date,
        ): (DataPositionInterface | null)[];
        getSquashedPositionData(
            startDate?: Date,
            endDate?: Date,
        ): (DataPositionInterface | null)[];
        getSquashedStreamData(
            streamType: string,
            startDate?: Date,
            endDate?: Date,
        ): number[];
        getStartEvents(): DataStartEvent[];
        getStat<TValue = DefaultDataValue>(
            statType: string,
        ): void | DataInterface<TValue>;
        getStats<TValue = DefaultDataValue>(): Map<string, DataInterface<TValue>>;
        getStatsAsArray<TValue = DefaultDataValue>(): DataInterface<TValue>[];
        getStopAllEvents(): DataStopAllEvent[];
        getStopEvents(): DataStopEvent[];
        getStream(type: string): StreamInterface;
        getStreamData(
            streamType: string | StreamInterface,
            startDate?: Date,
            endDate?: Date,
        ): (number | null)[];
        getStreamDataByDuration(
            streamType: string,
            filterNull?: boolean,
            filterInfinity?: boolean,
        ): StreamDataItem[];
        getStreamDataByTime(
            streamType: string,
            filterNull?: boolean,
        ): StreamDataItem[];
        getStreamDataTypesBasedOnDataType(
            streamTypeToBaseOn: string,
            streamTypes: string[],
        ): { [type: string]: number | null }[];
        getStreamDataTypesBasedOnTime(
            streamTypes?: string[],
        ): { [type: number]: { [type: string]: number | null } };
        getSwimLengths(): SwimLengthInterface[];
        getTimer(): DataTimerTime;
        hasLaps(): boolean;
        hasPositionData(startDate?: Date, endDate?: Date): boolean;
        hasPowerMeter(): boolean;
        hasStreamData(
            streamType: string | StreamInterface,
            startDate?: Date,
            endDate?: Date,
        ): boolean;
        hasSwimLengths(): boolean;
        isTrainer(): boolean;
        removeStat(statType: string): void;
        removeStream(streamType: string | StreamInterface): this;
        replaceStreamData(streamType: string, data: (number | null)[]): this;
        setAllEvents(events: DataEvent[]): this;
        setDistance(distance: DataDistance): void;
        setDuration(duration: DataDuration): void;
        setID(id: string | null): this;
        setMovingTime(duration: DataMovingTime): void;
        setPause(pause: DataPause): void;
        setSwimLengths(swimLengths: SwimLengthInterface[]): this;
        setTimer(duration: DataTimerTime): void;
        toJSON(): ActivityJSONInterface;
    }

    Hierarchy (View Summary)

    Index

    Properties

    endDate: Date
    intensityZones: IntensityZonesInterface[]
    name: string
    powerCurve?: DataPowerCurve
    startDate: Date

    Methods

    • Adds a value to the streams data Floor is used so a date with > end date does not create and extra slug in the array

      Parameters

      • type: string
      • date: Date
      • value: number

      Returns this

    • Gets the data of a stream with optional params of start and end but removes nulls

      Parameters

      • streamType: string
      • OptionalstartDate: Date
      • OptionalendDate: Date

      Returns number[]

    • Gets the data of a stream with optional params of start and end

      Parameters

      • streamType: string | StreamInterface
      • OptionalstartDate: Date
      • OptionalendDate: Date

      Returns (number | null)[]

    • Gets the data of the stream based on duration

      Parameters

      • streamType: string
      • OptionalfilterNull: boolean
      • OptionalfilterInfinity: boolean

      Returns StreamDataItem[]

    • Gets more than one stream type based on another stream type

      Parameters

      • streamTypeToBaseOn: string
      • streamTypes: string[]

      Returns { [type: string]: number | null }[]

    • Gets more than one stream data based on time

      Parameters

      • OptionalstreamTypes: string[]

      Returns { [type: number]: { [type: string]: number | null } }

    • Checks if there are lat,long data pairs

      Parameters

      • OptionalstartDate: Date
      • OptionalendDate: Date

      Returns boolean

    • Replace stream data by another

      Parameters

      • streamType: string
      • data: (number | null)[]

      Returns this