feat: add models and enum
This commit is contained in:
@@ -7,7 +7,7 @@ def add_comment(token: str, post_id: str, content: str, reply_comment_id: str |
|
||||
return fetch(token, 'post', f'posts/{post_id}/comments', data)
|
||||
|
||||
def get_comments(token: str, post_id: str, limit: int = 20, cursor: int = 0, sort: str = 'popular'):
|
||||
return fetch(token, 'get', f'posts/{post_id}/comments', {'limit': limit, 'sort': sort, 'cursor': cursor})
|
||||
return fetch(token, 'get', f'posts/{post_id}/comments', {'limit': limit, 'sort': sort, 'cursor': cursor})['data']
|
||||
|
||||
def like_comment(token: str, comment_id: str):
|
||||
return fetch(token, 'post', f'comments/{comment_id}/like')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from itd.request import fetch
|
||||
|
||||
def get_hastags(token: str, limit: int = 10):
|
||||
return fetch(token, 'get', 'hashtags/trending', {'limit': limit})
|
||||
return fetch(token, 'get', 'hashtags/trending', {'limit': limit})['data']
|
||||
|
||||
def get_posts_by_hastag(token: str, hashtag: str, limit: int = 20, cursor: int = 0):
|
||||
return fetch(token, 'get', f'hashtags/{hashtag}/posts', {'limit': limit, 'cursor': cursor})
|
||||
|
||||
@@ -18,7 +18,7 @@ def get_posts(token: str, username: str | None = None, limit: int = 20, cursor:
|
||||
if tab:
|
||||
data['tab'] = tab
|
||||
|
||||
return fetch(token, 'get', 'posts', data)
|
||||
return fetch(token, 'get', 'posts', data)['data']
|
||||
|
||||
def get_post(token: str, id: str):
|
||||
return fetch(token, 'get', f'posts/{id}')
|
||||
|
||||
Reference in New Issue
Block a user