update-api
All checks were successful
deploy / deploy (push) Successful in 1m16s

This commit is contained in:
Untone 2023-11-28 11:33:28 +03:00
parent 12ad685b31
commit 2d89a4ec86
2 changed files with 12 additions and 6 deletions

View File

@ -20,7 +20,7 @@ class ReactionKind(Enumeration):
REJECT = 8 # -1
# public feed
QUOTE = 9 # +0 bookmark
QUOTE = 9 # +0
COMMENT = 0 # +0
LIKE = 11 # +1
DISLIKE = 12 # -1

View File

@ -28,13 +28,13 @@ async def _request_endpoint(query_name, body):
async def get_author(author_id) -> Author:
query_name = "getAuthor"
query_name = "get_author"
query_type = "query"
operation = "GetAuthor"
query_fields = "id slug pic name"
gql = {
"query": query_type + " " + operation + " { " + query_name + " { " + query_fields + "м} " + " }",
"query": query_type + " " + operation + " { " + query_name + " { " + query_fields + "} " + " }",
"operationName": operation,
"variables": None,
}
@ -43,13 +43,19 @@ async def get_author(author_id) -> Author:
async def get_followed_shouts(author_id: int) -> List[Shout]:
query_name = "getFollowedShouts"
query_name = "load_shouts_followed"
query_type = "query"
operation = "GetFollowedShouts"
query_fields = "id slug title"
query = f"{query_type} {operation}($author_id: Int!) {{ {query_name}(author_id: $author_id) {{ {query_fields} }} }}"
query = f"""{query_type} {operation}($author_id: Int!, limit: Int, offset: Int) {{
{query_name}(author_id: $author_id, limit: $limit, offset: $offset) {{ {query_fields} }}
}}"""
body = {"query": query, "operationName": operation, "variables": {"author_id": author_id}}
body = {
"query": query,
"operationName": operation,
"variables": {"author_id": author_id, "limit": 1000, "offset": 0}, # FIXME: too big
}
return await _request_endpoint(query_name, body)