Merge branch 'dev' into 'main'

Mark notifications as read

See merge request trustcafe/trustcafe-api-wrapper!6
This commit is contained in:
Simon Little 2026-04-13 16:45:24 +00:00
commit 0476c3fe9f
6 changed files with 40 additions and 4 deletions

View file

@ -33,7 +33,9 @@ import trustcafeapiwrapper, os
API = trustcafeapiwrapper.APIClient( API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("client_id"), client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret") client_secret=os.getenv("client_secret"),
env="alpha" # alpha | production.
debug=False
) )
profile = API.run_job('userprofile.get', "simon-little") profile = API.run_job('userprofile.get', "simon-little")

View file

@ -90,7 +90,31 @@ print(postlist)
## mute ## mute
## notifcation ## notifcation
### `listnotifications` ### `listnotifications`
```python
API.run_job('notification.listnotifications')
```
### `markallasread`
```python
API.run_job('notification.markallasread')
```
## post ## post
### create
```python
API.run_job('post.create', {
"postText": "This is a test post created via the API wrapper.",
"parent": {
"pk": "maintrunk#maintrunk",
"sk": "maintrunk#maintrunk"
}
})
```
### get
### listall
### listbybranch
### listbyuserprofile
### listpublic
### listremove
### update
## reaction ## reaction
## trust ## trust
## userprofile ## userprofile

View file

@ -1,6 +1,6 @@
[project] [project]
name = "trustcafeapiwrapper" name = "trustcafeapiwrapper"
version = "0.1.0.7" version = "0.1.0.8"
description = "Wraps the Trust Cafe API" description = "Wraps the Trust Cafe API"
readme = "README.md" readme = "README.md"
requires-python = ">=3.13" requires-python = ">=3.13"

View file

@ -1 +1,2 @@
from .listnotifications import listnotifications from .listnotifications import listnotifications
from .markallasread import markallasread

View file

@ -0,0 +1,8 @@
def markallasread(API):
"""
Mark all notifications as read.
Returns:
"""
API.make_request("POST", "megaphone", "inbox/markallread", authenticate=True)

View file

@ -138,6 +138,7 @@ def save_response(response):
# x += 1 # x += 1
# save_response(API.run_job('notification.listnotifications')) # save_response(API.run_job('notification.listnotifications'))
save_response(API.run_job('notification.markallasread'))
# save_response(API.run_job('feed.cafefeed')) # save_response(API.run_job('feed.cafefeed'))
@ -149,7 +150,7 @@ def save_response(response):
# })) # }))
# save_response(API.run_job('post.listall')) # save_response(API.run_job('post.listall'))
save_response(API.run_job('post.listpublic')) # save_response(API.run_job('post.listpublic'))
# from trustcafeapiwrapper.wrappers.post.create_post import create_post # from trustcafeapiwrapper.wrappers.post.create_post import create_post