Edit Post

Editing and changing post details and content

Amity SDK supports the editing of the following post types:

  • Text post

  • Image post

  • File post

  • Video post

Edit a Post

Amity Social SDK provides a post editing functionality that fosters accountability and user awareness within your application. This feature enables users to edit their own posts exclusively. Users can only edit their own posts, except that you're an admin or a moderator of a particular community. The functionality encourages responsible interactions and maintains accountability. Upon completing an edit operation, the SDK updates the editedAt property to the current time, reflecting the changes made by the user. You can then leverage the updated editedAt timestamp to create a user interface that informs users of edited posts, fostering transparency. You can edit a post by follow this sample code.

You can edit a post using a pattern similar to creating a post. Follow these steps:

  1. Choose the appropriate post builder type and structure your post.

  2. Make the API call for post editing.

Note: If you intend to update files, images, or videos in a post, you must upload them first. Once you have the data, you can use it with the corresponding post type. Ensure that the builder type matches the original post type.

Update Text Post

To edit a text post, utilize the editPost method in a post repository using AmityTextPostBuilder class to compose a new text as demonstrated in the provided code snippet.

Update File Post

To edit a file post, utilize the editPost method in a post repository using AmityFilePostBuilder class to compose a set of new files as demonstrated in the provided code snippet. The files parameter should include both the current files (if required) and any newly uploaded files you wish to append to the post.

Update Image Post

To edit an image post, utilize the editPost method in a post repository using AmityImagePostBuilder class to compose a set of new images as demonstrated in the provided code snippet. The images parameter should include both the current images (if required) and any newly uploaded images you wish to append to the post.

Update Video Post

To edit a video post, utilize the editPost method in a post repository using AmityVideoPostBuilder class to compose a set of new videos as demonstrated in the provided code snippet. The videos parameter should include both the current videos (if required) and any newly uploaded videos you wish to append to the post.

You can upload a maximum of ten images/files in a single post.

Last updated