This commit is contained in:
parent
12ad685b31
commit
2d89a4ec86
|
@ -20,7 +20,7 @@ class ReactionKind(Enumeration):
|
||||||
REJECT = 8 # -1
|
REJECT = 8 # -1
|
||||||
|
|
||||||
# public feed
|
# public feed
|
||||||
QUOTE = 9 # +0 bookmark
|
QUOTE = 9 # +0
|
||||||
COMMENT = 0 # +0
|
COMMENT = 0 # +0
|
||||||
LIKE = 11 # +1
|
LIKE = 11 # +1
|
||||||
DISLIKE = 12 # -1
|
DISLIKE = 12 # -1
|
||||||
|
|
|
@ -28,13 +28,13 @@ async def _request_endpoint(query_name, body):
|
||||||
|
|
||||||
|
|
||||||
async def get_author(author_id) -> Author:
|
async def get_author(author_id) -> Author:
|
||||||
query_name = "getAuthor"
|
query_name = "get_author"
|
||||||
query_type = "query"
|
query_type = "query"
|
||||||
operation = "GetAuthor"
|
operation = "GetAuthor"
|
||||||
query_fields = "id slug pic name"
|
query_fields = "id slug pic name"
|
||||||
|
|
||||||
gql = {
|
gql = {
|
||||||
"query": query_type + " " + operation + " { " + query_name + " { " + query_fields + "м} " + " }",
|
"query": query_type + " " + operation + " { " + query_name + " { " + query_fields + "} " + " }",
|
||||||
"operationName": operation,
|
"operationName": operation,
|
||||||
"variables": None,
|
"variables": None,
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,19 @@ async def get_author(author_id) -> Author:
|
||||||
|
|
||||||
|
|
||||||
async def get_followed_shouts(author_id: int) -> List[Shout]:
|
async def get_followed_shouts(author_id: int) -> List[Shout]:
|
||||||
query_name = "getFollowedShouts"
|
query_name = "load_shouts_followed"
|
||||||
query_type = "query"
|
query_type = "query"
|
||||||
operation = "GetFollowedShouts"
|
operation = "GetFollowedShouts"
|
||||||
query_fields = "id slug title"
|
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)
|
return await _request_endpoint(query_name, body)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user