feat(runtime): Add "keys" and "excludeKeys" to fetch record api (#79)

Adding support for some more options when fetching a record.
91f9aca25b/src/Routers/ClassesRouter.js (L60-L68)
This commit is contained in:
Eric Tuvesson
2024-11-12 15:50:49 +01:00
committed by GitHub
parent fff03c05bf
commit 016837f466
4 changed files with 23 additions and 1 deletions

View File

@@ -263,7 +263,9 @@ class CloudStore {
* @param {{
* objectId: string;
* collection: string;
* keys?: string[] | string;
* include?: string[] | string;
* excludeKeys?: string[] | string;
* success: (data: unknown) => void;
* error: (error: unknown) => void;
* }} options
@@ -275,6 +277,16 @@ class CloudStore {
args.push('include=' + (Array.isArray(options.include) ? options.include.join(',') : options.include));
}
if (options.keys) {
args.push('keys=' + (Array.isArray(options.keys) ? options.keys.join(',') : options.keys));
}
if (options.excludeKeys) {
args.push(
'excludeKeys=' + (Array.isArray(options.excludeKeys) ? options.excludeKeys.join(',') : options.excludeKeys)
);
}
this._makeRequest(
'/classes/' + options.collection + '/' + options.objectId + (args.length > 0 ? '?' + args.join('&') : ''),
{