Create Post
When creating a post, you can select the target type or which feed you want the post to exist, It can be any of the following:
User feed - collection of posts for a user's timeline
Community feed - collection of posts from members of the community
Content - external content
In creating a post, these are the following parameters:
Parameter | Description | Attributes |
---|---|---|
| ID of the user, community, or content. If you want the post to exist in a user feed, you need to provide the userID, etc.. | |
| Where you want the post to exist |
|
| Keywords you want to associate with your post. This is optional. Up to five tags can be added and each tag can be up to 24 characters long | |
| Post content (for text post) | |
IDs | IDs of the media you want to attach to your post | IDs of images, files, videos, and stream |
Post target type
The targetType
parameter can be any of the following:
UserFeed
CommunityFeed
Content
If you want the post to belong to a user feed, targetType
should be UserFeed
and targetId
is the ID of the user. Otherwise, if you want it to belong to a community, targetType
and targetId
should be CommunityFeed
and the ID of the community respectively.
For an external content post or a post in which the targetType
is Content
, it can stand on its own without belonging to a user or community. You can create a post object of this type if you want to associate the post to a content (e.g. a news article) in your app which is external to Amity Social Cloud.
Post type
A single post can have up to 20,000 characters. For custom post, the size of the JSON data must not exceed 100KB.
For a successful creation of the post, the reply will be the post model. Otherwise, it will return an error.
Amity SDK supports the creation of the following post types:
File Upload
Before you can create an image, video, file, or custom post, you must first upload the image, video, or the file that you will add to your post. The SDK provides a convenient FileRepository class to handle the uploading of these files.
The model
that you will receive from the live object used to upload file via FileRepository
will appear in this format:
Model Description
Name | Data Type | Description | Attributes |
|
| Root file key on cloud storage | |
|
| Http link for file download | |
|
| File type |
|
|
| The date/time when a file is uploaded | |
|
| The date/time when a file is updated | |
|
| Information about the file |
For more information on the fileObject
type, you can refer here.
Last updated