// Create video file
const createVideoFile = async (fileObject) => {
const liveFile = FileRepository.createVideo({ file: fileObject });
const model = await new Promise((resolve) =>
liveFile.once("dataUpdated", (data) => resolve(data))
);
return model;
};
// post user feed
const postNewsFeed = async (data) => {
try {
const payload = {
targetType: PostTargetType.UserFeed,
targetId: // targetId
text: data.text,
};
const amityFile = await createVideoFile(data.videoIds[0]);
payload.videoIds = [amityFile.fileId];
const livePost = PostRepository.createVideoPost(payload);
let response = await new Promise((resolve) => {
livePost.once("dataUpdated", (model) => {
resolve(model);
});
});
livePost.on("dataError", (error) => {
console.log(error, "error");
throw Error(error);
});
return response;
}
} catch (error) {
console.log(error);
throw Error(error);
}
};
After making the above call this is how my payload looks like in network tab
{
"attachments": [
{
"fileId": "65031f4d3f3187907c0e26a4",
"type": "video"
}
],
"metadata": {},
"targetType": "user",
"targetId": "6363629dd",
"data": {
"text": "Posting video feed"
}
}
And this is the response from the API (I am sharing only post object I do get other object like “postChildren”, “user” etc…)
{
"posts": [
{
"_id": "65031f5f287db2cc0",
"path": "64a67c52725b00292f5f3333/social/user/64feaeca62c509fe15d7f63c/post/65031f5f287db2ceae8127c0",
"sharedCount": 0,
"targetType": "user",
"dataType": "text",
"commentsCount": 0,
"editedAt": "2023-09-14T14:57:35.324Z",
"createdAt": "2023-09-14T14:57:35.324Z",
"updatedAt": "2023-09-14T14:57:35.328Z",
"isDeleted": false,
"hasFlaggedComment": false,
"hasFlaggedChildren": false,
"data": {
"text": "Posting video feed"
},
"postId": "65031f5f287d127c0",
"postedUserId": "6363629500d1d",
"targetId": "6363629d500d1d",
"flagCount": 0,
"hashFlag": null,
"reactions": {},
"reactionsCount": 0,
"myReactions": [],
"comments": [],
"children": [
"65031f5f287db2aeae8127c3"
],
"mentionees": [],
"tags": []
}
],
The same response I am getting in the listing. There are no URL’s