List removed posts
Last evaluated key for pagination
This commit is contained in:
parent
e1a8e008e1
commit
2b608be054
9 changed files with 35 additions and 282 deletions
|
|
@ -1,11 +1,12 @@
|
|||
def listall(API) -> dict:
|
||||
def listall(API, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches the list of posts for a given branch from the API.
|
||||
|
||||
Args:
|
||||
branch_slug (str): Slug of the branch to fetch posts for.
|
||||
lastEvaluatedKey (dict, optional): Key to start fetching posts from.
|
||||
Returns:
|
||||
dict: The list of posts for the branch.
|
||||
"""
|
||||
post_list = API.make_request("GET", "content", f"post", authenticate=True)
|
||||
post_list = API.make_request("GET", "content", f"post", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return post_list
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
def listpublic(API) -> dict:
|
||||
"""
|
||||
Fetches the list of public posts from the API.
|
||||
|
||||
Args:
|
||||
branch_slug (str): Slug of the branch to fetch posts for.
|
||||
Returns:
|
||||
dict: The list of public posts.
|
||||
"""
|
||||
post_list = API.make_request("GET", "content", f"post/public", authenticate=True)
|
||||
return post_list
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
def listbybranch(API, branch_slug: str,) -> dict:
|
||||
def listbybranch(API, branch_slug: str, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches the list of posts for a given branch from the API.
|
||||
|
||||
Args:
|
||||
branch_slug (str): Slug of the branch to fetch posts for.
|
||||
lastEvaluatedKey (dict, optional): Key to start fetching posts from.
|
||||
Returns:
|
||||
dict: The list of posts for the branch.
|
||||
"""
|
||||
post_list = API.make_request("GET", "content", f"post/ref-subwiki/{branch_slug}", authenticate=True)
|
||||
post_list = API.make_request("GET", "content", f"post/ref-subwiki/{branch_slug}", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return post_list
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
def listbyuserprofile(API, user_slug: str,) -> dict:
|
||||
def listbyuserprofile(API, user_slug: str, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches the list of posts for a given user profile from the API.
|
||||
|
||||
Args:
|
||||
user_slug (str): Slug of the user profile to fetch posts for.
|
||||
lastEvaluatedKey (dict, optional): Key to start fetching posts from.
|
||||
Returns:
|
||||
dict: The list of posts for the user profile.
|
||||
"""
|
||||
# Note there is actually a reference to `/branch` in the API url
|
||||
# and it should be considered for removal because that's confusing
|
||||
post_list = API.make_request("GET", "content", f"post/ref-userprofile/branch/{user_slug}", authenticate=True)
|
||||
post_list = API.make_request("GET", "content", f"post/ref-userprofile/branch/{user_slug}", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return post_list
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
def listpublic(API) -> dict:
|
||||
def listpublic(API, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches the list of public posts from the API.
|
||||
|
||||
Args:
|
||||
branch_slug (str): Slug of the branch to fetch posts for.
|
||||
lastEvaluatedKey (dict, optional): Key to start fetching posts from.
|
||||
Returns:
|
||||
dict: The list of public posts.
|
||||
"""
|
||||
post_list = API.make_request("GET", "content", f"post/public", authenticate=True)
|
||||
post_list = API.make_request("GET", "content", f"post/public", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return post_list
|
||||
11
src/trustcafeapiwrapper/jobs/post/listremoved.py
Normal file
11
src/trustcafeapiwrapper/jobs/post/listremoved.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
def listremoved(API, lastEvaluatedKey=None) -> dict:
|
||||
"""
|
||||
Fetches the list of removed posts from the API.
|
||||
|
||||
Args:
|
||||
lastEvaluatedKey (dict, optional): Key to start fetching posts from.
|
||||
Returns:
|
||||
dict: The list of removed posts.
|
||||
"""
|
||||
post_list = API.make_request("GET", "content", f"post/removed", authenticate=True, query_params=lastEvaluatedKey)
|
||||
return post_list
|
||||
Loading…
Add table
Add a link
Reference in a new issue