Developers
NOTICE: This DOES NOT WORK until at least Jarvis-1.0.0-InDev-2013052501 or later!!
API Classes
Want to send out notifications from your plugin? Jarvis offers an API for you to achieve exactly that! In your project, soft-depend on Jarvis, and you can use the API classes to facilitate your notifications.
The `type` field is a string used to prevent flooding of same message type to admins too frequently. Admins can customize the duration before same message type gets sent to their devices in the plugin configuration. The default is 5 minutes. You can use suffix if your notification are different. For example, I use "spam-<playername>" to allow notifications to go through for Spammer1 and AnotherSpammer without cool down. Please do not abuse this just so you can send messages repeatedly.
As for the `report` messages. Each one propagates to the more detailed function. If you enter just one report message, it will use that for short, medium, and long reports. If you use the short + medium, the medium will be propagated to use for long report. Currently, I only use the short report, but if you want to custom tailor messages for different devices, you can do so here. However, please keep in mind about where the messages are going for your report. For example, if your report exceeds 140 characters, Twitter will not accept it. If your medium length report are too long, it may be difficult to read in a push notification. If your report is too short, it might not be meaningful enough in an e-mail.
Finally, please keep in mind that simply having the plugin does not mean it works. The plugin will not be able to send notifications to the admin until they have their encryption keys setup using the `/jarvis getkeys` command. For the time being, Emitter will quietly discard the messages, which is not the desired behaviour. I will be adding return codes to inform you of the status in the future. I will update the documentations as that becomes available.
Class | Description |
---|---|
net.chiisana.jarvis.api.Emitter | Main emitter class for emitting notifications. |
net.chiisana.jarvis.api.model.Severity | Severity of notification emitted. |
net.chiisana.jarvis.api.model.EmitterResult | Result from Emitter. |
DEPRECATEDnet.chiisana.jarvis.model.Severity | DEPRECATED Deprecated copy of net.chiisana.jarvis.api.model.Severity. |
net.chiisana.jarvis.api.Emitter
Static Function | Parameters | Return Type | Description |
---|---|---|---|
Emit | Severity severity, String type, String report | EmitterResult | Emit a notification of Severity severity, with identifying type of type, and report content of report for short, medium, and long report notification channels. |
Emit | Severity severity, String type, String reportShort, String reportMedium | EmitterResult | Emit a notification of Severity severity, with identifying type of type, and report content of reportShort for short, and reportMedium for medium, and long report notification channels. |
Emit | Severity severity, String type, String reportShort, String reportMedium, String reportLong, | EmitterResult | Emit a notification of Severity severity, with identifying type of type, and report content of reportShort for short, and reportMedium for medium, and reportLong for long report notification channels. |
net.chiisana.jarvis.api.model.Severity
Enumeration | Description |
---|---|
INFO | FYI Notification, informative, no action required |
LOW | Good to know, not really that bad |
MEDIUM | Something is happening, and you should be informed |
HIGH | Something bad is happening, and you should act soon |
URGENT | You want to act on this now! |
net.chiisana.jarvis.api.model.EmitterResult
Enumeration | Description |
---|---|
SUCCESS | Successfully delivered the notification according to preferences |
NETWORK_ERROR | Failed to send notification to API server. Currently does not resend, you should re-queue this for later. |
SENT_RECENTLY | The notification type have been sent recently. It will not be resent again until the configured duration have lapsed. |
ENCRYPTION_NOT_AVAILABLE | Encryption engine not available. Perhaps the server admin haven't used the getkeys command to get encryption keys. |