@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,185 @@
|
|
|
1
|
+
import { BaseSocialMediaAction, MediaFile, SocialPost, SearchParams, SocialAnalytics } from '../../base/base-social.action';
|
|
2
|
+
import { AxiosInstance, AxiosError } from 'axios';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for all Twitter/X actions.
|
|
5
|
+
* Handles Twitter-specific authentication, API interactions, and rate limiting.
|
|
6
|
+
* Uses Twitter API v2 with OAuth 2.0.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class TwitterBaseAction extends BaseSocialMediaAction {
|
|
9
|
+
protected get platformName(): string;
|
|
10
|
+
protected get apiBaseUrl(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Upload endpoint for media
|
|
13
|
+
*/
|
|
14
|
+
protected get uploadApiUrl(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Axios instance for making HTTP requests
|
|
17
|
+
*/
|
|
18
|
+
private _axiosInstance;
|
|
19
|
+
/**
|
|
20
|
+
* Get or create axios instance with interceptors
|
|
21
|
+
*/
|
|
22
|
+
protected get axiosInstance(): AxiosInstance;
|
|
23
|
+
/**
|
|
24
|
+
* Refresh the access token using the refresh token
|
|
25
|
+
*/
|
|
26
|
+
protected refreshAccessToken(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the authenticated user's info
|
|
29
|
+
*/
|
|
30
|
+
protected getCurrentUser(): Promise<TwitterUser>;
|
|
31
|
+
/**
|
|
32
|
+
* Upload media to Twitter
|
|
33
|
+
*/
|
|
34
|
+
protected uploadSingleMedia(file: MediaFile): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Wait for media processing to complete (for videos)
|
|
37
|
+
*/
|
|
38
|
+
private waitForMediaProcessing;
|
|
39
|
+
/**
|
|
40
|
+
* Get media category based on MIME type
|
|
41
|
+
*/
|
|
42
|
+
private getMediaCategory;
|
|
43
|
+
/**
|
|
44
|
+
* Validate media file meets Twitter requirements
|
|
45
|
+
*/
|
|
46
|
+
protected validateMediaFile(file: MediaFile): void;
|
|
47
|
+
/**
|
|
48
|
+
* Create a tweet
|
|
49
|
+
*/
|
|
50
|
+
protected createTweet(tweetData: CreateTweetData): Promise<Tweet>;
|
|
51
|
+
/**
|
|
52
|
+
* Delete a tweet
|
|
53
|
+
*/
|
|
54
|
+
protected deleteTweet(tweetId: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Get tweets with specified parameters
|
|
57
|
+
*/
|
|
58
|
+
protected getTweets(endpoint: string, params?: Record<string, any>): Promise<Tweet[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get paginated tweets
|
|
61
|
+
*/
|
|
62
|
+
protected getPaginatedTweets(endpoint: string, params?: Record<string, any>, maxResults?: number): Promise<Tweet[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Convert Twitter tweet to common format
|
|
65
|
+
*/
|
|
66
|
+
protected normalizePost(tweet: Tweet): SocialPost;
|
|
67
|
+
/**
|
|
68
|
+
* Normalize Twitter analytics to common format
|
|
69
|
+
*/
|
|
70
|
+
protected normalizeAnalytics(twitterMetrics: TwitterMetrics): SocialAnalytics;
|
|
71
|
+
/**
|
|
72
|
+
* Search for tweets - implemented in search action
|
|
73
|
+
*/
|
|
74
|
+
protected searchPosts(params: SearchParams): Promise<SocialPost[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Handle Twitter-specific errors
|
|
77
|
+
*/
|
|
78
|
+
protected handleTwitterError(error: AxiosError): never;
|
|
79
|
+
/**
|
|
80
|
+
* Parse Twitter-specific rate limit headers
|
|
81
|
+
*/
|
|
82
|
+
protected parseRateLimitHeaders(headers: any): {
|
|
83
|
+
remaining: number;
|
|
84
|
+
reset: Date;
|
|
85
|
+
limit: number;
|
|
86
|
+
} | null;
|
|
87
|
+
/**
|
|
88
|
+
* Build search query with operators
|
|
89
|
+
*/
|
|
90
|
+
protected buildSearchQuery(params: SearchParams): string;
|
|
91
|
+
/**
|
|
92
|
+
* Format date for Twitter API (RFC 3339)
|
|
93
|
+
*/
|
|
94
|
+
protected formatTwitterDate(date: Date | string): string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Twitter-specific interfaces
|
|
98
|
+
*/
|
|
99
|
+
export interface TwitterUser {
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
username: string;
|
|
103
|
+
profile_image_url?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
created_at: string;
|
|
106
|
+
verified?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface CreateTweetData {
|
|
109
|
+
text: string;
|
|
110
|
+
media?: {
|
|
111
|
+
media_ids: string[];
|
|
112
|
+
};
|
|
113
|
+
poll?: {
|
|
114
|
+
options: string[];
|
|
115
|
+
duration_minutes: number;
|
|
116
|
+
};
|
|
117
|
+
reply?: {
|
|
118
|
+
in_reply_to_tweet_id: string;
|
|
119
|
+
};
|
|
120
|
+
quote_tweet_id?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface Tweet {
|
|
123
|
+
id: string;
|
|
124
|
+
text: string;
|
|
125
|
+
created_at: string;
|
|
126
|
+
author_id?: string;
|
|
127
|
+
conversation_id?: string;
|
|
128
|
+
public_metrics?: {
|
|
129
|
+
retweet_count: number;
|
|
130
|
+
reply_count: number;
|
|
131
|
+
like_count: number;
|
|
132
|
+
quote_count: number;
|
|
133
|
+
bookmark_count: number;
|
|
134
|
+
impression_count: number;
|
|
135
|
+
};
|
|
136
|
+
attachments?: {
|
|
137
|
+
media_keys?: string[];
|
|
138
|
+
poll_ids?: string[];
|
|
139
|
+
};
|
|
140
|
+
entities?: {
|
|
141
|
+
hashtags?: Array<{
|
|
142
|
+
start: number;
|
|
143
|
+
end: number;
|
|
144
|
+
tag: string;
|
|
145
|
+
}>;
|
|
146
|
+
mentions?: Array<{
|
|
147
|
+
start: number;
|
|
148
|
+
end: number;
|
|
149
|
+
username: string;
|
|
150
|
+
}>;
|
|
151
|
+
urls?: Array<{
|
|
152
|
+
start: number;
|
|
153
|
+
end: number;
|
|
154
|
+
url: string;
|
|
155
|
+
expanded_url: string;
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
referenced_tweets?: Array<{
|
|
159
|
+
type: 'retweeted' | 'quoted' | 'replied_to';
|
|
160
|
+
id: string;
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
163
|
+
export interface TwitterMetrics {
|
|
164
|
+
impression_count: number;
|
|
165
|
+
engagement_count: number;
|
|
166
|
+
retweet_count: number;
|
|
167
|
+
reply_count: number;
|
|
168
|
+
like_count: number;
|
|
169
|
+
quote_count: number;
|
|
170
|
+
bookmark_count: number;
|
|
171
|
+
url_link_clicks: number;
|
|
172
|
+
user_profile_clicks: number;
|
|
173
|
+
video_view_count?: number;
|
|
174
|
+
}
|
|
175
|
+
export interface TwitterSearchParams {
|
|
176
|
+
query: string;
|
|
177
|
+
start_time?: string;
|
|
178
|
+
end_time?: string;
|
|
179
|
+
max_results?: number;
|
|
180
|
+
next_token?: string;
|
|
181
|
+
since_id?: string;
|
|
182
|
+
until_id?: string;
|
|
183
|
+
sort_order?: 'recency' | 'relevancy';
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=twitter-base.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twitter-base.action.d.ts","sourceRoot":"","sources":["../../../src/providers/twitter/twitter-base.action.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TwitterBaseAction = void 0;
|
|
13
|
+
const global_1 = require("@memberjunction/global");
|
|
14
|
+
const base_social_action_1 = require("../../base/base-social.action");
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
const core_1 = require("@memberjunction/core");
|
|
17
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
18
|
+
/**
|
|
19
|
+
* Base class for all Twitter/X actions.
|
|
20
|
+
* Handles Twitter-specific authentication, API interactions, and rate limiting.
|
|
21
|
+
* Uses Twitter API v2 with OAuth 2.0.
|
|
22
|
+
*/
|
|
23
|
+
let TwitterBaseAction = class TwitterBaseAction extends base_social_action_1.BaseSocialMediaAction {
|
|
24
|
+
get platformName() {
|
|
25
|
+
return 'Twitter';
|
|
26
|
+
}
|
|
27
|
+
get apiBaseUrl() {
|
|
28
|
+
return 'https://api.twitter.com/2';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Upload endpoint for media
|
|
32
|
+
*/
|
|
33
|
+
get uploadApiUrl() {
|
|
34
|
+
return 'https://upload.twitter.com/1.1';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Axios instance for making HTTP requests
|
|
38
|
+
*/
|
|
39
|
+
_axiosInstance = null;
|
|
40
|
+
/**
|
|
41
|
+
* Get or create axios instance with interceptors
|
|
42
|
+
*/
|
|
43
|
+
get axiosInstance() {
|
|
44
|
+
if (!this._axiosInstance) {
|
|
45
|
+
this._axiosInstance = axios_1.default.create({
|
|
46
|
+
baseURL: this.apiBaseUrl,
|
|
47
|
+
timeout: 30000,
|
|
48
|
+
headers: {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
'Accept': 'application/json'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// Add request interceptor for auth
|
|
54
|
+
this._axiosInstance.interceptors.request.use((config) => {
|
|
55
|
+
const token = this.getAccessToken();
|
|
56
|
+
if (token) {
|
|
57
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
58
|
+
}
|
|
59
|
+
return config;
|
|
60
|
+
}, (error) => Promise.reject(error));
|
|
61
|
+
// Add response interceptor for rate limit handling
|
|
62
|
+
this._axiosInstance.interceptors.response.use((response) => {
|
|
63
|
+
// Log rate limit info
|
|
64
|
+
const rateLimitInfo = this.parseRateLimitHeaders(response.headers);
|
|
65
|
+
if (rateLimitInfo) {
|
|
66
|
+
(0, core_1.LogStatus)(`Twitter Rate Limit - Remaining: ${rateLimitInfo.remaining}/${rateLimitInfo.limit}, Reset: ${rateLimitInfo.reset}`);
|
|
67
|
+
}
|
|
68
|
+
return response;
|
|
69
|
+
}, async (error) => {
|
|
70
|
+
if (error.response?.status === 429) {
|
|
71
|
+
// Rate limit exceeded
|
|
72
|
+
const resetTime = error.response.headers['x-rate-limit-reset'];
|
|
73
|
+
const waitTime = resetTime
|
|
74
|
+
? Math.max(0, parseInt(resetTime) - Math.floor(Date.now() / 1000))
|
|
75
|
+
: 60;
|
|
76
|
+
await this.handleRateLimit(waitTime);
|
|
77
|
+
// Retry the request
|
|
78
|
+
return this._axiosInstance.request(error.config);
|
|
79
|
+
}
|
|
80
|
+
return Promise.reject(error);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return this._axiosInstance;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Refresh the access token using the refresh token
|
|
87
|
+
*/
|
|
88
|
+
async refreshAccessToken() {
|
|
89
|
+
const refreshToken = this.getRefreshToken();
|
|
90
|
+
if (!refreshToken) {
|
|
91
|
+
throw new Error('No refresh token available for Twitter');
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const clientId = this.getCustomAttribute(2) || ''; // Client ID stored in CustomAttribute2
|
|
95
|
+
const clientSecret = this.getCustomAttribute(3) || ''; // Client Secret stored in CustomAttribute3
|
|
96
|
+
const basicAuth = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
|
|
97
|
+
const response = await axios_1.default.post('https://api.twitter.com/2/oauth2/token', new URLSearchParams({
|
|
98
|
+
grant_type: 'refresh_token',
|
|
99
|
+
refresh_token: refreshToken,
|
|
100
|
+
client_id: clientId
|
|
101
|
+
}).toString(), {
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
104
|
+
'Authorization': `Basic ${basicAuth}`
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const { access_token, refresh_token: newRefreshToken, expires_in } = response.data;
|
|
108
|
+
// Update stored tokens
|
|
109
|
+
await this.updateStoredTokens(access_token, newRefreshToken || refreshToken, expires_in);
|
|
110
|
+
(0, core_1.LogStatus)('Twitter access token refreshed successfully');
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
(0, core_1.LogError)(`Failed to refresh Twitter access token: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get the authenticated user's info
|
|
119
|
+
*/
|
|
120
|
+
async getCurrentUser() {
|
|
121
|
+
try {
|
|
122
|
+
const response = await this.axiosInstance.get('/users/me', {
|
|
123
|
+
params: {
|
|
124
|
+
'user.fields': 'id,name,username,profile_image_url,description,created_at,verified'
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return response.data.data;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
(0, core_1.LogError)(`Failed to get current user: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Upload media to Twitter
|
|
136
|
+
*/
|
|
137
|
+
async uploadSingleMedia(file) {
|
|
138
|
+
try {
|
|
139
|
+
const fileData = typeof file.data === 'string'
|
|
140
|
+
? Buffer.from(file.data, 'base64')
|
|
141
|
+
: file.data;
|
|
142
|
+
// Step 1: Initialize upload
|
|
143
|
+
const initResponse = await axios_1.default.post(`${this.uploadApiUrl}/media/upload.json`, new URLSearchParams({
|
|
144
|
+
command: 'INIT',
|
|
145
|
+
total_bytes: fileData.length.toString(),
|
|
146
|
+
media_type: file.mimeType,
|
|
147
|
+
media_category: this.getMediaCategory(file.mimeType)
|
|
148
|
+
}).toString(), {
|
|
149
|
+
headers: {
|
|
150
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
151
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const mediaId = initResponse.data.media_id_string;
|
|
155
|
+
// Step 2: Upload chunks (for large files, Twitter requires chunking)
|
|
156
|
+
const chunkSize = 5 * 1024 * 1024; // 5MB chunks
|
|
157
|
+
let segmentIndex = 0;
|
|
158
|
+
for (let offset = 0; offset < fileData.length; offset += chunkSize) {
|
|
159
|
+
const chunk = fileData.slice(offset, Math.min(offset + chunkSize, fileData.length));
|
|
160
|
+
const formData = new form_data_1.default();
|
|
161
|
+
formData.append('command', 'APPEND');
|
|
162
|
+
formData.append('media_id', mediaId);
|
|
163
|
+
formData.append('segment_index', segmentIndex.toString());
|
|
164
|
+
formData.append('media', chunk, {
|
|
165
|
+
filename: file.filename,
|
|
166
|
+
contentType: file.mimeType
|
|
167
|
+
});
|
|
168
|
+
await axios_1.default.post(`${this.uploadApiUrl}/media/upload.json`, formData, {
|
|
169
|
+
headers: {
|
|
170
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
171
|
+
...formData.getHeaders()
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
segmentIndex++;
|
|
175
|
+
}
|
|
176
|
+
// Step 3: Finalize upload
|
|
177
|
+
await axios_1.default.post(`${this.uploadApiUrl}/media/upload.json`, new URLSearchParams({
|
|
178
|
+
command: 'FINALIZE',
|
|
179
|
+
media_id: mediaId
|
|
180
|
+
}).toString(), {
|
|
181
|
+
headers: {
|
|
182
|
+
'Authorization': `Bearer ${this.getAccessToken()}`,
|
|
183
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
// Step 4: Check processing status (for videos)
|
|
187
|
+
if (file.mimeType.startsWith('video/')) {
|
|
188
|
+
await this.waitForMediaProcessing(mediaId);
|
|
189
|
+
}
|
|
190
|
+
return mediaId;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
(0, core_1.LogError)(`Failed to upload media to Twitter: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Wait for media processing to complete (for videos)
|
|
199
|
+
*/
|
|
200
|
+
async waitForMediaProcessing(mediaId, maxWaitTime = 60000) {
|
|
201
|
+
const startTime = Date.now();
|
|
202
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
203
|
+
const response = await axios_1.default.get(`${this.uploadApiUrl}/media/upload.json`, {
|
|
204
|
+
params: {
|
|
205
|
+
command: 'STATUS',
|
|
206
|
+
media_id: mediaId
|
|
207
|
+
},
|
|
208
|
+
headers: {
|
|
209
|
+
'Authorization': `Bearer ${this.getAccessToken()}`
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const { processing_info } = response.data;
|
|
213
|
+
if (!processing_info) {
|
|
214
|
+
// Processing complete
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (processing_info.state === 'succeeded') {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (processing_info.state === 'failed') {
|
|
221
|
+
throw new Error(`Media processing failed: ${processing_info.error?.message || 'Unknown error'}`);
|
|
222
|
+
}
|
|
223
|
+
// Wait before checking again
|
|
224
|
+
const checkAfterSecs = processing_info.check_after_secs || 1;
|
|
225
|
+
await new Promise(resolve => setTimeout(resolve, checkAfterSecs * 1000));
|
|
226
|
+
}
|
|
227
|
+
throw new Error('Media processing timeout');
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get media category based on MIME type
|
|
231
|
+
*/
|
|
232
|
+
getMediaCategory(mimeType) {
|
|
233
|
+
if (mimeType.startsWith('image/gif')) {
|
|
234
|
+
return 'tweet_gif';
|
|
235
|
+
}
|
|
236
|
+
else if (mimeType.startsWith('image/')) {
|
|
237
|
+
return 'tweet_image';
|
|
238
|
+
}
|
|
239
|
+
else if (mimeType.startsWith('video/')) {
|
|
240
|
+
return 'tweet_video';
|
|
241
|
+
}
|
|
242
|
+
return 'tweet_image';
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Validate media file meets Twitter requirements
|
|
246
|
+
*/
|
|
247
|
+
validateMediaFile(file) {
|
|
248
|
+
const supportedTypes = [
|
|
249
|
+
'image/jpeg',
|
|
250
|
+
'image/png',
|
|
251
|
+
'image/gif',
|
|
252
|
+
'image/webp',
|
|
253
|
+
'video/mp4'
|
|
254
|
+
];
|
|
255
|
+
if (!supportedTypes.includes(file.mimeType)) {
|
|
256
|
+
throw new Error(`Unsupported media type: ${file.mimeType}. Supported types: ${supportedTypes.join(', ')}`);
|
|
257
|
+
}
|
|
258
|
+
// Twitter media size limits
|
|
259
|
+
let maxSize;
|
|
260
|
+
if (file.mimeType === 'image/gif') {
|
|
261
|
+
maxSize = 15 * 1024 * 1024; // 15MB for GIFs
|
|
262
|
+
}
|
|
263
|
+
else if (file.mimeType.startsWith('image/')) {
|
|
264
|
+
maxSize = 5 * 1024 * 1024; // 5MB for images
|
|
265
|
+
}
|
|
266
|
+
else if (file.mimeType.startsWith('video/')) {
|
|
267
|
+
maxSize = 512 * 1024 * 1024; // 512MB for videos
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
maxSize = 5 * 1024 * 1024; // Default 5MB
|
|
271
|
+
}
|
|
272
|
+
if (file.size > maxSize) {
|
|
273
|
+
throw new Error(`File size exceeds limit. Max: ${maxSize / 1024 / 1024}MB, Got: ${file.size / 1024 / 1024}MB`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Create a tweet
|
|
278
|
+
*/
|
|
279
|
+
async createTweet(tweetData) {
|
|
280
|
+
try {
|
|
281
|
+
const response = await this.axiosInstance.post('/tweets', tweetData);
|
|
282
|
+
return response.data.data;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
this.handleTwitterError(error);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Delete a tweet
|
|
290
|
+
*/
|
|
291
|
+
async deleteTweet(tweetId) {
|
|
292
|
+
try {
|
|
293
|
+
await this.axiosInstance.delete(`/tweets/${tweetId}`);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
this.handleTwitterError(error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get tweets with specified parameters
|
|
301
|
+
*/
|
|
302
|
+
async getTweets(endpoint, params = {}) {
|
|
303
|
+
try {
|
|
304
|
+
const defaultParams = {
|
|
305
|
+
'tweet.fields': 'id,text,created_at,author_id,conversation_id,public_metrics,attachments,entities,referenced_tweets',
|
|
306
|
+
'user.fields': 'id,name,username,profile_image_url',
|
|
307
|
+
'media.fields': 'url,preview_image_url,type,width,height',
|
|
308
|
+
'expansions': 'author_id,attachments.media_keys,referenced_tweets.id',
|
|
309
|
+
'max_results': 100
|
|
310
|
+
};
|
|
311
|
+
const response = await this.axiosInstance.get(endpoint, {
|
|
312
|
+
params: { ...defaultParams, ...params }
|
|
313
|
+
});
|
|
314
|
+
return response.data.data || [];
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
(0, core_1.LogError)(`Failed to get tweets: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get paginated tweets
|
|
323
|
+
*/
|
|
324
|
+
async getPaginatedTweets(endpoint, params = {}, maxResults) {
|
|
325
|
+
const tweets = [];
|
|
326
|
+
let paginationToken;
|
|
327
|
+
const limit = params.max_results || 100;
|
|
328
|
+
while (true) {
|
|
329
|
+
const response = await this.axiosInstance.get(endpoint, {
|
|
330
|
+
params: {
|
|
331
|
+
...params,
|
|
332
|
+
max_results: limit,
|
|
333
|
+
...(paginationToken && { pagination_token: paginationToken })
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
if (response.data.data && Array.isArray(response.data.data)) {
|
|
337
|
+
tweets.push(...response.data.data);
|
|
338
|
+
}
|
|
339
|
+
// Check if we've reached max results
|
|
340
|
+
if (maxResults && tweets.length >= maxResults) {
|
|
341
|
+
return tweets.slice(0, maxResults);
|
|
342
|
+
}
|
|
343
|
+
// Check for more pages
|
|
344
|
+
paginationToken = response.data.meta?.next_token;
|
|
345
|
+
if (!paginationToken) {
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return tweets;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Convert Twitter tweet to common format
|
|
353
|
+
*/
|
|
354
|
+
normalizePost(tweet) {
|
|
355
|
+
return {
|
|
356
|
+
id: tweet.id,
|
|
357
|
+
platform: 'Twitter',
|
|
358
|
+
profileId: tweet.author_id || '',
|
|
359
|
+
content: tweet.text,
|
|
360
|
+
mediaUrls: tweet.attachments?.media_keys || [],
|
|
361
|
+
publishedAt: new Date(tweet.created_at),
|
|
362
|
+
analytics: tweet.public_metrics ? {
|
|
363
|
+
impressions: tweet.public_metrics.impression_count || 0,
|
|
364
|
+
engagements: (tweet.public_metrics.retweet_count || 0) +
|
|
365
|
+
(tweet.public_metrics.reply_count || 0) +
|
|
366
|
+
(tweet.public_metrics.like_count || 0) +
|
|
367
|
+
(tweet.public_metrics.quote_count || 0),
|
|
368
|
+
clicks: 0, // Not available in public metrics
|
|
369
|
+
shares: tweet.public_metrics.retweet_count || 0,
|
|
370
|
+
comments: tweet.public_metrics.reply_count || 0,
|
|
371
|
+
likes: tweet.public_metrics.like_count || 0,
|
|
372
|
+
reach: tweet.public_metrics.impression_count || 0,
|
|
373
|
+
platformMetrics: tweet.public_metrics
|
|
374
|
+
} : undefined,
|
|
375
|
+
platformSpecificData: {
|
|
376
|
+
conversationId: tweet.conversation_id,
|
|
377
|
+
referencedTweets: tweet.referenced_tweets,
|
|
378
|
+
entities: tweet.entities
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Normalize Twitter analytics to common format
|
|
384
|
+
*/
|
|
385
|
+
normalizeAnalytics(twitterMetrics) {
|
|
386
|
+
return {
|
|
387
|
+
impressions: twitterMetrics.impression_count || 0,
|
|
388
|
+
engagements: twitterMetrics.engagement_count || 0,
|
|
389
|
+
clicks: twitterMetrics.url_link_clicks || 0,
|
|
390
|
+
shares: twitterMetrics.retweet_count || 0,
|
|
391
|
+
comments: twitterMetrics.reply_count || 0,
|
|
392
|
+
likes: twitterMetrics.like_count || 0,
|
|
393
|
+
reach: twitterMetrics.impression_count || 0,
|
|
394
|
+
videoViews: twitterMetrics.video_view_count,
|
|
395
|
+
platformMetrics: twitterMetrics
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Search for tweets - implemented in search action
|
|
400
|
+
*/
|
|
401
|
+
async searchPosts(params) {
|
|
402
|
+
// This is implemented in the search-tweets.action.ts
|
|
403
|
+
throw new Error('Search posts is implemented in TwitterSearchTweetsAction');
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Handle Twitter-specific errors
|
|
407
|
+
*/
|
|
408
|
+
handleTwitterError(error) {
|
|
409
|
+
if (error.response) {
|
|
410
|
+
const { status, data } = error.response;
|
|
411
|
+
const errorData = data;
|
|
412
|
+
switch (status) {
|
|
413
|
+
case 400:
|
|
414
|
+
throw new Error(`Bad Request: ${errorData.detail || errorData.message || 'Invalid request parameters'}`);
|
|
415
|
+
case 401:
|
|
416
|
+
throw new Error('Unauthorized: Invalid or expired access token');
|
|
417
|
+
case 403:
|
|
418
|
+
throw new Error('Forbidden: Insufficient permissions. Ensure the app has required Twitter scopes.');
|
|
419
|
+
case 404:
|
|
420
|
+
throw new Error('Not Found: Resource does not exist');
|
|
421
|
+
case 429:
|
|
422
|
+
throw new Error('Rate Limit Exceeded: Too many requests');
|
|
423
|
+
case 500:
|
|
424
|
+
throw new Error('Internal Server Error: Twitter service error');
|
|
425
|
+
case 503:
|
|
426
|
+
throw new Error('Service Unavailable: Twitter service temporarily unavailable');
|
|
427
|
+
default:
|
|
428
|
+
throw new Error(`Twitter API Error (${status}): ${errorData.detail || errorData.message || 'Unknown error'}`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
else if (error.request) {
|
|
432
|
+
throw new Error('Network Error: No response from Twitter');
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
throw new Error(`Request Error: ${error.message}`);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Parse Twitter-specific rate limit headers
|
|
440
|
+
*/
|
|
441
|
+
parseRateLimitHeaders(headers) {
|
|
442
|
+
const remaining = headers['x-rate-limit-remaining'];
|
|
443
|
+
const reset = headers['x-rate-limit-reset'];
|
|
444
|
+
const limit = headers['x-rate-limit-limit'];
|
|
445
|
+
if (remaining !== undefined && reset && limit) {
|
|
446
|
+
return {
|
|
447
|
+
remaining: parseInt(remaining),
|
|
448
|
+
reset: new Date(parseInt(reset) * 1000), // Unix timestamp to Date
|
|
449
|
+
limit: parseInt(limit)
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Build search query with operators
|
|
456
|
+
*/
|
|
457
|
+
buildSearchQuery(params) {
|
|
458
|
+
const parts = [];
|
|
459
|
+
if (params.query) {
|
|
460
|
+
parts.push(params.query);
|
|
461
|
+
}
|
|
462
|
+
if (params.hashtags && params.hashtags.length > 0) {
|
|
463
|
+
const hashtagQuery = params.hashtags
|
|
464
|
+
.map(tag => tag.startsWith('#') ? tag : `#${tag}`)
|
|
465
|
+
.join(' OR ');
|
|
466
|
+
parts.push(`(${hashtagQuery})`);
|
|
467
|
+
}
|
|
468
|
+
return parts.join(' ');
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Format date for Twitter API (RFC 3339)
|
|
472
|
+
*/
|
|
473
|
+
formatTwitterDate(date) {
|
|
474
|
+
if (typeof date === 'string') {
|
|
475
|
+
date = new Date(date);
|
|
476
|
+
}
|
|
477
|
+
return date.toISOString();
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
exports.TwitterBaseAction = TwitterBaseAction;
|
|
481
|
+
exports.TwitterBaseAction = TwitterBaseAction = __decorate([
|
|
482
|
+
(0, global_1.RegisterClass)(base_social_action_1.BaseSocialMediaAction, 'TwitterBaseAction')
|
|
483
|
+
], TwitterBaseAction);
|
|
484
|
+
//# sourceMappingURL=twitter-base.action.js.map
|