{"action":"created","issue":{"url":"https://api.github.com/repos/cozy/cozy-client-js/issues/256","repository_url":"https://api.github.com/repos/cozy/cozy-client-js","labels_url":"https://api.github.com/repos/cozy/cozy-client-js/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/cozy/cozy-client-js/issues/256/comments","events_url":"https://api.github.com/repos/cozy/cozy-client-js/issues/256/events","html_url":"https://github.com/cozy/cozy-client-js/pull/256","id":310619667,"number":256,"title":"feat: add intents.redirect() method ✨","user":{"login":"gregorylegarec","id":776764,"avatar_url":"https://avatars3.githubusercontent.com/u/776764?v=4","gravatar_id":"","url":"https://api.github.com/users/gregorylegarec","html_url":"https://github.com/gregorylegarec","followers_url":"https://api.github.com/users/gregorylegarec/followers","following_url":"https://api.github.com/users/gregorylegarec/following{/other_user}","gists_url":"https://api.github.com/users/gregorylegarec/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorylegarec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorylegarec/subscriptions","organizations_url":"https://api.github.com/users/gregorylegarec/orgs","repos_url":"https://api.github.com/users/gregorylegarec/repos","events_url":"https://api.github.com/users/gregorylegarec/events{/privacy}","received_events_url":"https://api.github.com/users/gregorylegarec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-02T21:36:03Z","updated_at":"2018-04-12T23:28:29Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/cozy/cozy-client-js/pulls/256","html_url":"https://github.com/cozy/cozy-client-js/pull/256","diff_url":"https://github.com/cozy/cozy-client-js/pull/256.diff","patch_url":"https://github.com/cozy/cozy-client-js/pull/256.patch"},"body":"~PRIORITY : VERY LOW~\r\n\r\nThis PR tries to solve the redirection point exposed in #201 and adds two methods to intents API, both used to easily redirect to a given document or a given doctype. The two added methods are:\r\n\r\n* `getRedirectionURL(type, data)` which retrieves a redirection URL.\r\n* `redirect(type, data)` which retrieves a redirection URL and performs the redirection.\r\n\r\n### Example\r\n\r\n```jsx\r\nimport Button from 'cozy-ui/react/Button'\r\n// [...]\r\n  render() {\r\n    const { folder } = this.props\r\n    return (\r\n      <Button\r\n        label={`Open ${folder.name}`}\r\n        onClick={() => cozy.client.intents.redirect('io.cozy.files', folder)}\r\n      />\r\n    )\r\n  }\r\n```\r\n\r\n### Declaring a redirection handler\r\n\r\nRedirection are declared in `manfiest.webapp`, like a regular intent\r\n\r\n```json\r\n\"intents\": [\r\n    {\r\n      \"action\": \"REDIRECT\",\r\n      \"type\": [\r\n        \"io.cozy.konnectors\"\r\n      ],\r\n      \"href\": \"/\"\r\n    }\r\n  ],\r\n```\r\n\r\n### Current limitations\r\n* For now, it is still not possible to remove an intent from database.\r\n* Statck cannot handle an intent having a sharp character in this `href` attribute, and URLencode it (i.e. replaces `#` by `%23`).\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cozy/cozy-client-js/issues/comments/380974460","html_url":"https://github.com/cozy/cozy-client-js/pull/256#issuecomment-380974460","issue_url":"https://api.github.com/repos/cozy/cozy-client-js/issues/256","id":380974460,"user":{"login":"gregorylegarec","id":776764,"avatar_url":"https://avatars3.githubusercontent.com/u/776764?v=4","gravatar_id":"","url":"https://api.github.com/users/gregorylegarec","html_url":"https://github.com/gregorylegarec","followers_url":"https://api.github.com/users/gregorylegarec/followers","following_url":"https://api.github.com/users/gregorylegarec/following{/other_user}","gists_url":"https://api.github.com/users/gregorylegarec/gists{/gist_id}","starred_url":"https://api.github.com/users/gregorylegarec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregorylegarec/subscriptions","organizations_url":"https://api.github.com/users/gregorylegarec/orgs","repos_url":"https://api.github.com/users/gregorylegarec/repos","events_url":"https://api.github.com/users/gregorylegarec/events{/privacy}","received_events_url":"https://api.github.com/users/gregorylegarec/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T23:28:29Z","updated_at":"2018-04-12T23:28:29Z","author_association":"CONTRIBUTOR","body":"![](https://github.trello.services/images/mini-trello-icon.png) [(3) ETU je peux filtrer dans mon Store](https://trello.com/c/HK3JrzHB/917-3-etu-je-peux-filtrer-dans-mon-store)"}}
{"actor":{"display_login":"gregorylegarec"}}