Refactor (and simplify) Model methods parameters
sebelga opened this issue · comments
Sébastien Loix commented
We will use this next major version bump to update the API of the Model
APIs. Indeed having to pass a bunch of null
(or undefined) value to set an option
// current api
BlogPost.get(123, null, null, null, { dataloader });
I will simplify with only 2 (max 3) parameters
// Datastore makes a difference between an "ID" (integer) and a "name" (string) for a Key.
// The new API will require to specify if we are providing an ID or Name
BlogPost.get({ id: 123 }, { dataloader });
For Model.update()
it will be 3
BlogPost.update(
{ id: 123 }, // id
{ ...data }, // data
{ ancestors: ['SomeParent', 'ParentName'], replace: true } // any additional (optional) option
);
Todo
Sébastien Loix commented
Closing this issue as I won't be able to continue the work on it.