Updated Development_API (markdown)

Chris Caron 2023-12-16 14:51:01 -05:00
parent fbe208c29e
commit 1ac9cedd1b

@ -9,11 +9,12 @@
* [`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)
* **Features**:
* [Pickle Support](#pickleserialization-support)
* **Advanced**:
* [The Apprise Notification Object](#the-apprise-notification-object)
* [The Apprise Asset Object](#the-apprise-asset-object)
* [The Apprise Notification Object](#the-apprise-notification-object)
* **Features**:
* [Pickle Support](#pickleserialization-support)
<!--te-->
# Development API
@ -359,6 +360,38 @@ apobj = apprise.Apprise(asset=asset)
# default configuration has been over-ridden.
```
## The Apprise Notification Object
The **[[The Apprise Object|Development_API#the-apprise-object]]** actually already does a really good managing these for you. But if you want to manage the notifications yourself here is how you can do it:
```python
# Import this library
import apprise
# Instantiate an object. This is what the apprise object
# would have otherwise done under the hood:
obj = apprise.Apprise.instantiate('glib://')
# Now you can use the notify() function to pass notifications.
# notify() is similar to Apprise.notify() except the overhead of
# of tagging is not present. There also no handling of the
# the text input type (HTML, MARKUP, etc). This is on you
# to manipulate before passing in the content.
obj.notify(
body=u"A test message",
title=u"a title",
)
# send() is a very low level call which directly posts the
# body and title you specify to the remote notification server
# There is NO data manipulation here, no overflow handling
# nothing. But this allows you to free form your own
# messages and pass them along using the apprise handling
obj.send(
body=u"A test message",
title=u"a title",
)
```
# Features
## Pickle/Serialization Support
You can Serialize your loaded notifications so they can be restored later on:
@ -391,37 +424,4 @@ apobj = pickle.loads(serialized)
# Perhaps we previously wrote it to disk, well we can load our data this way as well:
with open("myfile.txt", "r+") as file:
apobj = pickle.loads(file.read())
```
# Advanced
## The Apprise Notification Object
The **[[The Apprise Object|Development_API#the-apprise-object]]** actually already does a really good managing these for you. But if you want to manage the notifications yourself here is how you can do it:
```python
# Import this library
import apprise
# Instantiate an object. This is what the apprise object
# would have otherwise done under the hood:
obj = apprise.Apprise.instantiate('glib://')
# Now you can use the notify() function to pass notifications.
# notify() is similar to Apprise.notify() except the overhead of
# of tagging is not present. There also no handling of the
# the text input type (HTML, MARKUP, etc). This is on you
# to manipulate before passing in the content.
obj.notify(
body=u"A test message",
title=u"a title",
)
# send() is a very low level call which directly posts the
# body and title you specify to the remote notification server
# There is NO data manipulation here, no overflow handling
# nothing. But this allows you to free form your own
# messages and pass them along using the apprise handling
obj.send(
body=u"A test message",
title=u"a title",
)
```