From e9193d15d454b85bdae9a99da15d914828c0668f Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 6 Jul 2022 08:50:23 -0400 Subject: [PATCH] Updated Development_API (markdown) --- Development_API.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Development_API.md b/Development_API.md index fc2392b..a9d80af 100644 --- a/Development_API.md +++ b/Development_API.md @@ -1,3 +1,19 @@ +# Table of Contents + + + * [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) + + # 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: