Updated Development_API (markdown)

Chris Caron 2019-02-09 02:17:34 -05:00
parent 3e05b8cccc
commit 6839538693

@ -34,7 +34,7 @@ We can retrieve a list of the active and loaded notification services by using p
print("There are %d notification services loaded" % len(apobj))
```
You can send a notification to all of the loaded notifications services by just providing it a **title** and a **body** like so:
You can now send a notification to all of the loaded notifications services by just providing it a **title** and a **body** like so:
```python
# Then notify these services any time you desire. The below would
# notify all of the services loaded into our Apprise object.
@ -42,7 +42,65 @@ apobj.notify(
title='my notification title',
body='what a great notification service!',
)
```
Tagging is a great way to add a richer experience to the notification flow.
You can associate one or more _tags_ with the notifications you choose to add. This grants you to flexibility to later call on just some (or all) of your added services. It also allows you to easily filter out notifications based on user preferences.
Here is an example:
```python
# import our library
import apprise
# Create our object
a = apprise.Apprise()
# Add a tag by tuple
a.add('json://localhost/tagA/', tag=("TagA", ))
# Add 2 tags by string; the comma and/or space auto delimit
# our entries
a.add('json://localhost/tagAB/', tag="TagA, TagB")
# Add a tag using a set
a.add('json://localhost/tagB/', tag=set(["TagB"])
# Add a tag by string (again)
a.add('json://localhost/tagC/', tag="TagC")
# Add 2 tags using a list
a.add('json://localhost/tagCD/', tag=["TagC", "TagD"])
# Add a tag by string (again)
a.add('json://localhost/tagD/', tag="TagD")
# add a tag set by set (again)
a.add('json://localhost/tagCDE/', tag=set(["TagC", "TagD", "TagE"]))
# Expression: TagC and TagD
# Matches the following only:
# - json://localhost/tagCD/
# - json://localhost/tagCDE/
a.notify(title="my title", body="my body", tag=[('TagC', 'TagD')])
# Expression: (TagY and TagZ) or TagX
# Matches nothing
a.notify(title="my title", body="my body", tag=[('TagY', 'TagZ'), 'TagX'])
# Expression: (TagY and TagZ) or TagA
# Matches the following only:
# - json://localhost/tagAB/
a.notify(title="my title", body="my body", tag=[('TagY', 'TagZ'), 'TagA'])
# Expression: (TagE and TagD) or TagB
# Matches the following only:
# - json://localhost/tagCDE/
# - json://localhost/tagAB/
# - json://localhost/tagB/
a.notify(title="my title", body="my body", tag=[('TagE', 'TagD'), 'TagB'])
```
By default, all notifications are sent as type **NotifyType.INFO** using the _default_ theme. The following other types are included with this theme:
| Notification Type | Text Representation | Image |