trustcafe-api-wrapper/jobs/post/listbyuserprofile.py
2026-03-31 10:33:30 +01:00

14 lines
No EOL
641 B
Python

def listbyuserprofile(API, user_slug: str,) -> 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.
Returns:
dict: The list of posts for the user profile.
"""
print(f"Fetching posts for user profile: {user_slug}")
# 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)
return post_list