Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetChangesetListUrlParams $top is being ignored #247

Open
EK723 opened this issue May 30, 2024 · 1 comment
Open

GetChangesetListUrlParams $top is being ignored #247

EK723 opened this issue May 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@EK723
Copy link

EK723 commented May 30, 2024

The urlParams $top (located at GetChangesetListParams > 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.

@EK723 EK723 added the bug Something isn't working label May 30, 2024
@austeja-bentley
Copy link
Contributor

austeja-bentley commented Jun 5, 2024

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];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants