{"action":"created","issue":{"url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/1344","repository_url":"https://api.github.com/repos/cozy-labs/cozy-desktop","labels_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/1344/labels{/name}","comments_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/1344/comments","events_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/1344/events","html_url":"https://github.com/cozy-labs/cozy-desktop/pull/1344","id":391017225,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4NjQ3ODY1","number":1344,"title":"test: Refactor builders","user":{"login":"sebn","id":2260801,"node_id":"MDQ6VXNlcjIyNjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2260801?v=4","gravatar_id":"","url":"https://api.github.com/users/sebn","html_url":"https://github.com/sebn","followers_url":"https://api.github.com/users/sebn/followers","following_url":"https://api.github.com/users/sebn/following{/other_user}","gists_url":"https://api.github.com/users/sebn/gists{/gist_id}","starred_url":"https://api.github.com/users/sebn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebn/subscriptions","organizations_url":"https://api.github.com/users/sebn/orgs","repos_url":"https://api.github.com/users/sebn/repos","events_url":"https://api.github.com/users/sebn/events{/privacy}","received_events_url":"https://api.github.com/users/sebn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-12-14T08:45:24Z","updated_at":"2018-12-18T09:03:12Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/1344","html_url":"https://github.com/cozy-labs/cozy-desktop/pull/1344","diff_url":"https://github.com/cozy-labs/cozy-desktop/pull/1344.diff","patch_url":"https://github.com/cozy-labs/cozy-desktop/pull/1344.patch"},"body":"- Builders can be used more easily when one doesn't need to save the corresponding data into the Pouch or the Cozy.\r\n- Single facade (no need for separate `new MetadataBuilders()` instanciation, separate `../support/builders/remote/warning` loading, or nested `builders.metadata.*` / `builders.remote.*` calls).\r\n- Added some missing flow type annotation that was hidden by another issue.\r\n\r\nNew interface:\r\n\r\n```js\r\n// No need to save data:\r\nconst builders = new Builders() // New\r\n\r\n// Need to save data in the Cozy:\r\nconst builders = new Builders({cozy})\r\n\r\n// Need to save data in Pouch:\r\nconst builders = new Builders({pouch}) // New\r\n\r\n// Need to save data in both:\r\nconst builders = new Builders({cozy, pouch})\r\n\r\n// Metadata:\r\nawait builders.metafile().path(...).create() // Saved in Pouch\r\nbuilders.metadir().upToDate().build() // Not saved in Pouch\r\n\r\n// I don't care about the doctype:\r\nbuilders.metadata().path(...).build()\r\nbuilders.metadata(old).path(...).build() // New (needed for a future PR)\r\n\r\n// Remote docs:\r\nawait builders.remoteDir().inDir(...).create() // Saved in Cozy\r\nbuilders.remoteFile().data(...).build() // Not saved in Cozy\r\n\r\n// Remote warnings:\r\nbuilders.remoteWarnings() // Single-call since no other need for now\r\n```"},"comment":{"url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/comments/448146957","html_url":"https://github.com/cozy-labs/cozy-desktop/pull/1344#issuecomment-448146957","issue_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/1344","id":448146957,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODE0Njk1Nw==","user":{"login":"sebn","id":2260801,"node_id":"MDQ6VXNlcjIyNjA4MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2260801?v=4","gravatar_id":"","url":"https://api.github.com/users/sebn","html_url":"https://github.com/sebn","followers_url":"https://api.github.com/users/sebn/followers","following_url":"https://api.github.com/users/sebn/following{/other_user}","gists_url":"https://api.github.com/users/sebn/gists{/gist_id}","starred_url":"https://api.github.com/users/sebn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebn/subscriptions","organizations_url":"https://api.github.com/users/sebn/orgs","repos_url":"https://api.github.com/users/sebn/repos","events_url":"https://api.github.com/users/sebn/events{/privacy}","received_events_url":"https://api.github.com/users/sebn/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T09:03:12Z","updated_at":"2018-12-18T09:03:12Z","author_association":"CONTRIBUTOR","body":"CI is green. Rebasing on master so we can merge as soon as release is published."}}
{"actor":{"display_login":"sebn"}}