feat: add models part 3

This commit is contained in:
firedotguy
2026-02-01 17:20:37 +03:00
parent 2a9f7da9a9
commit ba78457de5
13 changed files with 267 additions and 78 deletions

View File

@@ -1,16 +1,15 @@
from uuid import UUID
from itd.request import fetch
def get_notifications(token: str, limit: int = 20, cursor: int = 0, type: str | None = None):
data = {'limit': str(limit), 'cursor': str(cursor)}
if type:
data['type'] = type
return fetch(token, 'get', 'notifications', data)
def get_notifications(token: str, limit: int = 20, offset: int = 0):
return fetch(token, 'get', 'notifications', {'limit': limit, 'offset': offset})
def mark_as_read(token: str, id: str):
return fetch(token, 'post', f'notification/{id}/read')
def mark_as_read(token: str, id: UUID):
return fetch(token, 'post', f'notifications/{id}/read')
def mark_all_as_read(token: str):
return fetch(token, 'post', f'notification/read-all')
return fetch(token, 'post', f'notifications/read-all')
def get_unread_notifications_count(token: str):
return fetch(token, 'get', 'notifications/count')