@olastudio/social-media-sdk 0.1.2 → 0.2.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/dist/adapters/expo.d.mts +1 -1
- package/dist/adapters/expo.d.ts +1 -1
- package/dist/adapters/index.d.mts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/{auth.types-DTXCyA56.d.mts → auth.types-Do2L11TO.d.mts} +1 -1
- package/dist/{auth.types-DTXCyA56.d.ts → auth.types-Do2L11TO.d.ts} +1 -1
- package/dist/core/index.d.mts +128 -5
- package/dist/core/index.d.ts +128 -5
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +229 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -0
- package/dist/index.mjs.map +1 -1
- package/dist/{insights.types-DF2_r0L1.d.ts → insights.types-BCalhgkj.d.ts} +1 -1
- package/dist/{insights.types-5z7HJnbt.d.mts → insights.types-hLzNJATM.d.mts} +1 -1
- package/dist/providers/facebook/index.d.mts +109 -2
- package/dist/providers/facebook/index.d.ts +109 -2
- package/dist/providers/facebook/index.js +105 -0
- package/dist/providers/facebook/index.js.map +1 -1
- package/dist/providers/facebook/index.mjs +105 -0
- package/dist/providers/facebook/index.mjs.map +1 -1
- package/dist/providers/instagram/index.d.mts +141 -3
- package/dist/providers/instagram/index.d.ts +141 -3
- package/dist/providers/instagram/index.js +124 -0
- package/dist/providers/instagram/index.js.map +1 -1
- package/dist/providers/instagram/index.mjs +124 -0
- package/dist/providers/instagram/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/adapters/expo.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OAuthAdapter } from './index.mjs';
|
|
2
|
-
import { O as OAuthConfig,
|
|
2
|
+
import { O as OAuthConfig, a as OAuthResult } from '../auth.types-Do2L11TO.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Expo Adapter - OAuth adapter for React Native / Expo
|
package/dist/adapters/expo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OAuthAdapter } from './index.js';
|
|
2
|
-
import { O as OAuthConfig,
|
|
2
|
+
import { O as OAuthConfig, a as OAuthResult } from '../auth.types-Do2L11TO.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Expo Adapter - OAuth adapter for React Native / Expo
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -125,4 +125,4 @@ interface OAuthResult {
|
|
|
125
125
|
params?: Record<string, any>;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export type {
|
|
128
|
+
export type { AuthProvider as A, LoginConfig as L, OAuthConfig as O, ProviderName as P, RequestOptions as R, UserProfile as U, OAuthResult as a, AuthResult as b, PaginatedResponse as c, APIErrorData as d };
|
|
@@ -125,4 +125,4 @@ interface OAuthResult {
|
|
|
125
125
|
params?: Record<string, any>;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export type {
|
|
128
|
+
export type { AuthProvider as A, LoginConfig as L, OAuthConfig as O, ProviderName as P, RequestOptions as R, UserProfile as U, OAuthResult as a, AuthResult as b, PaginatedResponse as c, APIErrorData as d };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,7 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { A as APIClient, H as HttpClientConfig } from '../insights.types-hLzNJATM.mjs';
|
|
2
|
+
export { p as AggregatedInsights, E as INSIGHTS_PERIODS, y as INSTAGRAM_ACCOUNT_METRICS, z as INSTAGRAM_DEMOGRAPHICS_METRICS, B as INSTAGRAM_MEDIA_METRICS_COMMON, C as INSTAGRAM_REELS_METRICS, D as INSTAGRAM_STORIES_METRICS, b as InsightBreakdown, a as InsightDataItem, I as InsightValue, q as InsightsError, F as InsightsPeriod, c as InsightsResponse, l as InstagramAccountInsightsParams, n as InstagramAccountSummary, o as InstagramMediaInsights, m as InstagramMediaInsightsParams, M as METRIC_PRESETS, r as PAGE_METRICS_LIFETIME, s as PAGE_METRICS_PERIODIC, x as PHOTO_METRICS, t as POST_METRICS, P as PageInsightsParams, d as PageOverview, k as PhotoInsights, j as PhotoInsightsParams, f as PostInsights, e as PostInsightsParams, v as REELS_METRICS, w as REELS_METRICS_EXTENDED, i as ReelsInsights, R as ReelsInsightsParams, u as VIDEO_METRICS, g as VideoInsights, V as VideoInsightsParams, h as VideoWithInsights } from '../insights.types-hLzNJATM.mjs';
|
|
3
|
+
import { R as RequestOptions } from '../auth.types-Do2L11TO.mjs';
|
|
4
|
+
export { d as APIErrorData, A as AuthProvider, b as AuthResult, L as LoginConfig, O as OAuthConfig, a as OAuthResult, c as PaginatedResponse, P as ProviderName, U as UserProfile } from '../auth.types-Do2L11TO.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Messaging Types - Types for Facebook/Instagram Messaging APIs
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Participant in a conversation
|
|
11
|
+
*/
|
|
12
|
+
interface MessagingParticipant {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Message attachment (images, videos, etc.)
|
|
19
|
+
*/
|
|
20
|
+
interface MessageAttachment {
|
|
21
|
+
id: string;
|
|
22
|
+
mime_type: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
image_data?: {
|
|
26
|
+
url: string;
|
|
27
|
+
preview_url?: string;
|
|
28
|
+
width?: number;
|
|
29
|
+
height?: number;
|
|
30
|
+
};
|
|
31
|
+
video_data?: {
|
|
32
|
+
url: string;
|
|
33
|
+
preview_url?: string;
|
|
34
|
+
length?: number;
|
|
35
|
+
};
|
|
36
|
+
file_url?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Individual message in a conversation
|
|
40
|
+
*/
|
|
41
|
+
interface Message {
|
|
42
|
+
id: string;
|
|
43
|
+
from: MessagingParticipant;
|
|
44
|
+
to: {
|
|
45
|
+
data: MessagingParticipant[];
|
|
46
|
+
};
|
|
47
|
+
message: string;
|
|
48
|
+
created_time: string;
|
|
49
|
+
attachments?: {
|
|
50
|
+
data: MessageAttachment[];
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Conversation (thread) with a user
|
|
55
|
+
*/
|
|
56
|
+
interface Conversation {
|
|
57
|
+
id: string;
|
|
58
|
+
participants: {
|
|
59
|
+
data: MessagingParticipant[];
|
|
60
|
+
};
|
|
61
|
+
messages?: {
|
|
62
|
+
data: Message[];
|
|
63
|
+
};
|
|
64
|
+
updated_time: string;
|
|
65
|
+
unread_count?: number;
|
|
66
|
+
snippet?: string;
|
|
67
|
+
can_reply?: boolean;
|
|
68
|
+
is_subscribed?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Facebook/Instagram paging cursors
|
|
72
|
+
*/
|
|
73
|
+
interface PagingCursors {
|
|
74
|
+
before?: string;
|
|
75
|
+
after?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Paginated response for conversations
|
|
79
|
+
*/
|
|
80
|
+
interface ConversationsResponse {
|
|
81
|
+
data: Conversation[];
|
|
82
|
+
paging?: {
|
|
83
|
+
cursors?: PagingCursors;
|
|
84
|
+
next?: string;
|
|
85
|
+
previous?: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Paginated response for messages
|
|
90
|
+
*/
|
|
91
|
+
interface MessagesResponse {
|
|
92
|
+
data: Message[];
|
|
93
|
+
paging?: {
|
|
94
|
+
cursors?: PagingCursors;
|
|
95
|
+
next?: string;
|
|
96
|
+
previous?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Response when sending a message
|
|
101
|
+
*/
|
|
102
|
+
interface SendMessageResponse {
|
|
103
|
+
recipient_id: string;
|
|
104
|
+
message_id: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Options for fetching conversations
|
|
108
|
+
*/
|
|
109
|
+
interface GetConversationsOptions {
|
|
110
|
+
/** Number of conversations to fetch (default: 25, max: 100) */
|
|
111
|
+
limit?: number;
|
|
112
|
+
/** Cursor for pagination */
|
|
113
|
+
after?: string;
|
|
114
|
+
/** Fields to include */
|
|
115
|
+
fields?: string[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Options for fetching messages
|
|
119
|
+
*/
|
|
120
|
+
interface GetMessagesOptions {
|
|
121
|
+
/** Number of messages to fetch (default: 25, max: 100) */
|
|
122
|
+
limit?: number;
|
|
123
|
+
/** Cursor for pagination */
|
|
124
|
+
after?: string;
|
|
125
|
+
/** Fields to include */
|
|
126
|
+
fields?: string[];
|
|
127
|
+
}
|
|
5
128
|
|
|
6
129
|
/**
|
|
7
130
|
* Base Error - Error base para la librería
|
|
@@ -102,4 +225,4 @@ declare const FACEBOOK_GRAPH_API_BASE_URL: "https://graph.facebook.com/v24.0";
|
|
|
102
225
|
*/
|
|
103
226
|
declare const FACEBOOK_OAUTH_AUTHORIZATION_URL: "https://www.facebook.com/v24.0/dialog/oauth";
|
|
104
227
|
|
|
105
|
-
export { APIClient, APIError, AuthError, BaseError, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, HttpClient, HttpClientConfig, RequestOptions };
|
|
228
|
+
export { APIClient, APIError, AuthError, BaseError, type Conversation, type ConversationsResponse, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, type GetConversationsOptions, type GetMessagesOptions, HttpClient, HttpClientConfig, type Message, type MessageAttachment, type MessagesResponse, type MessagingParticipant, type PagingCursors, RequestOptions, type SendMessageResponse };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { A as APIClient, H as HttpClientConfig } from '../insights.types-BCalhgkj.js';
|
|
2
|
+
export { p as AggregatedInsights, E as INSIGHTS_PERIODS, y as INSTAGRAM_ACCOUNT_METRICS, z as INSTAGRAM_DEMOGRAPHICS_METRICS, B as INSTAGRAM_MEDIA_METRICS_COMMON, C as INSTAGRAM_REELS_METRICS, D as INSTAGRAM_STORIES_METRICS, b as InsightBreakdown, a as InsightDataItem, I as InsightValue, q as InsightsError, F as InsightsPeriod, c as InsightsResponse, l as InstagramAccountInsightsParams, n as InstagramAccountSummary, o as InstagramMediaInsights, m as InstagramMediaInsightsParams, M as METRIC_PRESETS, r as PAGE_METRICS_LIFETIME, s as PAGE_METRICS_PERIODIC, x as PHOTO_METRICS, t as POST_METRICS, P as PageInsightsParams, d as PageOverview, k as PhotoInsights, j as PhotoInsightsParams, f as PostInsights, e as PostInsightsParams, v as REELS_METRICS, w as REELS_METRICS_EXTENDED, i as ReelsInsights, R as ReelsInsightsParams, u as VIDEO_METRICS, g as VideoInsights, V as VideoInsightsParams, h as VideoWithInsights } from '../insights.types-BCalhgkj.js';
|
|
3
|
+
import { R as RequestOptions } from '../auth.types-Do2L11TO.js';
|
|
4
|
+
export { d as APIErrorData, A as AuthProvider, b as AuthResult, L as LoginConfig, O as OAuthConfig, a as OAuthResult, c as PaginatedResponse, P as ProviderName, U as UserProfile } from '../auth.types-Do2L11TO.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Messaging Types - Types for Facebook/Instagram Messaging APIs
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Participant in a conversation
|
|
11
|
+
*/
|
|
12
|
+
interface MessagingParticipant {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Message attachment (images, videos, etc.)
|
|
19
|
+
*/
|
|
20
|
+
interface MessageAttachment {
|
|
21
|
+
id: string;
|
|
22
|
+
mime_type: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
image_data?: {
|
|
26
|
+
url: string;
|
|
27
|
+
preview_url?: string;
|
|
28
|
+
width?: number;
|
|
29
|
+
height?: number;
|
|
30
|
+
};
|
|
31
|
+
video_data?: {
|
|
32
|
+
url: string;
|
|
33
|
+
preview_url?: string;
|
|
34
|
+
length?: number;
|
|
35
|
+
};
|
|
36
|
+
file_url?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Individual message in a conversation
|
|
40
|
+
*/
|
|
41
|
+
interface Message {
|
|
42
|
+
id: string;
|
|
43
|
+
from: MessagingParticipant;
|
|
44
|
+
to: {
|
|
45
|
+
data: MessagingParticipant[];
|
|
46
|
+
};
|
|
47
|
+
message: string;
|
|
48
|
+
created_time: string;
|
|
49
|
+
attachments?: {
|
|
50
|
+
data: MessageAttachment[];
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Conversation (thread) with a user
|
|
55
|
+
*/
|
|
56
|
+
interface Conversation {
|
|
57
|
+
id: string;
|
|
58
|
+
participants: {
|
|
59
|
+
data: MessagingParticipant[];
|
|
60
|
+
};
|
|
61
|
+
messages?: {
|
|
62
|
+
data: Message[];
|
|
63
|
+
};
|
|
64
|
+
updated_time: string;
|
|
65
|
+
unread_count?: number;
|
|
66
|
+
snippet?: string;
|
|
67
|
+
can_reply?: boolean;
|
|
68
|
+
is_subscribed?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Facebook/Instagram paging cursors
|
|
72
|
+
*/
|
|
73
|
+
interface PagingCursors {
|
|
74
|
+
before?: string;
|
|
75
|
+
after?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Paginated response for conversations
|
|
79
|
+
*/
|
|
80
|
+
interface ConversationsResponse {
|
|
81
|
+
data: Conversation[];
|
|
82
|
+
paging?: {
|
|
83
|
+
cursors?: PagingCursors;
|
|
84
|
+
next?: string;
|
|
85
|
+
previous?: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Paginated response for messages
|
|
90
|
+
*/
|
|
91
|
+
interface MessagesResponse {
|
|
92
|
+
data: Message[];
|
|
93
|
+
paging?: {
|
|
94
|
+
cursors?: PagingCursors;
|
|
95
|
+
next?: string;
|
|
96
|
+
previous?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Response when sending a message
|
|
101
|
+
*/
|
|
102
|
+
interface SendMessageResponse {
|
|
103
|
+
recipient_id: string;
|
|
104
|
+
message_id: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Options for fetching conversations
|
|
108
|
+
*/
|
|
109
|
+
interface GetConversationsOptions {
|
|
110
|
+
/** Number of conversations to fetch (default: 25, max: 100) */
|
|
111
|
+
limit?: number;
|
|
112
|
+
/** Cursor for pagination */
|
|
113
|
+
after?: string;
|
|
114
|
+
/** Fields to include */
|
|
115
|
+
fields?: string[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Options for fetching messages
|
|
119
|
+
*/
|
|
120
|
+
interface GetMessagesOptions {
|
|
121
|
+
/** Number of messages to fetch (default: 25, max: 100) */
|
|
122
|
+
limit?: number;
|
|
123
|
+
/** Cursor for pagination */
|
|
124
|
+
after?: string;
|
|
125
|
+
/** Fields to include */
|
|
126
|
+
fields?: string[];
|
|
127
|
+
}
|
|
5
128
|
|
|
6
129
|
/**
|
|
7
130
|
* Base Error - Error base para la librería
|
|
@@ -102,4 +225,4 @@ declare const FACEBOOK_GRAPH_API_BASE_URL: "https://graph.facebook.com/v24.0";
|
|
|
102
225
|
*/
|
|
103
226
|
declare const FACEBOOK_OAUTH_AUTHORIZATION_URL: "https://www.facebook.com/v24.0/dialog/oauth";
|
|
104
227
|
|
|
105
|
-
export { APIClient, APIError, AuthError, BaseError, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, HttpClient, HttpClientConfig, RequestOptions };
|
|
228
|
+
export { APIClient, APIError, AuthError, BaseError, type Conversation, type ConversationsResponse, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, type GetConversationsOptions, type GetMessagesOptions, HttpClient, HttpClientConfig, type Message, type MessageAttachment, type MessagesResponse, type MessagingParticipant, type PagingCursors, RequestOptions, type SendMessageResponse };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { b as
|
|
2
|
-
export {
|
|
3
|
-
export { APIError, AuthError, BaseError, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, HttpClient } from './core/index.mjs';
|
|
1
|
+
export { A as APIClient, p as AggregatedInsights, H as HttpClientConfig, E as INSIGHTS_PERIODS, y as INSTAGRAM_ACCOUNT_METRICS, z as INSTAGRAM_DEMOGRAPHICS_METRICS, B as INSTAGRAM_MEDIA_METRICS_COMMON, C as INSTAGRAM_REELS_METRICS, D as INSTAGRAM_STORIES_METRICS, b as InsightBreakdown, a as InsightDataItem, I as InsightValue, q as InsightsError, F as InsightsPeriod, c as InsightsResponse, l as InstagramAccountInsightsParams, n as InstagramAccountSummary, o as InstagramMediaInsights, m as InstagramMediaInsightsParams, M as METRIC_PRESETS, r as PAGE_METRICS_LIFETIME, s as PAGE_METRICS_PERIODIC, x as PHOTO_METRICS, t as POST_METRICS, P as PageInsightsParams, d as PageOverview, k as PhotoInsights, j as PhotoInsightsParams, f as PostInsights, e as PostInsightsParams, v as REELS_METRICS, w as REELS_METRICS_EXTENDED, i as ReelsInsights, R as ReelsInsightsParams, u as VIDEO_METRICS, g as VideoInsights, V as VideoInsightsParams, h as VideoWithInsights } from './insights.types-hLzNJATM.mjs';
|
|
2
|
+
export { d as APIErrorData, A as AuthProvider, b as AuthResult, L as LoginConfig, O as OAuthConfig, a as OAuthResult, c as PaginatedResponse, P as ProviderName, R as RequestOptions, U as UserProfile } from './auth.types-Do2L11TO.mjs';
|
|
3
|
+
export { APIError, AuthError, BaseError, Conversation, ConversationsResponse, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, GetConversationsOptions, GetMessagesOptions, HttpClient, Message, MessageAttachment, MessagesResponse, MessagingParticipant, PagingCursors, SendMessageResponse } from './core/index.mjs';
|
|
4
4
|
export { OAuthAdapter } from './adapters/index.mjs';
|
|
5
5
|
export { FacebookAPI, FacebookAuth, FacebookConfig, FacebookErrorResponse, FacebookExchangeTokenParams, FacebookPage, FacebookPagesResponse, FacebookPostResponse, FacebookProvider, FacebookPublishPostParams, FacebookScopesBusiness, FacebookScopesUser, FacebookTokenResponse, FacebookUserProfile } from './providers/facebook/index.mjs';
|
|
6
|
-
export { InstagramAPI, InstagramAccount, InstagramAuth, InstagramConfig, InstagramInsights, InstagramInsightsParams, InstagramMedia, InstagramMediaContainerResponse, InstagramMediaResponse, InstagramMediaType, InstagramProfile, InstagramProvider, InstagramPublishParams, InstagramPublishResponse, InstagramScopes } from './providers/instagram/index.mjs';
|
|
6
|
+
export { InstagramAPI, InstagramAccount, InstagramAuth, InstagramComment, InstagramCommentsResponse, InstagramConfig, InstagramInsights, InstagramInsightsParams, InstagramMedia, InstagramMediaContainerResponse, InstagramMediaResponse, InstagramMediaType, InstagramProfile, InstagramProvider, InstagramPublishParams, InstagramPublishResponse, InstagramScopes } from './providers/instagram/index.mjs';
|
|
7
7
|
export { TIKTOK_API_BASE_URL, TIKTOK_API_VERSION, TIKTOK_DEFAULT_SCOPES, TIKTOK_OAUTH_AUTHORIZATION_URL, TIKTOK_OAUTH_REVOKE_URL, TIKTOK_OAUTH_TOKEN_URL, TikTokAPI, TikTokAPIResponse, TikTokAccountInsights, TikTokAuth, TikTokConfig, TikTokErrorResponse, TikTokInsights, TikTokInsightsParams, TikTokProvider, TikTokPublishStatus, TikTokPublishStatusResponse, TikTokScope, TikTokScopes, TikTokTokenResponse, TikTokUploadInitResponse, TikTokUserInfo, TikTokVideo, TikTokVideoInsights, TikTokVideoListResponse } from './providers/tiktok/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { b as
|
|
2
|
-
export {
|
|
3
|
-
export { APIError, AuthError, BaseError, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, HttpClient } from './core/index.js';
|
|
1
|
+
export { A as APIClient, p as AggregatedInsights, H as HttpClientConfig, E as INSIGHTS_PERIODS, y as INSTAGRAM_ACCOUNT_METRICS, z as INSTAGRAM_DEMOGRAPHICS_METRICS, B as INSTAGRAM_MEDIA_METRICS_COMMON, C as INSTAGRAM_REELS_METRICS, D as INSTAGRAM_STORIES_METRICS, b as InsightBreakdown, a as InsightDataItem, I as InsightValue, q as InsightsError, F as InsightsPeriod, c as InsightsResponse, l as InstagramAccountInsightsParams, n as InstagramAccountSummary, o as InstagramMediaInsights, m as InstagramMediaInsightsParams, M as METRIC_PRESETS, r as PAGE_METRICS_LIFETIME, s as PAGE_METRICS_PERIODIC, x as PHOTO_METRICS, t as POST_METRICS, P as PageInsightsParams, d as PageOverview, k as PhotoInsights, j as PhotoInsightsParams, f as PostInsights, e as PostInsightsParams, v as REELS_METRICS, w as REELS_METRICS_EXTENDED, i as ReelsInsights, R as ReelsInsightsParams, u as VIDEO_METRICS, g as VideoInsights, V as VideoInsightsParams, h as VideoWithInsights } from './insights.types-BCalhgkj.js';
|
|
2
|
+
export { d as APIErrorData, A as AuthProvider, b as AuthResult, L as LoginConfig, O as OAuthConfig, a as OAuthResult, c as PaginatedResponse, P as ProviderName, R as RequestOptions, U as UserProfile } from './auth.types-Do2L11TO.js';
|
|
3
|
+
export { APIError, AuthError, BaseError, Conversation, ConversationsResponse, FACEBOOK_GRAPH_API_BASE_URL, FACEBOOK_GRAPH_API_VERSION, FACEBOOK_OAUTH_AUTHORIZATION_URL, GetConversationsOptions, GetMessagesOptions, HttpClient, Message, MessageAttachment, MessagesResponse, MessagingParticipant, PagingCursors, SendMessageResponse } from './core/index.js';
|
|
4
4
|
export { OAuthAdapter } from './adapters/index.js';
|
|
5
5
|
export { FacebookAPI, FacebookAuth, FacebookConfig, FacebookErrorResponse, FacebookExchangeTokenParams, FacebookPage, FacebookPagesResponse, FacebookPostResponse, FacebookProvider, FacebookPublishPostParams, FacebookScopesBusiness, FacebookScopesUser, FacebookTokenResponse, FacebookUserProfile } from './providers/facebook/index.js';
|
|
6
|
-
export { InstagramAPI, InstagramAccount, InstagramAuth, InstagramConfig, InstagramInsights, InstagramInsightsParams, InstagramMedia, InstagramMediaContainerResponse, InstagramMediaResponse, InstagramMediaType, InstagramProfile, InstagramProvider, InstagramPublishParams, InstagramPublishResponse, InstagramScopes } from './providers/instagram/index.js';
|
|
6
|
+
export { InstagramAPI, InstagramAccount, InstagramAuth, InstagramComment, InstagramCommentsResponse, InstagramConfig, InstagramInsights, InstagramInsightsParams, InstagramMedia, InstagramMediaContainerResponse, InstagramMediaResponse, InstagramMediaType, InstagramProfile, InstagramProvider, InstagramPublishParams, InstagramPublishResponse, InstagramScopes } from './providers/instagram/index.js';
|
|
7
7
|
export { TIKTOK_API_BASE_URL, TIKTOK_API_VERSION, TIKTOK_DEFAULT_SCOPES, TIKTOK_OAUTH_AUTHORIZATION_URL, TIKTOK_OAUTH_REVOKE_URL, TIKTOK_OAUTH_TOKEN_URL, TikTokAPI, TikTokAPIResponse, TikTokAccountInsights, TikTokAuth, TikTokConfig, TikTokErrorResponse, TikTokInsights, TikTokInsightsParams, TikTokProvider, TikTokPublishStatus, TikTokPublishStatusResponse, TikTokScope, TikTokScopes, TikTokTokenResponse, TikTokUploadInitResponse, TikTokUserInfo, TikTokVideo, TikTokVideoInsights, TikTokVideoListResponse } from './providers/tiktok/index.js';
|
package/dist/index.js
CHANGED
|
@@ -951,6 +951,111 @@ var FacebookAPI = class {
|
|
|
951
951
|
getApiVersion() {
|
|
952
952
|
return FACEBOOK_GRAPH_API_VERSION;
|
|
953
953
|
}
|
|
954
|
+
// ============= Messaging Methods =============
|
|
955
|
+
/**
|
|
956
|
+
* Get conversations (inbox) for a Facebook Page
|
|
957
|
+
* Requires `pages_messaging` permission
|
|
958
|
+
*
|
|
959
|
+
* @param pageId - Facebook Page ID
|
|
960
|
+
* @param options - Pagination and field options
|
|
961
|
+
* @returns Paginated list of conversations
|
|
962
|
+
*/
|
|
963
|
+
async getPageConversations(pageId, options = {}) {
|
|
964
|
+
try {
|
|
965
|
+
const defaultFields = [
|
|
966
|
+
"id",
|
|
967
|
+
"participants",
|
|
968
|
+
"updated_time",
|
|
969
|
+
"unread_count",
|
|
970
|
+
"snippet",
|
|
971
|
+
"can_reply",
|
|
972
|
+
"messages.limit(1){id,message,from,created_time}"
|
|
973
|
+
];
|
|
974
|
+
const params = {
|
|
975
|
+
fields: (options.fields || defaultFields).join(","),
|
|
976
|
+
limit: options.limit || 25
|
|
977
|
+
};
|
|
978
|
+
if (options.after) {
|
|
979
|
+
params.after = options.after;
|
|
980
|
+
}
|
|
981
|
+
const response = await this.get(`/${pageId}/conversations`, params);
|
|
982
|
+
return response;
|
|
983
|
+
} catch (error) {
|
|
984
|
+
throw new APIError(
|
|
985
|
+
`Failed to fetch page conversations: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
986
|
+
void 0,
|
|
987
|
+
"CONVERSATIONS_FETCH_ERROR",
|
|
988
|
+
error
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Get messages from a specific conversation
|
|
994
|
+
*
|
|
995
|
+
* @param conversationId - Conversation ID
|
|
996
|
+
* @param options - Pagination options
|
|
997
|
+
* @returns Paginated list of messages
|
|
998
|
+
*/
|
|
999
|
+
async getConversationMessages(conversationId, options = {}) {
|
|
1000
|
+
try {
|
|
1001
|
+
const defaultFields = [
|
|
1002
|
+
"id",
|
|
1003
|
+
"message",
|
|
1004
|
+
"from",
|
|
1005
|
+
"to",
|
|
1006
|
+
"created_time",
|
|
1007
|
+
"attachments"
|
|
1008
|
+
];
|
|
1009
|
+
const params = {
|
|
1010
|
+
fields: (options.fields || defaultFields).join(","),
|
|
1011
|
+
limit: options.limit || 25
|
|
1012
|
+
};
|
|
1013
|
+
if (options.after) {
|
|
1014
|
+
params.after = options.after;
|
|
1015
|
+
}
|
|
1016
|
+
const response = await this.get(`/${conversationId}/messages`, params);
|
|
1017
|
+
return response;
|
|
1018
|
+
} catch (error) {
|
|
1019
|
+
throw new APIError(
|
|
1020
|
+
`Failed to fetch conversation messages: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1021
|
+
void 0,
|
|
1022
|
+
"MESSAGES_FETCH_ERROR",
|
|
1023
|
+
error
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Send a message in a conversation
|
|
1029
|
+
* Uses the Send API for Page messaging
|
|
1030
|
+
*
|
|
1031
|
+
* @param pageId - Facebook Page ID
|
|
1032
|
+
* @param recipientId - PSID (Page-Scoped User ID) of the recipient
|
|
1033
|
+
* @param message - Message text to send
|
|
1034
|
+
* @param pageAccessToken - Page access token with messaging permission
|
|
1035
|
+
* @returns Message send response
|
|
1036
|
+
*/
|
|
1037
|
+
async sendMessage(pageId, recipientId, message, pageAccessToken) {
|
|
1038
|
+
try {
|
|
1039
|
+
const body = {
|
|
1040
|
+
recipient: { id: recipientId },
|
|
1041
|
+
message: { text: message },
|
|
1042
|
+
messaging_type: "RESPONSE",
|
|
1043
|
+
access_token: pageAccessToken || this.accessToken
|
|
1044
|
+
};
|
|
1045
|
+
const response = await this.post(
|
|
1046
|
+
`/${pageId}/messages`,
|
|
1047
|
+
body
|
|
1048
|
+
);
|
|
1049
|
+
return response;
|
|
1050
|
+
} catch (error) {
|
|
1051
|
+
throw new APIError(
|
|
1052
|
+
`Failed to send message: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1053
|
+
void 0,
|
|
1054
|
+
"MESSAGE_SEND_ERROR",
|
|
1055
|
+
error
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
954
1059
|
};
|
|
955
1060
|
|
|
956
1061
|
// providers/facebook/auth/FacebookAuth.ts
|
|
@@ -1513,6 +1618,31 @@ var InstagramAPI = class {
|
|
|
1513
1618
|
);
|
|
1514
1619
|
}
|
|
1515
1620
|
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Get comments for a media item
|
|
1623
|
+
* @param mediaId - Media ID
|
|
1624
|
+
* @param limit - Max number of comments to fetch (default: 25)
|
|
1625
|
+
* @returns Array of comments
|
|
1626
|
+
*/
|
|
1627
|
+
async getMediaComments(mediaId, limit = 25) {
|
|
1628
|
+
try {
|
|
1629
|
+
const response = await this.get(
|
|
1630
|
+
`/${mediaId}/comments`,
|
|
1631
|
+
{
|
|
1632
|
+
fields: "id,text,timestamp,username,like_count,from{id,username},replies{id,text,timestamp,username,like_count}",
|
|
1633
|
+
limit
|
|
1634
|
+
}
|
|
1635
|
+
);
|
|
1636
|
+
return response.data || [];
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
throw new APIError(
|
|
1639
|
+
`Failed to fetch comments: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1640
|
+
void 0,
|
|
1641
|
+
"COMMENTS_FETCH_ERROR",
|
|
1642
|
+
error
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1516
1646
|
/**
|
|
1517
1647
|
* Get Instagram account insights
|
|
1518
1648
|
*/
|
|
@@ -1756,6 +1886,105 @@ var InstagramAPI = class {
|
|
|
1756
1886
|
getApiVersion() {
|
|
1757
1887
|
return FACEBOOK_GRAPH_API_VERSION;
|
|
1758
1888
|
}
|
|
1889
|
+
// ============= Messaging Methods =============
|
|
1890
|
+
/**
|
|
1891
|
+
* Get conversations (inbox) for an Instagram Professional account
|
|
1892
|
+
* Requires `instagram_manage_messages` permission
|
|
1893
|
+
*
|
|
1894
|
+
* @param instagramAccountId - Instagram Business/Creator Account ID
|
|
1895
|
+
* @param options - Pagination and field options
|
|
1896
|
+
* @returns Paginated list of conversations
|
|
1897
|
+
*/
|
|
1898
|
+
async getConversations(instagramAccountId, options = {}) {
|
|
1899
|
+
try {
|
|
1900
|
+
const defaultFields = [
|
|
1901
|
+
"id",
|
|
1902
|
+
"participants",
|
|
1903
|
+
"updated_time",
|
|
1904
|
+
"messages.limit(1){id,message,from,created_time}"
|
|
1905
|
+
];
|
|
1906
|
+
const params = {
|
|
1907
|
+
fields: (options.fields || defaultFields).join(","),
|
|
1908
|
+
limit: options.limit || 25
|
|
1909
|
+
};
|
|
1910
|
+
if (options.after) {
|
|
1911
|
+
params.after = options.after;
|
|
1912
|
+
}
|
|
1913
|
+
const response = await this.get(`/${instagramAccountId}/conversations`, params);
|
|
1914
|
+
return response;
|
|
1915
|
+
} catch (error) {
|
|
1916
|
+
throw new APIError(
|
|
1917
|
+
`Failed to fetch Instagram conversations: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1918
|
+
void 0,
|
|
1919
|
+
"CONVERSATIONS_FETCH_ERROR",
|
|
1920
|
+
error
|
|
1921
|
+
);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Get messages from a specific Instagram conversation
|
|
1926
|
+
*
|
|
1927
|
+
* @param conversationId - Conversation ID
|
|
1928
|
+
* @param options - Pagination options
|
|
1929
|
+
* @returns Paginated list of messages
|
|
1930
|
+
*/
|
|
1931
|
+
async getConversationMessages(conversationId, options = {}) {
|
|
1932
|
+
try {
|
|
1933
|
+
const defaultFields = [
|
|
1934
|
+
"id",
|
|
1935
|
+
"message",
|
|
1936
|
+
"from",
|
|
1937
|
+
"to",
|
|
1938
|
+
"created_time",
|
|
1939
|
+
"attachments"
|
|
1940
|
+
];
|
|
1941
|
+
const params = {
|
|
1942
|
+
fields: (options.fields || defaultFields).join(","),
|
|
1943
|
+
limit: options.limit || 25
|
|
1944
|
+
};
|
|
1945
|
+
if (options.after) {
|
|
1946
|
+
params.after = options.after;
|
|
1947
|
+
}
|
|
1948
|
+
const response = await this.get(`/${conversationId}/messages`, params);
|
|
1949
|
+
return response;
|
|
1950
|
+
} catch (error) {
|
|
1951
|
+
throw new APIError(
|
|
1952
|
+
`Failed to fetch Instagram messages: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1953
|
+
void 0,
|
|
1954
|
+
"MESSAGES_FETCH_ERROR",
|
|
1955
|
+
error
|
|
1956
|
+
);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Send a message to an Instagram user
|
|
1961
|
+
* Uses the Instagram Send API
|
|
1962
|
+
*
|
|
1963
|
+
* @param instagramAccountId - Instagram Business/Creator Account ID
|
|
1964
|
+
* @param recipientId - Instagram-scoped ID of the recipient
|
|
1965
|
+
* @param message - Message text to send
|
|
1966
|
+
* @returns Message send response
|
|
1967
|
+
*/
|
|
1968
|
+
async sendMessage(instagramAccountId, recipientId, message) {
|
|
1969
|
+
try {
|
|
1970
|
+
const body = {
|
|
1971
|
+
recipient: { id: recipientId },
|
|
1972
|
+
message: { text: message }
|
|
1973
|
+
};
|
|
1974
|
+
const response = await this.post(
|
|
1975
|
+
`/${instagramAccountId}/messages`,
|
|
1976
|
+
body
|
|
1977
|
+
);
|
|
1978
|
+
return response;
|
|
1979
|
+
} catch (error) {
|
|
1980
|
+
throw new APIError(
|
|
1981
|
+
`Failed to send Instagram message: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1982
|
+
void 0,
|
|
1983
|
+
"MESSAGE_SEND_ERROR",
|
|
1984
|
+
error
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1759
1988
|
};
|
|
1760
1989
|
|
|
1761
1990
|
// providers/instagram/InstagramProvider.ts
|