I would like to go to specific page for example page:3
of some data set i set in the doc that you can do this to go to the next page
import { REDACTEDObjecType } from "@carlos-test-app/sdk";
import { isOk, Osdk, PageResult, Result } from "@osdk/client";
const firstPage: Result<PageResult<Osdk.Instance<REDACTEDObjecType>>>
= await client(REDACTEDObjecType).fetchPageWithErrors({ $pageSize: 30 });
if (isOk(firstPage)) {
const secondPage: Result<PageResult<Osdk.Instance<REDACTEDObjecType, never, "name">>>
// You can also down select properties to only get the properties you need from the object
= await client(REDACTEDObjecType).fetchPageWithErrors({ $select: ["name"], $pageSize: 30, $nextPageToken: firstPage.value.nextPageToken });
const objects = isOk(secondPage) ? [...firstPage.value.data, ...secondPage.value.data] : firstPage.value.data;
const object = objects[0];
}
// If you want to get rids, you need to add a flag to specifically request for it. Note how the return type now includes $rid rather than never
const secondPageWithRids: Result<PageResult<Osdk.Instance<REDACTEDObjecType, "$rid", "name">>>
= await client(REDACTEDObjecType).fetchPageWithErrors({ $select: ["name"], $includeRid:true, $pageSize: 30, $nextPageToken: firstPage.value.nextPageToken });
// To fetch a page without a result wrapper, use fetchPage with a try/catch instead
try {
const firstPage: PageResult<Osdk.Instance<REDACTEDObjecType>>
= await client(REDACTEDObjecType).fetchPage({ $pageSize: 30 });
const secondPage: PageResult<Osdk.Instance<REDACTEDObjecType>>
= await client(REDACTEDObjecType).fetchPage({ $pageSize: 30, $nextPageToken: firstPage.nextPageToken });
const objects = [...firstPage.data, ...secondPage.data];
const object = objects[0];
}
catch (e) {
console.error(e);
}
I would like to know if you can go directly to something like page 4.