Interface containing the functions to extract the data from the response object. For example the getCollectionResult extracts the data from data.d.results per default but this needs to be adjusted in some situations.

interface ResponseDataAccessor {
    getCollectionResult: (data: any) => any[];
    getLinkedCollectionResult: (data: any) => any[];
    getSingleResult: (data: any) => Record<string, any>;
    isCollectionResult: (data: any) => boolean;
}

Properties

getCollectionResult: (data: any) => any[]

A function that extracts array data from the response object. The data is extracted per default from data.d.results.

getLinkedCollectionResult: (data: any) => any[]

Extract the collection data from the one-to-many link response. If the data does not contain a collection, an empty array is returned.

getSingleResult: (data: any) => Record<string, any>

A function that extracts object data from the response object. The data is extracted by default from data.d.results.

isCollectionResult: (data: any) => boolean

Checks if the response is an array-like object.

Copyright Ⓒ 2024 SAP SE or an SAP affiliate company. All rights reserved.