{"action":"created","issue":{"url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/834","labels_url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/834/labels{/name}","comments_url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/834/comments","events_url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/834/events","html_url":"https://github.com/remotestorage/remotestorage.js/issues/834","id":56855036,"number":834,"title":"Add function for updating objects to BaseClient","user":{"login":"skddc","id":842,"avatar_url":"https://avatars.githubusercontent.com/u/842?v=3","gravatar_id":"","url":"https://api.github.com/users/skddc","html_url":"https://github.com/skddc","followers_url":"https://api.github.com/users/skddc/followers","following_url":"https://api.github.com/users/skddc/following{/other_user}","gists_url":"https://api.github.com/users/skddc/gists{/gist_id}","starred_url":"https://api.github.com/users/skddc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skddc/subscriptions","organizations_url":"https://api.github.com/users/skddc/orgs","repos_url":"https://api.github.com/users/skddc/repos","events_url":"https://api.github.com/users/skddc/events{/privacy}","received_events_url":"https://api.github.com/users/skddc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/remotestorage/remotestorage.js/labels/help%20wanted","name":"help wanted","color":"bfe5bf"},{"url":"https://api.github.com/repos/remotestorage/remotestorage.js/labels/improvement","name":"improvement","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-06T19:18:20Z","updated_at":"2015-02-07T14:31:43Z","closed_at":null,"body":"The app we're working on right now saves different parts of an object from different places. It would be extremely convenient to have a function on the BaseClient that supports updating single properties on existing objects by wrapping `storeObject` and `getObject` in one convenient helper function.\r\n\r\nAPI could look like this e.g.:\r\n\r\n```js\r\nclient.updateObject(path, {keyToUpdateOne: 'foo', keyToUpdateTwo: 'bar'});\r\n```\r\n\r\nThe function would then fetch the object using getObject, update only the keys from the second argument and validate and store again via `storeObject`.\r\n\r\nIt's actually quite simple, so if someone wants to take a stab at this, go ahead! Don't be afraid of the test suite (if that's a reason not to try), we can help you with that later. ;)"},"comment":{"url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/comments/73366407","html_url":"https://github.com/remotestorage/remotestorage.js/issues/834#issuecomment-73366407","issue_url":"https://api.github.com/repos/remotestorage/remotestorage.js/issues/834","id":73366407,"user":{"login":"skddc","id":842,"avatar_url":"https://avatars.githubusercontent.com/u/842?v=3","gravatar_id":"","url":"https://api.github.com/users/skddc","html_url":"https://github.com/skddc","followers_url":"https://api.github.com/users/skddc/followers","following_url":"https://api.github.com/users/skddc/following{/other_user}","gists_url":"https://api.github.com/users/skddc/gists{/gist_id}","starred_url":"https://api.github.com/users/skddc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skddc/subscriptions","organizations_url":"https://api.github.com/users/skddc/orgs","repos_url":"https://api.github.com/users/skddc/repos","events_url":"https://api.github.com/users/skddc/events{/privacy}","received_events_url":"https://api.github.com/users/skddc/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T14:31:43Z","updated_at":"2015-02-07T14:31:43Z","body":"Not sure I understand. Why do you have to put a lock on it, when you can update it as soon as `getObject`'s promise resolves? The idea was that it's just a helper so you don't have to do that manually. There might be a disclaimer needed in the docs for certain scenarios, but in essence it should be very similar to just using `storeObject` on the same object multiple times in a row, no?"}}