From dd8f12ea43c5f86cda168ee6f35508315f722b52 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Mon, 13 May 2024 21:24:26 -0400 Subject: [PATCH] Updated Development_Contribution (markdown) --- Development_Contribution.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Development_Contribution.md b/Development_Contribution.md index aa1b1c6..f1bb44c 100644 --- a/Development_Contribution.md +++ b/Development_Contribution.md @@ -35,9 +35,7 @@ Note: `bin/checkdone.sh` does a full scan of the product where `test.sh` is a qu It basically boils down to this: ```python -# Whatever your class is called that inherits NotifyBase, make sure -# to also make that the filename as well. Below is an example of what -# plugins/NotifyFooBar.py might look like: +# plugins/foorbar.py might look like: from .NotifyBase import NotifyBase from ..AppriseLocale import gettext_lazy as _ @@ -105,14 +103,14 @@ class NotifyFooBar(NotifyBase): ``` With respect to the above example: -- You just need to create a single notification python file as `/plugins/NotifyServiceName.py` +- You just need to create a single notification python file as `/plugins/service_name.py` - Make sure you call the class inside `NotifyServiceName` and inherit from `NotifyBase` - Make sure your class object name is the same as the filename you create. This is very important! - From there you just need to at a bare minimum define: - **the class objects**: - `service_name`: A string that acts as a default descriptive name associated with the Notification - `service_url`: A string that identifies the platform/services URL. This is used purely as meta data for those who seek it. But this field is required. - - `protocol` and/or `secure_protocol`: A string (or can be a list of strings) identifying the scheme:// keyword that apprise uses to map to the Plugin Class it's associated with. For example, `slack` is mapped to the `NotifySlack` class found in the [`/plugins/NotifySlack.py` file](https://github.com/caronc/apprise/blob/master/apprise/plugins/NotifySlack.py). This must be defined so that people can leverage your plugin. You must choose a protocol name that isn't already taken. + - `protocol` and/or `secure_protocol`: A string (or can be a list of strings) identifying the scheme:// keyword that apprise uses to map to the Plugin Class it's associated with. For example, `slack` is mapped to the `NotifySlack` class found in the [`/plugins/slack.py` file](https://github.com/caronc/apprise/blob/master/apprise/plugins/slack.py). This must be defined so that people can leverage your plugin. You must choose a protocol name that isn't already taken. - `setup_url`: A string that identifies the URL a user can use to get information on how to use this Apprise Notification. At this time I'm just creating URLs that point back to my GitHub Wiki page. - **the functions**: @@ -200,8 +198,8 @@ With respect to the above example: If your service is really complex (and requires a lot of code), maybe it's easier to split your code into multiple files. This is how i handled the [NotifyFCM plugin i wrote](https://github.com/caronc/apprise/tree/master/apprise/plugins/NotifyFCM) which was based on Google's version. - Don't be afraid to just copy and paste another already created service and update it for your own usage. - - [plugins/NotifyJSON.py](https://github.com/caronc/apprise/blob/master/apprise/plugins/NotifyJSON.py) is a bit advanced; but shows the general idea of the structure. - - [plugin/NotifyFCM](https://github.com/caronc/apprise/tree/master/apprise/plugins/NotifyFCM) is a much more complex design but illustrates how you can build your notification into smaller components. + - [plugins/custom_json.py](https://github.com/caronc/apprise/blob/master/apprise/plugins/custom_json.py) is a bit advanced; but shows the general idea of the structure. + - [plugin/fcm](https://github.com/caronc/apprise/tree/master/apprise/plugins/fcm) is a much more complex design but illustrates how you can build your notification into smaller components. - All in all.... just have a look at the [plugins directory](https://github.com/caronc/apprise/tree/master/apprise/plugins) and feel free to use this as a reference to help structure and solve your own notification service you might be building You can have a look at the NotifyBase object and see all of the other entries you can define that Apprise can look after for you (such as restricting the message length, title length, handling TEXT -> Markdown, etc). You can also look at how other classes were built.