operand-meta-sdk 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.eslintrc.js +25 -0
  2. package/.prettierrc +4 -0
  3. package/README.md +435 -0
  4. package/dist/jest.config.d.ts +3 -0
  5. package/dist/jest.config.js +14 -0
  6. package/dist/jest.config.js.map +1 -0
  7. package/dist/src/__test__/mocks/index.d.ts +2 -0
  8. package/dist/src/__test__/mocks/index.js +6 -0
  9. package/dist/src/__test__/mocks/index.js.map +1 -0
  10. package/dist/src/error/operand-error.d.ts +8 -0
  11. package/dist/src/error/operand-error.js +196 -0
  12. package/dist/src/error/operand-error.js.map +1 -0
  13. package/dist/src/index.d.ts +10 -0
  14. package/dist/src/index.js +22 -0
  15. package/dist/src/index.js.map +1 -0
  16. package/dist/src/interfaces/ing-publish.d.ts +53 -0
  17. package/dist/src/interfaces/ing-publish.js +3 -0
  18. package/dist/src/interfaces/ing-publish.js.map +1 -0
  19. package/dist/src/interfaces/meta-auth.d.ts +14 -0
  20. package/dist/src/interfaces/meta-auth.js +3 -0
  21. package/dist/src/interfaces/meta-auth.js.map +1 -0
  22. package/dist/src/interfaces/meta-mkt.d.ts +4 -0
  23. package/dist/src/interfaces/meta-mkt.js +3 -0
  24. package/dist/src/interfaces/meta-mkt.js.map +1 -0
  25. package/dist/src/interfaces/meta-response.d.ts +285 -0
  26. package/dist/src/interfaces/meta-response.js +3 -0
  27. package/dist/src/interfaces/meta-response.js.map +1 -0
  28. package/dist/src/interfaces/meta.d.ts +6 -0
  29. package/dist/src/interfaces/meta.js +3 -0
  30. package/dist/src/interfaces/meta.js.map +1 -0
  31. package/dist/src/interfaces/page-publish.d.ts +66 -0
  32. package/dist/src/interfaces/page-publish.js +3 -0
  33. package/dist/src/interfaces/page-publish.js.map +1 -0
  34. package/dist/src/modules/auth/meta-auth.d.ts +35 -0
  35. package/dist/src/modules/auth/meta-auth.js +131 -0
  36. package/dist/src/modules/auth/meta-auth.js.map +1 -0
  37. package/dist/src/modules/auth/meta-auth.spec.d.ts +1 -0
  38. package/dist/src/modules/auth/meta-auth.spec.js +76 -0
  39. package/dist/src/modules/auth/meta-auth.spec.js.map +1 -0
  40. package/dist/src/modules/comments/ing-comments.d.ts +7 -0
  41. package/dist/src/modules/comments/ing-comments.js +27 -0
  42. package/dist/src/modules/comments/ing-comments.js.map +1 -0
  43. package/dist/src/modules/comments/page-comments.d.ts +6 -0
  44. package/dist/src/modules/comments/page-comments.js +18 -0
  45. package/dist/src/modules/comments/page-comments.js.map +1 -0
  46. package/dist/src/modules/insights/ing-insights.d.ts +42 -0
  47. package/dist/src/modules/insights/ing-insights.js +150 -0
  48. package/dist/src/modules/insights/ing-insights.js.map +1 -0
  49. package/dist/src/modules/insights/mkt-insights.d.ts +10 -0
  50. package/dist/src/modules/insights/mkt-insights.js +46 -0
  51. package/dist/src/modules/insights/mkt-insights.js.map +1 -0
  52. package/dist/src/modules/insights/page-insights.d.ts +34 -0
  53. package/dist/src/modules/insights/page-insights.js +146 -0
  54. package/dist/src/modules/insights/page-insights.js.map +1 -0
  55. package/dist/src/modules/meta-ing.d.ts +5 -0
  56. package/dist/src/modules/meta-ing.js +11 -0
  57. package/dist/src/modules/meta-ing.js.map +1 -0
  58. package/dist/src/modules/meta-mkt.d.ts +5 -0
  59. package/dist/src/modules/meta-mkt.js +11 -0
  60. package/dist/src/modules/meta-mkt.js.map +1 -0
  61. package/dist/src/modules/meta-page.d.ts +5 -0
  62. package/dist/src/modules/meta-page.js +11 -0
  63. package/dist/src/modules/meta-page.js.map +1 -0
  64. package/dist/src/modules/meta.d.ts +10 -0
  65. package/dist/src/modules/meta.js +23 -0
  66. package/dist/src/modules/meta.js.map +1 -0
  67. package/dist/src/modules/publish/ing-publish.d.ts +39 -0
  68. package/dist/src/modules/publish/ing-publish.js +464 -0
  69. package/dist/src/modules/publish/ing-publish.js.map +1 -0
  70. package/dist/src/modules/publish/page-publish.d.ts +51 -0
  71. package/dist/src/modules/publish/page-publish.js +560 -0
  72. package/dist/src/modules/publish/page-publish.js.map +1 -0
  73. package/dist/src/modules/publish/page-publish.spec.d.ts +1 -0
  74. package/dist/src/modules/publish/page-publish.spec.js +280 -0
  75. package/dist/src/modules/publish/page-publish.spec.js.map +1 -0
  76. package/dist/src/modules/utils/meta-utils.d.ts +8 -0
  77. package/dist/src/modules/utils/meta-utils.js +28 -0
  78. package/dist/src/modules/utils/meta-utils.js.map +1 -0
  79. package/dist/src/utils/api.d.ts +8 -0
  80. package/dist/src/utils/api.js +36 -0
  81. package/dist/src/utils/api.js.map +1 -0
  82. package/dist/tsconfig.tsbuildinfo +1 -0
  83. package/jest.config.ts +198 -0
  84. package/package.json +39 -0
  85. package/src/__test__/mocks/image.jpeg +0 -0
  86. package/src/__test__/mocks/index.ts +5 -0
  87. package/src/__test__/mocks/video-to-post.mp4 +0 -0
  88. package/src/__test__/mocks/video-to-stories.mp4 +0 -0
  89. package/src/error/operand-error.ts +217 -0
  90. package/src/index.ts +21 -0
  91. package/src/interfaces/ing-publish.ts +58 -0
  92. package/src/interfaces/meta-auth.ts +52 -0
  93. package/src/interfaces/meta-mkt.ts +5 -0
  94. package/src/interfaces/meta-response.ts +319 -0
  95. package/src/interfaces/meta.ts +7 -0
  96. package/src/interfaces/page-publish.ts +72 -0
  97. package/src/modules/auth/meta-auth.spec.ts +93 -0
  98. package/src/modules/auth/meta-auth.ts +227 -0
  99. package/src/modules/comments/ing-comments.ts +38 -0
  100. package/src/modules/comments/page-comments.ts +20 -0
  101. package/src/modules/insights/ing-insights.ts +275 -0
  102. package/src/modules/insights/mkt-insights.ts +68 -0
  103. package/src/modules/insights/page-insights.ts +267 -0
  104. package/src/modules/meta-ing.ts +8 -0
  105. package/src/modules/meta-mkt.ts +8 -0
  106. package/src/modules/meta-page.ts +8 -0
  107. package/src/modules/meta.ts +31 -0
  108. package/src/modules/publish/ing-publish.ts +754 -0
  109. package/src/modules/publish/page-publish.spec.ts +386 -0
  110. package/src/modules/publish/page-publish.ts +881 -0
  111. package/src/modules/utils/meta-utils.ts +37 -0
  112. package/src/utils/api.ts +45 -0
  113. package/tsconfig.json +22 -0
