OSDN Git Service

MisskeyClient.RetweetPostメソッドを実装
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 27 May 2024 22:49:53 +0000 (07:49 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Mon, 10 Jun 2024 15:21:01 +0000 (00:21 +0900)
OpenTween/SocialProtocol/Misskey/MisskeyClient.cs

index 8ceaeea..923fb24 100644 (file)
@@ -139,8 +139,20 @@ namespace OpenTween.SocialProtocol.Misskey
         public Task UnfavoritePost(PostId postId)
             => throw this.CreateException();
 
-        public Task<PostClass?> RetweetPost(PostId postId)
-            => throw this.CreateException();
+        public async Task<PostClass?> RetweetPost(PostId postId)
+        {
+            var request = new NoteCreateRequest
+            {
+                RenoteId = this.AssertMisskeyNoteId(postId),
+            };
+
+            var note = await request.Send(this.account.Connection)
+                .ConfigureAwait(false);
+
+            var post = this.CreatePostFromNote(note, firstLoad: false);
+
+            return post;
+        }
 
         public Task UnretweetPost(PostId postId)
             => throw this.CreateException();