mirror of
https://github.com/caronc/apprise.git
synced 2024-12-13 10:21:51 +01:00
Updated Development_API (markdown)
parent
d74c3f9403
commit
bde8dece72
@ -99,19 +99,21 @@ apobj.notify(title='a title', body="a body", tag=["tagA", "TagB", ["TagC", "TagD
|
||||
apobj.notify(title="my title", body="my body")
|
||||
```
|
||||
|
||||
### Tagging and Categories
|
||||
Another example would be a system owner filling their code with clean logic like:
|
||||
#### Tagging and Categories
|
||||
Another use case for tagging might be for a system owner to fill their code with clean logic like:
|
||||
```python
|
||||
#...
|
||||
#... stuff happening
|
||||
apobj.notify(title='a title', body="a body", tag="service-message")
|
||||
# ...
|
||||
|
||||
# ... uh oh, something went wrong
|
||||
apobj.notify(title='a title', body="a body", tag="debug-message")
|
||||
# ...
|
||||
|
||||
# ... more stuff happening
|
||||
apobj.notify(title='a title', body="a body", tag="broadcast-notice")
|
||||
# ...
|
||||
```
|
||||
|
||||
Then somewhere when the Apprise Object (_apobj_) is first created, you poll your user for their settings and only load what they're interested in:
|
||||
The idea would be that somewhere when the Apprise Object (_apobj_) was first created, you (as a system owner) would have retrieved the user settings and only load the tags based on what they're interested in:
|
||||
```python
|
||||
# import our library
|
||||
import apprise
|
||||
@ -121,16 +123,12 @@ apobj = apprise.Apprise()
|
||||
|
||||
# Poll our user for their setting and add them
|
||||
apobj.add('mailto://myuser:theirpassword@hotmail.com', tag=[
|
||||
# Services we want to subscribe to
|
||||
# Services we want our user subscribed to:
|
||||
"service-message",
|
||||
"broadcast-notice"
|
||||
])
|
||||
|
||||
# Note that in this example, the user would never be notified for
|
||||
# "debug-message" calls. Yet the system owner does not need to provide
|
||||
# any additional logic around this call to perform this filter since
|
||||
# apprise will take care of it for you.
|
||||
```
|
||||
**Takeaway**: In this example (above), the user would never be notified for "_debug-message_" calls. Yet the developer of this system does not need to provide any additional logic around the apprise calls other than the _tag_ that should trigger the notification. Just let _Apprise_ handle the logic of what notifications to send for you.
|
||||
|
||||
#### Message Types and Themes
|
||||
By default, all notifications are sent as type **NotifyType.INFO** using the _default_ theme. The following other types are included with this theme:
|
||||
|
Loading…
Reference in New Issue
Block a user