feat: add report

This commit is contained in:
firedotguy
2026-01-29 21:11:00 +03:00
parent c2866a9d28
commit 6e7826f049
2 changed files with 20 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ from itd.comments import get_comments, add_comment, delete_comment, like_comment
from itd.hashtags import get_hastags, get_posts_by_hastag from itd.hashtags import get_hastags, get_posts_by_hastag
from itd.notifications import get_notifications, mark_as_read, mark_all_as_read, get_unread_notifications_count from itd.notifications import get_notifications, mark_as_read, mark_all_as_read, get_unread_notifications_count
from itd.posts import create_post, get_posts, get_post, edit_post, delete_post, pin_post, repost, view_post from itd.posts import create_post, get_posts, get_post, edit_post, delete_post, pin_post, repost, view_post
from itd.reports import report
class Client: class Client:
def __init__(self, token: str): def __init__(self, token: str):
@@ -73,4 +75,17 @@ class Client:
return repost(self.token, id, content) return repost(self.token, id, content)
def view_post(self, id: str): def view_post(self, id: str):
return view_post(self.token, id) return view_post(self.token, id)
def report(self, id: str, type: str = 'post', reason: str = 'other', description: str = ''):
return report(id, type, reason, description)
def report_user(self, id: str, reason: str = 'other', description: str = ''):
return report(id, 'user', reason, description)
def report_post(self, id: str, reason: str = 'other', description: str = ''):
return report(id, 'post', reason, description)
def report_comment(self, id: str, reason: str = 'other', description: str = ''):
return report(id, 'comment', reason, description)

4
itd/reports.py Normal file
View File

@@ -0,0 +1,4 @@
from itd.request import fetch
def report(token: str, id: str, type: str = 'post', reason: str = 'other', description: str = ''):
return fetch(token, 'post', 'reports', {'targetId': id, 'targetType': type, 'reason': reason, 'description': description})