diff --git a/src/FeedsV3Client.cs b/src/FeedsV3Client.cs index bd0a309..ccd2c98 100644 --- a/src/FeedsV3Client.cs +++ b/src/FeedsV3Client.cs @@ -293,6 +293,21 @@ public async Task> UpdateActivityAsync(st return result; } + public async Task> RestoreActivityAsync(string id,RestoreActivityRequest request, + CancellationToken cancellationToken = default) + { + var pathParams = new Dictionary + { + ["id"] = id, + }; + + var result = await _client.MakeRequestAsync( + "POST", + "/api/v2/feeds/activities/{id}/restore",null,request,pathParams, + cancellationToken); + + return result; + } public async Task> QueryBookmarkFoldersAsync(QueryBookmarkFoldersRequest request, CancellationToken cancellationToken = default) { @@ -1085,10 +1100,11 @@ public async Task> UnfollowAsync(string source, ["source"] = source, ["target"] = target, }; + var queryParams = ExtractQueryParams(request); var result = await _client.MakeRequestAsync( "DELETE", - "/api/v2/feeds/follows/{source}/{target}",null,null,pathParams, + "/api/v2/feeds/follows/{source}/{target}",queryParams,null,pathParams, cancellationToken); return result; diff --git a/src/models.cs b/src/models.cs index eecd47d..ccd4e46 100644 --- a/src/models.cs +++ b/src/models.cs @@ -489,6 +489,8 @@ public class ActivityRequest public string Type { get; set; } [JsonPropertyName("feeds")] public List Feeds { get; set; } + [JsonPropertyName("create_notification_activity")] + public bool? CreateNotificationActivity { get; set; } [JsonPropertyName("expires_at")] public string? ExpiresAt { get; set; } [JsonPropertyName("id")] @@ -501,6 +503,8 @@ public class ActivityRequest public string? RestrictReplies { get; set; } [JsonPropertyName("skip_enrich_url")] public bool? SkipEnrichUrl { get; set; } + [JsonPropertyName("skip_push")] + public bool? SkipPush { get; set; } [JsonPropertyName("text")] public string? Text { get; set; } [JsonPropertyName("user_id")] @@ -595,6 +599,8 @@ public class ActivityResponse public bool? IsWatched { get; set; } [JsonPropertyName("moderation_action")] public string? ModerationAction { get; set; } + [JsonPropertyName("selector_source")] + public string? SelectorSource { get; set; } [JsonPropertyName("text")] public string? Text { get; set; } [JsonPropertyName("visibility_tag")] @@ -613,6 +619,26 @@ public class ActivityResponse public PollResponseData? Poll { get; set; } } + public class ActivityRestoredEvent + { + [JsonPropertyName("created_at")] + public DateTime CreatedAt { get; set; } + [JsonPropertyName("fid")] + public string Fid { get; set; } + [JsonPropertyName("activity")] + public ActivityResponse Activity { get; set; } + [JsonPropertyName("custom")] + public object Custom { get; set; } + [JsonPropertyName("type")] + public string Type { get; set; } + [JsonPropertyName("feed_visibility")] + public string? FeedVisibility { get; set; } + [JsonPropertyName("received_at")] + public DateTime? ReceivedAt { get; set; } + [JsonPropertyName("user")] + public UserResponseCommonFields? User { get; set; } + } + public class ActivitySelectorConfig { [JsonPropertyName("type")] @@ -695,6 +721,8 @@ public class AddActivityRequest public string Type { get; set; } [JsonPropertyName("feeds")] public List Feeds { get; set; } + [JsonPropertyName("create_notification_activity")] + public bool? CreateNotificationActivity { get; set; } [JsonPropertyName("expires_at")] public string? ExpiresAt { get; set; } [JsonPropertyName("id")] @@ -707,6 +735,8 @@ public class AddActivityRequest public string? RestrictReplies { get; set; } [JsonPropertyName("skip_enrich_url")] public bool? SkipEnrichUrl { get; set; } + [JsonPropertyName("skip_push")] + public bool? SkipPush { get; set; } [JsonPropertyName("text")] public string? Text { get; set; } [JsonPropertyName("user_id")] @@ -739,6 +769,8 @@ public class AddActivityResponse public string Duration { get; set; } [JsonPropertyName("activity")] public ActivityResponse Activity { get; set; } + [JsonPropertyName("mention_notifications_created")] + public int? MentionNotificationsCreated { get; set; } } public class AddBookmarkRequest @@ -789,6 +821,8 @@ public class AddCommentReactionResponse public CommentResponse Comment { get; set; } [JsonPropertyName("reaction")] public FeedsReactionResponse Reaction { get; set; } + [JsonPropertyName("notification_created")] + public bool? NotificationCreated { get; set; } } public class AddCommentRequest @@ -827,6 +861,10 @@ public class AddCommentResponse public string Duration { get; set; } [JsonPropertyName("comment")] public CommentResponse Comment { get; set; } + [JsonPropertyName("mention_notifications_created")] + public int? MentionNotificationsCreated { get; set; } + [JsonPropertyName("notification_created")] + public bool? NotificationCreated { get; set; } } public class AddCommentsBatchRequest @@ -877,6 +915,8 @@ public class AddReactionResponse public ActivityResponse Activity { get; set; } [JsonPropertyName("reaction")] public FeedsReactionResponse Reaction { get; set; } + [JsonPropertyName("notification_created")] + public bool? NotificationCreated { get; set; } } public class AggregatedActivityResponse @@ -1751,6 +1791,8 @@ public class CallResponse public DateTime? EndedAt { get; set; } [JsonPropertyName("join_ahead_time_seconds")] public int? JoinAheadTimeSeconds { get; set; } + [JsonPropertyName("routing_number")] + public string? RoutingNumber { get; set; } [JsonPropertyName("starts_at")] public DateTime? StartsAt { get; set; } [JsonPropertyName("team")] @@ -2621,6 +2663,8 @@ public class CommentResponse public double? ControversyScore { get; set; } [JsonPropertyName("deleted_at")] public DateTime? DeletedAt { get; set; } + [JsonPropertyName("edited_at")] + public DateTime? EditedAt { get; set; } [JsonPropertyName("parent_id")] public string? ParentID { get; set; } [JsonPropertyName("text")] @@ -3185,6 +3229,8 @@ public class DeleteActivitiesRequest { [JsonPropertyName("ids")] public List Ids { get; set; } + [JsonPropertyName("delete_notification_activity")] + public bool? DeleteNotificationActivity { get; set; } [JsonPropertyName("hard_delete")] public bool? HardDelete { get; set; } [JsonPropertyName("user_id")] @@ -4561,6 +4607,8 @@ public class FollowRequest public string? PushPreference { get; set; } [JsonPropertyName("skip_push")] public bool? SkipPush { get; set; } + [JsonPropertyName("status")] + public string? Status { get; set; } [JsonPropertyName("custom")] public object Custom { get; set; } } @@ -5309,6 +5357,10 @@ public class ImportV2TaskItem public class ImportV2TaskSettings { + [JsonPropertyName("mode")] + public string? Mode { get; set; } + [JsonPropertyName("path")] + public string? Path { get; set; } [JsonPropertyName("skip_references_check")] public bool? SkipReferencesCheck { get; set; } [JsonPropertyName("s3")] @@ -7771,6 +7823,22 @@ public class RestoreActionRequest public string? DecisionReason { get; set; } } + public class RestoreActivityRequest + { + [JsonPropertyName("user_id")] + public string? UserID { get; set; } + [JsonPropertyName("user")] + public UserRequest? User { get; set; } + } + + public class RestoreActivityResponse + { + [JsonPropertyName("duration")] + public string Duration { get; set; } + [JsonPropertyName("activity")] + public ActivityResponse Activity { get; set; } + } + public class RestoreUsersRequest { [JsonPropertyName("user_ids")] @@ -8147,6 +8215,8 @@ public class SingleFollowResponse public string Duration { get; set; } [JsonPropertyName("follow")] public FollowResponse Follow { get; set; } + [JsonPropertyName("notification_created")] + public bool? NotificationCreated { get; set; } } public class SortParam @@ -8341,6 +8411,8 @@ public class ThreadedCommentResponse public double? ControversyScore { get; set; } [JsonPropertyName("deleted_at")] public DateTime? DeletedAt { get; set; } + [JsonPropertyName("edited_at")] + public DateTime? EditedAt { get; set; } [JsonPropertyName("parent_id")] public string? ParentID { get; set; } [JsonPropertyName("text")] @@ -8487,6 +8559,8 @@ public class UnfollowBatchRequest { [JsonPropertyName("follows")] public List Follows { get; set; } + [JsonPropertyName("delete_notification_activity")] + public bool? DeleteNotificationActivity { get; set; } } public class UnfollowBatchResponse @@ -8537,6 +8611,8 @@ public class UnpinActivityResponse public class UpdateActivityPartialRequest { + [JsonPropertyName("handle_mention_notifications")] + public bool? HandleMentionNotifications { get; set; } [JsonPropertyName("user_id")] public string? UserID { get; set; } [JsonPropertyName("unset")] @@ -8559,6 +8635,8 @@ public class UpdateActivityRequest { [JsonPropertyName("expires_at")] public DateTime? ExpiresAt { get; set; } + [JsonPropertyName("handle_mention_notifications")] + public bool? HandleMentionNotifications { get; set; } [JsonPropertyName("poll_id")] public string? PollID { get; set; } [JsonPropertyName("restrict_replies")] @@ -8795,6 +8873,8 @@ public class UpdateCommentRequest { [JsonPropertyName("comment")] public string? Comment { get; set; } + [JsonPropertyName("handle_mention_notifications")] + public bool? HandleMentionNotifications { get; set; } [JsonPropertyName("skip_enrich_url")] public bool? SkipEnrichUrl { get; set; } [JsonPropertyName("skip_push")] @@ -8803,6 +8883,8 @@ public class UpdateCommentRequest public string? UserID { get; set; } [JsonPropertyName("attachments")] public List Attachments { get; set; } + [JsonPropertyName("mentioned_user_ids")] + public List MentionedUserIds { get; set; } [JsonPropertyName("custom")] public object Custom { get; set; } [JsonPropertyName("user")] @@ -8971,6 +9053,8 @@ public class UpdateFollowRequest public string? PushPreference { get; set; } [JsonPropertyName("skip_push")] public bool? SkipPush { get; set; } + [JsonPropertyName("status")] + public string? Status { get; set; } [JsonPropertyName("custom")] public object Custom { get; set; } } @@ -9117,6 +9201,8 @@ public class UpsertActivitiesResponse public string Duration { get; set; } [JsonPropertyName("activities")] public List Activities { get; set; } + [JsonPropertyName("mention_notifications_created")] + public int? MentionNotificationsCreated { get; set; } } public class UpsertCollectionsRequest diff --git a/tests/FeedTests.cs b/tests/FeedTests.cs index 64b945a..5f11f64 100644 --- a/tests/FeedTests.cs +++ b/tests/FeedTests.cs @@ -633,6 +633,42 @@ public async Task UpdateActivityAsync_ShouldCallCorrectEndpoint() It.IsAny()), Times.Once); } [Test] + public async Task RestoreActivityAsync_ShouldCallCorrectEndpoint() + { + // Arrange + var request = new RestoreActivityRequest(); + var id = "test-id"; + + var expectedResponse = new StreamResponse + { + Data = new RestoreActivityResponse() + }; + + _mockClient.Setup(x => x.MakeRequestAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny(), + It.IsAny>(), + It.IsAny())) + .ReturnsAsync(expectedResponse); + + // Act + var result = await _client.RestoreActivityAsync(id,request); + + // Assert + Assert.That(result, Is.Not.Null); + Assert.That(result, Is.EqualTo(expectedResponse)); + + _mockClient.Verify(x => x.MakeRequestAsync( + "POST", + "/api/v2/feeds/activities/{id}/restore", + It.IsAny>(), + It.IsAny(), + It.IsAny>(), + It.IsAny()), Times.Once); + } + [Test] public async Task QueryBookmarkFoldersAsync_ShouldCallCorrectEndpoint() { // Arrange