@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,351 @@
|
|
|
1
|
+
import { R as RequestOptions } from './auth.types-DTXCyA56.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* API Types - Interfaces for API clients
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Interface that each API client must implement
|
|
9
|
+
*/
|
|
10
|
+
interface APIClient {
|
|
11
|
+
/**
|
|
12
|
+
* Generic request
|
|
13
|
+
*/
|
|
14
|
+
request<T>(endpoint: string, options?: RequestOptions): Promise<T>;
|
|
15
|
+
/**
|
|
16
|
+
* GET request
|
|
17
|
+
*/
|
|
18
|
+
get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* POST request
|
|
21
|
+
*/
|
|
22
|
+
post<T>(endpoint: string, body?: any): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* PUT request
|
|
25
|
+
*/
|
|
26
|
+
put<T>(endpoint: string, body?: any): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* DELETE request
|
|
29
|
+
*/
|
|
30
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* HTTP client configuration
|
|
34
|
+
*/
|
|
35
|
+
interface HttpClientConfig {
|
|
36
|
+
baseURL: string;
|
|
37
|
+
timeout?: number;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
accessToken?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Insights Constants - Metrics available for Facebook/Instagram APIs
|
|
44
|
+
* Updated for Graph API v24.0 (includes Nov 2025 changes)
|
|
45
|
+
*
|
|
46
|
+
* @see https://developers.facebook.com/docs/insights/guides
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Facebook Page metrics (lifetime)
|
|
50
|
+
* Note: 'page_fans' deprecated Nov 2025, use 'followers_count' field instead
|
|
51
|
+
*/
|
|
52
|
+
declare const PAGE_METRICS_LIFETIME: readonly ["page_fans_country", "page_fans_city", "page_fans_gender_age"];
|
|
53
|
+
/**
|
|
54
|
+
* Facebook Page metrics (day/week/days_28)
|
|
55
|
+
* Note: 'page_impressions' deprecated Nov 2025, use 'page_views' instead
|
|
56
|
+
*/
|
|
57
|
+
declare const PAGE_METRICS_PERIODIC: readonly ["page_views_total", "page_views", "page_post_engagements", "page_fans_online", "page_fans_online_per_day", "page_video_views", "page_daily_follows", "page_daily_unfollows"];
|
|
58
|
+
/**
|
|
59
|
+
* Post metrics (lifetime only)
|
|
60
|
+
* Note: 'post_impressions' deprecated, use 'post_views' equivalents
|
|
61
|
+
*/
|
|
62
|
+
declare const POST_METRICS: readonly ["post_engaged_users", "post_negative_feedback", "post_engaged_fan", "post_clicks", "post_clicks_unique", "post_reactions_by_type_total"];
|
|
63
|
+
/**
|
|
64
|
+
* Video metrics (lifetime)
|
|
65
|
+
* Note: 'video_views' deprecated Apr 2024, use 'total_video_views'
|
|
66
|
+
*/
|
|
67
|
+
declare const VIDEO_METRICS: readonly ["total_video_views", "total_video_views_unique", "total_video_views_autoplayed", "total_video_views_clicked_to_play", "total_video_views_organic", "total_video_views_organic_unique", "total_video_views_paid", "total_video_views_paid_unique", "total_video_avg_time_watched", "total_video_view_total_time", "total_video_complete_views", "total_video_complete_views_unique", "total_video_complete_views_organic", "total_video_complete_views_organic_unique", "total_video_complete_views_paid", "total_video_complete_views_paid_unique"];
|
|
68
|
+
/**
|
|
69
|
+
* Facebook Reels metrics (added Dec 2024)
|
|
70
|
+
* Available via Video Insights API
|
|
71
|
+
*/
|
|
72
|
+
declare const REELS_METRICS: readonly ["blue_reels_play_count", "post_video_avg_time_watched", "post_video_views", "post_video_social_actions"];
|
|
73
|
+
/**
|
|
74
|
+
* Extended Reels metrics for detailed analysis
|
|
75
|
+
*/
|
|
76
|
+
declare const REELS_METRICS_EXTENDED: readonly ["plays", "comments", "likes", "shares", "reach", "total_plays", "average_minutes_viewed", "minutes_viewed"];
|
|
77
|
+
/**
|
|
78
|
+
* Photo metrics (lifetime only)
|
|
79
|
+
*/
|
|
80
|
+
declare const PHOTO_METRICS: readonly ["photo_views", "photo_reach", "engaged_users"];
|
|
81
|
+
/**
|
|
82
|
+
* Instagram account metrics (day/week/days_28)
|
|
83
|
+
* Note: 'impressions' deprecated Apr 2025, use 'views'
|
|
84
|
+
*/
|
|
85
|
+
declare const INSTAGRAM_ACCOUNT_METRICS: readonly ["views", "reach", "accounts_engaged", "total_interactions", "likes", "comments", "shares", "saves", "follows_and_unfollows", "profile_links_taps", "profile_views"];
|
|
86
|
+
/**
|
|
87
|
+
* Instagram account metrics - Demographics
|
|
88
|
+
*/
|
|
89
|
+
declare const INSTAGRAM_DEMOGRAPHICS_METRICS: readonly ["follower_demographics", "reached_audience_demographics", "engaged_audience_demographics"];
|
|
90
|
+
/**
|
|
91
|
+
* Instagram media metrics (all types)
|
|
92
|
+
*/
|
|
93
|
+
declare const INSTAGRAM_MEDIA_METRICS_COMMON: readonly ["views", "reach", "likes", "comments", "shares", "saved", "total_interactions"];
|
|
94
|
+
/**
|
|
95
|
+
* Instagram Reels specific metrics
|
|
96
|
+
*/
|
|
97
|
+
declare const INSTAGRAM_REELS_METRICS: readonly ["plays", "reach", "likes", "comments", "shares", "saved", "total_interactions"];
|
|
98
|
+
/**
|
|
99
|
+
* Instagram Stories specific metrics
|
|
100
|
+
*/
|
|
101
|
+
declare const INSTAGRAM_STORIES_METRICS: readonly ["exits", "replies", "taps_forward", "taps_back", "views", "reach"];
|
|
102
|
+
declare const INSIGHTS_PERIODS: {
|
|
103
|
+
readonly DAY: "day";
|
|
104
|
+
readonly WEEK: "week";
|
|
105
|
+
readonly DAYS_28: "days_28";
|
|
106
|
+
readonly MONTH: "month";
|
|
107
|
+
readonly LIFETIME: "lifetime";
|
|
108
|
+
};
|
|
109
|
+
type InsightsPeriod = typeof INSIGHTS_PERIODS[keyof typeof INSIGHTS_PERIODS];
|
|
110
|
+
/**
|
|
111
|
+
* Common metric presets for quick access
|
|
112
|
+
*/
|
|
113
|
+
declare const METRIC_PRESETS: {
|
|
114
|
+
readonly PAGE_OVERVIEW: readonly ["page_views_total", "page_post_engagements", "page_video_views"];
|
|
115
|
+
readonly VIDEO_PERFORMANCE: readonly ["total_video_views", "total_video_avg_time_watched", "total_video_complete_views"];
|
|
116
|
+
readonly REELS_PERFORMANCE: readonly ["blue_reels_play_count", "post_video_avg_time_watched", "post_video_social_actions"];
|
|
117
|
+
readonly INSTAGRAM_OVERVIEW: readonly ["views", "reach", "accounts_engaged", "total_interactions"];
|
|
118
|
+
readonly INSTAGRAM_ENGAGEMENT: readonly ["likes", "comments", "shares", "saves"];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Insights Types - Types for Facebook/Instagram Insights APIs
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Base insight value structure
|
|
127
|
+
*/
|
|
128
|
+
interface InsightValue {
|
|
129
|
+
value: number | Record<string, number>;
|
|
130
|
+
end_time?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Base insight data item
|
|
134
|
+
*/
|
|
135
|
+
interface InsightDataItem {
|
|
136
|
+
id?: string;
|
|
137
|
+
name: string;
|
|
138
|
+
period: string;
|
|
139
|
+
values?: InsightValue[];
|
|
140
|
+
total_value?: {
|
|
141
|
+
value: number;
|
|
142
|
+
breakdowns?: InsightBreakdown[];
|
|
143
|
+
};
|
|
144
|
+
title?: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Insight breakdown structure
|
|
149
|
+
*/
|
|
150
|
+
interface InsightBreakdown {
|
|
151
|
+
dimension_keys: string[];
|
|
152
|
+
results: Array<{
|
|
153
|
+
dimension_values: string[];
|
|
154
|
+
value: number;
|
|
155
|
+
end_time?: string;
|
|
156
|
+
}>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Generic insights response
|
|
160
|
+
*/
|
|
161
|
+
interface InsightsResponse {
|
|
162
|
+
data: InsightDataItem[];
|
|
163
|
+
paging?: {
|
|
164
|
+
previous?: string;
|
|
165
|
+
next?: string;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Page insights request params
|
|
170
|
+
*/
|
|
171
|
+
interface PageInsightsParams {
|
|
172
|
+
metric: string[];
|
|
173
|
+
period?: InsightsPeriod;
|
|
174
|
+
since?: number;
|
|
175
|
+
until?: number;
|
|
176
|
+
date_preset?: 'today' | 'yesterday' | 'this_week' | 'last_week' | 'this_month' | 'last_month';
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Page overview data
|
|
180
|
+
*/
|
|
181
|
+
interface PageOverview {
|
|
182
|
+
id: string;
|
|
183
|
+
name: string;
|
|
184
|
+
followers_count: number;
|
|
185
|
+
fan_count?: number;
|
|
186
|
+
views_total?: number;
|
|
187
|
+
engagement?: number;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Post insights request params
|
|
191
|
+
*/
|
|
192
|
+
interface PostInsightsParams {
|
|
193
|
+
postId: string;
|
|
194
|
+
metric?: string[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Post insights data
|
|
198
|
+
*/
|
|
199
|
+
interface PostInsights {
|
|
200
|
+
id: string;
|
|
201
|
+
views?: number;
|
|
202
|
+
reach?: number;
|
|
203
|
+
engaged_users?: number;
|
|
204
|
+
clicks?: number;
|
|
205
|
+
reactions_by_type?: Record<string, number>;
|
|
206
|
+
negative_feedback?: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Video insights request params
|
|
210
|
+
*/
|
|
211
|
+
interface VideoInsightsParams {
|
|
212
|
+
videoId: string;
|
|
213
|
+
metric?: string[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Video insights data
|
|
217
|
+
*/
|
|
218
|
+
interface VideoInsights {
|
|
219
|
+
id: string;
|
|
220
|
+
total_views?: number;
|
|
221
|
+
unique_views?: number;
|
|
222
|
+
avg_time_watched?: number;
|
|
223
|
+
complete_views?: number;
|
|
224
|
+
organic_views?: number;
|
|
225
|
+
paid_views?: number;
|
|
226
|
+
total_time_watched?: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Video basic info with insights
|
|
230
|
+
*/
|
|
231
|
+
interface VideoWithInsights {
|
|
232
|
+
id: string;
|
|
233
|
+
title?: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
created_time: string;
|
|
236
|
+
length?: number;
|
|
237
|
+
views?: number;
|
|
238
|
+
insights?: VideoInsights;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Reels insights request params
|
|
242
|
+
*/
|
|
243
|
+
interface ReelsInsightsParams {
|
|
244
|
+
reelId: string;
|
|
245
|
+
metric?: string[];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Reels insights data
|
|
249
|
+
*/
|
|
250
|
+
interface ReelsInsights {
|
|
251
|
+
id: string;
|
|
252
|
+
plays?: number;
|
|
253
|
+
total_plays?: number;
|
|
254
|
+
avg_time_watched?: number;
|
|
255
|
+
reach?: number;
|
|
256
|
+
likes?: number;
|
|
257
|
+
comments?: number;
|
|
258
|
+
shares?: number;
|
|
259
|
+
saves?: number;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Photo insights request params
|
|
263
|
+
*/
|
|
264
|
+
interface PhotoInsightsParams {
|
|
265
|
+
photoId: string;
|
|
266
|
+
metric?: string[];
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Photo insights data
|
|
270
|
+
*/
|
|
271
|
+
interface PhotoInsights {
|
|
272
|
+
id: string;
|
|
273
|
+
views?: number;
|
|
274
|
+
reach?: number;
|
|
275
|
+
engaged_users?: number;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Instagram account insights params
|
|
279
|
+
*/
|
|
280
|
+
interface InstagramAccountInsightsParams {
|
|
281
|
+
metric: string[];
|
|
282
|
+
period?: InsightsPeriod;
|
|
283
|
+
metric_type?: 'time_series' | 'total_value';
|
|
284
|
+
since?: number;
|
|
285
|
+
until?: number;
|
|
286
|
+
breakdown?: 'city' | 'country' | 'age' | 'gender';
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Instagram media insights params
|
|
290
|
+
*/
|
|
291
|
+
interface InstagramMediaInsightsParams {
|
|
292
|
+
mediaId: string;
|
|
293
|
+
metric?: string[];
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Instagram account summary
|
|
297
|
+
*/
|
|
298
|
+
interface InstagramAccountSummary {
|
|
299
|
+
id: string;
|
|
300
|
+
username: string;
|
|
301
|
+
followers_count: number;
|
|
302
|
+
views?: number;
|
|
303
|
+
reach?: number;
|
|
304
|
+
accounts_engaged?: number;
|
|
305
|
+
total_interactions?: number;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Instagram media insights data
|
|
309
|
+
*/
|
|
310
|
+
interface InstagramMediaInsights {
|
|
311
|
+
id: string;
|
|
312
|
+
media_type: 'IMAGE' | 'VIDEO' | 'CAROUSEL_ALBUM' | 'REELS';
|
|
313
|
+
views?: number;
|
|
314
|
+
reach?: number;
|
|
315
|
+
likes?: number;
|
|
316
|
+
comments?: number;
|
|
317
|
+
shares?: number;
|
|
318
|
+
saves?: number;
|
|
319
|
+
plays?: number;
|
|
320
|
+
total_interactions?: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Aggregated insights for a time period
|
|
324
|
+
*/
|
|
325
|
+
interface AggregatedInsights {
|
|
326
|
+
period: {
|
|
327
|
+
since: string;
|
|
328
|
+
until: string;
|
|
329
|
+
};
|
|
330
|
+
totals: {
|
|
331
|
+
views?: number;
|
|
332
|
+
reach?: number;
|
|
333
|
+
engagement?: number;
|
|
334
|
+
followers_gained?: number;
|
|
335
|
+
followers_lost?: number;
|
|
336
|
+
};
|
|
337
|
+
breakdown?: {
|
|
338
|
+
byDay?: Record<string, number>;
|
|
339
|
+
byContentType?: Record<string, number>;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Insights-specific error
|
|
344
|
+
*/
|
|
345
|
+
interface InsightsError {
|
|
346
|
+
metric: string;
|
|
347
|
+
error_code: number;
|
|
348
|
+
error_message: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { type APIClient as A, INSTAGRAM_MEDIA_METRICS_COMMON as B, INSTAGRAM_REELS_METRICS as C, INSTAGRAM_STORIES_METRICS as D, INSIGHTS_PERIODS as E, type InsightsPeriod as F, type HttpClientConfig as H, type InsightValue as I, METRIC_PRESETS as M, type PageInsightsParams as P, type ReelsInsightsParams as R, type VideoInsightsParams as V, type InsightDataItem as a, type InsightBreakdown as b, type InsightsResponse as c, type PageOverview as d, type PostInsightsParams as e, type PostInsights as f, type VideoInsights as g, type VideoWithInsights as h, type ReelsInsights as i, type PhotoInsightsParams as j, type PhotoInsights as k, type InstagramAccountInsightsParams as l, type InstagramMediaInsightsParams as m, type InstagramAccountSummary as n, type InstagramMediaInsights as o, type AggregatedInsights as p, type InsightsError as q, PAGE_METRICS_LIFETIME as r, PAGE_METRICS_PERIODIC as s, POST_METRICS as t, VIDEO_METRICS as u, REELS_METRICS as v, REELS_METRICS_EXTENDED as w, PHOTO_METRICS as x, INSTAGRAM_ACCOUNT_METRICS as y, INSTAGRAM_DEMOGRAPHICS_METRICS as z };
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { R as RequestOptions } from './auth.types-DTXCyA56.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* API Types - Interfaces for API clients
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Interface that each API client must implement
|
|
9
|
+
*/
|
|
10
|
+
interface APIClient {
|
|
11
|
+
/**
|
|
12
|
+
* Generic request
|
|
13
|
+
*/
|
|
14
|
+
request<T>(endpoint: string, options?: RequestOptions): Promise<T>;
|
|
15
|
+
/**
|
|
16
|
+
* GET request
|
|
17
|
+
*/
|
|
18
|
+
get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* POST request
|
|
21
|
+
*/
|
|
22
|
+
post<T>(endpoint: string, body?: any): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* PUT request
|
|
25
|
+
*/
|
|
26
|
+
put<T>(endpoint: string, body?: any): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* DELETE request
|
|
29
|
+
*/
|
|
30
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* HTTP client configuration
|
|
34
|
+
*/
|
|
35
|
+
interface HttpClientConfig {
|
|
36
|
+
baseURL: string;
|
|
37
|
+
timeout?: number;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
accessToken?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Insights Constants - Metrics available for Facebook/Instagram APIs
|
|
44
|
+
* Updated for Graph API v24.0 (includes Nov 2025 changes)
|
|
45
|
+
*
|
|
46
|
+
* @see https://developers.facebook.com/docs/insights/guides
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Facebook Page metrics (lifetime)
|
|
50
|
+
* Note: 'page_fans' deprecated Nov 2025, use 'followers_count' field instead
|
|
51
|
+
*/
|
|
52
|
+
declare const PAGE_METRICS_LIFETIME: readonly ["page_fans_country", "page_fans_city", "page_fans_gender_age"];
|
|
53
|
+
/**
|
|
54
|
+
* Facebook Page metrics (day/week/days_28)
|
|
55
|
+
* Note: 'page_impressions' deprecated Nov 2025, use 'page_views' instead
|
|
56
|
+
*/
|
|
57
|
+
declare const PAGE_METRICS_PERIODIC: readonly ["page_views_total", "page_views", "page_post_engagements", "page_fans_online", "page_fans_online_per_day", "page_video_views", "page_daily_follows", "page_daily_unfollows"];
|
|
58
|
+
/**
|
|
59
|
+
* Post metrics (lifetime only)
|
|
60
|
+
* Note: 'post_impressions' deprecated, use 'post_views' equivalents
|
|
61
|
+
*/
|
|
62
|
+
declare const POST_METRICS: readonly ["post_engaged_users", "post_negative_feedback", "post_engaged_fan", "post_clicks", "post_clicks_unique", "post_reactions_by_type_total"];
|
|
63
|
+
/**
|
|
64
|
+
* Video metrics (lifetime)
|
|
65
|
+
* Note: 'video_views' deprecated Apr 2024, use 'total_video_views'
|
|
66
|
+
*/
|
|
67
|
+
declare const VIDEO_METRICS: readonly ["total_video_views", "total_video_views_unique", "total_video_views_autoplayed", "total_video_views_clicked_to_play", "total_video_views_organic", "total_video_views_organic_unique", "total_video_views_paid", "total_video_views_paid_unique", "total_video_avg_time_watched", "total_video_view_total_time", "total_video_complete_views", "total_video_complete_views_unique", "total_video_complete_views_organic", "total_video_complete_views_organic_unique", "total_video_complete_views_paid", "total_video_complete_views_paid_unique"];
|
|
68
|
+
/**
|
|
69
|
+
* Facebook Reels metrics (added Dec 2024)
|
|
70
|
+
* Available via Video Insights API
|
|
71
|
+
*/
|
|
72
|
+
declare const REELS_METRICS: readonly ["blue_reels_play_count", "post_video_avg_time_watched", "post_video_views", "post_video_social_actions"];
|
|
73
|
+
/**
|
|
74
|
+
* Extended Reels metrics for detailed analysis
|
|
75
|
+
*/
|
|
76
|
+
declare const REELS_METRICS_EXTENDED: readonly ["plays", "comments", "likes", "shares", "reach", "total_plays", "average_minutes_viewed", "minutes_viewed"];
|
|
77
|
+
/**
|
|
78
|
+
* Photo metrics (lifetime only)
|
|
79
|
+
*/
|
|
80
|
+
declare const PHOTO_METRICS: readonly ["photo_views", "photo_reach", "engaged_users"];
|
|
81
|
+
/**
|
|
82
|
+
* Instagram account metrics (day/week/days_28)
|
|
83
|
+
* Note: 'impressions' deprecated Apr 2025, use 'views'
|
|
84
|
+
*/
|
|
85
|
+
declare const INSTAGRAM_ACCOUNT_METRICS: readonly ["views", "reach", "accounts_engaged", "total_interactions", "likes", "comments", "shares", "saves", "follows_and_unfollows", "profile_links_taps", "profile_views"];
|
|
86
|
+
/**
|
|
87
|
+
* Instagram account metrics - Demographics
|
|
88
|
+
*/
|
|
89
|
+
declare const INSTAGRAM_DEMOGRAPHICS_METRICS: readonly ["follower_demographics", "reached_audience_demographics", "engaged_audience_demographics"];
|
|
90
|
+
/**
|
|
91
|
+
* Instagram media metrics (all types)
|
|
92
|
+
*/
|
|
93
|
+
declare const INSTAGRAM_MEDIA_METRICS_COMMON: readonly ["views", "reach", "likes", "comments", "shares", "saved", "total_interactions"];
|
|
94
|
+
/**
|
|
95
|
+
* Instagram Reels specific metrics
|
|
96
|
+
*/
|
|
97
|
+
declare const INSTAGRAM_REELS_METRICS: readonly ["plays", "reach", "likes", "comments", "shares", "saved", "total_interactions"];
|
|
98
|
+
/**
|
|
99
|
+
* Instagram Stories specific metrics
|
|
100
|
+
*/
|
|
101
|
+
declare const INSTAGRAM_STORIES_METRICS: readonly ["exits", "replies", "taps_forward", "taps_back", "views", "reach"];
|
|
102
|
+
declare const INSIGHTS_PERIODS: {
|
|
103
|
+
readonly DAY: "day";
|
|
104
|
+
readonly WEEK: "week";
|
|
105
|
+
readonly DAYS_28: "days_28";
|
|
106
|
+
readonly MONTH: "month";
|
|
107
|
+
readonly LIFETIME: "lifetime";
|
|
108
|
+
};
|
|
109
|
+
type InsightsPeriod = typeof INSIGHTS_PERIODS[keyof typeof INSIGHTS_PERIODS];
|
|
110
|
+
/**
|
|
111
|
+
* Common metric presets for quick access
|
|
112
|
+
*/
|
|
113
|
+
declare const METRIC_PRESETS: {
|
|
114
|
+
readonly PAGE_OVERVIEW: readonly ["page_views_total", "page_post_engagements", "page_video_views"];
|
|
115
|
+
readonly VIDEO_PERFORMANCE: readonly ["total_video_views", "total_video_avg_time_watched", "total_video_complete_views"];
|
|
116
|
+
readonly REELS_PERFORMANCE: readonly ["blue_reels_play_count", "post_video_avg_time_watched", "post_video_social_actions"];
|
|
117
|
+
readonly INSTAGRAM_OVERVIEW: readonly ["views", "reach", "accounts_engaged", "total_interactions"];
|
|
118
|
+
readonly INSTAGRAM_ENGAGEMENT: readonly ["likes", "comments", "shares", "saves"];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Insights Types - Types for Facebook/Instagram Insights APIs
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Base insight value structure
|
|
127
|
+
*/
|
|
128
|
+
interface InsightValue {
|
|
129
|
+
value: number | Record<string, number>;
|
|
130
|
+
end_time?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Base insight data item
|
|
134
|
+
*/
|
|
135
|
+
interface InsightDataItem {
|
|
136
|
+
id?: string;
|
|
137
|
+
name: string;
|
|
138
|
+
period: string;
|
|
139
|
+
values?: InsightValue[];
|
|
140
|
+
total_value?: {
|
|
141
|
+
value: number;
|
|
142
|
+
breakdowns?: InsightBreakdown[];
|
|
143
|
+
};
|
|
144
|
+
title?: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Insight breakdown structure
|
|
149
|
+
*/
|
|
150
|
+
interface InsightBreakdown {
|
|
151
|
+
dimension_keys: string[];
|
|
152
|
+
results: Array<{
|
|
153
|
+
dimension_values: string[];
|
|
154
|
+
value: number;
|
|
155
|
+
end_time?: string;
|
|
156
|
+
}>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Generic insights response
|
|
160
|
+
*/
|
|
161
|
+
interface InsightsResponse {
|
|
162
|
+
data: InsightDataItem[];
|
|
163
|
+
paging?: {
|
|
164
|
+
previous?: string;
|
|
165
|
+
next?: string;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Page insights request params
|
|
170
|
+
*/
|
|
171
|
+
interface PageInsightsParams {
|
|
172
|
+
metric: string[];
|
|
173
|
+
period?: InsightsPeriod;
|
|
174
|
+
since?: number;
|
|
175
|
+
until?: number;
|
|
176
|
+
date_preset?: 'today' | 'yesterday' | 'this_week' | 'last_week' | 'this_month' | 'last_month';
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Page overview data
|
|
180
|
+
*/
|
|
181
|
+
interface PageOverview {
|
|
182
|
+
id: string;
|
|
183
|
+
name: string;
|
|
184
|
+
followers_count: number;
|
|
185
|
+
fan_count?: number;
|
|
186
|
+
views_total?: number;
|
|
187
|
+
engagement?: number;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Post insights request params
|
|
191
|
+
*/
|
|
192
|
+
interface PostInsightsParams {
|
|
193
|
+
postId: string;
|
|
194
|
+
metric?: string[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Post insights data
|
|
198
|
+
*/
|
|
199
|
+
interface PostInsights {
|
|
200
|
+
id: string;
|
|
201
|
+
views?: number;
|
|
202
|
+
reach?: number;
|
|
203
|
+
engaged_users?: number;
|
|
204
|
+
clicks?: number;
|
|
205
|
+
reactions_by_type?: Record<string, number>;
|
|
206
|
+
negative_feedback?: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Video insights request params
|
|
210
|
+
*/
|
|
211
|
+
interface VideoInsightsParams {
|
|
212
|
+
videoId: string;
|
|
213
|
+
metric?: string[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Video insights data
|
|
217
|
+
*/
|
|
218
|
+
interface VideoInsights {
|
|
219
|
+
id: string;
|
|
220
|
+
total_views?: number;
|
|
221
|
+
unique_views?: number;
|
|
222
|
+
avg_time_watched?: number;
|
|
223
|
+
complete_views?: number;
|
|
224
|
+
organic_views?: number;
|
|
225
|
+
paid_views?: number;
|
|
226
|
+
total_time_watched?: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Video basic info with insights
|
|
230
|
+
*/
|
|
231
|
+
interface VideoWithInsights {
|
|
232
|
+
id: string;
|
|
233
|
+
title?: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
created_time: string;
|
|
236
|
+
length?: number;
|
|
237
|
+
views?: number;
|
|
238
|
+
insights?: VideoInsights;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Reels insights request params
|
|
242
|
+
*/
|
|
243
|
+
interface ReelsInsightsParams {
|
|
244
|
+
reelId: string;
|
|
245
|
+
metric?: string[];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Reels insights data
|
|
249
|
+
*/
|
|
250
|
+
interface ReelsInsights {
|
|
251
|
+
id: string;
|
|
252
|
+
plays?: number;
|
|
253
|
+
total_plays?: number;
|
|
254
|
+
avg_time_watched?: number;
|
|
255
|
+
reach?: number;
|
|
256
|
+
likes?: number;
|
|
257
|
+
comments?: number;
|
|
258
|
+
shares?: number;
|
|
259
|
+
saves?: number;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Photo insights request params
|
|
263
|
+
*/
|
|
264
|
+
interface PhotoInsightsParams {
|
|
265
|
+
photoId: string;
|
|
266
|
+
metric?: string[];
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Photo insights data
|
|
270
|
+
*/
|
|
271
|
+
interface PhotoInsights {
|
|
272
|
+
id: string;
|
|
273
|
+
views?: number;
|
|
274
|
+
reach?: number;
|
|
275
|
+
engaged_users?: number;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Instagram account insights params
|
|
279
|
+
*/
|
|
280
|
+
interface InstagramAccountInsightsParams {
|
|
281
|
+
metric: string[];
|
|
282
|
+
period?: InsightsPeriod;
|
|
283
|
+
metric_type?: 'time_series' | 'total_value';
|
|
284
|
+
since?: number;
|
|
285
|
+
until?: number;
|
|
286
|
+
breakdown?: 'city' | 'country' | 'age' | 'gender';
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Instagram media insights params
|
|
290
|
+
*/
|
|
291
|
+
interface InstagramMediaInsightsParams {
|
|
292
|
+
mediaId: string;
|
|
293
|
+
metric?: string[];
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Instagram account summary
|
|
297
|
+
*/
|
|
298
|
+
interface InstagramAccountSummary {
|
|
299
|
+
id: string;
|
|
300
|
+
username: string;
|
|
301
|
+
followers_count: number;
|
|
302
|
+
views?: number;
|
|
303
|
+
reach?: number;
|
|
304
|
+
accounts_engaged?: number;
|
|
305
|
+
total_interactions?: number;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Instagram media insights data
|
|
309
|
+
*/
|
|
310
|
+
interface InstagramMediaInsights {
|
|
311
|
+
id: string;
|
|
312
|
+
media_type: 'IMAGE' | 'VIDEO' | 'CAROUSEL_ALBUM' | 'REELS';
|
|
313
|
+
views?: number;
|
|
314
|
+
reach?: number;
|
|
315
|
+
likes?: number;
|
|
316
|
+
comments?: number;
|
|
317
|
+
shares?: number;
|
|
318
|
+
saves?: number;
|
|
319
|
+
plays?: number;
|
|
320
|
+
total_interactions?: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Aggregated insights for a time period
|
|
324
|
+
*/
|
|
325
|
+
interface AggregatedInsights {
|
|
326
|
+
period: {
|
|
327
|
+
since: string;
|
|
328
|
+
until: string;
|
|
329
|
+
};
|
|
330
|
+
totals: {
|
|
331
|
+
views?: number;
|
|
332
|
+
reach?: number;
|
|
333
|
+
engagement?: number;
|
|
334
|
+
followers_gained?: number;
|
|
335
|
+
followers_lost?: number;
|
|
336
|
+
};
|
|
337
|
+
breakdown?: {
|
|
338
|
+
byDay?: Record<string, number>;
|
|
339
|
+
byContentType?: Record<string, number>;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Insights-specific error
|
|
344
|
+
*/
|
|
345
|
+
interface InsightsError {
|
|
346
|
+
metric: string;
|
|
347
|
+
error_code: number;
|
|
348
|
+
error_message: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { type APIClient as A, INSTAGRAM_MEDIA_METRICS_COMMON as B, INSTAGRAM_REELS_METRICS as C, INSTAGRAM_STORIES_METRICS as D, INSIGHTS_PERIODS as E, type InsightsPeriod as F, type HttpClientConfig as H, type InsightValue as I, METRIC_PRESETS as M, type PageInsightsParams as P, type ReelsInsightsParams as R, type VideoInsightsParams as V, type InsightDataItem as a, type InsightBreakdown as b, type InsightsResponse as c, type PageOverview as d, type PostInsightsParams as e, type PostInsights as f, type VideoInsights as g, type VideoWithInsights as h, type ReelsInsights as i, type PhotoInsightsParams as j, type PhotoInsights as k, type InstagramAccountInsightsParams as l, type InstagramMediaInsightsParams as m, type InstagramAccountSummary as n, type InstagramMediaInsights as o, type AggregatedInsights as p, type InsightsError as q, PAGE_METRICS_LIFETIME as r, PAGE_METRICS_PERIODIC as s, POST_METRICS as t, VIDEO_METRICS as u, REELS_METRICS as v, REELS_METRICS_EXTENDED as w, PHOTO_METRICS as x, INSTAGRAM_ACCOUNT_METRICS as y, INSTAGRAM_DEMOGRAPHICS_METRICS as z };
|