NavVis IVION API
    Preparing search index...

    Interface RestRepositoryInterface<T>

    The RestRepository retreives resources from the database through the REST API.

    A full list of resources can be fetched by calling findAll and a specific resource by calling findOne.

    interface RestRepositoryInterface<T> {
        create(): T;
        filter(params: RestFilterInterface): Promise<T[]>;
        findAll(forceFetch?: boolean): Promise<T[]>;
        findOne(id: number, forceFetch?: boolean): Promise<T>;
        remove(item: T): Promise<void>;
        save(items: T | T[]): Promise<T[]>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Methods

    • Factory method. Creates and returns a new empty instance of the entity.

      Returns T

      An instance of the entity.

    • Find all repository items matching the filter parameters.

      Parameters

      Returns Promise<T[]>

      Promise with the entities that match the filter.

    • Gets all repository items. The cached data will be returned if the data has been fetched before. Using the forceFetch parameter, a user can order a fresh copy to be fetched from the server.

      Parameters

      • OptionalforceFetch: boolean

        Whether to bypass the cache and retrieve a fresh copy from the server.

      Returns Promise<T[]>

      Promise with the repository items.

    • Get one repository item by id. The cached data will be returned if the data has been fetched before. Use the forceFetch parameter to retrieve a fresh copy from the server. In case a new record is fetched, the data and dataMap will be updated accordingly.

      Parameters

      • id: number

        Identifier of the repository item

      • OptionalforceFetch: boolean

        Whether to bypass the cache and retrieve a fresh copy from the server.

      Returns Promise<T>

    • Deletes an item from the repository.

      Parameters

      • item: T

        The item to delete.

      Returns Promise<void>

      Promise that resolves once the request has completed.

    • Saves new and/or updated items.

      Parameters

      • items: T | T[]

        The item(s) to save or update.

      Returns Promise<T[]>

      Promise with the saved objects.