attachment_ids для комментариев

This commit is contained in:
Rationess
2026-02-03 22:20:33 +03:00
parent ba78457de5
commit 6ac12c6f79
2 changed files with 10 additions and 8 deletions

View File

@@ -2,11 +2,11 @@ from uuid import UUID
from itd.request import fetch
def add_comment(token: str, post_id: UUID, content: str):
return fetch(token, 'post', f'posts/{post_id}/comments', {'content': content})
def add_comment(token: str, post_id: UUID, content: str, attachment_ids: list[UUID] = []):
return fetch(token, 'post', f'posts/{post_id}/comments', {'content': content, "attachmentIds": list(map(str, attachment_ids))})
def add_reply_comment(token: str, comment_id: UUID, content: str, author_id: UUID):
return fetch(token, 'post', f'comments/{comment_id}/replies', {'content': content, 'replyToUserId': str(author_id)})
def add_reply_comment(token: str, comment_id: UUID, content: str, author_id: UUID, attachment_ids: list[UUID] = []):
return fetch(token, 'post', f'comments/{comment_id}/replies', {'content': content, 'replyToUserId': str(author_id), "attachmentIds": list(map(str, attachment_ids))})
def get_comments(token: str, post_id: UUID, limit: int = 20, cursor: int = 0, sort: str = 'popular'):
return fetch(token, 'get', f'posts/{post_id}/comments', {'limit': limit, 'sort': sort, 'cursor': cursor})