@@ -0,0 +1,217 @@
1
+ import { MetaError } from "../interfaces/meta-response";
2
+ import { AxiosError } from "axios";
3
+
4
+ export class OperandError {
5
+ private message_private: string;
6
+ private code_private: number;
7
+
8
+ parseMetaError(...data: any) {
9
+ const { error, message } = data[0];
10
+
11
+ console.log({ error: error?.response?.data || error });
12
+
13
+ if (error instanceof AxiosError) {
14
+ const data = error.response?.data as MetaError;
15
+
16
+ if (!data || !data.error) {
17
+ this.message_private = "Unknown error occurred";
18
+ this.code_private = 500;
19
+ return;
20
+ }
21
+
22
+ switch (data.error.code) {
23
+ // Authentication Errors
24
+ case 190:
25
+ this.message_private = "Access token has expired";
26
+ this.code_private = data.error.code;
27
+ break;
28
+ case 102:
29
+ this.message_private = "Session has expired";
30
+ this.code_private = data.error.code;
31
+ break;
32
+ case 104:
33
+ this.message_private = "Unsupported version";
34
+ this.code_private = data.error.code;
35
+ break;
36
+ case 2:
37
+ this.message_private = "Service temporarily unavailable";
38
+ this.code_private = data.error.code;
39
+ break;
40
+
41
+ // Permission Errors
42
+ case 10:
43
+ this.message_private = "Application does not have permission";
44
+ this.code_private = data.error.code;
45
+ break;
46
+ case 200:
47
+ this.message_private = "Access to this resource not allowed";
48
+ this.code_private = data.error.code;
49
+ break;
50
+ case 210:
51
+ this.message_private = "User not visible";
52
+ this.code_private = data.error.code;
53
+ break;
54
+
55
+ // Rate Limit Errors
56
+ case 4:
57
+ this.message_private = "Application request limit reached";
58
+ this.code_private = data.error.code;
59
+ break;
60
+ case 17:
61
+ this.message_private = "User request limit reached";
62
+ this.code_private = data.error.code;
63
+ break;
64
+ case 32:
65
+ this.message_private = "Page request limit reached";
66
+ this.code_private = data.error.code;
67
+ break;
68
+
69
+ // Publication Errors - Facebook
70
+ case 100:
71
+ this.message_private = "Invalid parameter";
72
+ this.code_private = data.error.code;
73
+ break;
74
+ case 1487851:
75
+ this.message_private = "Too many URLs in the post message";
76
+ this.code_private = data.error.code;
77
+ break;
78
+ case 368:
79
+ this.message_private =
80
+ "The action attempted has been deemed abusive or is otherwise disallowed";
81
+ this.code_private = data.error.code;
82
+ break;
83
+ case 506:
84
+ this.message_private = "Duplicate post content";
85
+ this.code_private = data.error.code;
86
+ break;
87
+ case 1000:
88
+ this.message_private =
89
+ "Application does not have permission for this action";
90
+ this.code_private = data.error.code;
91
+ break;
92
+ case 1297001:
93
+ this.message_private = "Content type is not supported";
94
+ this.code_private = data.error.code;
95
+ break;
96
+ case 324:
97
+ this.message_private = "Missing or invalid image file";
98
+ this.code_private = data.error.code;
99
+ break;
100
+ case 500:
101
+ this.message_private = "Service error. Try again later.";
102
+ this.code_private = data.error.code;
103
+ break;
104
+ case 1157:
105
+ this.message_private = "Unsupported post request";
106
+ this.code_private = data.error.code;
107
+ break;
108
+ case 36:
109
+ this.message_private = "Upload request limit reached";
110
+ this.code_private = data.error.code;
111
+ break;
112
+
113
+ // Publication Errors - Instagram
114
+ case 9007:
115
+ this.message_private =
116
+ "The media is not ready for publishing, please wait for a moment";
117
+ this.code_private = data.error.code;
118
+ break;
119
+ case 9008:
120
+ this.message_private = "The image aspect ratio is too wide";
121
+ this.code_private = data.error.code;
122
+ break;
123
+ case 10901:
124
+ this.message_private = "Video too long for Instagram";
125
+ this.code_private = data.error.code;
126
+ break;
127
+ case 352:
128
+ this.message_private = "Instagram account not eligible";
129
+ this.code_private = data.error.code;
130
+ break;
131
+ case 24:
132
+ this.message_private =
133
+ "Error attaching Instagram accounts (permissions or rate limit issue)";
134
+ this.code_private = data.error.code;
135
+ break;
136
+ case 10900:
137
+ this.message_private =
138
+ "Instagram media post not allowing tagged users";
139
+ this.code_private = data.error.code;
140
+ break;
141
+ case 9001:
142
+ this.message_private =
143
+ "Instagram account already has the maximum number of posts in progress";
144
+ this.code_private = data.error.code;
145
+ break;
146
+ case 10902:
147
+ this.message_private = "Instagram media type not supported";
148
+ this.code_private = data.error.code;
149
+ break;
150
+ case 2207:
151
+ this.message_private = "Invalid Instagram media URL or ID";
152
+ this.code_private = data.error.code;
153
+ break;
154
+ case 2500:
155
+ this.message_private = "Too many hashtags in the Instagram post";
156
+ this.code_private = data.error.code;
157
+ break;
158
+
159
+ // Content Policy Errors
160
+ case 369:
161
+ this.message_private =
162
+ "Invalid content: does not meet community standards";
163
+ this.code_private = data.error.code;
164
+ break;
165
+ case 370:
166
+ this.message_private =
167
+ "Restricted content: does not meet ad policies";
168
+ this.code_private = data.error.code;
169
+ break;
170
+ case 372:
171
+ this.message_private = "Content contains prohibited terms";
172
+ this.code_private = data.error.code;
173
+ break;
174
+
175
+ // Business Errors
176
+ case 33:
177
+ this.message_private = "Business request limit reached";
178
+ this.code_private = data.error.code;
179
+ break;
180
+ case 803:
181
+ this.message_private = "Ad account cannot be used";
182
+ this.code_private = data.error.code;
183
+ break;
184
+
185
+ default:
186
+ this.message_private =
187
+ data.error.message || "Error communicating with the target";
188
+ this.code_private = data.error.code || 500;
189
+ }
190
+ } else if (error instanceof OperandError) {
191
+ this.message_private = error.message;
192
+ this.code_private = error.code;
193
+ } else {
194
+ this.message_private = message || "Unknown error occurred";
195
+ this.code_private = 500;
196
+ }
197
+ }
198
+
199
+ constructor(...data: any) {
200
+ this.parseMetaError(...data);
201
+
202
+ console.error(
203
+ JSON.stringify({
204
+ message: this.message,
205
+ code: this.code,
206
+ }),
207
+ );
208
+ }
209
+
210
+ get message() {
211
+ return this.message_private;
212
+ }
213
+
214
+ get code() {
215
+ return this.code_private;
216
+ }
217
+ }
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { MetaAuth } from "./modules/auth/meta-auth";
2
+ import { MetaPage } from "./modules/meta-page";
3
+ import { MetaIng } from "./modules/meta-ing";
4
+ import { MetaMkt } from "./modules/meta-mkt";
5
+ import { OperandError } from "./error/operand-error";
6
+ import * as IMetaAuth from "./interfaces/meta-auth";
7
+ import * as IMetaPage from "./interfaces/page-publish";
8
+ import * as IMetaIng from "./interfaces/ing-publish";
9
+ import * as IMetaResponse from "./interfaces/meta-response";
10
+
11
+ export {
12
+ MetaAuth,
13
+ MetaPage,
14
+ MetaIng,
15
+ MetaMkt,
16
+ OperandError,
17
+ IMetaAuth,
18
+ IMetaPage,
19
+ IMetaIng,
20
+ IMetaResponse,
21
+ };
@@ -0,0 +1,58 @@
1
+ import { ConstructorMain } from "./meta";
2
+
3
+ export interface ConstructorIng extends ConstructorMain {
4
+ ingId: string;
5
+ typeToken?: "fb" | "ig";
6
+ }
7
+
8
+ export type PhotoMediaItem = {
9
+ mediaType: "photo";
10
+ source: "url";
11
+ value: string;
12
+ };
13
+
14
+ export type VideoMediaItem = {
15
+ mediaType: "video";
16
+ source: "url" | "path";
17
+ value: string;
18
+ };
19
+
20
+ export type Medias = PhotoMediaItem | VideoMediaItem;
21
+
22
+ export interface UserTag {
23
+ username: string;
24
+ x?: number;
25
+ y?: number;
26
+ }
27
+
28
+ export type CreatePost = {
29
+ medias: Medias[];
30
+ caption?: string;
31
+ coverUrl?: string;
32
+ thumbOffset?: number;
33
+ userTags?: UserTag[];
34
+ collaborators?: string[];
35
+ };
36
+
37
+ export type CreatePhotoStory = Medias & { userTags?: UserTag[] };
38
+
39
+ export type CreateVideoStory = Medias & { userTags?: UserTag[] };
40
+
41
+ export type CreateStories = Medias & { userTags?: UserTag[] };
42
+
43
+ export interface IIngPublish {
44
+ createPost(data: CreatePost): Promise<string>;
45
+ createStories(data: CreateStories): Promise<string>;
46
+ getLinkPost(id: string): Promise<string>;
47
+ }
48
+
49
+ export interface saveMediaInMetaIngContainer {
50
+ value: string;
51
+ to: "REELS" | "STORIES" | "FEED";
52
+ isCarouselItem?: boolean;
53
+ caption?: string;
54
+ coverUrl?: string;
55
+ thumbOffset?: number;
56
+ userTags?: UserTag[];
57
+ collaborators?: string[];
58
+ }
@@ -0,0 +1,52 @@
1
+ export type ApiVersion =
2
+ | "v17.0"
3
+ | "v18.0"
4
+ | "v19.0"
5
+ | "v20.0"
6
+ | "v21.0"
7
+ | "v22.0"
8
+ | "v23.0";
9
+
10
+ export type CreateMetaAuth = {
11
+ client_id: string;
12
+ client_secret: string;
13
+ redirect_uri?: string;
14
+ apiVersion: ApiVersion;
15
+ code: string;
16
+ };
17
+
18
+ export type FieldsPage = Array<
19
+ | "id"
20
+ | "name"
21
+ | "about"
22
+ | "category"
23
+ | "category_list"
24
+ | "location"
25
+ | "fan_count"
26
+ | "access_token"
27
+ | "tasks"
28
+ | "picture"
29
+ | "cover"
30
+ | "photos"
31
+ | "videos"
32
+ | "engagement"
33
+ | "is_published"
34
+ | "is_verified"
35
+ | "verification_status"
36
+ | "website"
37
+ | "emails"
38
+ | "phone"
39
+ | "instagram_business_account"
40
+ | "hours"
41
+ | "created_time"
42
+ | "bio"
43
+ | "link"
44
+ | "business"
45
+ | string
46
+ >;
47
+
48
+ export type GetAccounts = {
49
+ fields: FieldsPage;
50
+ accessToken: string;
51
+ apiVersion: ApiVersion;
52
+ };
@@ -0,0 +1,5 @@
1
+ import { ConstructorMain } from "./meta";
2
+
3
+ export interface ConstructorMkt extends ConstructorMain {
4
+ adAAccountId: string;
5
+ }
@@ -0,0 +1,319 @@
1
+ export interface PagePost {
2
+ created_time: string;
3
+ message: string;
4
+ id: string;
5
+ }
6
+
7
+ export interface PaginationCursors {
8
+ before?: string;
9
+ after?: string;
10
+ }
11
+
12
+ export interface PaginationInfo {
13
+ cursors: PaginationCursors;
14
+ next?: string;
15
+ }
16
+
17
+ export interface GetPagePostsResponse {
18
+ data: PagePost[];
19
+ paging: PaginationInfo;
20
+ }
21
+
22
+ export interface CreatePagePostResponse {
23
+ id: string;
24
+ post_id?: string;
25
+ }
26
+
27
+ export interface UpdatePagePostResponse {
28
+ success: boolean;
29
+ }
30
+
31
+ export interface DeletePagePostResponse {
32
+ success: boolean;
33
+ }
34
+
35
+ export interface SaveMediaStorageResponse {
36
+ id: string;
37
+ }
38
+
39
+ export interface CreatePhotoStoriesResponse {
40
+ success: boolean;
41
+ post_id: string;
42
+ }
43
+
44
+ export interface CreateAccessTokenResponse {
45
+ access_token: string;
46
+ token_type: string;
47
+ }
48
+
49
+ export interface FacebookPage {
50
+ id: string;
51
+ name?: string;
52
+ about?: string;
53
+ category?: string;
54
+ category_list?: Array<{ id: string; name: string }>;
55
+ location?: {
56
+ city?: string;
57
+ country?: string;
58
+ latitude?: number;
59
+ longitude?: number;
60
+ street?: string;
61
+ zip?: string;
62
+ };
63
+ fan_count?: number;
64
+ access_token?: string;
65
+ tasks?: string[];
66
+ picture?: {
67
+ data: {
68
+ url: string;
69
+ width?: number;
70
+ height?: number;
71
+ is_silhouette?: boolean;
72
+ };
73
+ };
74
+ cover?: {
75
+ id: string;
76
+ source: string;
77
+ offset_y?: number;
78
+ offset_x?: number;
79
+ };
80
+ photos?: {
81
+ data: Array<{
82
+ id: string;
83
+ name?: string;
84
+ created_time?: string;
85
+ picture?: string;
86
+ }>;
87
+ };
88
+ videos?: {
89
+ data: Array<{
90
+ id: string;
91
+ title?: string;
92
+ description?: string;
93
+ picture?: string;
94
+ source?: string;
95
+ }>;
96
+ };
97
+ engagement?: {
98
+ count?: number;
99
+ social_sentence?: string;
100
+ };
101
+ is_published?: boolean;
102
+ is_verified?: boolean;
103
+ verification_status?: string;
104
+ website?: string;
105
+ emails?: string[];
106
+ phone?: string;
107
+ instagram_business_account?: {
108
+ id: string;
109
+ username: string;
110
+ name?: string;
111
+ picture?: string;
112
+ };
113
+ hours?: {
114
+ monday?: string;
115
+ tuesday?: string;
116
+ wednesday?: string;
117
+ thursday?: string;
118
+ friday?: string;
119
+ saturday?: string;
120
+ sunday?: string;
121
+ };
122
+ created_time?: string;
123
+ bio?: string;
124
+ link?: string;
125
+ business?: {
126
+ id: string;
127
+ name: string;
128
+ owned_ad_accounts?: {
129
+ id: string;
130
+ account_id: string;
131
+ name: string;
132
+ account_status?: number;
133
+ };
134
+ };
135
+ }
136
+
137
+ export interface InstagramAccount {
138
+ id: string;
139
+ username: string;
140
+ name: string;
141
+ followers_count: number;
142
+ picture?: string;
143
+ }
144
+
145
+ export interface FacebookAdAccount {
146
+ data: Array<{
147
+ account_id: string;
148
+ id: string;
149
+ }>;
150
+ paging: PaginationInfo;
151
+ }
152
+
153
+ export interface GetPageAccountsResponse {
154
+ data: Array<FacebookPage>;
155
+ paging: { cursors: PaginationCursors };
156
+ }
157
+
158
+ export interface CreateStartVideoUploadResponse {
159
+ video_id: string;
160
+ upload_url: string;
161
+ }
162
+
163
+ export interface CreateLoadingVideoUploadResponse {
164
+ success: boolean;
165
+ }
166
+
167
+ export interface CreateFinishVideoUploadResponse {
168
+ success: boolean;
169
+ message: string;
170
+ post_id: string;
171
+ }
172
+
173
+ export interface GetStatusMediaContainerDownloadResponse {
174
+ status_code: "FINISHED" | "ERROR" | "EXPIRED" | "IN_PROGRESS" | "PUBLISHED";
175
+ id: string;
176
+ }
177
+
178
+ export interface PostMediaContainerReelsResponse {
179
+ id: string;
180
+ uri: string;
181
+ }
182
+
183
+ export interface GetFollowersCountResponseCurrent {
184
+ followers_count: number;
185
+ id: string;
186
+ }
187
+
188
+ export interface Insights<T> {
189
+ name: string;
190
+ period: string;
191
+ values: T;
192
+ title: string;
193
+ description: string;
194
+ id: string;
195
+ total_value?: {
196
+ value: number;
197
+ };
198
+ }
199
+
200
+ export interface GetInsightsResponse {
201
+ data: Insights<
202
+ {
203
+ value: number;
204
+ end_time?: string;
205
+ }[]
206
+ >[];
207
+ paging: {
208
+ previous: string;
209
+ };
210
+ }
211
+
212
+ export interface GetInsightsPageFollowersAndUnFollowersResponse {
213
+ data: Insights<
214
+ {
215
+ value: {
216
+ follows: 100;
217
+ unfollows: 50;
218
+ };
219
+ end_time?: string;
220
+ }[]
221
+ >[];
222
+ paging: {
223
+ previous: string;
224
+ };
225
+ }
226
+
227
+ export interface GetInsightsPageActionsPostReactionsTotalResponse {
228
+ data: Insights<
229
+ {
230
+ value: {
231
+ like?: number;
232
+ love?: number;
233
+ wow?: number;
234
+ haha?: number;
235
+ sorry?: number;
236
+ anger?: number;
237
+ };
238
+ end_time?: string;
239
+ }[]
240
+ >[];
241
+ paging: {
242
+ previous: string;
243
+ };
244
+ }
245
+
246
+ export interface PostComment {
247
+ id: string;
248
+ message: string;
249
+ created_time: string;
250
+ from: {
251
+ id: string;
252
+ name: string;
253
+ };
254
+ }
255
+
256
+ export interface GetPostCommentsResponse {
257
+ data: PostComment[];
258
+ paging: PaginationInfo;
259
+ }
260
+
261
+ export interface AdMetrics {
262
+ reach: string;
263
+ date_start: string;
264
+ date_stop: string;
265
+ publisher_platform: string;
266
+ }
267
+
268
+ export interface AdMetricsResponse {
269
+ data: AdMetrics[];
270
+ paging?: PaginationInfo;
271
+ }
272
+
273
+ export interface GetStoriesPageResponse {
274
+ data: {
275
+ post_id: string;
276
+ status: string;
277
+ creation_time: string;
278
+ media_type: string;
279
+ media_id: string;
280
+ url: string;
281
+ }[];
282
+ }
283
+
284
+ export interface MetaError {
285
+ error: {
286
+ message: string;
287
+ type: string;
288
+ code: number;
289
+ fbtrace_id: string;
290
+ };
291
+ }
292
+
293
+ export interface GetAlongTokenMetaResponse {
294
+ access_token: string;
295
+ token_type: "bearer";
296
+ expires_in: number;
297
+ }
298
+
299
+ export interface BusinessDiscovery {
300
+ followers_count: number;
301
+ media_count: number;
302
+ picture: string;
303
+ id: string;
304
+ }
305
+
306
+ export interface GetInstagramDiscoveryResponse {
307
+ business_discovery: BusinessDiscovery;
308
+ id: string;
309
+ }
310
+
311
+ export interface GetInsightsAccountsEngagedResponse {
312
+ data: Insights<{
313
+ value: null;
314
+ }>[];
315
+ paging: {
316
+ previous: string;
317
+ next: string;
318
+ };
319
+ }
@@ -0,0 +1,7 @@
1
+ import { ApiVersion } from "./meta-auth";
2
+
3
+ export type ConstructorMain = {
4
+ pageAccessToken: string;
5
+ apiVersion: ApiVersion;
6
+ isInstagramApi?: boolean;
7
+ };