From: Ian Kelling <iank@fsf.org>
Date: Tue, 21 Nov 2023 19:27:00 +0000 (-0500)
Subject: add tweet pin/unpin functions
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;p=tweepy.git

add tweet pin/unpin functions
---

diff --git a/tweepy/api.py b/tweepy/api.py
index 37caf07..2072ac6 100644
--- a/tweepy/api.py
+++ b/tweepy/api.py
@@ -2543,6 +2543,36 @@ class API:
             'GET', 'account/settings', use_cache=False, **kwargs
         )
 
+    def pin_tweet(self, id, **kwargs):
+        """pin_tweet(*, id)
+
+        Pin a tweet on your account.
+
+        References
+        ----------
+
+        As of 2023-11-21, this endpoint is not listed in twitter's api documentation.
+        """
+
+        return self.request(
+            'POST', 'account/pin_tweet', endpoint_parameters=('tweet_mode', 'id'), tweet_mode='extended', id=id, **kwargs
+        )
+
+    def unpin_tweet(self, id, **kwargs):
+        """pin_tweet(*, id)
+
+        Unpin a tweet on your account
+
+        References
+        ----------
+
+        As of 2023-11-21, this endpoint is not listed in twitter's api documentation.
+        """
+
+        return self.request(
+            'POST', 'account/unpin_tweet', endpoint_parameters=('tweet_mode', 'id'), tweet_mode='extended', id=id, **kwargs
+        )
+
     @payload('user')
     def verify_credentials(self, **kwargs):
         """verify_credentials(*, include_entities, skip_status, include_email)