@olastudio/social-media-sdk 0.1.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/README.md +112 -0
- package/dist/adapters/expo.d.mts +19 -0
- package/dist/adapters/expo.d.ts +19 -0
- package/dist/adapters/expo.js +100 -0
- package/dist/adapters/expo.js.map +1 -0
- package/dist/adapters/expo.mjs +77 -0
- package/dist/adapters/expo.mjs.map +1 -0
- package/dist/adapters/index.d.mts +21 -0
- package/dist/adapters/index.d.ts +21 -0
- package/dist/adapters/index.js +6 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/index.mjs +3 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/auth.types-DTXCyA56.d.mts +128 -0
- package/dist/auth.types-DTXCyA56.d.ts +128 -0
- package/dist/chunk-36RADUUO.mjs +31 -0
- package/dist/chunk-36RADUUO.mjs.map +1 -0
- package/dist/chunk-7QAMNVQU.js +666 -0
- package/dist/chunk-7QAMNVQU.js.map +1 -0
- package/dist/chunk-B6NUTR54.js +4 -0
- package/dist/chunk-B6NUTR54.js.map +1 -0
- package/dist/chunk-BX3RO5PW.js +4 -0
- package/dist/chunk-BX3RO5PW.js.map +1 -0
- package/dist/chunk-CGNGZNVG.mjs +391 -0
- package/dist/chunk-CGNGZNVG.mjs.map +1 -0
- package/dist/chunk-ER5A6TIL.js +296 -0
- package/dist/chunk-ER5A6TIL.js.map +1 -0
- package/dist/chunk-GF3OEIKI.mjs +3 -0
- package/dist/chunk-GF3OEIKI.mjs.map +1 -0
- package/dist/chunk-H5GAC4UG.mjs +277 -0
- package/dist/chunk-H5GAC4UG.mjs.map +1 -0
- package/dist/chunk-HPLIHYLQ.js +35 -0
- package/dist/chunk-HPLIHYLQ.js.map +1 -0
- package/dist/chunk-MV6HJQQO.mjs +3 -0
- package/dist/chunk-MV6HJQQO.mjs.map +1 -0
- package/dist/chunk-ONR2OJOB.mjs +848 -0
- package/dist/chunk-ONR2OJOB.mjs.map +1 -0
- package/dist/chunk-PJ4KYVHH.js +854 -0
- package/dist/chunk-PJ4KYVHH.js.map +1 -0
- package/dist/chunk-QRGJXASL.js +402 -0
- package/dist/chunk-QRGJXASL.js.map +1 -0
- package/dist/chunk-QZHJXRRW.mjs +661 -0
- package/dist/chunk-QZHJXRRW.mjs.map +1 -0
- package/dist/core/index.d.mts +105 -0
- package/dist/core/index.d.ts +105 -0
- package/dist/core/index.js +94 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/index.mjs +5 -0
- package/dist/core/index.mjs.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +174 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -0
- package/dist/insights.types-5z7HJnbt.d.mts +351 -0
- package/dist/insights.types-DF2_r0L1.d.ts +351 -0
- package/dist/providers/facebook/index.d.mts +464 -0
- package/dist/providers/facebook/index.d.ts +464 -0
- package/dist/providers/facebook/index.js +30 -0
- package/dist/providers/facebook/index.js.map +1 -0
- package/dist/providers/facebook/index.mjs +5 -0
- package/dist/providers/facebook/index.mjs.map +1 -0
- package/dist/providers/instagram/index.d.mts +355 -0
- package/dist/providers/instagram/index.d.ts +355 -0
- package/dist/providers/instagram/index.js +26 -0
- package/dist/providers/instagram/index.js.map +1 -0
- package/dist/providers/instagram/index.mjs +5 -0
- package/dist/providers/instagram/index.mjs.map +1 -0
- package/dist/providers/tiktok/index.d.mts +346 -0
- package/dist/providers/tiktok/index.d.ts +346 -0
- package/dist/providers/tiktok/index.js +48 -0
- package/dist/providers/tiktok/index.js.map +1 -0
- package/dist/providers/tiktok/index.mjs +3 -0
- package/dist/providers/tiktok/index.mjs.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7QAMNVQU_js = require('../../chunk-7QAMNVQU.js');
|
|
4
|
+
require('../../chunk-ER5A6TIL.js');
|
|
5
|
+
require('../../chunk-HPLIHYLQ.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "InstagramAPI", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunk7QAMNVQU_js.InstagramAPI; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "InstagramAuth", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunk7QAMNVQU_js.InstagramAuth; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "InstagramProvider", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk7QAMNVQU_js.InstagramProvider; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "InstagramScopes", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunk7QAMNVQU_js.InstagramScopes; }
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TikTok API Constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* TikTok API Version
|
|
6
|
+
* @see https://developers.tiktok.com/doc/about-tiktok-api-versions
|
|
7
|
+
*/
|
|
8
|
+
declare const TIKTOK_API_VERSION: "v2";
|
|
9
|
+
/**
|
|
10
|
+
* TikTok API Base URL
|
|
11
|
+
*/
|
|
12
|
+
declare const TIKTOK_API_BASE_URL: "https://open.tiktokapis.com/v2";
|
|
13
|
+
/**
|
|
14
|
+
* TikTok OAuth URLs
|
|
15
|
+
*/
|
|
16
|
+
declare const TIKTOK_OAUTH_AUTHORIZATION_URL: "https://www.tiktok.com/v2/auth/authorize/";
|
|
17
|
+
declare const TIKTOK_OAUTH_TOKEN_URL: "https://open.tiktokapis.com/v2/oauth/token/";
|
|
18
|
+
declare const TIKTOK_OAUTH_REVOKE_URL: "https://open.tiktokapis.com/v2/oauth/revoke/";
|
|
19
|
+
/**
|
|
20
|
+
* TikTok OAuth Scopes
|
|
21
|
+
* @see https://developers.tiktok.com/doc/tiktok-api-scopes
|
|
22
|
+
*/
|
|
23
|
+
declare const TikTokScopes: {
|
|
24
|
+
readonly USER_INFO_BASIC: "user.info.basic";
|
|
25
|
+
readonly USER_INFO_PROFILE: "user.info.profile";
|
|
26
|
+
readonly USER_INFO_STATS: "user.info.stats";
|
|
27
|
+
readonly VIDEO_LIST: "video.list";
|
|
28
|
+
readonly VIDEO_PUBLISH: "video.publish";
|
|
29
|
+
readonly VIDEO_UPLOAD: "video.upload";
|
|
30
|
+
};
|
|
31
|
+
type TikTokScope = typeof TikTokScopes[keyof typeof TikTokScopes];
|
|
32
|
+
/**
|
|
33
|
+
* Default scopes for TikTok connection
|
|
34
|
+
*/
|
|
35
|
+
declare const TIKTOK_DEFAULT_SCOPES: TikTokScope[];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* TikTok Types - Type definitions for TikTok API
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* TikTok Provider configuration
|
|
43
|
+
*/
|
|
44
|
+
interface TikTokConfig {
|
|
45
|
+
clientKey: string;
|
|
46
|
+
clientSecret?: string;
|
|
47
|
+
redirectUri?: string;
|
|
48
|
+
scopes?: TikTokScope[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* TikTok OAuth token response
|
|
52
|
+
*/
|
|
53
|
+
interface TikTokTokenResponse {
|
|
54
|
+
access_token: string;
|
|
55
|
+
expires_in: number;
|
|
56
|
+
open_id: string;
|
|
57
|
+
refresh_expires_in: number;
|
|
58
|
+
refresh_token: string;
|
|
59
|
+
scope: string;
|
|
60
|
+
token_type: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* TikTok user info response
|
|
64
|
+
*/
|
|
65
|
+
interface TikTokUserInfo {
|
|
66
|
+
open_id: string;
|
|
67
|
+
union_id?: string;
|
|
68
|
+
avatar_url?: string;
|
|
69
|
+
avatar_url_100?: string;
|
|
70
|
+
avatar_large_url?: string;
|
|
71
|
+
display_name?: string;
|
|
72
|
+
username?: string;
|
|
73
|
+
bio_description?: string;
|
|
74
|
+
profile_deep_link?: string;
|
|
75
|
+
is_verified?: boolean;
|
|
76
|
+
follower_count?: number;
|
|
77
|
+
following_count?: number;
|
|
78
|
+
likes_count?: number;
|
|
79
|
+
video_count?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* TikTok API response wrapper
|
|
83
|
+
*/
|
|
84
|
+
interface TikTokAPIResponse<T> {
|
|
85
|
+
data: T;
|
|
86
|
+
error: {
|
|
87
|
+
code: string;
|
|
88
|
+
message: string;
|
|
89
|
+
log_id: string;
|
|
90
|
+
} | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* TikTok video info
|
|
94
|
+
*/
|
|
95
|
+
interface TikTokVideo {
|
|
96
|
+
id: string;
|
|
97
|
+
create_time: number;
|
|
98
|
+
cover_image_url?: string;
|
|
99
|
+
share_url?: string;
|
|
100
|
+
video_description?: string;
|
|
101
|
+
duration?: number;
|
|
102
|
+
height?: number;
|
|
103
|
+
width?: number;
|
|
104
|
+
title?: string;
|
|
105
|
+
embed_html?: string;
|
|
106
|
+
embed_link?: string;
|
|
107
|
+
like_count?: number;
|
|
108
|
+
comment_count?: number;
|
|
109
|
+
share_count?: number;
|
|
110
|
+
view_count?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* TikTok video list response
|
|
114
|
+
*/
|
|
115
|
+
interface TikTokVideoListResponse {
|
|
116
|
+
videos: TikTokVideo[];
|
|
117
|
+
cursor: number;
|
|
118
|
+
has_more: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* TikTok upload init response
|
|
122
|
+
*/
|
|
123
|
+
interface TikTokUploadInitResponse {
|
|
124
|
+
publish_id: string;
|
|
125
|
+
upload_url: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* TikTok publish status
|
|
129
|
+
*/
|
|
130
|
+
type TikTokPublishStatus = 'PROCESSING_UPLOAD' | 'PROCESSING_DOWNLOAD' | 'SEND_TO_USER_INBOX' | 'PUBLISH_COMPLETE' | 'FAILED';
|
|
131
|
+
/**
|
|
132
|
+
* TikTok publish status response
|
|
133
|
+
*/
|
|
134
|
+
interface TikTokPublishStatusResponse {
|
|
135
|
+
status: TikTokPublishStatus;
|
|
136
|
+
fail_reason?: string;
|
|
137
|
+
publicaly_available_post_id?: string[];
|
|
138
|
+
uploaded_bytes?: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* TikTok error response
|
|
142
|
+
*/
|
|
143
|
+
interface TikTokErrorResponse {
|
|
144
|
+
error: {
|
|
145
|
+
code: string;
|
|
146
|
+
message: string;
|
|
147
|
+
log_id: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* TikTok account insights (aggregated from user info and videos)
|
|
152
|
+
*/
|
|
153
|
+
interface TikTokAccountInsights {
|
|
154
|
+
followerCount: number;
|
|
155
|
+
followingCount: number;
|
|
156
|
+
likesCount: number;
|
|
157
|
+
videoCount: number;
|
|
158
|
+
totalViews: number;
|
|
159
|
+
totalComments: number;
|
|
160
|
+
totalShares: number;
|
|
161
|
+
averageEngagementRate: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* TikTok video insights
|
|
165
|
+
*/
|
|
166
|
+
interface TikTokVideoInsights {
|
|
167
|
+
videoId: string;
|
|
168
|
+
viewCount: number;
|
|
169
|
+
likeCount: number;
|
|
170
|
+
commentCount: number;
|
|
171
|
+
shareCount: number;
|
|
172
|
+
engagementRate: number;
|
|
173
|
+
createTime: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* TikTok insights response (unified format similar to Instagram/Facebook)
|
|
177
|
+
*/
|
|
178
|
+
interface TikTokInsights {
|
|
179
|
+
data: Array<{
|
|
180
|
+
name: string;
|
|
181
|
+
period: string;
|
|
182
|
+
values: Array<{
|
|
183
|
+
value: number;
|
|
184
|
+
end_time?: string;
|
|
185
|
+
}>;
|
|
186
|
+
title?: string;
|
|
187
|
+
description?: string;
|
|
188
|
+
}>;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* TikTok insights params
|
|
192
|
+
*/
|
|
193
|
+
interface TikTokInsightsParams {
|
|
194
|
+
metric: string[];
|
|
195
|
+
dateRange?: {
|
|
196
|
+
start: number;
|
|
197
|
+
end: number;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* TikTok API - API client for TikTok endpoints
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* TikTok API client
|
|
207
|
+
*/
|
|
208
|
+
declare class TikTokAPI {
|
|
209
|
+
private _config;
|
|
210
|
+
private accessToken?;
|
|
211
|
+
constructor(config: TikTokConfig, accessToken?: string);
|
|
212
|
+
/**
|
|
213
|
+
* Set access token
|
|
214
|
+
*/
|
|
215
|
+
setAccessToken(accessToken: string): void;
|
|
216
|
+
/**
|
|
217
|
+
* Get current access token
|
|
218
|
+
*/
|
|
219
|
+
getAccessToken(): string | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* Make authenticated API request
|
|
222
|
+
*/
|
|
223
|
+
private request;
|
|
224
|
+
/**
|
|
225
|
+
* Get user info
|
|
226
|
+
* @see https://developers.tiktok.com/doc/tiktok-api-v2-get-user-info
|
|
227
|
+
*/
|
|
228
|
+
getUserInfo(fields?: string[]): Promise<TikTokUserInfo>;
|
|
229
|
+
/**
|
|
230
|
+
* Get user's videos
|
|
231
|
+
* @see https://developers.tiktok.com/doc/tiktok-api-v2-video-list
|
|
232
|
+
*/
|
|
233
|
+
getVideoList(options?: {
|
|
234
|
+
cursor?: number;
|
|
235
|
+
maxCount?: number;
|
|
236
|
+
fields?: string[];
|
|
237
|
+
}): Promise<TikTokVideoListResponse>;
|
|
238
|
+
/**
|
|
239
|
+
* Initialize direct video upload
|
|
240
|
+
* @see https://developers.tiktok.com/doc/tiktok-api-v2-post-publish-video-init
|
|
241
|
+
*/
|
|
242
|
+
initVideoUpload(options: {
|
|
243
|
+
sourceInfo: {
|
|
244
|
+
source: 'FILE_UPLOAD' | 'PULL_FROM_URL';
|
|
245
|
+
videoSize?: number;
|
|
246
|
+
chunkSize?: number;
|
|
247
|
+
totalChunkCount?: number;
|
|
248
|
+
videoUrl?: string;
|
|
249
|
+
};
|
|
250
|
+
postInfo?: {
|
|
251
|
+
title?: string;
|
|
252
|
+
privacyLevel?: 'PUBLIC_TO_EVERYONE' | 'MUTUAL_FOLLOW_FRIENDS' | 'SELF_ONLY';
|
|
253
|
+
disableDuet?: boolean;
|
|
254
|
+
disableStitch?: boolean;
|
|
255
|
+
disableComment?: boolean;
|
|
256
|
+
videoCoverTimestampMs?: number;
|
|
257
|
+
};
|
|
258
|
+
}): Promise<TikTokUploadInitResponse>;
|
|
259
|
+
/**
|
|
260
|
+
* Get publish status
|
|
261
|
+
* @see https://developers.tiktok.com/doc/tiktok-api-v2-post-publish-status-fetch
|
|
262
|
+
*/
|
|
263
|
+
getPublishStatus(publishId: string): Promise<TikTokPublishStatusResponse>;
|
|
264
|
+
/**
|
|
265
|
+
* Get account insights (aggregated from user info and recent videos)
|
|
266
|
+
* TikTok doesn't have a dedicated insights API like Instagram/Facebook,
|
|
267
|
+
* so we compute metrics from user info and video stats
|
|
268
|
+
*/
|
|
269
|
+
getAccountInsights(): Promise<TikTokAccountInsights>;
|
|
270
|
+
/**
|
|
271
|
+
* Get insights for a specific video
|
|
272
|
+
*/
|
|
273
|
+
getVideoInsights(videoId: string): Promise<TikTokVideoInsights | null>;
|
|
274
|
+
/**
|
|
275
|
+
* Get insights for multiple videos
|
|
276
|
+
*/
|
|
277
|
+
getVideosInsights(maxCount?: number): Promise<TikTokVideoInsights[]>;
|
|
278
|
+
/**
|
|
279
|
+
* Get formatted insights (unified format similar to Instagram/Facebook)
|
|
280
|
+
* This allows for easier aggregation across platforms
|
|
281
|
+
*/
|
|
282
|
+
getInsights(params: TikTokInsightsParams): Promise<TikTokInsights>;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* TikTok Auth - Authentication utilities
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* TikTok Auth class for OAuth operations
|
|
291
|
+
*/
|
|
292
|
+
declare class TikTokAuth {
|
|
293
|
+
private config;
|
|
294
|
+
constructor(config: TikTokConfig);
|
|
295
|
+
/**
|
|
296
|
+
* Build authorization URL for OAuth flow
|
|
297
|
+
*/
|
|
298
|
+
getAuthorizationUrl(options?: {
|
|
299
|
+
redirectUri?: string;
|
|
300
|
+
scopes?: TikTokScope[];
|
|
301
|
+
state?: string;
|
|
302
|
+
}): string;
|
|
303
|
+
/**
|
|
304
|
+
* Exchange authorization code for access token
|
|
305
|
+
* NOTE: This should be done server-side to protect client_secret
|
|
306
|
+
*/
|
|
307
|
+
exchangeCodeForToken(code: string, redirectUri?: string): Promise<TikTokTokenResponse>;
|
|
308
|
+
/**
|
|
309
|
+
* Refresh access token using refresh token
|
|
310
|
+
* NOTE: This should be done server-side to protect client_secret
|
|
311
|
+
*/
|
|
312
|
+
refreshToken(refreshToken: string): Promise<TikTokTokenResponse>;
|
|
313
|
+
/**
|
|
314
|
+
* Revoke access token
|
|
315
|
+
*/
|
|
316
|
+
revokeToken(accessToken: string): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* TikTok Provider - Main TikTok provider
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* TikTok provider that encapsulates Auth and API
|
|
325
|
+
*/
|
|
326
|
+
declare class TikTokProvider {
|
|
327
|
+
readonly name: "tiktok";
|
|
328
|
+
auth: TikTokAuth;
|
|
329
|
+
api: TikTokAPI;
|
|
330
|
+
config: TikTokConfig;
|
|
331
|
+
constructor(config: TikTokConfig);
|
|
332
|
+
/**
|
|
333
|
+
* Create new API instance with access token
|
|
334
|
+
*/
|
|
335
|
+
createAPIClient(accessToken: string): TikTokAPI;
|
|
336
|
+
/**
|
|
337
|
+
* Update access token of existing API client
|
|
338
|
+
*/
|
|
339
|
+
setAccessToken(accessToken: string): void;
|
|
340
|
+
/**
|
|
341
|
+
* Get current access token
|
|
342
|
+
*/
|
|
343
|
+
getAccessToken(): string | undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export { TIKTOK_API_BASE_URL, TIKTOK_API_VERSION, TIKTOK_DEFAULT_SCOPES, TIKTOK_OAUTH_AUTHORIZATION_URL, TIKTOK_OAUTH_REVOKE_URL, TIKTOK_OAUTH_TOKEN_URL, TikTokAPI, type TikTokAPIResponse, type TikTokAccountInsights, TikTokAuth, type TikTokConfig, type TikTokErrorResponse, type TikTokInsights, type TikTokInsightsParams, TikTokProvider, type TikTokPublishStatus, type TikTokPublishStatusResponse, type TikTokScope, TikTokScopes, type TikTokTokenResponse, type TikTokUploadInitResponse, type TikTokUserInfo, type TikTokVideo, type TikTokVideoInsights, type TikTokVideoListResponse };
|