41 lines
No EOL
1.4 KiB
Python
41 lines
No EOL
1.4 KiB
Python
def create_post(post_text, parent_pksk="maintrunk#maintrunk", blur_label=None, card_url=None, collaborative=False):
|
|
"""
|
|
Creates a new post.
|
|
|
|
Args:
|
|
post_text (str): The text content of the post.
|
|
parent_pksk (str): The parent PKSK for the post, default is "maintrunk#maintrunk".
|
|
blur_label (str, optional): An optional label for blurring the post content.
|
|
card_url (str, optional): An optional URL to include as a card in the post.
|
|
collaborative (bool, optional): Whether the post is collaborative, default is False.
|
|
|
|
Returns:
|
|
dict: The response from the API containing details of the created post.
|
|
"""
|
|
|
|
|
|
|
|
'''
|
|
WIP
|
|
|
|
How best to handle the API client here?
|
|
|
|
- Should this be part of a big class?
|
|
- Should we pass the API client as an argument to this function?
|
|
- We can't create a new instance of the API client within this function
|
|
because it would need the credentials which can be dynamic and
|
|
don't want to tangle up this wrapper.
|
|
-
|
|
|
|
'''
|
|
response = API.run_job('post.create', {
|
|
"blurLabel": blur_label,
|
|
"cardUrl": card_url,
|
|
"postText": post_text,
|
|
"collaborative": collaborative,
|
|
"parent": {
|
|
"pk": parent_pksk,
|
|
"sk": parent_pksk
|
|
}
|
|
})
|
|
return response |