Preparing search index...

    Interface TrackApi

    Provider interface for the Track API.

    Plugins that record positions implement this and register it via TrackProviderRegistry.registerTrackApiProvider. How and where the positions are stored is entirely the provider's business.

    interface TrackApi {
        getTrackContexts(query: TracksRequest): Promise<Context[]>;
        getTracks(query: TracksRequest): Promise<TracksResponse>;
        deleteTrack?(id: string): Promise<boolean>;
        deleteTrackSpan?(id: string, span: TrackSpan): Promise<boolean>;
        getTrack?(id: string): Promise<TrackFeature | undefined>;
        storeTrack?(track: TrackImport): Promise<string>;
    }
    Index
    • Deletes a stored track by id, resolving false when no such track exists.

      Optional, and independent of storeTrack: a provider may accept imports without allowing recorded tracks to be deleted, or the reverse.

      Parameters

      • id: string

      Returns Promise<boolean>

    • Deletes the part of a stored track recorded within span, resolving false when no such track exists.

      Optional, and separate from TrackApi.deleteTrack rather than an argument to it: a provider written against deleteTrack(id) would ignore a span it was not expecting and delete the whole track. A provider that lacks this method is answered 501 for a span, never a whole delete.

      A track with no times has no part to address by time; a provider refuses that with TrackRejectedError. Deleting a span that holds no points of an existing track is not an error.

      Parameters

      Returns Promise<boolean>

    • Returns one stored track by id, or undefined when no such track exists.

      Optional, like the writes. Every other way of finding a track filters by something a track might not have — a time window needs times, a context query needs a context — so a track imported with neither would be unreachable without this.

      Parameters

      • id: string

      Returns Promise<TrackFeature | undefined>

    • Stores a track the client supplied, and resolves to the id it assigned.

      Optional: a provider that only records what it observes does not implement this, and the server answers 501 rather than refusing its registration.

      The id is what a later getTrack and deleteTrack receive, and must be a non-empty string. A provider assigns it rather than accepting one, so two clients importing the same file cannot collide, and an import can never overwrite a recorded track by naming its context. Only the id comes back: the client already has what it sent, and can fetch the track to see what the provider derived from it.

      Parameters

      Returns Promise<string>