feat: add get and delete files

This commit is contained in:
firedotguy
2026-02-08 23:11:59 +03:00
parent c2413277d6
commit 9a4c47bd8e
5 changed files with 55 additions and 10 deletions

View File

@@ -1,7 +1,14 @@
from _io import BufferedReader
from uuid import UUID
from itd.request import fetch
def upload_file(token: str, name: str, data: BufferedReader):
return fetch(token, 'post', 'files/upload', files={'file': (name, data)})
def get_file(token: str, id: UUID):
return fetch(token, 'get', f'files/{id}')
def delete_file(token: str, id: UUID):
return fetch(token, 'delete', f'files/{id}')

View File

@@ -2,16 +2,8 @@ from warnings import deprecated
from uuid import UUID
from itd.request import fetch
@deprecated("get_hastags устарела используйте get_hashtags")
def get_hastags(token: str, limit: int = 10):
return fetch(token, 'get', 'hashtags/trending', {'limit': limit})
def get_hashtags(token: str, limit: int = 10):
return fetch(token, 'get', 'hashtags/trending', {'limit': limit})
@deprecated("get_posts_by_hastag устерла используй get_posts_by_hashtag")
def get_posts_by_hastag(token: str, hashtag: str, limit: int = 20, cursor: UUID | None = None):
return fetch(token, 'get', f'hashtags/{hashtag}/posts', {'limit': limit, 'cursor': cursor})
def get_posts_by_hashtag(token: str, hashtag: str, limit: int = 20, cursor: UUID | None = None):
return fetch(token, 'get', f'hashtags/{hashtag}/posts', {'limit': limit, 'cursor': cursor})