@memberjunction/actions-bizapps-social 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +16 -0
- package/README.md +375 -0
- package/dist/base/base-social.action.d.ts +137 -0
- package/dist/base/base-social.action.d.ts.map +1 -0
- package/dist/base/base-social.action.js +176 -0
- package/dist/base/base-social.action.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/buffer/actions/create-post.action.d.ts +20 -0
- package/dist/providers/buffer/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/create-post.action.js +195 -0
- package/dist/providers/buffer/actions/create-post.action.js.map +1 -0
- package/dist/providers/buffer/actions/delete-post.action.d.ts +20 -0
- package/dist/providers/buffer/actions/delete-post.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/delete-post.action.js +119 -0
- package/dist/providers/buffer/actions/delete-post.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-analytics.action.d.ts +28 -0
- package/dist/providers/buffer/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-analytics.action.js +143 -0
- package/dist/providers/buffer/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.d.ts +24 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.js +161 -0
- package/dist/providers/buffer/actions/get-pending-posts.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-profiles.action.d.ts +24 -0
- package/dist/providers/buffer/actions/get-profiles.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-profiles.action.js +128 -0
- package/dist/providers/buffer/actions/get-profiles.action.js.map +1 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.d.ts +32 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.js +187 -0
- package/dist/providers/buffer/actions/get-sent-posts.action.js.map +1 -0
- package/dist/providers/buffer/actions/index.d.ts +9 -0
- package/dist/providers/buffer/actions/index.d.ts.map +1 -0
- package/dist/providers/buffer/actions/index.js +25 -0
- package/dist/providers/buffer/actions/index.js.map +1 -0
- package/dist/providers/buffer/actions/reorder-queue.action.d.ts +20 -0
- package/dist/providers/buffer/actions/reorder-queue.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/reorder-queue.action.js +138 -0
- package/dist/providers/buffer/actions/reorder-queue.action.js.map +1 -0
- package/dist/providers/buffer/actions/search-posts.action.d.ts +28 -0
- package/dist/providers/buffer/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/buffer/actions/search-posts.action.js +249 -0
- package/dist/providers/buffer/actions/search-posts.action.js.map +1 -0
- package/dist/providers/buffer/buffer-base.action.d.ts +95 -0
- package/dist/providers/buffer/buffer-base.action.d.ts.map +1 -0
- package/dist/providers/buffer/buffer-base.action.js +419 -0
- package/dist/providers/buffer/buffer-base.action.js.map +1 -0
- package/dist/providers/buffer/index.d.ts +3 -0
- package/dist/providers/buffer/index.d.ts.map +1 -0
- package/dist/providers/buffer/index.js +19 -0
- package/dist/providers/buffer/index.js.map +1 -0
- package/dist/providers/facebook/actions/boost-post.action.d.ts +45 -0
- package/dist/providers/facebook/actions/boost-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/boost-post.action.js +340 -0
- package/dist/providers/facebook/actions/boost-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/create-album.action.d.ts +33 -0
- package/dist/providers/facebook/actions/create-album.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/create-album.action.js +285 -0
- package/dist/providers/facebook/actions/create-album.action.js.map +1 -0
- package/dist/providers/facebook/actions/create-post.action.d.ts +21 -0
- package/dist/providers/facebook/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/create-post.action.js +223 -0
- package/dist/providers/facebook/actions/create-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-page-insights.action.d.ts +37 -0
- package/dist/providers/facebook/actions/get-page-insights.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-page-insights.action.js +359 -0
- package/dist/providers/facebook/actions/get-page-insights.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-page-posts.action.d.ts +29 -0
- package/dist/providers/facebook/actions/get-page-posts.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-page-posts.action.js +216 -0
- package/dist/providers/facebook/actions/get-page-posts.action.js.map +1 -0
- package/dist/providers/facebook/actions/get-post-insights.action.d.ts +33 -0
- package/dist/providers/facebook/actions/get-post-insights.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/get-post-insights.action.js +287 -0
- package/dist/providers/facebook/actions/get-post-insights.action.js.map +1 -0
- package/dist/providers/facebook/actions/index.d.ts +10 -0
- package/dist/providers/facebook/actions/index.d.ts.map +1 -0
- package/dist/providers/facebook/actions/index.js +26 -0
- package/dist/providers/facebook/actions/index.js.map +1 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.d.ts +41 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.js +328 -0
- package/dist/providers/facebook/actions/respond-to-comments.action.js.map +1 -0
- package/dist/providers/facebook/actions/schedule-post.action.d.ts +29 -0
- package/dist/providers/facebook/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/schedule-post.action.js +289 -0
- package/dist/providers/facebook/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/facebook/actions/search-posts.action.d.ts +54 -0
- package/dist/providers/facebook/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/facebook/actions/search-posts.action.js +396 -0
- package/dist/providers/facebook/actions/search-posts.action.js.map +1 -0
- package/dist/providers/facebook/facebook-base.action.d.ts +230 -0
- package/dist/providers/facebook/facebook-base.action.d.ts.map +1 -0
- package/dist/providers/facebook/facebook-base.action.js +566 -0
- package/dist/providers/facebook/facebook-base.action.js.map +1 -0
- package/dist/providers/facebook/index.d.ts +3 -0
- package/dist/providers/facebook/index.d.ts.map +1 -0
- package/dist/providers/facebook/index.js +19 -0
- package/dist/providers/facebook/index.js.map +1 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts +24 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js +266 -0
- package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts +25 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js +202 -0
- package/dist/providers/hootsuite/actions/create-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts +20 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js +172 -0
- package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.d.ts +52 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.js +265 -0
- package/dist/providers/hootsuite/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts +37 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js +208 -0
- package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts +36 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js +212 -0
- package/dist/providers/hootsuite/actions/get-social-profiles.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/search-posts.action.d.ts +53 -0
- package/dist/providers/hootsuite/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/search-posts.action.js +353 -0
- package/dist/providers/hootsuite/actions/search-posts.action.js.map +1 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts +20 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js +217 -0
- package/dist/providers/hootsuite/actions/update-scheduled-post.action.js.map +1 -0
- package/dist/providers/hootsuite/hootsuite-base.action.d.ts +101 -0
- package/dist/providers/hootsuite/hootsuite-base.action.d.ts.map +1 -0
- package/dist/providers/hootsuite/hootsuite-base.action.js +274 -0
- package/dist/providers/hootsuite/hootsuite-base.action.js.map +1 -0
- package/dist/providers/hootsuite/index.d.ts +10 -0
- package/dist/providers/hootsuite/index.d.ts.map +1 -0
- package/dist/providers/hootsuite/index.js +28 -0
- package/dist/providers/hootsuite/index.js.map +1 -0
- package/dist/providers/instagram/actions/create-post.action.d.ts +30 -0
- package/dist/providers/instagram/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/create-post.action.js +269 -0
- package/dist/providers/instagram/actions/create-post.action.js.map +1 -0
- package/dist/providers/instagram/actions/create-story.action.d.ts +43 -0
- package/dist/providers/instagram/actions/create-story.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/create-story.action.js +365 -0
- package/dist/providers/instagram/actions/create-story.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-account-insights.action.d.ts +50 -0
- package/dist/providers/instagram/actions/get-account-insights.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-account-insights.action.js +390 -0
- package/dist/providers/instagram/actions/get-account-insights.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-business-posts.action.d.ts +30 -0
- package/dist/providers/instagram/actions/get-business-posts.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-business-posts.action.js +246 -0
- package/dist/providers/instagram/actions/get-business-posts.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-comments.action.d.ts +41 -0
- package/dist/providers/instagram/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-comments.action.js +337 -0
- package/dist/providers/instagram/actions/get-comments.action.js.map +1 -0
- package/dist/providers/instagram/actions/get-post-insights.action.d.ts +42 -0
- package/dist/providers/instagram/actions/get-post-insights.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/get-post-insights.action.js +271 -0
- package/dist/providers/instagram/actions/get-post-insights.action.js.map +1 -0
- package/dist/providers/instagram/actions/index.d.ts +9 -0
- package/dist/providers/instagram/actions/index.d.ts.map +1 -0
- package/dist/providers/instagram/actions/index.js +26 -0
- package/dist/providers/instagram/actions/index.js.map +1 -0
- package/dist/providers/instagram/actions/schedule-post.action.d.ts +34 -0
- package/dist/providers/instagram/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/schedule-post.action.js +234 -0
- package/dist/providers/instagram/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/instagram/actions/search-posts.action.d.ts +56 -0
- package/dist/providers/instagram/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/instagram/actions/search-posts.action.js +479 -0
- package/dist/providers/instagram/actions/search-posts.action.js.map +1 -0
- package/dist/providers/instagram/index.d.ts +3 -0
- package/dist/providers/instagram/index.d.ts.map +1 -0
- package/dist/providers/instagram/index.js +20 -0
- package/dist/providers/instagram/index.js.map +1 -0
- package/dist/providers/instagram/instagram-base.action.d.ts +76 -0
- package/dist/providers/instagram/instagram-base.action.d.ts.map +1 -0
- package/dist/providers/instagram/instagram-base.action.js +362 -0
- package/dist/providers/instagram/instagram-base.action.js.map +1 -0
- package/dist/providers/linkedin/actions/create-article.action.d.ts +28 -0
- package/dist/providers/linkedin/actions/create-article.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/create-article.action.js +275 -0
- package/dist/providers/linkedin/actions/create-article.action.js.map +1 -0
- package/dist/providers/linkedin/actions/create-post.action.d.ts +20 -0
- package/dist/providers/linkedin/actions/create-post.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/create-post.action.js +188 -0
- package/dist/providers/linkedin/actions/create-post.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-followers.action.d.ts +29 -0
- package/dist/providers/linkedin/actions/get-followers.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-followers.action.js +222 -0
- package/dist/providers/linkedin/actions/get-followers.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts +24 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.js +163 -0
- package/dist/providers/linkedin/actions/get-organization-posts.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts +25 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.js +156 -0
- package/dist/providers/linkedin/actions/get-personal-posts.action.js.map +1 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts +28 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.js +200 -0
- package/dist/providers/linkedin/actions/get-post-analytics.action.js.map +1 -0
- package/dist/providers/linkedin/actions/index.d.ts +9 -0
- package/dist/providers/linkedin/actions/index.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/index.js +25 -0
- package/dist/providers/linkedin/actions/index.js.map +1 -0
- package/dist/providers/linkedin/actions/schedule-post.action.d.ts +22 -0
- package/dist/providers/linkedin/actions/schedule-post.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/schedule-post.action.js +205 -0
- package/dist/providers/linkedin/actions/schedule-post.action.js.map +1 -0
- package/dist/providers/linkedin/actions/search-posts.action.d.ts +41 -0
- package/dist/providers/linkedin/actions/search-posts.action.d.ts.map +1 -0
- package/dist/providers/linkedin/actions/search-posts.action.js +292 -0
- package/dist/providers/linkedin/actions/search-posts.action.js.map +1 -0
- package/dist/providers/linkedin/index.d.ts +3 -0
- package/dist/providers/linkedin/index.d.ts.map +1 -0
- package/dist/providers/linkedin/index.js +19 -0
- package/dist/providers/linkedin/index.js.map +1 -0
- package/dist/providers/linkedin/linkedin-base.action.d.ts +166 -0
- package/dist/providers/linkedin/linkedin-base.action.d.ts.map +1 -0
- package/dist/providers/linkedin/linkedin-base.action.js +346 -0
- package/dist/providers/linkedin/linkedin-base.action.js.map +1 -0
- package/dist/providers/tiktok/actions/create-video-post.action.d.ts +21 -0
- package/dist/providers/tiktok/actions/create-video-post.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/create-video-post.action.js +226 -0
- package/dist/providers/tiktok/actions/create-video-post.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.d.ts +32 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.js +242 -0
- package/dist/providers/tiktok/actions/get-account-analytics.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-comments.action.d.ts +44 -0
- package/dist/providers/tiktok/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-comments.action.js +290 -0
- package/dist/providers/tiktok/actions/get-comments.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.d.ts +48 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.js +309 -0
- package/dist/providers/tiktok/actions/get-trending-hashtags.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.d.ts +20 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.js +131 -0
- package/dist/providers/tiktok/actions/get-user-videos.action.js.map +1 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.d.ts +28 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.js +198 -0
- package/dist/providers/tiktok/actions/get-video-analytics.action.js.map +1 -0
- package/dist/providers/tiktok/actions/index.d.ts +8 -0
- package/dist/providers/tiktok/actions/index.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/index.js +25 -0
- package/dist/providers/tiktok/actions/index.js.map +1 -0
- package/dist/providers/tiktok/actions/search-videos.action.d.ts +89 -0
- package/dist/providers/tiktok/actions/search-videos.action.d.ts.map +1 -0
- package/dist/providers/tiktok/actions/search-videos.action.js +653 -0
- package/dist/providers/tiktok/actions/search-videos.action.js.map +1 -0
- package/dist/providers/tiktok/index.d.ts +3 -0
- package/dist/providers/tiktok/index.d.ts.map +1 -0
- package/dist/providers/tiktok/index.js +20 -0
- package/dist/providers/tiktok/index.js.map +1 -0
- package/dist/providers/tiktok/tiktok-base.action.d.ts +87 -0
- package/dist/providers/tiktok/tiktok-base.action.d.ts.map +1 -0
- package/dist/providers/tiktok/tiktok-base.action.js +294 -0
- package/dist/providers/tiktok/tiktok-base.action.js.map +1 -0
- package/dist/providers/twitter/actions/create-thread.action.d.ts +28 -0
- package/dist/providers/twitter/actions/create-thread.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/create-thread.action.js +217 -0
- package/dist/providers/twitter/actions/create-thread.action.js.map +1 -0
- package/dist/providers/twitter/actions/create-tweet.action.d.ts +24 -0
- package/dist/providers/twitter/actions/create-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/create-tweet.action.js +199 -0
- package/dist/providers/twitter/actions/create-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/delete-tweet.action.d.ts +24 -0
- package/dist/providers/twitter/actions/delete-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/delete-tweet.action.js +158 -0
- package/dist/providers/twitter/actions/delete-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-analytics.action.d.ts +44 -0
- package/dist/providers/twitter/actions/get-analytics.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-analytics.action.js +399 -0
- package/dist/providers/twitter/actions/get-analytics.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-mentions.action.d.ts +24 -0
- package/dist/providers/twitter/actions/get-mentions.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-mentions.action.js +229 -0
- package/dist/providers/twitter/actions/get-mentions.action.js.map +1 -0
- package/dist/providers/twitter/actions/get-timeline.action.d.ts +24 -0
- package/dist/providers/twitter/actions/get-timeline.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/get-timeline.action.js +249 -0
- package/dist/providers/twitter/actions/get-timeline.action.js.map +1 -0
- package/dist/providers/twitter/actions/index.d.ts +14 -0
- package/dist/providers/twitter/actions/index.d.ts.map +1 -0
- package/dist/providers/twitter/actions/index.js +30 -0
- package/dist/providers/twitter/actions/index.js.map +1 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.d.ts +30 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.js +250 -0
- package/dist/providers/twitter/actions/schedule-tweet.action.js.map +1 -0
- package/dist/providers/twitter/actions/search-tweets.action.d.ts +41 -0
- package/dist/providers/twitter/actions/search-tweets.action.d.ts.map +1 -0
- package/dist/providers/twitter/actions/search-tweets.action.js +559 -0
- package/dist/providers/twitter/actions/search-tweets.action.js.map +1 -0
- package/dist/providers/twitter/index.d.ts +8 -0
- package/dist/providers/twitter/index.d.ts.map +1 -0
- package/dist/providers/twitter/index.js +24 -0
- package/dist/providers/twitter/index.js.map +1 -0
- package/dist/providers/twitter/twitter-base.action.d.ts +185 -0
- package/dist/providers/twitter/twitter-base.action.d.ts.map +1 -0
- package/dist/providers/twitter/twitter-base.action.js +484 -0
- package/dist/providers/twitter/twitter-base.action.js.map +1 -0
- package/dist/providers/youtube/actions/create-playlist.action.d.ts +28 -0
- package/dist/providers/youtube/actions/create-playlist.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/create-playlist.action.js +235 -0
- package/dist/providers/youtube/actions/create-playlist.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.d.ts +60 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.js +429 -0
- package/dist/providers/youtube/actions/get-channel-analytics.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.d.ts +28 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.js +263 -0
- package/dist/providers/youtube/actions/get-channel-videos.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-comments.action.d.ts +40 -0
- package/dist/providers/youtube/actions/get-comments.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-comments.action.js +381 -0
- package/dist/providers/youtube/actions/get-comments.action.js.map +1 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.d.ts +48 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.js +280 -0
- package/dist/providers/youtube/actions/get-video-analytics.action.js.map +1 -0
- package/dist/providers/youtube/actions/index.d.ts +10 -0
- package/dist/providers/youtube/actions/index.d.ts.map +1 -0
- package/dist/providers/youtube/actions/index.js +26 -0
- package/dist/providers/youtube/actions/index.js.map +1 -0
- package/dist/providers/youtube/actions/schedule-video.action.d.ts +24 -0
- package/dist/providers/youtube/actions/schedule-video.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/schedule-video.action.js +225 -0
- package/dist/providers/youtube/actions/schedule-video.action.js.map +1 -0
- package/dist/providers/youtube/actions/search-videos.action.d.ts +40 -0
- package/dist/providers/youtube/actions/search-videos.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/search-videos.action.js +483 -0
- package/dist/providers/youtube/actions/search-videos.action.js.map +1 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.d.ts +32 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.js +298 -0
- package/dist/providers/youtube/actions/update-video-metadata.action.js.map +1 -0
- package/dist/providers/youtube/actions/upload-video.action.d.ts +28 -0
- package/dist/providers/youtube/actions/upload-video.action.d.ts.map +1 -0
- package/dist/providers/youtube/actions/upload-video.action.js +266 -0
- package/dist/providers/youtube/actions/upload-video.action.js.map +1 -0
- package/dist/providers/youtube/index.d.ts +3 -0
- package/dist/providers/youtube/index.d.ts.map +1 -0
- package/dist/providers/youtube/index.js +19 -0
- package/dist/providers/youtube/index.js.map +1 -0
- package/dist/providers/youtube/youtube-base.action.d.ts +83 -0
- package/dist/providers/youtube/youtube-base.action.d.ts.map +1 -0
- package/dist/providers/youtube/youtube-base.action.js +319 -0
- package/dist/providers/youtube/youtube-base.action.js.map +1 -0
- package/package.json +42 -0
- package/social_actions_summary.md +439 -0
- package/src/base/base-social.action.ts +270 -0
- package/src/index.ts +26 -0
- package/src/providers/buffer/actions/create-post.action.ts +205 -0
- package/src/providers/buffer/actions/delete-post.action.ts +116 -0
- package/src/providers/buffer/actions/get-analytics.action.ts +146 -0
- package/src/providers/buffer/actions/get-pending-posts.action.ts +161 -0
- package/src/providers/buffer/actions/get-profiles.action.ts +126 -0
- package/src/providers/buffer/actions/get-sent-posts.action.ts +189 -0
- package/src/providers/buffer/actions/index.ts +8 -0
- package/src/providers/buffer/actions/reorder-queue.action.ts +141 -0
- package/src/providers/buffer/actions/search-posts.action.ts +262 -0
- package/src/providers/buffer/buffer-base.action.ts +490 -0
- package/src/providers/buffer/index.ts +2 -0
- package/src/providers/facebook/actions/boost-post.action.ts +412 -0
- package/src/providers/facebook/actions/create-album.action.ts +335 -0
- package/src/providers/facebook/actions/create-post.action.ts +243 -0
- package/src/providers/facebook/actions/get-page-insights.action.ts +427 -0
- package/src/providers/facebook/actions/get-page-posts.action.ts +241 -0
- package/src/providers/facebook/actions/get-post-insights.action.ts +338 -0
- package/src/providers/facebook/actions/index.ts +9 -0
- package/src/providers/facebook/actions/respond-to-comments.action.ts +372 -0
- package/src/providers/facebook/actions/schedule-post.action.ts +310 -0
- package/src/providers/facebook/actions/search-posts.action.ts +449 -0
- package/src/providers/facebook/facebook-base.action.ts +750 -0
- package/src/providers/facebook/index.ts +2 -0
- package/src/providers/hootsuite/actions/bulk-schedule-posts.action.ts +293 -0
- package/src/providers/hootsuite/actions/create-scheduled-post.action.ts +206 -0
- package/src/providers/hootsuite/actions/delete-scheduled-post.action.ts +173 -0
- package/src/providers/hootsuite/actions/get-analytics.action.ts +281 -0
- package/src/providers/hootsuite/actions/get-scheduled-posts.action.ts +220 -0
- package/src/providers/hootsuite/actions/get-social-profiles.action.ts +220 -0
- package/src/providers/hootsuite/actions/search-posts.action.ts +395 -0
- package/src/providers/hootsuite/actions/update-scheduled-post.action.ts +222 -0
- package/src/providers/hootsuite/hootsuite-base.action.ts +346 -0
- package/src/providers/hootsuite/index.ts +12 -0
- package/src/providers/instagram/README.md +129 -0
- package/src/providers/instagram/actions/create-post.action.ts +329 -0
- package/src/providers/instagram/actions/create-story.action.ts +415 -0
- package/src/providers/instagram/actions/get-account-insights.action.ts +449 -0
- package/src/providers/instagram/actions/get-business-posts.action.ts +281 -0
- package/src/providers/instagram/actions/get-comments.action.ts +395 -0
- package/src/providers/instagram/actions/get-post-insights.action.ts +302 -0
- package/src/providers/instagram/actions/index.ts +9 -0
- package/src/providers/instagram/actions/schedule-post.action.ts +248 -0
- package/src/providers/instagram/actions/search-posts.action.ts +569 -0
- package/src/providers/instagram/index.ts +3 -0
- package/src/providers/instagram/instagram-base.action.ts +430 -0
- package/src/providers/linkedin/actions/create-article.action.ts +301 -0
- package/src/providers/linkedin/actions/create-post.action.ts +190 -0
- package/src/providers/linkedin/actions/get-followers.action.ts +226 -0
- package/src/providers/linkedin/actions/get-organization-posts.action.ts +164 -0
- package/src/providers/linkedin/actions/get-personal-posts.action.ts +158 -0
- package/src/providers/linkedin/actions/get-post-analytics.action.ts +205 -0
- package/src/providers/linkedin/actions/index.ts +8 -0
- package/src/providers/linkedin/actions/schedule-post.action.ts +206 -0
- package/src/providers/linkedin/actions/search-posts.action.ts +323 -0
- package/src/providers/linkedin/index.ts +2 -0
- package/src/providers/linkedin/linkedin-base.action.ts +481 -0
- package/src/providers/tiktok/actions/create-video-post.action.ts +234 -0
- package/src/providers/tiktok/actions/get-account-analytics.action.ts +255 -0
- package/src/providers/tiktok/actions/get-comments.action.ts +332 -0
- package/src/providers/tiktok/actions/get-trending-hashtags.action.ts +341 -0
- package/src/providers/tiktok/actions/get-user-videos.action.ts +136 -0
- package/src/providers/tiktok/actions/get-video-analytics.action.ts +218 -0
- package/src/providers/tiktok/actions/index.ts +8 -0
- package/src/providers/tiktok/actions/search-videos.action.ts +717 -0
- package/src/providers/tiktok/index.ts +3 -0
- package/src/providers/tiktok/tiktok-base.action.ts +356 -0
- package/src/providers/twitter/README.md +207 -0
- package/src/providers/twitter/actions/create-thread.action.ts +227 -0
- package/src/providers/twitter/actions/create-tweet.action.ts +204 -0
- package/src/providers/twitter/actions/delete-tweet.action.ts +153 -0
- package/src/providers/twitter/actions/get-analytics.action.ts +440 -0
- package/src/providers/twitter/actions/get-mentions.action.ts +233 -0
- package/src/providers/twitter/actions/get-timeline.action.ts +248 -0
- package/src/providers/twitter/actions/index.ts +14 -0
- package/src/providers/twitter/actions/schedule-tweet.action.ts +259 -0
- package/src/providers/twitter/actions/search-tweets.action.ts +588 -0
- package/src/providers/twitter/index.ts +8 -0
- package/src/providers/twitter/twitter-base.action.ts +629 -0
- package/src/providers/youtube/actions/create-playlist.action.ts +256 -0
- package/src/providers/youtube/actions/get-channel-analytics.action.ts +502 -0
- package/src/providers/youtube/actions/get-channel-videos.action.ts +286 -0
- package/src/providers/youtube/actions/get-comments.action.ts +411 -0
- package/src/providers/youtube/actions/get-video-analytics.action.ts +298 -0
- package/src/providers/youtube/actions/index.ts +9 -0
- package/src/providers/youtube/actions/schedule-video.action.ts +246 -0
- package/src/providers/youtube/actions/search-videos.action.ts +530 -0
- package/src/providers/youtube/actions/update-video-metadata.action.ts +321 -0
- package/src/providers/youtube/actions/upload-video.action.ts +288 -0
- package/src/providers/youtube/index.ts +2 -0
- package/src/providers/youtube/youtube-base.action.ts +373 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
2
|
+
import { BaseSocialMediaAction, MediaFile, SocialPost, SearchParams, SocialAnalytics } from '../../base/base-social.action';
|
|
3
|
+
import axios, { AxiosInstance, AxiosError } from 'axios';
|
|
4
|
+
import { ActionParam } from '@memberjunction/actions-base';
|
|
5
|
+
import { LogStatus, LogError } from '@memberjunction/core';
|
|
6
|
+
import FormData from 'form-data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Base class for all Twitter/X actions.
|
|
10
|
+
* Handles Twitter-specific authentication, API interactions, and rate limiting.
|
|
11
|
+
* Uses Twitter API v2 with OAuth 2.0.
|
|
12
|
+
*/
|
|
13
|
+
@RegisterClass(BaseSocialMediaAction, 'TwitterBaseAction')
|
|
14
|
+
export abstract class TwitterBaseAction extends BaseSocialMediaAction {
|
|
15
|
+
protected get platformName(): string {
|
|
16
|
+
return 'Twitter';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
protected get apiBaseUrl(): string {
|
|
20
|
+
return 'https://api.twitter.com/2';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Upload endpoint for media
|
|
25
|
+
*/
|
|
26
|
+
protected get uploadApiUrl(): string {
|
|
27
|
+
return 'https://upload.twitter.com/1.1';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Axios instance for making HTTP requests
|
|
32
|
+
*/
|
|
33
|
+
private _axiosInstance: AxiosInstance | null = null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get or create axios instance with interceptors
|
|
37
|
+
*/
|
|
38
|
+
protected get axiosInstance(): AxiosInstance {
|
|
39
|
+
if (!this._axiosInstance) {
|
|
40
|
+
this._axiosInstance = axios.create({
|
|
41
|
+
baseURL: this.apiBaseUrl,
|
|
42
|
+
timeout: 30000,
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Accept': 'application/json'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Add request interceptor for auth
|
|
50
|
+
this._axiosInstance.interceptors.request.use(
|
|
51
|
+
(config) => {
|
|
52
|
+
const token = this.getAccessToken();
|
|
53
|
+
if (token) {
|
|
54
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
55
|
+
}
|
|
56
|
+
return config;
|
|
57
|
+
},
|
|
58
|
+
(error) => Promise.reject(error)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Add response interceptor for rate limit handling
|
|
62
|
+
this._axiosInstance.interceptors.response.use(
|
|
63
|
+
(response) => {
|
|
64
|
+
// Log rate limit info
|
|
65
|
+
const rateLimitInfo = this.parseRateLimitHeaders(response.headers);
|
|
66
|
+
if (rateLimitInfo) {
|
|
67
|
+
LogStatus(`Twitter Rate Limit - Remaining: ${rateLimitInfo.remaining}/${rateLimitInfo.limit}, Reset: ${rateLimitInfo.reset}`);
|
|
68
|
+
}
|
|
69
|
+
return response;
|
|
70
|
+
},
|
|
71
|
+
async (error: AxiosError) => {
|
|
72
|
+
if (error.response?.status === 429) {
|
|
73
|
+
// Rate limit exceeded
|
|
74
|
+
const resetTime = error.response.headers['x-rate-limit-reset'];
|
|
75
|
+
const waitTime = resetTime
|
|
76
|
+
? Math.max(0, parseInt(resetTime) - Math.floor(Date.now() / 1000))
|
|
77
|
+
: 60;
|
|
78
|
+
await this.handleRateLimit(waitTime);
|
|
79
|
+
|
|
80
|
+
// Retry the request
|
|
81
|
+
return this._axiosInstance!.request(error.config!);
|
|
82
|
+
}
|
|
83
|
+
return Promise.reject(error);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return this._axiosInstance;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Refresh the access token using the refresh token
|
|
92
|
+
*/
|
|
93
|
+
protected async refreshAccessToken(): Promise<void> {
|
|
94
|
+
const refreshToken = this.getRefreshToken();
|
|
95
|
+
if (!refreshToken) {
|
|
96
|
+
throw new Error('No refresh token available for Twitter');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
const clientId = this.getCustomAttribute(2) || ''; // Client ID stored in CustomAttribute2
|
|
101
|
+
const clientSecret = this.getCustomAttribute(3) || ''; // Client Secret stored in CustomAttribute3
|
|
102
|
+
|
|
103
|
+
const basicAuth = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
|
|
104
|
+
|
|
105
|
+
const response = await axios.post('https://api.twitter.com/2/oauth2/token',
|
|
106
|
+
new URLSearchParams({
|
|
107
|
+
grant_type: 'refresh_token',
|
|
108
|
+
refresh_token: refreshToken,
|
|
109
|
+
client_id: clientId
|
|
110
|
+
}).toString(),
|
|
111
|
+
{
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
114
|
+
'Authorization': `Basic ${basicAuth}`
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const { access_token, refresh_token: newRefreshToken, expires_in } = response.data;
|
|
120
|
+
|
|
121
|
+
// Update stored tokens
|
|
122
|
+
await this.updateStoredTokens(
|
|
123
|
+
access_token,
|
|
124
|
+
newRefreshToken || refreshToken,
|
|
125
|
+
expires_in
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
LogStatus('Twitter access token refreshed successfully');
|
|
129
|
+
} catch (error) {
|
|
130
|
+
LogError(`Failed to refresh Twitter access token: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get the authenticated user's info
|
|
137
|
+
*/
|
|
138
|
+
protected async getCurrentUser(): Promise<TwitterUser> {
|
|
139
|
+
try {
|
|
140
|
+
const response = await this.axiosInstance.get('/users/me', {
|
|
141
|
+
params: {
|
|
142
|
+
'user.fields': 'id,name,username,profile_image_url,description,created_at,verified'
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return response.data.data;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
LogError(`Failed to get current user: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Upload media to Twitter
|
|
154
|
+
*/
|
|
155
|
+
protected async uploadSingleMedia(file: MediaFile): Promise<string> {
|
|
156
|
+
try {
|
|
157
|
+
const fileData = typeof file.data === 'string'
|
|
158
|
+
? Buffer.from(file.data, 'base64')
|
|
159
|
+
: file.data;
|
|
160
|
+
|
|
161
|
+
// Step 1: Initialize upload
|
|
162
|
+
const initResponse = await axios.post(
|
|
163
|
+
`${this.uploadApiUrl}/media/upload.json`,
|
|
164
|
+
new URLSearchParams({
|
|
165
|
+
command: 'INIT',
|
|
166
|
+
total_bytes: fileData.length.toString(),
|
|
167
|
+
media_type: file.mimeType,
|
|
168
|
+
media_category: this.getMediaCategory(file.mimeType)
|
|
169
|
+
}).toString(),
|
|
170
|
+
{
|
|
171
|
+
headers: {
|
|
172
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
173
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const mediaId = initResponse.data.media_id_string;
|
|
179
|
+
|
|
180
|
+
// Step 2: Upload chunks (for large files, Twitter requires chunking)
|
|
181
|
+
const chunkSize = 5 * 1024 * 1024; // 5MB chunks
|
|
182
|
+
let segmentIndex = 0;
|
|
183
|
+
|
|
184
|
+
for (let offset = 0; offset < fileData.length; offset += chunkSize) {
|
|
185
|
+
const chunk = fileData.slice(offset, Math.min(offset + chunkSize, fileData.length));
|
|
186
|
+
|
|
187
|
+
const formData = new FormData();
|
|
188
|
+
formData.append('command', 'APPEND');
|
|
189
|
+
formData.append('media_id', mediaId);
|
|
190
|
+
formData.append('segment_index', segmentIndex.toString());
|
|
191
|
+
formData.append('media', chunk, {
|
|
192
|
+
filename: file.filename,
|
|
193
|
+
contentType: file.mimeType
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
await axios.post(
|
|
197
|
+
`${this.uploadApiUrl}/media/upload.json`,
|
|
198
|
+
formData,
|
|
199
|
+
{
|
|
200
|
+
headers: {
|
|
201
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
202
|
+
...formData.getHeaders()
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
segmentIndex++;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Step 3: Finalize upload
|
|
211
|
+
await axios.post(
|
|
212
|
+
`${this.uploadApiUrl}/media/upload.json`,
|
|
213
|
+
new URLSearchParams({
|
|
214
|
+
command: 'FINALIZE',
|
|
215
|
+
media_id: mediaId
|
|
216
|
+
}).toString(),
|
|
217
|
+
{
|
|
218
|
+
headers: {
|
|
219
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
220
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
// Step 4: Check processing status (for videos)
|
|
226
|
+
if (file.mimeType.startsWith('video/')) {
|
|
227
|
+
await this.waitForMediaProcessing(mediaId);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return mediaId;
|
|
231
|
+
} catch (error) {
|
|
232
|
+
LogError(`Failed to upload media to Twitter: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Wait for media processing to complete (for videos)
|
|
239
|
+
*/
|
|
240
|
+
private async waitForMediaProcessing(mediaId: string, maxWaitTime: number = 60000): Promise<void> {
|
|
241
|
+
const startTime = Date.now();
|
|
242
|
+
|
|
243
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
244
|
+
const response = await axios.get(
|
|
245
|
+
`${this.uploadApiUrl}/media/upload.json`,
|
|
246
|
+
{
|
|
247
|
+
params: {
|
|
248
|
+
command: 'STATUS',
|
|
249
|
+
media_id: mediaId
|
|
250
|
+
},
|
|
251
|
+
headers: {
|
|
252
|
+
'Authorization': `Bearer ${this.getAccessToken()}`
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
const { processing_info } = response.data;
|
|
258
|
+
|
|
259
|
+
if (!processing_info) {
|
|
260
|
+
// Processing complete
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (processing_info.state === 'succeeded') {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (processing_info.state === 'failed') {
|
|
269
|
+
throw new Error(`Media processing failed: ${processing_info.error?.message || 'Unknown error'}`);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Wait before checking again
|
|
273
|
+
const checkAfterSecs = processing_info.check_after_secs || 1;
|
|
274
|
+
await new Promise(resolve => setTimeout(resolve, checkAfterSecs * 1000));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
throw new Error('Media processing timeout');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Get media category based on MIME type
|
|
282
|
+
*/
|
|
283
|
+
private getMediaCategory(mimeType: string): string {
|
|
284
|
+
if (mimeType.startsWith('image/gif')) {
|
|
285
|
+
return 'tweet_gif';
|
|
286
|
+
} else if (mimeType.startsWith('image/')) {
|
|
287
|
+
return 'tweet_image';
|
|
288
|
+
} else if (mimeType.startsWith('video/')) {
|
|
289
|
+
return 'tweet_video';
|
|
290
|
+
}
|
|
291
|
+
return 'tweet_image';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Validate media file meets Twitter requirements
|
|
296
|
+
*/
|
|
297
|
+
protected validateMediaFile(file: MediaFile): void {
|
|
298
|
+
const supportedTypes = [
|
|
299
|
+
'image/jpeg',
|
|
300
|
+
'image/png',
|
|
301
|
+
'image/gif',
|
|
302
|
+
'image/webp',
|
|
303
|
+
'video/mp4'
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
if (!supportedTypes.includes(file.mimeType)) {
|
|
307
|
+
throw new Error(`Unsupported media type: ${file.mimeType}. Supported types: ${supportedTypes.join(', ')}`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Twitter media size limits
|
|
311
|
+
let maxSize: number;
|
|
312
|
+
if (file.mimeType === 'image/gif') {
|
|
313
|
+
maxSize = 15 * 1024 * 1024; // 15MB for GIFs
|
|
314
|
+
} else if (file.mimeType.startsWith('image/')) {
|
|
315
|
+
maxSize = 5 * 1024 * 1024; // 5MB for images
|
|
316
|
+
} else if (file.mimeType.startsWith('video/')) {
|
|
317
|
+
maxSize = 512 * 1024 * 1024; // 512MB for videos
|
|
318
|
+
} else {
|
|
319
|
+
maxSize = 5 * 1024 * 1024; // Default 5MB
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (file.size > maxSize) {
|
|
323
|
+
throw new Error(`File size exceeds limit. Max: ${maxSize / 1024 / 1024}MB, Got: ${file.size / 1024 / 1024}MB`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Create a tweet
|
|
329
|
+
*/
|
|
330
|
+
protected async createTweet(tweetData: CreateTweetData): Promise<Tweet> {
|
|
331
|
+
try {
|
|
332
|
+
const response = await this.axiosInstance.post('/tweets', tweetData);
|
|
333
|
+
return response.data.data;
|
|
334
|
+
} catch (error) {
|
|
335
|
+
this.handleTwitterError(error as AxiosError);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Delete a tweet
|
|
341
|
+
*/
|
|
342
|
+
protected async deleteTweet(tweetId: string): Promise<void> {
|
|
343
|
+
try {
|
|
344
|
+
await this.axiosInstance.delete(`/tweets/${tweetId}`);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
this.handleTwitterError(error as AxiosError);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Get tweets with specified parameters
|
|
352
|
+
*/
|
|
353
|
+
protected async getTweets(endpoint: string, params: Record<string, any> = {}): Promise<Tweet[]> {
|
|
354
|
+
try {
|
|
355
|
+
const defaultParams = {
|
|
356
|
+
'tweet.fields': 'id,text,created_at,author_id,conversation_id,public_metrics,attachments,entities,referenced_tweets',
|
|
357
|
+
'user.fields': 'id,name,username,profile_image_url',
|
|
358
|
+
'media.fields': 'url,preview_image_url,type,width,height',
|
|
359
|
+
'expansions': 'author_id,attachments.media_keys,referenced_tweets.id',
|
|
360
|
+
'max_results': 100
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const response = await this.axiosInstance.get(endpoint, {
|
|
364
|
+
params: { ...defaultParams, ...params }
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
return response.data.data || [];
|
|
368
|
+
} catch (error) {
|
|
369
|
+
LogError(`Failed to get tweets: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
370
|
+
throw error;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Get paginated tweets
|
|
376
|
+
*/
|
|
377
|
+
protected async getPaginatedTweets(endpoint: string, params: Record<string, any> = {}, maxResults?: number): Promise<Tweet[]> {
|
|
378
|
+
const tweets: Tweet[] = [];
|
|
379
|
+
let paginationToken: string | undefined;
|
|
380
|
+
const limit = params.max_results || 100;
|
|
381
|
+
|
|
382
|
+
while (true) {
|
|
383
|
+
const response = await this.axiosInstance.get(endpoint, {
|
|
384
|
+
params: {
|
|
385
|
+
...params,
|
|
386
|
+
max_results: limit,
|
|
387
|
+
...(paginationToken && { pagination_token: paginationToken })
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
if (response.data.data && Array.isArray(response.data.data)) {
|
|
392
|
+
tweets.push(...response.data.data);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Check if we've reached max results
|
|
396
|
+
if (maxResults && tweets.length >= maxResults) {
|
|
397
|
+
return tweets.slice(0, maxResults);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// Check for more pages
|
|
401
|
+
paginationToken = response.data.meta?.next_token;
|
|
402
|
+
if (!paginationToken) {
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return tweets;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Convert Twitter tweet to common format
|
|
412
|
+
*/
|
|
413
|
+
protected normalizePost(tweet: Tweet): SocialPost {
|
|
414
|
+
return {
|
|
415
|
+
id: tweet.id,
|
|
416
|
+
platform: 'Twitter',
|
|
417
|
+
profileId: tweet.author_id || '',
|
|
418
|
+
content: tweet.text,
|
|
419
|
+
mediaUrls: tweet.attachments?.media_keys || [],
|
|
420
|
+
publishedAt: new Date(tweet.created_at),
|
|
421
|
+
analytics: tweet.public_metrics ? {
|
|
422
|
+
impressions: tweet.public_metrics.impression_count || 0,
|
|
423
|
+
engagements: (tweet.public_metrics.retweet_count || 0) +
|
|
424
|
+
(tweet.public_metrics.reply_count || 0) +
|
|
425
|
+
(tweet.public_metrics.like_count || 0) +
|
|
426
|
+
(tweet.public_metrics.quote_count || 0),
|
|
427
|
+
clicks: 0, // Not available in public metrics
|
|
428
|
+
shares: tweet.public_metrics.retweet_count || 0,
|
|
429
|
+
comments: tweet.public_metrics.reply_count || 0,
|
|
430
|
+
likes: tweet.public_metrics.like_count || 0,
|
|
431
|
+
reach: tweet.public_metrics.impression_count || 0,
|
|
432
|
+
platformMetrics: tweet.public_metrics
|
|
433
|
+
} : undefined,
|
|
434
|
+
platformSpecificData: {
|
|
435
|
+
conversationId: tweet.conversation_id,
|
|
436
|
+
referencedTweets: tweet.referenced_tweets,
|
|
437
|
+
entities: tweet.entities
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Normalize Twitter analytics to common format
|
|
444
|
+
*/
|
|
445
|
+
protected normalizeAnalytics(twitterMetrics: TwitterMetrics): SocialAnalytics {
|
|
446
|
+
return {
|
|
447
|
+
impressions: twitterMetrics.impression_count || 0,
|
|
448
|
+
engagements: twitterMetrics.engagement_count || 0,
|
|
449
|
+
clicks: twitterMetrics.url_link_clicks || 0,
|
|
450
|
+
shares: twitterMetrics.retweet_count || 0,
|
|
451
|
+
comments: twitterMetrics.reply_count || 0,
|
|
452
|
+
likes: twitterMetrics.like_count || 0,
|
|
453
|
+
reach: twitterMetrics.impression_count || 0,
|
|
454
|
+
videoViews: twitterMetrics.video_view_count,
|
|
455
|
+
platformMetrics: twitterMetrics
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Search for tweets - implemented in search action
|
|
461
|
+
*/
|
|
462
|
+
protected async searchPosts(params: SearchParams): Promise<SocialPost[]> {
|
|
463
|
+
// This is implemented in the search-tweets.action.ts
|
|
464
|
+
throw new Error('Search posts is implemented in TwitterSearchTweetsAction');
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Handle Twitter-specific errors
|
|
469
|
+
*/
|
|
470
|
+
protected handleTwitterError(error: AxiosError): never {
|
|
471
|
+
if (error.response) {
|
|
472
|
+
const { status, data } = error.response;
|
|
473
|
+
const errorData = data as any;
|
|
474
|
+
|
|
475
|
+
switch (status) {
|
|
476
|
+
case 400:
|
|
477
|
+
throw new Error(`Bad Request: ${errorData.detail || errorData.message || 'Invalid request parameters'}`);
|
|
478
|
+
case 401:
|
|
479
|
+
throw new Error('Unauthorized: Invalid or expired access token');
|
|
480
|
+
case 403:
|
|
481
|
+
throw new Error('Forbidden: Insufficient permissions. Ensure the app has required Twitter scopes.');
|
|
482
|
+
case 404:
|
|
483
|
+
throw new Error('Not Found: Resource does not exist');
|
|
484
|
+
case 429:
|
|
485
|
+
throw new Error('Rate Limit Exceeded: Too many requests');
|
|
486
|
+
case 500:
|
|
487
|
+
throw new Error('Internal Server Error: Twitter service error');
|
|
488
|
+
case 503:
|
|
489
|
+
throw new Error('Service Unavailable: Twitter service temporarily unavailable');
|
|
490
|
+
default:
|
|
491
|
+
throw new Error(`Twitter API Error (${status}): ${errorData.detail || errorData.message || 'Unknown error'}`);
|
|
492
|
+
}
|
|
493
|
+
} else if (error.request) {
|
|
494
|
+
throw new Error('Network Error: No response from Twitter');
|
|
495
|
+
} else {
|
|
496
|
+
throw new Error(`Request Error: ${error.message}`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Parse Twitter-specific rate limit headers
|
|
502
|
+
*/
|
|
503
|
+
protected parseRateLimitHeaders(headers: any): { remaining: number; reset: Date; limit: number; } | null {
|
|
504
|
+
const remaining = headers['x-rate-limit-remaining'];
|
|
505
|
+
const reset = headers['x-rate-limit-reset'];
|
|
506
|
+
const limit = headers['x-rate-limit-limit'];
|
|
507
|
+
|
|
508
|
+
if (remaining !== undefined && reset && limit) {
|
|
509
|
+
return {
|
|
510
|
+
remaining: parseInt(remaining),
|
|
511
|
+
reset: new Date(parseInt(reset) * 1000), // Unix timestamp to Date
|
|
512
|
+
limit: parseInt(limit)
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Build search query with operators
|
|
521
|
+
*/
|
|
522
|
+
protected buildSearchQuery(params: SearchParams): string {
|
|
523
|
+
const parts: string[] = [];
|
|
524
|
+
|
|
525
|
+
if (params.query) {
|
|
526
|
+
parts.push(params.query);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (params.hashtags && params.hashtags.length > 0) {
|
|
530
|
+
const hashtagQuery = params.hashtags
|
|
531
|
+
.map(tag => tag.startsWith('#') ? tag : `#${tag}`)
|
|
532
|
+
.join(' OR ');
|
|
533
|
+
parts.push(`(${hashtagQuery})`);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return parts.join(' ');
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Format date for Twitter API (RFC 3339)
|
|
541
|
+
*/
|
|
542
|
+
protected formatTwitterDate(date: Date | string): string {
|
|
543
|
+
if (typeof date === 'string') {
|
|
544
|
+
date = new Date(date);
|
|
545
|
+
}
|
|
546
|
+
return date.toISOString();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Twitter-specific interfaces
|
|
552
|
+
*/
|
|
553
|
+
export interface TwitterUser {
|
|
554
|
+
id: string;
|
|
555
|
+
name: string;
|
|
556
|
+
username: string;
|
|
557
|
+
profile_image_url?: string;
|
|
558
|
+
description?: string;
|
|
559
|
+
created_at: string;
|
|
560
|
+
verified?: boolean;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export interface CreateTweetData {
|
|
564
|
+
text: string;
|
|
565
|
+
media?: {
|
|
566
|
+
media_ids: string[];
|
|
567
|
+
};
|
|
568
|
+
poll?: {
|
|
569
|
+
options: string[];
|
|
570
|
+
duration_minutes: number;
|
|
571
|
+
};
|
|
572
|
+
reply?: {
|
|
573
|
+
in_reply_to_tweet_id: string;
|
|
574
|
+
};
|
|
575
|
+
quote_tweet_id?: string;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface Tweet {
|
|
579
|
+
id: string;
|
|
580
|
+
text: string;
|
|
581
|
+
created_at: string;
|
|
582
|
+
author_id?: string;
|
|
583
|
+
conversation_id?: string;
|
|
584
|
+
public_metrics?: {
|
|
585
|
+
retweet_count: number;
|
|
586
|
+
reply_count: number;
|
|
587
|
+
like_count: number;
|
|
588
|
+
quote_count: number;
|
|
589
|
+
bookmark_count: number;
|
|
590
|
+
impression_count: number;
|
|
591
|
+
};
|
|
592
|
+
attachments?: {
|
|
593
|
+
media_keys?: string[];
|
|
594
|
+
poll_ids?: string[];
|
|
595
|
+
};
|
|
596
|
+
entities?: {
|
|
597
|
+
hashtags?: Array<{ start: number; end: number; tag: string }>;
|
|
598
|
+
mentions?: Array<{ start: number; end: number; username: string }>;
|
|
599
|
+
urls?: Array<{ start: number; end: number; url: string; expanded_url: string }>;
|
|
600
|
+
};
|
|
601
|
+
referenced_tweets?: Array<{
|
|
602
|
+
type: 'retweeted' | 'quoted' | 'replied_to';
|
|
603
|
+
id: string;
|
|
604
|
+
}>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export interface TwitterMetrics {
|
|
608
|
+
impression_count: number;
|
|
609
|
+
engagement_count: number;
|
|
610
|
+
retweet_count: number;
|
|
611
|
+
reply_count: number;
|
|
612
|
+
like_count: number;
|
|
613
|
+
quote_count: number;
|
|
614
|
+
bookmark_count: number;
|
|
615
|
+
url_link_clicks: number;
|
|
616
|
+
user_profile_clicks: number;
|
|
617
|
+
video_view_count?: number;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
export interface TwitterSearchParams {
|
|
621
|
+
query: string;
|
|
622
|
+
start_time?: string;
|
|
623
|
+
end_time?: string;
|
|
624
|
+
max_results?: number;
|
|
625
|
+
next_token?: string;
|
|
626
|
+
since_id?: string;
|
|
627
|
+
until_id?: string;
|
|
628
|
+
sort_order?: 'recency' | 'relevancy';
|
|
629
|
+
}
|