Added page size support to MSGraph client

Signed-off-by: Alex Crome <afscrome@users.noreply.github.com>
This commit is contained in:
Alex Crome
2023-01-22 21:05:12 +00:00
parent 6fc1c895b2
commit 58d9145eef
2 changed files with 8 additions and 2 deletions
@@ -70,7 +70,7 @@ describe('MicrosoftGraphClient', () => {
expect(await response.json()).toEqual({ value: 'example' });
});
it('should perform api request with filter, select and expand', async () => {
it('should perform api request with filter, select, expand and top', async () => {
worker.use(
rest.get('https://example.com/users', (req, res, ctx) =>
res(ctx.status(200), ctx.json({ queryString: req.url.search })),
@@ -81,12 +81,13 @@ describe('MicrosoftGraphClient', () => {
filter: 'test eq true',
expand: 'children',
select: ['id', 'children'],
top: 471,
});
expect(response.status).toBe(200);
expect(await response.json()).toEqual({
queryString:
'?$filter=test%20eq%20true&$select=id,children&$expand=children',
'?$filter=test%20eq%20true&$select=id,children&$expand=children&$top=471',
});
});
@@ -52,6 +52,10 @@ export type ODataQuery = {
* Retrieves the total count of matching resources.
*/
count?: boolean;
/**
* Maximum number of records to receive in one batch.
*/
top?: number;
};
/**
@@ -188,6 +192,7 @@ export class MicrosoftGraphClient {
$select: query?.select?.join(','),
$expand: query?.expand,
$count: query?.count,
$top: query?.top,
},
{
addQueryPrefix: true,