Updated Development_Contribution (markdown)

master
Chris Caron 2025-07-28 20:35:27 -04:00
parent c06f16d020
commit 40d055f79b
1 changed files with 11 additions and 11 deletions

@ -138,15 +138,15 @@ With respect to the above example:
- **Putting it together**:
```python
from apprise.plugins.myservice import NotifyMyService
from apprise.plugins.foobar import NotifyFooBar
import Apprise
# Apprise is nothing but a manager of individual plugins
a = Apprise()
# Under the table, add just calls the NotifyMyService.parse_url() and passes
# Under the table, add just calls the NotifyFooBar.parse_url() and passes
# the result set into your new services __init__() function.
a.add('myscheme://details/?more=details&are=optional')
a.add('foobar://details/?more=details&are=optional')
# There would be one new service added to our manager now:
assert(len(a), 1)
@ -154,11 +154,11 @@ With respect to the above example:
# you can directly access the notification services if you wanted to this way:
# index element 0 exists because we added it successfully above (assuming you properly
# followed all the rules above):
assert isinstance(a[0], NotifyMyService)
assert isinstance(a[0], NotifyFooBar)
# So we know we can access the notification, then this would create a second notification service:
# The only thing add does is match the schema up with the class it should use and then call it's
# NotifyServiceName.parse_url()
# NotifyFooBar.parse_url()
# So parse_url() is in charge of preparing all of the arguments we can use to instantiate our object
# With that, it can then do Object(**parse_url_response)
@ -179,22 +179,22 @@ With respect to the above example:
- **Putting it together without the overhead of the Apprise manager**:
```python
from Apprise.plugins import NotifyMyService
from apprise.plugins.foobar import NotifyFooBar
# You can do this manually too if you want to test around the overhead
# of the Apprise manager itself:
results = NotifyMyService.parse_url('myscheme://details/?more=details&are=optional')
results = NotifyFooBar.parse_url('foobar://details/?more=details&are=optional')
# A simple dictionary of all of our arguments ready to go:
assert isinstance(results, dict)
# Now instantiate your object:
obj = NotifyMyService(**results)
obj = NotifyFooBar(**results)
# If you build your NotifyMyService correctly, then you should be able
# If you build your NotifyFooBar correctly, then you should be able
# to build a copy of the object perfectly using it's url() call
# Now instantiate your object:
clone_results = NotifyMyService.parse_url(obj.url())
clone_results = NotifyFooBar.parse_url(obj.url())
# A simple dictionary of all of our arguments ready to go:
assert isinstance(clone_results, dict)
@ -202,7 +202,7 @@ With respect to the above example:
# if you did this properly, you'll have a second working instance
# you can work with (this is a great test to make sure you coded
# your new notification service perfect)
clone = NotifyMyService(**clone_results)
clone = NotifyFooBar(**clone_results)
# The best test of all to ensure you did everything well; both the
# clone and original object you created should produce the same