Updated Development_API (markdown)

Chris Caron 2019-02-15 15:16:37 -05:00
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") apobj.notify(title="my title", body="my body")
``` ```
### Tagging and Categories #### Tagging and Categories
Another example would be a system owner filling their code with clean logic like: Another use case for tagging might be for a system owner to fill their code with clean logic like:
```python ```python
#... #... stuff happening
apobj.notify(title='a title', body="a body", tag="service-message") 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") 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") 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 ```python
# import our library # import our library
import apprise import apprise
@ -121,16 +123,12 @@ apobj = apprise.Apprise()
# Poll our user for their setting and add them # Poll our user for their setting and add them
apobj.add('mailto://myuser:theirpassword@hotmail.com', tag=[ apobj.add('mailto://myuser:theirpassword@hotmail.com', tag=[
# Services we want to subscribe to # Services we want our user subscribed to:
"service-message", "service-message",
"broadcast-notice" "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 #### 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: By default, all notifications are sent as type **NotifyType.INFO** using the _default_ theme. The following other types are included with this theme: