@memberjunction/actions-bizapps-social 2.112.0 → 2.113.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.
Files changed (204) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +13 -0
  3. package/dist/base/base-social.action.d.ts.map +1 -1
  4. package/dist/base/base-social.action.js +24 -18
  5. package/dist/base/base-social.action.js.map +1 -1
  6. package/dist/providers/buffer/buffer-base.action.d.ts.map +1 -1
  7. package/dist/providers/buffer/buffer-base.action.js +34 -35
  8. package/dist/providers/buffer/buffer-base.action.js.map +1 -1
  9. package/dist/providers/facebook/actions/boost-post.action.d.ts.map +1 -1
  10. package/dist/providers/facebook/actions/boost-post.action.js +33 -33
  11. package/dist/providers/facebook/actions/boost-post.action.js.map +1 -1
  12. package/dist/providers/facebook/actions/create-album.action.d.ts.map +1 -1
  13. package/dist/providers/facebook/actions/create-album.action.js +36 -34
  14. package/dist/providers/facebook/actions/create-album.action.js.map +1 -1
  15. package/dist/providers/facebook/actions/create-post.action.d.ts.map +1 -1
  16. package/dist/providers/facebook/actions/create-post.action.js +20 -20
  17. package/dist/providers/facebook/actions/create-post.action.js.map +1 -1
  18. package/dist/providers/facebook/actions/get-page-insights.action.d.ts.map +1 -1
  19. package/dist/providers/facebook/actions/get-page-insights.action.js +27 -25
  20. package/dist/providers/facebook/actions/get-page-insights.action.js.map +1 -1
  21. package/dist/providers/facebook/actions/get-page-posts.action.d.ts.map +1 -1
  22. package/dist/providers/facebook/actions/get-page-posts.action.js +23 -19
  23. package/dist/providers/facebook/actions/get-page-posts.action.js.map +1 -1
  24. package/dist/providers/facebook/actions/get-post-insights.action.d.ts.map +1 -1
  25. package/dist/providers/facebook/actions/get-post-insights.action.js +32 -28
  26. package/dist/providers/facebook/actions/get-post-insights.action.js.map +1 -1
  27. package/dist/providers/facebook/actions/respond-to-comments.action.d.ts.map +1 -1
  28. package/dist/providers/facebook/actions/respond-to-comments.action.js +44 -42
  29. package/dist/providers/facebook/actions/respond-to-comments.action.js.map +1 -1
  30. package/dist/providers/facebook/actions/schedule-post.action.d.ts.map +1 -1
  31. package/dist/providers/facebook/actions/schedule-post.action.js +29 -29
  32. package/dist/providers/facebook/actions/schedule-post.action.js.map +1 -1
  33. package/dist/providers/facebook/actions/search-posts.action.d.ts.map +1 -1
  34. package/dist/providers/facebook/actions/search-posts.action.js +39 -37
  35. package/dist/providers/facebook/actions/search-posts.action.js.map +1 -1
  36. package/dist/providers/facebook/facebook-base.action.d.ts.map +1 -1
  37. package/dist/providers/facebook/facebook-base.action.js +59 -44
  38. package/dist/providers/facebook/facebook-base.action.js.map +1 -1
  39. package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.d.ts.map +1 -1
  40. package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js +31 -33
  41. package/dist/providers/hootsuite/actions/bulk-schedule-posts.action.js.map +1 -1
  42. package/dist/providers/hootsuite/actions/create-scheduled-post.action.d.ts.map +1 -1
  43. package/dist/providers/hootsuite/actions/create-scheduled-post.action.js +32 -28
  44. package/dist/providers/hootsuite/actions/create-scheduled-post.action.js.map +1 -1
  45. package/dist/providers/hootsuite/actions/delete-scheduled-post.action.d.ts.map +1 -1
  46. package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js +19 -19
  47. package/dist/providers/hootsuite/actions/delete-scheduled-post.action.js.map +1 -1
  48. package/dist/providers/hootsuite/actions/get-analytics.action.d.ts.map +1 -1
  49. package/dist/providers/hootsuite/actions/get-analytics.action.js +26 -24
  50. package/dist/providers/hootsuite/actions/get-analytics.action.js.map +1 -1
  51. package/dist/providers/hootsuite/actions/get-scheduled-posts.action.d.ts.map +1 -1
  52. package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js +22 -22
  53. package/dist/providers/hootsuite/actions/get-scheduled-posts.action.js.map +1 -1
  54. package/dist/providers/hootsuite/actions/get-social-profiles.action.d.ts.map +1 -1
  55. package/dist/providers/hootsuite/actions/get-social-profiles.action.js +34 -32
  56. package/dist/providers/hootsuite/actions/get-social-profiles.action.js.map +1 -1
  57. package/dist/providers/hootsuite/actions/search-posts.action.d.ts.map +1 -1
  58. package/dist/providers/hootsuite/actions/search-posts.action.js +52 -43
  59. package/dist/providers/hootsuite/actions/search-posts.action.js.map +1 -1
  60. package/dist/providers/hootsuite/actions/update-scheduled-post.action.d.ts.map +1 -1
  61. package/dist/providers/hootsuite/actions/update-scheduled-post.action.js +28 -30
  62. package/dist/providers/hootsuite/actions/update-scheduled-post.action.js.map +1 -1
  63. package/dist/providers/hootsuite/hootsuite-base.action.d.ts.map +1 -1
  64. package/dist/providers/hootsuite/hootsuite-base.action.js +20 -18
  65. package/dist/providers/hootsuite/hootsuite-base.action.js.map +1 -1
  66. package/dist/providers/instagram/actions/create-post.action.d.ts.map +1 -1
  67. package/dist/providers/instagram/actions/create-post.action.js +26 -27
  68. package/dist/providers/instagram/actions/create-post.action.js.map +1 -1
  69. package/dist/providers/instagram/actions/create-story.action.d.ts.map +1 -1
  70. package/dist/providers/instagram/actions/create-story.action.js +35 -35
  71. package/dist/providers/instagram/actions/create-story.action.js.map +1 -1
  72. package/dist/providers/instagram/actions/get-account-insights.action.d.ts.map +1 -1
  73. package/dist/providers/instagram/actions/get-account-insights.action.js +59 -38
  74. package/dist/providers/instagram/actions/get-account-insights.action.js.map +1 -1
  75. package/dist/providers/instagram/actions/get-business-posts.action.d.ts.map +1 -1
  76. package/dist/providers/instagram/actions/get-business-posts.action.js +29 -29
  77. package/dist/providers/instagram/actions/get-business-posts.action.js.map +1 -1
  78. package/dist/providers/instagram/actions/get-comments.action.d.ts.map +1 -1
  79. package/dist/providers/instagram/actions/get-comments.action.js +36 -36
  80. package/dist/providers/instagram/actions/get-comments.action.js.map +1 -1
  81. package/dist/providers/instagram/actions/get-post-insights.action.d.ts.map +1 -1
  82. package/dist/providers/instagram/actions/get-post-insights.action.js +25 -23
  83. package/dist/providers/instagram/actions/get-post-insights.action.js.map +1 -1
  84. package/dist/providers/instagram/actions/schedule-post.action.d.ts.map +1 -1
  85. package/dist/providers/instagram/actions/schedule-post.action.js +25 -25
  86. package/dist/providers/instagram/actions/schedule-post.action.js.map +1 -1
  87. package/dist/providers/instagram/actions/search-posts.action.d.ts.map +1 -1
  88. package/dist/providers/instagram/actions/search-posts.action.js +60 -56
  89. package/dist/providers/instagram/actions/search-posts.action.js.map +1 -1
  90. package/dist/providers/instagram/instagram-base.action.d.ts.map +1 -1
  91. package/dist/providers/instagram/instagram-base.action.js +27 -25
  92. package/dist/providers/instagram/instagram-base.action.js.map +1 -1
  93. package/dist/providers/linkedin/actions/create-article.action.d.ts.map +1 -1
  94. package/dist/providers/linkedin/actions/create-article.action.js +45 -55
  95. package/dist/providers/linkedin/actions/create-article.action.js.map +1 -1
  96. package/dist/providers/linkedin/actions/create-post.action.d.ts.map +1 -1
  97. package/dist/providers/linkedin/actions/create-post.action.js +29 -31
  98. package/dist/providers/linkedin/actions/create-post.action.js.map +1 -1
  99. package/dist/providers/linkedin/actions/get-followers.action.d.ts.map +1 -1
  100. package/dist/providers/linkedin/actions/get-followers.action.js +28 -28
  101. package/dist/providers/linkedin/actions/get-followers.action.js.map +1 -1
  102. package/dist/providers/linkedin/actions/get-organization-posts.action.d.ts.map +1 -1
  103. package/dist/providers/linkedin/actions/get-organization-posts.action.js +20 -20
  104. package/dist/providers/linkedin/actions/get-organization-posts.action.js.map +1 -1
  105. package/dist/providers/linkedin/actions/get-personal-posts.action.d.ts.map +1 -1
  106. package/dist/providers/linkedin/actions/get-personal-posts.action.js +19 -19
  107. package/dist/providers/linkedin/actions/get-personal-posts.action.js.map +1 -1
  108. package/dist/providers/linkedin/actions/get-post-analytics.action.d.ts.map +1 -1
  109. package/dist/providers/linkedin/actions/get-post-analytics.action.js +23 -25
  110. package/dist/providers/linkedin/actions/get-post-analytics.action.js.map +1 -1
  111. package/dist/providers/linkedin/actions/schedule-post.action.d.ts.map +1 -1
  112. package/dist/providers/linkedin/actions/schedule-post.action.js +30 -32
  113. package/dist/providers/linkedin/actions/schedule-post.action.js.map +1 -1
  114. package/dist/providers/linkedin/actions/search-posts.action.d.ts.map +1 -1
  115. package/dist/providers/linkedin/actions/search-posts.action.js +30 -28
  116. package/dist/providers/linkedin/actions/search-posts.action.js.map +1 -1
  117. package/dist/providers/linkedin/linkedin-base.action.d.ts.map +1 -1
  118. package/dist/providers/linkedin/linkedin-base.action.js +38 -33
  119. package/dist/providers/linkedin/linkedin-base.action.js.map +1 -1
  120. package/dist/providers/tiktok/tiktok-base.action.d.ts.map +1 -1
  121. package/dist/providers/tiktok/tiktok-base.action.js +26 -25
  122. package/dist/providers/tiktok/tiktok-base.action.js.map +1 -1
  123. package/dist/providers/twitter/actions/create-thread.action.d.ts.map +1 -1
  124. package/dist/providers/twitter/actions/create-thread.action.js +29 -25
  125. package/dist/providers/twitter/actions/create-thread.action.js.map +1 -1
  126. package/dist/providers/twitter/actions/create-tweet.action.d.ts.map +1 -1
  127. package/dist/providers/twitter/actions/create-tweet.action.js +23 -23
  128. package/dist/providers/twitter/actions/create-tweet.action.js.map +1 -1
  129. package/dist/providers/twitter/actions/delete-tweet.action.d.ts.map +1 -1
  130. package/dist/providers/twitter/actions/delete-tweet.action.js +19 -19
  131. package/dist/providers/twitter/actions/delete-tweet.action.js.map +1 -1
  132. package/dist/providers/twitter/actions/get-analytics.action.d.ts.map +1 -1
  133. package/dist/providers/twitter/actions/get-analytics.action.js +47 -40
  134. package/dist/providers/twitter/actions/get-analytics.action.js.map +1 -1
  135. package/dist/providers/twitter/actions/get-mentions.action.d.ts.map +1 -1
  136. package/dist/providers/twitter/actions/get-mentions.action.js +31 -30
  137. package/dist/providers/twitter/actions/get-mentions.action.js.map +1 -1
  138. package/dist/providers/twitter/actions/get-timeline.action.d.ts.map +1 -1
  139. package/dist/providers/twitter/actions/get-timeline.action.js +29 -29
  140. package/dist/providers/twitter/actions/get-timeline.action.js.map +1 -1
  141. package/dist/providers/twitter/actions/schedule-tweet.action.d.ts.map +1 -1
  142. package/dist/providers/twitter/actions/schedule-tweet.action.js +26 -26
  143. package/dist/providers/twitter/actions/schedule-tweet.action.js.map +1 -1
  144. package/dist/providers/twitter/actions/search-tweets.action.d.ts.map +1 -1
  145. package/dist/providers/twitter/actions/search-tweets.action.js +58 -56
  146. package/dist/providers/twitter/actions/search-tweets.action.js.map +1 -1
  147. package/dist/providers/twitter/twitter-base.action.d.ts.map +1 -1
  148. package/dist/providers/twitter/twitter-base.action.js +68 -58
  149. package/dist/providers/twitter/twitter-base.action.js.map +1 -1
  150. package/dist/providers/youtube/youtube-base.action.d.ts +1 -1
  151. package/dist/providers/youtube/youtube-base.action.d.ts.map +1 -1
  152. package/dist/providers/youtube/youtube-base.action.js +25 -22
  153. package/dist/providers/youtube/youtube-base.action.js.map +1 -1
  154. package/package.json +6 -5
  155. package/src/base/base-social.action.ts +224 -217
  156. package/src/providers/buffer/buffer-base.action.ts +441 -435
  157. package/src/providers/facebook/actions/boost-post.action.ts +386 -350
  158. package/src/providers/facebook/actions/create-album.action.ts +307 -291
  159. package/src/providers/facebook/actions/create-post.action.ts +227 -224
  160. package/src/providers/facebook/actions/get-page-insights.action.ts +403 -383
  161. package/src/providers/facebook/actions/get-page-posts.action.ts +225 -214
  162. package/src/providers/facebook/actions/get-post-insights.action.ts +316 -300
  163. package/src/providers/facebook/actions/respond-to-comments.action.ts +336 -319
  164. package/src/providers/facebook/actions/schedule-post.action.ts +292 -289
  165. package/src/providers/facebook/actions/search-posts.action.ts +413 -399
  166. package/src/providers/facebook/facebook-base.action.ts +670 -653
  167. package/src/providers/hootsuite/actions/bulk-schedule-posts.action.ts +257 -257
  168. package/src/providers/hootsuite/actions/create-scheduled-post.action.ts +189 -184
  169. package/src/providers/hootsuite/actions/delete-scheduled-post.action.ts +161 -160
  170. package/src/providers/hootsuite/actions/get-analytics.action.ts +254 -249
  171. package/src/providers/hootsuite/actions/get-scheduled-posts.action.ts +207 -206
  172. package/src/providers/hootsuite/actions/get-social-profiles.action.ts +205 -206
  173. package/src/providers/hootsuite/actions/search-posts.action.ts +369 -351
  174. package/src/providers/hootsuite/actions/update-scheduled-post.action.ts +209 -211
  175. package/src/providers/hootsuite/hootsuite-base.action.ts +307 -301
  176. package/src/providers/instagram/actions/create-post.action.ts +296 -276
  177. package/src/providers/instagram/actions/create-story.action.ts +394 -378
  178. package/src/providers/instagram/actions/get-account-insights.action.ts +420 -384
  179. package/src/providers/instagram/actions/get-business-posts.action.ts +242 -233
  180. package/src/providers/instagram/actions/get-comments.action.ts +377 -365
  181. package/src/providers/instagram/actions/get-post-insights.action.ts +273 -265
  182. package/src/providers/instagram/actions/schedule-post.action.ts +235 -233
  183. package/src/providers/instagram/actions/search-posts.action.ts +538 -512
  184. package/src/providers/instagram/instagram-base.action.ts +393 -368
  185. package/src/providers/linkedin/actions/create-article.action.ts +266 -275
  186. package/src/providers/linkedin/actions/create-post.action.ts +177 -179
  187. package/src/providers/linkedin/actions/get-followers.action.ts +211 -211
  188. package/src/providers/linkedin/actions/get-organization-posts.action.ts +147 -146
  189. package/src/providers/linkedin/actions/get-personal-posts.action.ts +139 -138
  190. package/src/providers/linkedin/actions/get-post-analytics.action.ts +189 -190
  191. package/src/providers/linkedin/actions/schedule-post.action.ts +189 -191
  192. package/src/providers/linkedin/actions/search-posts.action.ts +283 -275
  193. package/src/providers/linkedin/linkedin-base.action.ts +421 -407
  194. package/src/providers/tiktok/tiktok-base.action.ts +320 -305
  195. package/src/providers/twitter/actions/create-thread.action.ts +207 -203
  196. package/src/providers/twitter/actions/create-tweet.action.ts +188 -187
  197. package/src/providers/twitter/actions/delete-tweet.action.ts +129 -128
  198. package/src/providers/twitter/actions/get-analytics.action.ts +411 -402
  199. package/src/providers/twitter/actions/get-mentions.action.ts +219 -218
  200. package/src/providers/twitter/actions/get-timeline.action.ts +233 -232
  201. package/src/providers/twitter/actions/schedule-tweet.action.ts +222 -221
  202. package/src/providers/twitter/actions/search-tweets.action.ts +543 -540
  203. package/src/providers/twitter/twitter-base.action.ts +560 -541
  204. package/src/providers/youtube/youtube-base.action.ts +333 -320
@@ -1,7 +1,7 @@
1
1
  import { RegisterClass } from '@memberjunction/global';
2
2
  import { TwitterBaseAction, Tweet } from '../twitter-base.action';
3
3
  import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
4
- import { LogStatus, LogError } from '@memberjunction/global';
4
+ import { LogStatus, LogError } from '@memberjunction/core';
5
5
  import { SocialPost } from '../../../base/base-social.action';
6
6
  import { BaseAction } from '@memberjunction/actions';
7
7
 
@@ -10,239 +10,240 @@ import { BaseAction } from '@memberjunction/actions';
10
10
  */
11
11
  @RegisterClass(BaseAction, 'TwitterGetTimelineAction')
12
12
  export class TwitterGetTimelineAction extends TwitterBaseAction {
13
- /**
14
- * Get timeline tweets from Twitter
15
- */
16
- protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
17
- const { Params, ContextUser } = params;
18
-
19
- try {
20
- // Initialize OAuth
21
- const companyIntegrationId = this.getParamValue(Params, 'CompanyIntegrationID');
22
- if (!(await this.initializeOAuth(companyIntegrationId))) {
23
- throw new Error('Failed to initialize OAuth connection');
24
- }
25
-
26
- // Extract parameters
27
- const timelineType = this.getParamValue(Params, 'TimelineType') || 'home'; // 'home' or 'user'
28
- const userId = this.getParamValue(Params, 'UserID');
29
- const username = this.getParamValue(Params, 'Username');
30
- const maxResults = this.getParamValue(Params, 'MaxResults') || 100;
31
- const excludeReplies = this.getParamValue(Params, 'ExcludeReplies') === true;
32
- const excludeRetweets = this.getParamValue(Params, 'ExcludeRetweets') === true;
33
- const startTime = this.getParamValue(Params, 'StartTime');
34
- const endTime = this.getParamValue(Params, 'EndTime');
35
- const sinceId = this.getParamValue(Params, 'SinceID');
36
- const untilId = this.getParamValue(Params, 'UntilID');
37
-
38
- let tweets: Tweet[] = [];
39
- let endpoint: string;
40
- const queryParams: Record<string, any> = {
41
- 'tweet.fields': 'id,text,created_at,author_id,conversation_id,public_metrics,attachments,entities,referenced_tweets',
42
- 'user.fields': 'id,name,username,profile_image_url,description,created_at,verified',
43
- 'media.fields': 'url,preview_image_url,type,width,height',
44
- expansions: 'author_id,attachments.media_keys,referenced_tweets.id,referenced_tweets.id.author_id',
45
- max_results: Math.min(maxResults, 100), // API limit per request
46
- };
47
-
48
- if (timelineType === 'home') {
49
- // Get home timeline (requires user context)
50
- const currentUser = await this.getCurrentUser();
51
- endpoint = `/users/${currentUser.id}/timelines/reverse_chronological`;
52
-
53
- // Home timeline specific parameters
54
- if (excludeReplies) {
55
- queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},replies` : 'replies';
13
+ /**
14
+ * Get timeline tweets from Twitter
15
+ */
16
+ protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
17
+ const { Params, ContextUser } = params;
18
+
19
+ try {
20
+ // Initialize OAuth
21
+ const companyIntegrationId = this.getParamValue(Params, 'CompanyIntegrationID');
22
+ if (!await this.initializeOAuth(companyIntegrationId)) {
23
+ throw new Error('Failed to initialize OAuth connection');
24
+ }
25
+
26
+ // Extract parameters
27
+ const timelineType = this.getParamValue(Params, 'TimelineType') || 'home'; // 'home' or 'user'
28
+ const userId = this.getParamValue(Params, 'UserID');
29
+ const username = this.getParamValue(Params, 'Username');
30
+ const maxResults = this.getParamValue(Params, 'MaxResults') || 100;
31
+ const excludeReplies = this.getParamValue(Params, 'ExcludeReplies') === true;
32
+ const excludeRetweets = this.getParamValue(Params, 'ExcludeRetweets') === true;
33
+ const startTime = this.getParamValue(Params, 'StartTime');
34
+ const endTime = this.getParamValue(Params, 'EndTime');
35
+ const sinceId = this.getParamValue(Params, 'SinceID');
36
+ const untilId = this.getParamValue(Params, 'UntilID');
37
+
38
+ let tweets: Tweet[] = [];
39
+ let endpoint: string;
40
+ const queryParams: Record<string, any> = {
41
+ 'tweet.fields': 'id,text,created_at,author_id,conversation_id,public_metrics,attachments,entities,referenced_tweets',
42
+ 'user.fields': 'id,name,username,profile_image_url,description,created_at,verified',
43
+ 'media.fields': 'url,preview_image_url,type,width,height',
44
+ 'expansions': 'author_id,attachments.media_keys,referenced_tweets.id,referenced_tweets.id.author_id',
45
+ 'max_results': Math.min(maxResults, 100) // API limit per request
46
+ };
47
+
48
+ if (timelineType === 'home') {
49
+ // Get home timeline (requires user context)
50
+ const currentUser = await this.getCurrentUser();
51
+ endpoint = `/users/${currentUser.id}/timelines/reverse_chronological`;
52
+
53
+ // Home timeline specific parameters
54
+ if (excludeReplies) {
55
+ queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},replies` : 'replies';
56
+ }
57
+ if (excludeRetweets) {
58
+ queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},retweets` : 'retweets';
59
+ }
60
+ } else {
61
+ // Get user timeline
62
+ let targetUserId: string;
63
+
64
+ if (userId) {
65
+ targetUserId = userId;
66
+ } else if (username) {
67
+ // Look up user by username
68
+ const userResponse = await this.axiosInstance.get(`/users/by/username/${username}`, {
69
+ params: { 'user.fields': 'id' }
70
+ });
71
+ targetUserId = userResponse.data.data.id;
72
+ } else {
73
+ // Default to authenticated user
74
+ const currentUser = await this.getCurrentUser();
75
+ targetUserId = currentUser.id;
76
+ }
77
+
78
+ endpoint = `/users/${targetUserId}/tweets`;
79
+
80
+ // User timeline specific parameters
81
+ if (excludeReplies) {
82
+ queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},replies` : 'replies';
83
+ }
84
+ if (excludeRetweets) {
85
+ queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},retweets` : 'retweets';
86
+ }
87
+ }
88
+
89
+ // Add time-based filters if provided
90
+ if (startTime) {
91
+ queryParams['start_time'] = this.formatTwitterDate(startTime);
92
+ }
93
+ if (endTime) {
94
+ queryParams['end_time'] = this.formatTwitterDate(endTime);
95
+ }
96
+ if (sinceId) {
97
+ queryParams['since_id'] = sinceId;
98
+ }
99
+ if (untilId) {
100
+ queryParams['until_id'] = untilId;
101
+ }
102
+
103
+ // Get paginated tweets
104
+ LogStatus(`Getting ${timelineType} timeline tweets...`);
105
+ tweets = await this.getPaginatedTweets(endpoint, queryParams, maxResults);
106
+
107
+ // Convert to normalized format
108
+ const normalizedPosts: SocialPost[] = tweets.map(tweet => this.normalizePost(tweet));
109
+
110
+ // Calculate summary statistics
111
+ const stats = {
112
+ totalTweets: normalizedPosts.length,
113
+ totalLikes: 0,
114
+ totalRetweets: 0,
115
+ totalReplies: 0,
116
+ totalImpressions: 0
117
+ };
118
+
119
+ normalizedPosts.forEach(post => {
120
+ if (post.analytics) {
121
+ stats.totalLikes += post.analytics.likes;
122
+ stats.totalRetweets += post.analytics.shares;
123
+ stats.totalReplies += post.analytics.comments;
124
+ stats.totalImpressions += post.analytics.impressions;
125
+ }
126
+ });
127
+
128
+ // Update output parameters
129
+ const outputParams = [...Params];
130
+ const postsParam = outputParams.find(p => p.Name === 'Posts');
131
+ if (postsParam) postsParam.Value = normalizedPosts;
132
+ const tweetsParam = outputParams.find(p => p.Name === 'Tweets');
133
+ if (tweetsParam) tweetsParam.Value = tweets;
134
+ const statsParam = outputParams.find(p => p.Name === 'Statistics');
135
+ if (statsParam) statsParam.Value = stats;
136
+
137
+ return {
138
+ Success: true,
139
+ ResultCode: 'SUCCESS',
140
+ Message: `Successfully retrieved ${normalizedPosts.length} tweets from ${timelineType} timeline`,
141
+ Params: outputParams
142
+ };
143
+
144
+ } catch (error) {
145
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
146
+
147
+ return {
148
+ Success: false,
149
+ ResultCode: this.getErrorCode(error),
150
+ Message: `Failed to get timeline: ${errorMessage}`,
151
+ Params
152
+ };
56
153
  }
57
- if (excludeRetweets) {
58
- queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},retweets` : 'retweets';
59
- }
60
- } else {
61
- // Get user timeline
62
- let targetUserId: string;
63
-
64
- if (userId) {
65
- targetUserId = userId;
66
- } else if (username) {
67
- // Look up user by username
68
- const userResponse = await this.axiosInstance.get(`/users/by/username/${username}`, {
69
- params: { 'user.fields': 'id' },
70
- });
71
- targetUserId = userResponse.data.data.id;
72
- } else {
73
- // Default to authenticated user
74
- const currentUser = await this.getCurrentUser();
75
- targetUserId = currentUser.id;
76
- }
77
-
78
- endpoint = `/users/${targetUserId}/tweets`;
154
+ }
79
155
 
80
- // User timeline specific parameters
81
- if (excludeReplies) {
82
- queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},replies` : 'replies';
83
- }
84
- if (excludeRetweets) {
85
- queryParams['exclude'] = queryParams['exclude'] ? `${queryParams['exclude']},retweets` : 'retweets';
156
+ /**
157
+ * Get error code based on error type
158
+ */
159
+ private getErrorCode(error: any): string {
160
+ if (error instanceof Error) {
161
+ if (error.message.includes('Rate Limit')) return 'RATE_LIMIT';
162
+ if (error.message.includes('Unauthorized')) return 'INVALID_TOKEN';
163
+ if (error.message.includes('Not Found')) return 'USER_NOT_FOUND';
164
+ if (error.message.includes('Forbidden')) return 'INSUFFICIENT_PERMISSIONS';
86
165
  }
87
- }
88
-
89
- // Add time-based filters if provided
90
- if (startTime) {
91
- queryParams['start_time'] = this.formatTwitterDate(startTime);
92
- }
93
- if (endTime) {
94
- queryParams['end_time'] = this.formatTwitterDate(endTime);
95
- }
96
- if (sinceId) {
97
- queryParams['since_id'] = sinceId;
98
- }
99
- if (untilId) {
100
- queryParams['until_id'] = untilId;
101
- }
102
-
103
- // Get paginated tweets
104
- LogStatus(`Getting ${timelineType} timeline tweets...`);
105
- tweets = await this.getPaginatedTweets(endpoint, queryParams, maxResults);
106
-
107
- // Convert to normalized format
108
- const normalizedPosts: SocialPost[] = tweets.map((tweet) => this.normalizePost(tweet));
109
-
110
- // Calculate summary statistics
111
- const stats = {
112
- totalTweets: normalizedPosts.length,
113
- totalLikes: 0,
114
- totalRetweets: 0,
115
- totalReplies: 0,
116
- totalImpressions: 0,
117
- };
118
-
119
- normalizedPosts.forEach((post) => {
120
- if (post.analytics) {
121
- stats.totalLikes += post.analytics.likes;
122
- stats.totalRetweets += post.analytics.shares;
123
- stats.totalReplies += post.analytics.comments;
124
- stats.totalImpressions += post.analytics.impressions;
125
- }
126
- });
127
-
128
- // Update output parameters
129
- const outputParams = [...Params];
130
- const postsParam = outputParams.find((p) => p.Name === 'Posts');
131
- if (postsParam) postsParam.Value = normalizedPosts;
132
- const tweetsParam = outputParams.find((p) => p.Name === 'Tweets');
133
- if (tweetsParam) tweetsParam.Value = tweets;
134
- const statsParam = outputParams.find((p) => p.Name === 'Statistics');
135
- if (statsParam) statsParam.Value = stats;
136
-
137
- return {
138
- Success: true,
139
- ResultCode: 'SUCCESS',
140
- Message: `Successfully retrieved ${normalizedPosts.length} tweets from ${timelineType} timeline`,
141
- Params: outputParams,
142
- };
143
- } catch (error) {
144
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
145
-
146
- return {
147
- Success: false,
148
- ResultCode: this.getErrorCode(error),
149
- Message: `Failed to get timeline: ${errorMessage}`,
150
- Params,
151
- };
166
+ return 'ERROR';
167
+ }
168
+
169
+ /**
170
+ * Define the parameters this action expects
171
+ */
172
+ public get Params(): ActionParam[] {
173
+ return [
174
+ ...this.commonSocialParams,
175
+ {
176
+ Name: 'TimelineType',
177
+ Type: 'Input',
178
+ Value: 'home' // 'home' or 'user'
179
+ },
180
+ {
181
+ Name: 'UserID',
182
+ Type: 'Input',
183
+ Value: null
184
+ },
185
+ {
186
+ Name: 'Username',
187
+ Type: 'Input',
188
+ Value: null
189
+ },
190
+ {
191
+ Name: 'MaxResults',
192
+ Type: 'Input',
193
+ Value: 100
194
+ },
195
+ {
196
+ Name: 'ExcludeReplies',
197
+ Type: 'Input',
198
+ Value: false
199
+ },
200
+ {
201
+ Name: 'ExcludeRetweets',
202
+ Type: 'Input',
203
+ Value: false
204
+ },
205
+ {
206
+ Name: 'StartTime',
207
+ Type: 'Input',
208
+ Value: null
209
+ },
210
+ {
211
+ Name: 'EndTime',
212
+ Type: 'Input',
213
+ Value: null
214
+ },
215
+ {
216
+ Name: 'SinceID',
217
+ Type: 'Input',
218
+ Value: null
219
+ },
220
+ {
221
+ Name: 'UntilID',
222
+ Type: 'Input',
223
+ Value: null
224
+ },
225
+ {
226
+ Name: 'Posts',
227
+ Type: 'Output',
228
+ Value: null
229
+ },
230
+ {
231
+ Name: 'Tweets',
232
+ Type: 'Output',
233
+ Value: null
234
+ },
235
+ {
236
+ Name: 'Statistics',
237
+ Type: 'Output',
238
+ Value: null
239
+ }
240
+ ];
152
241
  }
153
- }
154
-
155
- /**
156
- * Get error code based on error type
157
- */
158
- private getErrorCode(error: any): string {
159
- if (error instanceof Error) {
160
- if (error.message.includes('Rate Limit')) return 'RATE_LIMIT';
161
- if (error.message.includes('Unauthorized')) return 'INVALID_TOKEN';
162
- if (error.message.includes('Not Found')) return 'USER_NOT_FOUND';
163
- if (error.message.includes('Forbidden')) return 'INSUFFICIENT_PERMISSIONS';
242
+
243
+ /**
244
+ * Get action description
245
+ */
246
+ public get Description(): string {
247
+ return 'Gets timeline tweets from Twitter/X including home timeline or a specific user\'s timeline with filtering options';
164
248
  }
165
- return 'ERROR';
166
- }
167
-
168
- /**
169
- * Define the parameters this action expects
170
- */
171
- public get Params(): ActionParam[] {
172
- return [
173
- ...this.commonSocialParams,
174
- {
175
- Name: 'TimelineType',
176
- Type: 'Input',
177
- Value: 'home', // 'home' or 'user'
178
- },
179
- {
180
- Name: 'UserID',
181
- Type: 'Input',
182
- Value: null,
183
- },
184
- {
185
- Name: 'Username',
186
- Type: 'Input',
187
- Value: null,
188
- },
189
- {
190
- Name: 'MaxResults',
191
- Type: 'Input',
192
- Value: 100,
193
- },
194
- {
195
- Name: 'ExcludeReplies',
196
- Type: 'Input',
197
- Value: false,
198
- },
199
- {
200
- Name: 'ExcludeRetweets',
201
- Type: 'Input',
202
- Value: false,
203
- },
204
- {
205
- Name: 'StartTime',
206
- Type: 'Input',
207
- Value: null,
208
- },
209
- {
210
- Name: 'EndTime',
211
- Type: 'Input',
212
- Value: null,
213
- },
214
- {
215
- Name: 'SinceID',
216
- Type: 'Input',
217
- Value: null,
218
- },
219
- {
220
- Name: 'UntilID',
221
- Type: 'Input',
222
- Value: null,
223
- },
224
- {
225
- Name: 'Posts',
226
- Type: 'Output',
227
- Value: null,
228
- },
229
- {
230
- Name: 'Tweets',
231
- Type: 'Output',
232
- Value: null,
233
- },
234
- {
235
- Name: 'Statistics',
236
- Type: 'Output',
237
- Value: null,
238
- },
239
- ];
240
- }
241
-
242
- /**
243
- * Get action description
244
- */
245
- public get Description(): string {
246
- return "Gets timeline tweets from Twitter/X including home timeline or a specific user's timeline with filtering options";
247
- }
248
- }
249
+ }