Skip to content

Commit

Permalink
return cursor in SearchThingsResponse
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Weirich <matthias.weirich@selectcode.de>
  • Loading branch information
vavido committed Dec 6, 2022
1 parent 02116e5 commit 763431a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/lib/api/src/model/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class SearchThingsResponse extends EntityModel {
return o;
}
// @ts-ignore
return new SearchThingsResponse(o['items'].map((t: object) => Thing.fromObject(t)), o['nextPageOffset']);
return new SearchThingsResponse(o['items'].map((t: object) => Thing.fromObject(t)), o['nextPageOffset'], o['cursor']);
}

public toObject(): object {
Expand Down
4 changes: 4 additions & 0 deletions javascript/lib/api/tests/options/request.options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ describe('Search Options', () => {
searchOptions.withPageSize(10);
expect(searchOptions.getOptions().get('option')).toEqual('size(10)');
});
it('sets cursor and size', () => {
searchOptions.withCursor('eJylkD1PwzAQhv-LpxQc5YM0SbNBBBJDp0oslMGxz82JYJfLBQbEf8cpQupGKfZ29zz3Su').withPageSize(42);
expect(searchOptions.getOptions().get('option')).toEqual(encodeURIComponent('cursor(eJylkD1PwzAQhv-LpxQc5YM0SbNBBBJDp0oslMGxz82JYJfLBQbEf8cpQupGKfZ29zz3Su),size(42)'));
});
});

describe('Get Things Options', () => {
Expand Down

0 comments on commit 763431a

Please sign in to comment.