Update & Remove

Update an existing activity

1
2
3
4
5
6
7
8
val oldActivity: Activity // Existing activity
val updatedContent: ActivityContent = ... // Create updated post content

Communities.updateActivity(oldActivity.id, updatedContent, { result: GetSocialActivity ->
    Log.d("Communities", "Updated activity: $result")
}, { error: GetSocialError ->
    Log.d("Communities", "Failed to update activity: $error")
})
1
2
3
4
5
6
7
8
let oldActivity: Activity // Existing activity
let updatedContent = ... // Create updated post content

Communities.updateActivity(oldActivity.id, updatedContent, success: { activity in
    print("Updated activity: \(activity)")
}, failure: { error in
    print("Failed to update activity: \(error)")
})
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Activity oldActivity = // existing activity
ActivityContent activityContent = ... // Create updated post content

Communities.UpdateActivity(oldActivity.Id, activityContent,
    (activity) => {
        Debug.Log("Updated activity: " + activity);
    },
    (error) => {
        Debug.Log("Failed to update activity, error: " + error);
    });
1
2
3
4
5
6
Activity oldActivity = // existing activity
ActivityContent activityContent = ...; // Create updated post content

Communities.updateActivity(oldActivity.id, activityContent)
    .then((result) => print('Updated activity: $result'))
    .catchError((error) => print('Failed to update activity, error: $error'));
1
2
3
4
5
6
7
8
9
const oldActivity = // existing activity
const activityContent = ...; // Create updated post content

Communities.updateActivity(oldActivity.id, activityContent)
    .then((result) => {
        console.log('Updated activity: ' + result);
    }, (error) => {
        console.log('Failed to update activity, error: ' + error.message);
    });

Delete an existing activity

1
2
3
4
5
6
7
val removeQuery = RemoveActivitiesQuery.activities("id1", "id2")

Communities.removeActivities(removeQuery, {
    Log.d("Communities", "Removed activities")
}, { error: GetSocialError ->
    Log.d("Communities", "Failed to remove activities: $error")
})
1
2
3
4
5
6
7
let removeQuery = RemoveActivitiesQuery.activityIds(["id1", "id2"])

Communities.removeActivities(removeQuery, success: {
    print("Removed activities")
}, failure: { error in
    print("Failed to remove activities: \(error)")
})
1
2
3
4
5
6
7
8
9
var removeQuery = RemoveActivitiesQuery.activities(["id1", "id2"]);

Communities.removeActivities(removeQuery, 
    () => {
        Debug.Log("Removed activities");
    },
    (error) => {
        Debug.Log("Failed to remove activities, error: " + error);
    });
1
2
3
4
5
RemoveActivitiesQuery removeQuery = RemoveActivitiesQuery.activityIds(['id1', 'id2'])

Communities.removeActivities(removeQuery)
    .then((result) => print('Removed activities'))
    .catchError((error) => print('Failed to remove activities, error: $error'));
1
2
3
4
5
6
7
8
const removeQuery = RemoveActivitiesQuery.activityIds(['id1', 'id2']);

Communities.removeActivities(removeQuery)
    .then((result) => {
        console.log('Removed activities');
    }, (error) => {
        console.log('Failed to remove activities, error: ' + error.message);
    });

Give us your feedback! Was this article helpful?

😀 🙁