upload-post 2.5.0 → 2.7.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/index.d.ts +96 -5
- package/index.js +116 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ declare module 'upload-post' {
|
|
|
2
2
|
// ==================== Common Types ====================
|
|
3
3
|
|
|
4
4
|
/** Supported platforms for video upload */
|
|
5
|
-
export type VideoPlatform = 'tiktok' | 'instagram' | 'youtube' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'reddit' | 'bluesky' | 'x' | 'google_business' | 'discord' | 'telegram';
|
|
5
|
+
export type VideoPlatform = 'tiktok' | 'instagram' | 'youtube' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'reddit' | 'bluesky' | 'x' | 'google_business' | 'discord' | 'telegram' | 'mastodon' | 'wordpress';
|
|
6
6
|
|
|
7
7
|
/** Supported platforms for photo upload */
|
|
8
|
-
export type PhotoPlatform = 'tiktok' | 'instagram' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'reddit' | 'bluesky' | 'x' | 'google_business' | 'discord' | 'telegram';
|
|
8
|
+
export type PhotoPlatform = 'tiktok' | 'instagram' | 'linkedin' | 'facebook' | 'pinterest' | 'threads' | 'reddit' | 'bluesky' | 'x' | 'google_business' | 'discord' | 'telegram' | 'mastodon' | 'lemmy' | 'wordpress';
|
|
9
9
|
|
|
10
10
|
/** Supported platforms for text upload */
|
|
11
|
-
export type TextPlatform = 'x' | 'linkedin' | 'facebook' | 'threads' | 'reddit' | 'bluesky' | 'google_business' | 'discord' | 'telegram';
|
|
11
|
+
export type TextPlatform = 'x' | 'linkedin' | 'facebook' | 'threads' | 'reddit' | 'bluesky' | 'google_business' | 'discord' | 'telegram' | 'slack' | 'mastodon' | 'nostr' | 'lemmy' | 'devto' | 'hashnode' | 'wordpress' | 'whop' | 'listmonk';
|
|
12
12
|
|
|
13
13
|
/** TikTok privacy levels */
|
|
14
14
|
export type TikTokPrivacyLevel = 'PUBLIC_TO_EVERYONE' | 'MUTUAL_FOLLOW_FRIENDS' | 'FOLLOWER_OF_CREATOR' | 'SELF_ONLY';
|
|
@@ -87,6 +87,15 @@ declare module 'upload-post' {
|
|
|
87
87
|
youtubeTitle?: string;
|
|
88
88
|
pinterestTitle?: string;
|
|
89
89
|
threadsTitle?: string;
|
|
90
|
+
slackTitle?: string;
|
|
91
|
+
mastodonTitle?: string;
|
|
92
|
+
nostrTitle?: string;
|
|
93
|
+
lemmyTitle?: string;
|
|
94
|
+
devtoTitle?: string;
|
|
95
|
+
hashnodeTitle?: string;
|
|
96
|
+
wordpressTitle?: string;
|
|
97
|
+
whopTitle?: string;
|
|
98
|
+
listmonkTitle?: string;
|
|
90
99
|
|
|
91
100
|
// Platform-specific description overrides
|
|
92
101
|
description?: string;
|
|
@@ -773,7 +782,27 @@ declare module 'upload-post' {
|
|
|
773
782
|
// Instagram Comments
|
|
774
783
|
|
|
775
784
|
/**
|
|
776
|
-
* Get comments on
|
|
785
|
+
* Get comments on a post
|
|
786
|
+
* @param options - Query options
|
|
787
|
+
*/
|
|
788
|
+
getPostComments(options: {
|
|
789
|
+
user: string;
|
|
790
|
+
platform?: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
791
|
+
postId?: string;
|
|
792
|
+
postUrl?: string;
|
|
793
|
+
limit?: number;
|
|
794
|
+
after?: string;
|
|
795
|
+
}): Promise<{
|
|
796
|
+
success: boolean;
|
|
797
|
+
comments?: Array<{
|
|
798
|
+
id: string;
|
|
799
|
+
text: string;
|
|
800
|
+
timestamp: string;
|
|
801
|
+
user: { id: string; username: string };
|
|
802
|
+
}>;
|
|
803
|
+
}>;
|
|
804
|
+
/**
|
|
805
|
+
* Get comments on an Instagram post (legacy positional signature)
|
|
777
806
|
* @param user - Profile username
|
|
778
807
|
* @param options - Query options
|
|
779
808
|
*/
|
|
@@ -791,7 +820,7 @@ declare module 'upload-post' {
|
|
|
791
820
|
* Send a private reply (DM) to the author of an Instagram comment
|
|
792
821
|
* @param options - Reply options
|
|
793
822
|
*/
|
|
794
|
-
replyToComment(options: { user: string; commentId: string; message: string }): Promise<{
|
|
823
|
+
replyToComment(options: { user: string; commentId: string; message: string; buttons?: Array<{ title: string; url: string }> }): Promise<{
|
|
795
824
|
success: boolean;
|
|
796
825
|
recipient_id?: string;
|
|
797
826
|
message_id?: string;
|
|
@@ -810,6 +839,68 @@ declare module 'upload-post' {
|
|
|
810
839
|
error?: string;
|
|
811
840
|
}>;
|
|
812
841
|
|
|
842
|
+
/**
|
|
843
|
+
* Create a comment on a post, or reply to an existing comment.
|
|
844
|
+
* One of postId, postUrl, or commentId is required.
|
|
845
|
+
* @param options - Comment options
|
|
846
|
+
*/
|
|
847
|
+
createComment(options: {
|
|
848
|
+
user: string;
|
|
849
|
+
platform: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
850
|
+
message: string;
|
|
851
|
+
postId?: string;
|
|
852
|
+
postUrl?: string;
|
|
853
|
+
commentId?: string;
|
|
854
|
+
}): Promise<{
|
|
855
|
+
success: boolean;
|
|
856
|
+
id?: string;
|
|
857
|
+
message?: string;
|
|
858
|
+
error?: string;
|
|
859
|
+
}>;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Delete a comment on a post
|
|
863
|
+
* @param options - Delete options
|
|
864
|
+
*/
|
|
865
|
+
deleteComment(options: {
|
|
866
|
+
user: string;
|
|
867
|
+
platform: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
868
|
+
commentId: string;
|
|
869
|
+
/** Post identifier (the post URN for LinkedIn) */
|
|
870
|
+
postId?: string;
|
|
871
|
+
}): Promise<{
|
|
872
|
+
success: boolean;
|
|
873
|
+
message?: string;
|
|
874
|
+
error?: string;
|
|
875
|
+
}>;
|
|
876
|
+
|
|
877
|
+
// Post Management
|
|
878
|
+
/**
|
|
879
|
+
* Retry a failed post. Provide requestId or jobId.
|
|
880
|
+
* @param options - Retry options
|
|
881
|
+
*/
|
|
882
|
+
retryPost(options: { requestId?: string; jobId?: string }): Promise<{
|
|
883
|
+
success: boolean;
|
|
884
|
+
request_id?: string;
|
|
885
|
+
job_id?: string;
|
|
886
|
+
message?: string;
|
|
887
|
+
error?: string;
|
|
888
|
+
}>;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Unpublish (delete) a post from the platform
|
|
892
|
+
* @param options - Unpublish options
|
|
893
|
+
*/
|
|
894
|
+
unpublishPost(options: {
|
|
895
|
+
user: string;
|
|
896
|
+
platform: 'facebook' | 'youtube' | 'x' | 'linkedin' | 'threads';
|
|
897
|
+
postId: string;
|
|
898
|
+
}): Promise<{
|
|
899
|
+
success: boolean;
|
|
900
|
+
message?: string;
|
|
901
|
+
error?: string;
|
|
902
|
+
}>;
|
|
903
|
+
|
|
813
904
|
// Helper Endpoints
|
|
814
905
|
/**
|
|
815
906
|
* Get Facebook pages for a profile
|
package/index.js
CHANGED
|
@@ -104,6 +104,16 @@ export class UploadPost {
|
|
|
104
104
|
if (options.youtubeTitle) form.append('youtube_title', options.youtubeTitle);
|
|
105
105
|
if (options.pinterestTitle) form.append('pinterest_title', options.pinterestTitle);
|
|
106
106
|
if (options.threadsTitle) form.append('threads_title', options.threadsTitle);
|
|
107
|
+
// New credential-based platforms
|
|
108
|
+
if (options.slackTitle) form.append('slack_title', options.slackTitle);
|
|
109
|
+
if (options.mastodonTitle) form.append('mastodon_title', options.mastodonTitle);
|
|
110
|
+
if (options.nostrTitle) form.append('nostr_title', options.nostrTitle);
|
|
111
|
+
if (options.lemmyTitle) form.append('lemmy_title', options.lemmyTitle);
|
|
112
|
+
if (options.devtoTitle) form.append('devto_title', options.devtoTitle);
|
|
113
|
+
if (options.hashnodeTitle) form.append('hashnode_title', options.hashnodeTitle);
|
|
114
|
+
if (options.wordpressTitle) form.append('wordpress_title', options.wordpressTitle);
|
|
115
|
+
if (options.whopTitle) form.append('whop_title', options.whopTitle);
|
|
116
|
+
if (options.listmonkTitle) form.append('listmonk_title', options.listmonkTitle);
|
|
107
117
|
|
|
108
118
|
// Platform-specific description overrides
|
|
109
119
|
if (options.description) form.append('description', options.description);
|
|
@@ -739,7 +749,7 @@ export class UploadPost {
|
|
|
739
749
|
* @param {Object} [options] - Query options
|
|
740
750
|
* @param {string[]} [options.platforms] - Filter by platforms (instagram, linkedin, facebook, x, youtube, tiktok, threads, pinterest, reddit)
|
|
741
751
|
* @param {string} [options.pageId] - Facebook Page ID (required for Facebook analytics)
|
|
742
|
-
* @param {string} [options.pageUrn] - LinkedIn page URN
|
|
752
|
+
* @param {string} [options.pageUrn] - LinkedIn organization/company page URN or numeric ID. LinkedIn analytics are only available for pages you administer; personal profiles are not supported (LinkedIn exposes no member-level analytics). Defaults to the first administered organization page.
|
|
743
753
|
* @returns {Promise<Object>} Analytics data per platform
|
|
744
754
|
*/
|
|
745
755
|
async getAnalytics(profileUsername, options = {}) {
|
|
@@ -1013,18 +1023,27 @@ export class UploadPost {
|
|
|
1013
1023
|
// ==================== Instagram Comments ====================
|
|
1014
1024
|
|
|
1015
1025
|
/**
|
|
1016
|
-
* Get comments on
|
|
1026
|
+
* Get comments on a post
|
|
1017
1027
|
*
|
|
1018
|
-
* @param {string} user - Profile username
|
|
1019
1028
|
* @param {Object} options - Query options
|
|
1020
|
-
* @param {string}
|
|
1021
|
-
* @param {string} [options.
|
|
1029
|
+
* @param {string} options.user - Profile username
|
|
1030
|
+
* @param {string} [options.platform='instagram'] - Platform (instagram, facebook, youtube, linkedin)
|
|
1031
|
+
* @param {string} [options.postId] - Native post/media ID (provide postId or postUrl)
|
|
1032
|
+
* @param {string} [options.postUrl] - Full post URL (provide postId or postUrl)
|
|
1033
|
+
* @param {number} [options.limit] - Max number of comments to return
|
|
1034
|
+
* @param {string} [options.after] - Pagination cursor for the next page
|
|
1022
1035
|
* @returns {Promise<Object>} Comments data
|
|
1023
1036
|
*/
|
|
1024
|
-
async getPostComments(
|
|
1025
|
-
|
|
1037
|
+
async getPostComments(options = {}) {
|
|
1038
|
+
// Backwards compatibility: getPostComments(user, { postId, postUrl })
|
|
1039
|
+
if (typeof options === 'string') {
|
|
1040
|
+
options = { user: options, ...(arguments[1] || {}) };
|
|
1041
|
+
}
|
|
1042
|
+
const params = { platform: options.platform || 'instagram', user: options.user };
|
|
1026
1043
|
if (options.postId) params.post_id = options.postId;
|
|
1027
1044
|
if (options.postUrl) params.post_url = options.postUrl;
|
|
1045
|
+
if (options.limit !== undefined) params.limit = options.limit;
|
|
1046
|
+
if (options.after) params.after = options.after;
|
|
1028
1047
|
return this._request('/uploadposts/comments', 'GET', params);
|
|
1029
1048
|
}
|
|
1030
1049
|
|
|
@@ -1035,15 +1054,19 @@ export class UploadPost {
|
|
|
1035
1054
|
* @param {string} options.user - Profile username
|
|
1036
1055
|
* @param {string} options.commentId - Comment ID from getPostComments
|
|
1037
1056
|
* @param {string} options.message - Reply message text
|
|
1057
|
+
* @param {Array<{title: string, url: string}>} [options.buttons] - Optional web_url
|
|
1058
|
+
* buttons (max 3) rendered in the Instagram DM. Each item is `{ title, url }`.
|
|
1038
1059
|
* @returns {Promise<Object>} Reply result
|
|
1039
1060
|
*/
|
|
1040
1061
|
async replyToComment(options) {
|
|
1041
|
-
|
|
1062
|
+
const body = {
|
|
1042
1063
|
platform: 'instagram',
|
|
1043
1064
|
user: options.user,
|
|
1044
1065
|
comment_id: options.commentId,
|
|
1045
1066
|
message: options.message
|
|
1046
|
-
}
|
|
1067
|
+
};
|
|
1068
|
+
if (options.buttons) body.buttons = options.buttons;
|
|
1069
|
+
return this._request('/uploadposts/comments/reply', 'POST', body);
|
|
1047
1070
|
}
|
|
1048
1071
|
|
|
1049
1072
|
/**
|
|
@@ -1064,6 +1087,90 @@ export class UploadPost {
|
|
|
1064
1087
|
});
|
|
1065
1088
|
}
|
|
1066
1089
|
|
|
1090
|
+
/**
|
|
1091
|
+
* Create a comment on a post, or reply to an existing comment
|
|
1092
|
+
*
|
|
1093
|
+
* One of postId, postUrl, or commentId is required. Pass commentId to reply
|
|
1094
|
+
* to an existing comment; pass postId/postUrl to comment on the post itself.
|
|
1095
|
+
*
|
|
1096
|
+
* @param {Object} options - Comment options
|
|
1097
|
+
* @param {string} options.user - Profile username
|
|
1098
|
+
* @param {string} options.platform - Platform (instagram, facebook, youtube, linkedin)
|
|
1099
|
+
* @param {string} options.message - Comment text
|
|
1100
|
+
* @param {string} [options.postId] - Native post/media ID to comment on
|
|
1101
|
+
* @param {string} [options.postUrl] - Full post URL to comment on
|
|
1102
|
+
* @param {string} [options.commentId] - Existing comment ID to reply to
|
|
1103
|
+
* @returns {Promise<Object>} Created comment result
|
|
1104
|
+
*/
|
|
1105
|
+
async createComment(options) {
|
|
1106
|
+
const body = {
|
|
1107
|
+
platform: options.platform,
|
|
1108
|
+
user: options.user,
|
|
1109
|
+
message: options.message
|
|
1110
|
+
};
|
|
1111
|
+
if (options.commentId) body.comment_id = options.commentId;
|
|
1112
|
+
if (options.postId) body.post_id = options.postId;
|
|
1113
|
+
if (options.postUrl) body.post_url = options.postUrl;
|
|
1114
|
+
return this._request('/uploadposts/comments/create', 'POST', body);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Delete a comment on a post
|
|
1119
|
+
*
|
|
1120
|
+
* @param {Object} options - Delete options
|
|
1121
|
+
* @param {string} options.user - Profile username
|
|
1122
|
+
* @param {string} options.platform - Platform (instagram, facebook, youtube, linkedin)
|
|
1123
|
+
* @param {string} options.commentId - Comment ID to delete
|
|
1124
|
+
* @param {string} [options.postId] - Post identifier (the post URN for LinkedIn)
|
|
1125
|
+
* @returns {Promise<Object>} Deletion result
|
|
1126
|
+
*/
|
|
1127
|
+
async deleteComment(options) {
|
|
1128
|
+
const body = {
|
|
1129
|
+
platform: options.platform,
|
|
1130
|
+
user: options.user,
|
|
1131
|
+
comment_id: options.commentId
|
|
1132
|
+
};
|
|
1133
|
+
if (options.postId) body.post_id = options.postId;
|
|
1134
|
+
return this._request('/uploadposts/comments/delete', 'DELETE', body);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// ==================== Post Management ====================
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Retry a failed post
|
|
1141
|
+
*
|
|
1142
|
+
* Provide the request_id (from an async upload) or the job_id (from a
|
|
1143
|
+
* scheduled/queued upload).
|
|
1144
|
+
*
|
|
1145
|
+
* @param {Object} options - Retry options
|
|
1146
|
+
* @param {string} [options.requestId] - The request_id of the post to retry
|
|
1147
|
+
* @param {string} [options.jobId] - The job_id of the post to retry
|
|
1148
|
+
* @returns {Promise<Object>} Retry result
|
|
1149
|
+
*/
|
|
1150
|
+
async retryPost(options = {}) {
|
|
1151
|
+
const body = {};
|
|
1152
|
+
if (options.requestId) body.request_id = options.requestId;
|
|
1153
|
+
if (options.jobId) body.job_id = options.jobId;
|
|
1154
|
+
return this._request('/uploadposts/posts/retry', 'POST', body);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Unpublish (delete) a post from the platform
|
|
1159
|
+
*
|
|
1160
|
+
* @param {Object} options - Unpublish options
|
|
1161
|
+
* @param {string} options.user - Profile username
|
|
1162
|
+
* @param {string} options.platform - Platform (facebook, youtube, x, linkedin, threads)
|
|
1163
|
+
* @param {string} options.postId - Native post ID to unpublish
|
|
1164
|
+
* @returns {Promise<Object>} Unpublish result
|
|
1165
|
+
*/
|
|
1166
|
+
async unpublishPost(options) {
|
|
1167
|
+
return this._request('/uploadposts/posts/unpublish', 'POST', {
|
|
1168
|
+
platform: options.platform,
|
|
1169
|
+
user: options.user,
|
|
1170
|
+
post_id: options.postId
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1067
1174
|
// ==================== Helper Endpoints ====================
|
|
1068
1175
|
|
|
1069
1176
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upload-post",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Official client library for Upload-Post API - Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|