{"action":"created","issue":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/420","repository_url":"https://api.github.com/repos/kuzzleio/kuzzle","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/420/labels{/name}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/420/comments","events_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/420/events","html_url":"https://github.com/kuzzleio/kuzzle/issues/420","id":181838494,"number":420,"title":"Trigger event from plugin","user":{"login":"farwayer","id":2343101,"avatar_url":"https://avatars.githubusercontent.com/u/2343101?v=3","gravatar_id":"","url":"https://api.github.com/users/farwayer","html_url":"https://github.com/farwayer","followers_url":"https://api.github.com/users/farwayer/followers","following_url":"https://api.github.com/users/farwayer/following{/other_user}","gists_url":"https://api.github.com/users/farwayer/gists{/gist_id}","starred_url":"https://api.github.com/users/farwayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farwayer/subscriptions","organizations_url":"https://api.github.com/users/farwayer/orgs","repos_url":"https://api.github.com/users/farwayer/repos","events_url":"https://api.github.com/users/farwayer/events{/privacy}","received_events_url":"https://api.github.com/users/farwayer/received_events","type":"User","site_admin":false},"labels":[{"id":250449059,"url":"https://api.github.com/repos/kuzzleio/kuzzle/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-08T17:32:22Z","updated_at":"2016-12-08T09:44:06Z","closed_at":null,"body":"I want to throw error during plugin initialization with `log:error` event. But look like plugin must be privileged to get access to `pluginManager`. I do not need access to any internal functionality nor any internal data. Only throw event.\n\nI think throwing events it's very useful functionality for plugins and it should be available to all modules. Some plugins may throw events and another may catch them. It's very valuable case. I propose to add `trigger()` method to plugin context. \n\nAlso it will be nice to have `logger` helper object inside context with `warn()`, `info()`, `debug()`,  `verbose()` and `error()` methods. This functions should throw `log:*` events. For convenience only.\n"},"comment":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/comments/265697302","html_url":"https://github.com/kuzzleio/kuzzle/issues/420#issuecomment-265697302","issue_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/420","id":265697302,"user":{"login":"xbill82","id":5023426,"avatar_url":"https://avatars.githubusercontent.com/u/5023426?v=3","gravatar_id":"","url":"https://api.github.com/users/xbill82","html_url":"https://github.com/xbill82","followers_url":"https://api.github.com/users/xbill82/followers","following_url":"https://api.github.com/users/xbill82/following{/other_user}","gists_url":"https://api.github.com/users/xbill82/gists{/gist_id}","starred_url":"https://api.github.com/users/xbill82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xbill82/subscriptions","organizations_url":"https://api.github.com/users/xbill82/orgs","repos_url":"https://api.github.com/users/xbill82/repos","events_url":"https://api.github.com/users/xbill82/events{/privacy}","received_events_url":"https://api.github.com/users/xbill82/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T09:44:06Z","updated_at":"2016-12-08T09:44:06Z","body":"My personal thoughts on this subject involve the use in Kuzzle of a Mailer plugin within a shopping cart checkout process. Imagine that\r\n\r\n* the customer checks out her cart and pays it;\r\n* the Checkout plugin manages the whole transaction with the third-party payment service;\r\n* now a mail should be sent to the user, confirming that the purchase process is successful.\r\n\r\nWhat would be the best way to do it?\r\n\r\n* The Mailer plugin would be of type \"listener\", and would listen to some sort of `send-mail` event, which would contain the _whole_ mail (sender, receipients, Cc, Bcc and body) and just send it. Doesn't look very neat (and implies the use of `trigger` within the Checkout plugin).\r\n* The Mailer plugin would be of type \"controller\", thus expose a new API method like\r\n```json\r\n{\r\n  \"controller\": \"mailer\",\r\n  \"method\": \"send\"\r\n}\r\n```\r\nso that the Checkout plugin (assuming that it has access to the Kuzzle API) would call it to send the mail. Looks better and doesn't require the use of `trigger`.\r\n\r\nAny thoughts are welcome."}}
{"actor":{"display_login":"xbill82"}}