Open EK723 opened 1 month ago
Hello, the $top
parameter is put directly into the url when sending requests to iModels API and it specifies the page size in which entities are retrieved. All collection query functions in IModelsClient
return iterators, which, when iterated in full, will return all entities regardless of the page size it uses to query all entities. If you want to query just one entity, abort the iteration early with take
helper function:
const getChangesetListParams: GetChangesetListParams = {
authorization,
iModelId: testIModel.id,
urlParams: {
$top: 1
}
};
const changesetsIterator: EntityListIterator<Changeset> = iModelsClient.changesets.getRepresentationList(getChangesetListParams);
const changesets: Changeset[] = await take(changesetsIterator, 1);
const changeset = changesets[0];
The urlParams
$top
(located atGetChangesetListParams
>GetChangesetListUrlParams
>CollectionRequestParams
) is being ignored when running, for example,ChangesetOperations.getMinimalList()
. If$top
is set to 1, rather than returning 1 item, the program returns the entire list of changesets.