Post create
This commit is contained in:
parent
e775b3f456
commit
499c5aee98
3 changed files with 29 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from .get import get
|
||||
from .listbybranch import listbybranch
|
||||
from .listbyuserprofile import listbyuserprofile
|
||||
from .listbyuserprofile import listbyuserprofile
|
||||
from .create import create
|
||||
13
jobs/post/create.py
Normal file
13
jobs/post/create.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
def create(API, payload: dict) -> dict:
|
||||
"""
|
||||
Creates a new post in the API.
|
||||
|
||||
Args:
|
||||
payload (dict): The data for the new post.
|
||||
|
||||
Returns:
|
||||
dict: The post data.
|
||||
"""
|
||||
print(f"Creating a new post with payload: {payload}")
|
||||
post_data = API.make_request("POST", "content", "post", data=payload, authenticate=True)
|
||||
return post_data
|
||||
16
testing.py
16
testing.py
|
|
@ -42,6 +42,18 @@ if not API.is_token_valid():
|
|||
# print("-----------------------------")
|
||||
# feed = API.run_job('post.listbybranch', "music")
|
||||
# print(feed)
|
||||
# print("-----------------------------")
|
||||
# feed = API.run_job('post.listbyuserprofile', "simon-little")
|
||||
# print(feed)
|
||||
print("-----------------------------")
|
||||
feed = API.run_job('post.listbyuserprofile', "simon-little")
|
||||
print(feed)
|
||||
post = API.run_job('post.create', {
|
||||
"blurLabel": None,
|
||||
"cardUrl": None,
|
||||
"postText": "This is a test post created via the API wrapper.",
|
||||
"collaborative": False,
|
||||
"parent": {
|
||||
"pk": "maintrunk#maintrunk",
|
||||
"sk": "maintrunk#maintrunk"
|
||||
}
|
||||
})
|
||||
print(post)
|
||||
Loading…
Add table
Add a link
Reference in a new issue