Fetch blocks
You can retrieve the blocks of the project with the function MBManager.shared.getBlocks()
like this:
MBPaginatedResponse<MBBLock> blocks = await MBManager.shared.getBlocks();
The parameter named parameters
is an optional array of objects that conforms to the MBParameter
protocol that will be passed to the MBurger api as parameter.
The majority of the parameters that can be passed to the apis are already implemented in the SDK and can be used after the initialization:
MBSortParameter
MBPaginationParameter
MBFilterParameter
MBGeofenceParameter
So if you want to include a pagination parameter you can do this:
MBPaginationParameter paginationParam =
MBPaginationParameter(skip: 0, take: 10);
MBPaginatedResponse<MBBlock> blocks =
await MBManager.shared.getBlocks(parameters: [paginationParam]);
If you set the includeSections
parameter you can include also the sections of the blocks, if you set also includeElements
parameter also the elements will be included in the response.
So, you could retrieve the information of all the blocks, all the sections of the blocks, and all the elements of the sections with this call:
MBPaginationParameter paginationParam =
MBPaginationParameter(skip: 0, take: 10);
MBPaginatedResponse<MBBlock> blocks = await MBManager.shared.getBlocks(
parameters: [paginationParam],
includeSections: true,
includeElements: true,
);
Last updated
Was this helpful?