mise API - v0.0.0
    Preparing search index...

    Interface ListResource

    API abstract list resource class.

    interface ListResource {
        auth: Object;
        collection: Object | null;
        contentType: string;
        itemClass: Object;
        queryUrl: string;
        searchParams: Object | null;
        url: string;
        get data(): Object[] | null;
        get hasNextPage(): boolean;
        get hasPreviousPage(): boolean;
        get isEmpty(): boolean;
        get totalCount(): number;
        _getResource(
            linkRelation: string,
            ResourceClass: Object,
            searchParams?: { limit?: number; offset?: number },
            timeout?: number,
        ): Promise<Object>;
        _post(
            data: Object,
            uploadFileObj: Object | null,
            timeout?: number,
        ): Promise<ListResource>;
        clone(): Resource;
        get(
            searchParams?: { limit?: number; offset?: number },
            timeout?: number,
        ): Promise<ListResource>;
        getItem(id: number): Object;
        getItems(): Object[] | null;
        getPOSTParameters(): string[] | null;
        getSearchParameters(): string[] | null;
    }

    Hierarchy (View Summary)

    Index
    auth: Object
    collection: Object | null
    contentType: string
    itemClass: Object
    queryUrl: string
    searchParams: Object | null
    url: string
    • get data(): Object[] | null

      Get the list of item data objects (REST API descriptors).

      Returns Object[] | null

    • get hasNextPage(): boolean

      Return true if the list resource object has a next list page in the paginated REST API.

      Returns boolean

    • get hasPreviousPage(): boolean

      Return true if the list resource object has a previous list page in the paginated REST API.

      Returns boolean

    • get isEmpty(): boolean

      Return true if the resource object contains any data.

      Returns boolean

    • get totalCount(): number

      Get the total count of items of the entire collection across pages in the paginated REST API. Return -1 if no data has been fetched or the total number of items info is not available from the fetched data.

      Returns number

    • Internal method to fetch a related resource from the REST API that is referenced by a link relation within this list resource's collection object.

      Parameters

      • linkRelation: string
      • ResourceClass: Object
      • OptionalsearchParams: { limit?: number; offset?: number }

        search parameters object which is resource-specific

        • Optionallimit?: number

          page limit

        • Optionaloffset?: number

          page offset

      • Optionaltimeout: number

        request timeout

      Returns Promise<Object>

      • JS Promise, resolves to a ResourceClass object

      throw error if this list resource has not yet been fetched from the REST API

      throw error when the link relation is not found

    _post

    • _post(
          data: Object,
          uploadFileObj: Object | null,
          timeout?: number,
      ): Promise<ListResource>

      Internal helper method to make a POST request to this list resource through the REST API.

      Parameters

      • data: Object

        request JSON data object

      • uploadFileObj: Object | null

        custom file object

        • Object
          • fname

            file blob

        • null
      • Optionaltimeout: number

        request timeout

      Returns Promise<ListResource>

      • JS Promise, resolves to this object
    • Make a deep copy clone of this object resource.

      Returns Resource

      • clone object
    • Fetch this list resource from the REST API based on search parameters. If no search parameters then get the default first page.

      Parameters

      • OptionalsearchParams: { limit?: number; offset?: number }

        search parameters object which is resource-specific, the getSearchParameters method can be used to get a list of possible search parameters

        • Optionallimit?: number

          page limit

        • Optionaloffset?: number

          page offset

      • Optionaltimeout: number

        request timeout

      Returns Promise<ListResource>

      • JS Promise, resolves to this object
    • Get an item resource object given its id from the list of items in this list resource object.

      Parameters

      • id: number

        item id

      Returns Object

      • an instance of this.itemClass
    • Get an array of item resource objects corresponding to the items in this list resource object.

      Returns Object[] | null

    • Get an array of parameter names that can be used as properties of the data object in POST requests.

      Returns string[] | null

      • array of POST data properties or null if this list resource's data has not been fetched from the API yet or it doesn't support POST requests.
    • Get an array of search parameter names that can be used as properties of the searchParams argument to the get method.

      Returns string[] | null

      • array of search parameter names or null if this list resource's data has not been fetched from the API yet.