Updated Development_API (markdown)

master
Chris Caron 2022-07-06 08:50:23 -04:00
parent 12edfd548e
commit e9193d15d4
1 changed files with 33 additions and 0 deletions

@ -1,3 +1,19 @@
# Table of Contents
<!--ts-->
* [Development API](#development-api)
* [The Apprise Object](#the-apprise-object)
* [`add()`](#add-add-a-new-notification-service-by-urls)
* [`notify()`](#notify--send-notifications)
* [`len()`](#len-returns-number-of-notification-services-loaded)
* [`clear()`](#clear-reset-our-apprise-object)
* [`details()`](#details-dynamic-view-into-available-notification-services-apprise-offers)
* [`async_notify()`](#async_notify--leveraging-await-to-send-notifications)
* [The Apprise Asset Object](#the-apprise-asset-object)
* **Advanced**:
* [The Apprise Notification Object](#the-apprise-notification-object)
<!--te-->
# Development API
Apprise is very easy to use as a developer. The **Apprise()** object handles everything for you, meanwhile the **AppriseAsset()** Object allows you to stray away from some default configuration to personalize the users experience (and perhaps fit your application better):
* **[[The Apprise Object|Development_API#the-apprise-object]]**
@ -94,6 +110,23 @@ apobj.notify(
body_format=NotifyFormat.TEXT,
)
```
### async_notify() : Leveraging Await to Send Notification(s)
Under the hood, Apprise will attempt to send all of your notifications asynchronously which means it will acquire it's own event loop. If you already have one going, then you can still send your notifications using `await` like so:
```python
import asyncio
async my_event_loop():
# assumes you declared your apobj (as identified above)
# You can trigger it asynchronously now like so:
results = await apobj.async_notify(
body='what a great async friendly notification service!',
title='my notification title')
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```
#### Leverage Tagging
If you associated tags with your notification services when you called **add()** earlier, you can leverage it's full potential through the **notify()** function here. Tagging however allows you to trigger notifications only when a criteria is met. The tagging logic can be interpreted as follows: