@brandwave/ts 0.0.3 → 0.0.5

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/index.d.ts CHANGED
@@ -1,3 +1,84 @@
1
+ import { PostgrestClient } from '@supabase/postgrest-js';
2
+
3
+ type Json = string | number | boolean | null | {
4
+ [key: string]: Json | undefined;
5
+ } | Json[];
6
+
7
+ /** @internal */
8
+ type DbClient = PostgrestClient<Record<string, unknown>>;
9
+ /**
10
+ * Base pagination parameters for list queries.
11
+ */
12
+ type PaginationParams = {
13
+ pageIndex: number;
14
+ pageSize: number;
15
+ };
16
+ /**
17
+ * Standard parameters for list queries with optional search, sorting, and result limiting.
18
+ * All list queries are scoped to an organization.
19
+ */
20
+ type ListQueryParams = PaginationParams & {
21
+ organizationId: string;
22
+ searchTerm?: string;
23
+ sortBy?: string;
24
+ sortDirection?: 'asc' | 'desc';
25
+ /** Limit results (useful for dropdowns/autocomplete) */
26
+ maxResults?: number;
27
+ };
28
+ /**
29
+ * Metadata included with list responses.
30
+ */
31
+ type ListMeta = {
32
+ description: string;
33
+ filters: Record<string, string | number>;
34
+ pagination?: {
35
+ pageIndex: number;
36
+ pageSize: number;
37
+ from: number;
38
+ to: number;
39
+ };
40
+ sorting?: {
41
+ sortBy: string;
42
+ sortDirection: 'asc' | 'desc';
43
+ };
44
+ };
45
+ /**
46
+ * Standard paginated result shape returned by list queries.
47
+ */
48
+ type ListResult<T> = {
49
+ items: Array<T>;
50
+ totalCount: number;
51
+ _meta: ListMeta;
52
+ };
53
+ /**
54
+ * Metadata included with single-item responses.
55
+ */
56
+ type ItemMeta = {
57
+ description: string;
58
+ filters: Record<string, string>;
59
+ };
60
+ /**
61
+ * Standard result shape for single-item queries.
62
+ */
63
+ type ItemResult<T> = {
64
+ data: T;
65
+ _meta: ItemMeta;
66
+ };
67
+ /**
68
+ * Metadata included with count responses.
69
+ */
70
+ type CountMeta = {
71
+ description: string;
72
+ filters: Record<string, string>;
73
+ };
74
+ /**
75
+ * Standard result shape for count queries.
76
+ */
77
+ type CountResult = {
78
+ count: number;
79
+ _meta: CountMeta;
80
+ };
81
+
1
82
  type AuthOptions = {
2
83
  apiKey: string;
3
84
  accessToken?: never;
@@ -18,16 +99,4190 @@ type BrandwaveOptions = AuthOptions & {
18
99
  * Create a Brandwave client instance.
19
100
  */
20
101
  declare const createBrandwave: (options: BrandwaveOptions) => {
102
+ /** Activity-related operations */
103
+ activities: ((params: {
104
+ id: string;
105
+ }) => Promise<{
106
+ data: {
107
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
108
+ attendeesCount: number | null;
109
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
110
+ contentCaption: string | null;
111
+ contentHref: string | null;
112
+ cost: number | null;
113
+ createdAt: string;
114
+ demosCount: number | null;
115
+ description: string | null;
116
+ endAt: string | null;
117
+ engagement: number | null;
118
+ engagementTier: number | null;
119
+ id: string;
120
+ leadsCount: number | null;
121
+ likeCount: number | null;
122
+ metricsLastRefreshedAt: string | null;
123
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
124
+ organizationId: string;
125
+ publishedAt: string | null;
126
+ reach: number | null;
127
+ reachCount: number | null;
128
+ reachEstimationSource: Json | null
129
+ reachTier: number | null;
130
+ replyCount: number | null;
131
+ response: number | null;
132
+ responseTier: number | null;
133
+ savesCount: number | null;
134
+ sharesCount: number | null;
135
+ startAt: string | null;
136
+ updatedAt: string;
137
+ viewsCount: number | null;
138
+ activityCosts: {
139
+ activityId: string;
140
+ amount: number | null;
141
+ contributorId: string | null;
142
+ createdAt: string;
143
+ currency: string;
144
+ description: string | null;
145
+ id: string;
146
+ organizationId: string;
147
+ type: string;
148
+ updatedAt: string;
149
+ }[];
150
+ };
151
+ _meta: {
152
+ description: string;
153
+ filters: {
154
+ id: string;
155
+ };
156
+ };
157
+ }>) & {
158
+ list: (params: PaginationParams & {
159
+ organizationId: string;
160
+ searchTerm?: string;
161
+ sortBy?: string;
162
+ sortDirection?: "asc" | "desc";
163
+ maxResults?: number;
164
+ } & {
165
+ contributorId?: string;
166
+ campaignId?: string;
167
+ }) => Promise<{
168
+ items: {
169
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
170
+ attendeesCount: number | null;
171
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
172
+ contentCaption: string | null;
173
+ contentHref: string | null;
174
+ cost: number | null;
175
+ createdAt: string;
176
+ demosCount: number | null;
177
+ description: string | null;
178
+ endAt: string | null;
179
+ engagement: number | null;
180
+ engagementTier: number | null;
181
+ id: string;
182
+ leadsCount: number | null;
183
+ likeCount: number | null;
184
+ metricsLastRefreshedAt: string | null;
185
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
186
+ organizationId: string;
187
+ publishedAt: string | null;
188
+ reach: number | null;
189
+ reachCount: number | null;
190
+ reachEstimationSource: Json | null
191
+ reachTier: number | null;
192
+ replyCount: number | null;
193
+ response: number | null;
194
+ responseTier: number | null;
195
+ savesCount: number | null;
196
+ sharesCount: number | null;
197
+ startAt: string | null;
198
+ updatedAt: string;
199
+ viewsCount: number | null;
200
+ activityContributors: {
201
+ activityId: string;
202
+ contributorId: string;
203
+ createdAt: string;
204
+ id: string;
205
+ organizationId: string;
206
+ updatedAt: string;
207
+ contributor: {
208
+ activitiesCount: number | null;
209
+ costPerThousandEngagement: number | null;
210
+ costPerThousandReach: number | null;
211
+ costPerThousandResponse: number | null;
212
+ countryCode: string | null;
213
+ createdAt: string;
214
+ id: string;
215
+ name: string;
216
+ organizationId: string;
217
+ role: "person" | "community" | "brand_partner";
218
+ totalActivitiesCost: {
219
+ sum: number;
220
+ }[];
221
+ totalEngagement: number | null;
222
+ totalFollowersCount: number | null;
223
+ totalReach: number | null;
224
+ totalResponse: number | null;
225
+ updatedAt: string;
226
+ instagramAccounts: {
227
+ contributorId: string;
228
+ createdAt: string;
229
+ id: string;
230
+ instagramAccountId: string;
231
+ organizationId: string;
232
+ updatedAt: string;
233
+ instagramAccount: {
234
+ avatarUrl: string | null;
235
+ bio: string | null;
236
+ businessAccount: boolean | null;
237
+ businessCategoryName: string | null;
238
+ createdAt: string;
239
+ externalUrl: string | null;
240
+ facebookId: string | null;
241
+ followersCount: number | null;
242
+ followsCount: number | null;
243
+ fullName: string | null;
244
+ hasChannel: boolean | null;
245
+ highlightReelCount: number | null;
246
+ id: string;
247
+ igtvVideoCount: number | null;
248
+ instagramId: string | null;
249
+ joinedRecently: boolean | null;
250
+ lastRefreshedAt: string | null;
251
+ postsCount: number | null;
252
+ private: boolean | null;
253
+ status: "pending" | "completed" | "failed" | "refreshing";
254
+ updatedAt: string;
255
+ username: string | null;
256
+ verified: boolean | null;
257
+ };
258
+ }[];
259
+ youtubeAccounts: {
260
+ contributorId: string;
261
+ createdAt: string;
262
+ id: string;
263
+ organizationId: string;
264
+ updatedAt: string;
265
+ youtubeAccountId: string;
266
+ youtubeAccount: {
267
+ ageRestricted: boolean | null;
268
+ avatarUrl: string | null;
269
+ channelDescription: string | null;
270
+ channelId: string | null;
271
+ channelLocation: string | null;
272
+ channelName: string | null;
273
+ channelUrl: string | null;
274
+ createdAt: string;
275
+ id: string;
276
+ joinedDate: string | null;
277
+ lastRefreshedAt: string | null;
278
+ status: "pending" | "completed" | "failed" | "refreshing";
279
+ subscribersCount: number | null;
280
+ updatedAt: string;
281
+ username: string | null;
282
+ verified: boolean | null;
283
+ videosCount: number | null;
284
+ viewsCount: number | null;
285
+ };
286
+ }[];
287
+ tiktokAccounts: {
288
+ contributorId: string;
289
+ createdAt: string;
290
+ id: string;
291
+ organizationId: string;
292
+ tiktokAccountId: string;
293
+ updatedAt: string;
294
+ tiktokAccount: {
295
+ avatarUrl: string | null;
296
+ bioLink: string | null;
297
+ commerceCategory: string | null;
298
+ commerceUser: boolean | null;
299
+ createdAt: string;
300
+ digg: number | null;
301
+ fans: number | null;
302
+ following: number | null;
303
+ friends: number | null;
304
+ heart: number | null;
305
+ id: string;
306
+ lastRefreshedAt: string | null;
307
+ name: string | null;
308
+ nickName: string | null;
309
+ privateAccount: boolean | null;
310
+ profileUrl: string | null;
311
+ roomId: string | null;
312
+ signature: string | null;
313
+ status: "pending" | "completed" | "failed" | "refreshing";
314
+ tiktokId: string | null;
315
+ ttSeller: boolean | null;
316
+ updatedAt: string;
317
+ verified: boolean | null;
318
+ video: number | null;
319
+ };
320
+ }[];
321
+ twitterAccounts: {
322
+ contributorId: string;
323
+ createdAt: string;
324
+ id: string;
325
+ organizationId: string;
326
+ twitterAccountId: string;
327
+ updatedAt: string;
328
+ twitterAccount: {
329
+ avatarUrl: string | null;
330
+ coverImage: string | null;
331
+ createdAt: string;
332
+ description: string | null;
333
+ followersCount: number | null;
334
+ friendsCount: number | null;
335
+ id: string;
336
+ isBlueVerified: boolean | null;
337
+ lastRefreshedAt: string | null;
338
+ mediaCount: number | null;
339
+ name: string | null;
340
+ screenName: string | null;
341
+ status: "pending" | "completed" | "failed" | "refreshing";
342
+ statusesCount: number | null;
343
+ twitterId: string | null;
344
+ updatedAt: string;
345
+ verified: boolean | null;
346
+ };
347
+ }[];
348
+ linkedinAccounts: {
349
+ contributorId: string;
350
+ createdAt: string;
351
+ id: string;
352
+ linkedinAccountId: string;
353
+ organizationId: string;
354
+ updatedAt: string;
355
+ linkedinAccount: {
356
+ about: string | null;
357
+ avatarUrl: string | null;
358
+ connectionsCount: number | null;
359
+ coverImageUrl: string | null;
360
+ createdAt: string;
361
+ firstName: string | null;
362
+ followerCount: number | null;
363
+ headline: string | null;
364
+ id: string;
365
+ lastName: string | null;
366
+ lastRefreshedAt: string | null;
367
+ linkedinId: string | null;
368
+ publicIdentifier: string | null;
369
+ status: "pending" | "completed" | "failed" | "refreshing";
370
+ updatedAt: string;
371
+ };
372
+ }[];
373
+ redditAccounts: {
374
+ contributorId: string;
375
+ createdAt: string;
376
+ id: string;
377
+ organizationId: string;
378
+ redditAccountId: string;
379
+ updatedAt: string;
380
+ redditAccount: {
381
+ avatarUrl: string | null;
382
+ bannerUrl: string | null;
383
+ bio: string | null;
384
+ commentKarma: number | null;
385
+ createdAt: string;
386
+ displayName: string | null;
387
+ id: string;
388
+ isPremium: boolean | null;
389
+ isVerified: boolean | null;
390
+ lastRefreshedAt: string | null;
391
+ postKarma: number | null;
392
+ redditId: string | null;
393
+ status: "pending" | "completed" | "failed" | "refreshing";
394
+ totalKarma: number | null;
395
+ updatedAt: string;
396
+ username: string | null;
397
+ };
398
+ }[];
399
+ };
400
+ }[];
401
+ activityCosts: {
402
+ activityId: string;
403
+ amount: number | null;
404
+ contributorId: string | null;
405
+ createdAt: string;
406
+ currency: string;
407
+ description: string | null;
408
+ id: string;
409
+ organizationId: string;
410
+ type: string;
411
+ updatedAt: string;
412
+ }[];
413
+ campaignActivities: {
414
+ activityId: string;
415
+ campaignId: string;
416
+ createdAt: string;
417
+ id: string;
418
+ organizationId: string;
419
+ updatedAt: string;
420
+ } | null;
421
+ }[];
422
+ totalCount: number;
423
+ _meta: {
424
+ description: string;
425
+ filters: Record<string, string | number>;
426
+ pagination: {
427
+ pageIndex: number;
428
+ pageSize: number;
429
+ from: number;
430
+ to: number;
431
+ };
432
+ sorting: {
433
+ sortBy: string;
434
+ sortDirection: "asc" | "desc";
435
+ };
436
+ };
437
+ }>;
438
+ count: (params: {
439
+ organizationId: string;
440
+ contributorId?: string;
441
+ campaignId?: string;
442
+ }) => Promise<{
443
+ count: number;
444
+ _meta: {
445
+ description: string;
446
+ filters: Record<string, string>;
447
+ };
448
+ }>;
449
+ contributors: {
450
+ list: (params: PaginationParams & {
451
+ organizationId: string;
452
+ activityId: string;
453
+ maxResults?: number;
454
+ }) => Promise<{
455
+ items: {
456
+ activityId: string;
457
+ contributorId: string;
458
+ createdAt: string;
459
+ id: string;
460
+ organizationId: string;
461
+ updatedAt: string;
462
+ contributor: {
463
+ activitiesCount: number | null;
464
+ costPerThousandEngagement: number | null;
465
+ costPerThousandReach: number | null;
466
+ costPerThousandResponse: number | null;
467
+ countryCode: string | null;
468
+ createdAt: string;
469
+ id: string;
470
+ name: string;
471
+ organizationId: string;
472
+ role: "person" | "community" | "brand_partner";
473
+ totalActivitiesCost: {
474
+ sum: number;
475
+ }[];
476
+ totalEngagement: number | null;
477
+ totalFollowersCount: number | null;
478
+ totalReach: number | null;
479
+ totalResponse: number | null;
480
+ updatedAt: string;
481
+ instagramAccounts: {
482
+ contributorId: string;
483
+ createdAt: string;
484
+ id: string;
485
+ instagramAccountId: string;
486
+ organizationId: string;
487
+ updatedAt: string;
488
+ instagramAccount: {
489
+ avatarUrl: string | null;
490
+ bio: string | null;
491
+ businessAccount: boolean | null;
492
+ businessCategoryName: string | null;
493
+ createdAt: string;
494
+ externalUrl: string | null;
495
+ facebookId: string | null;
496
+ followersCount: number | null;
497
+ followsCount: number | null;
498
+ fullName: string | null;
499
+ hasChannel: boolean | null;
500
+ highlightReelCount: number | null;
501
+ id: string;
502
+ igtvVideoCount: number | null;
503
+ instagramId: string | null;
504
+ joinedRecently: boolean | null;
505
+ lastRefreshedAt: string | null;
506
+ postsCount: number | null;
507
+ private: boolean | null;
508
+ status: "pending" | "completed" | "failed" | "refreshing";
509
+ updatedAt: string;
510
+ username: string | null;
511
+ verified: boolean | null;
512
+ };
513
+ }[];
514
+ youtubeAccounts: {
515
+ contributorId: string;
516
+ createdAt: string;
517
+ id: string;
518
+ organizationId: string;
519
+ updatedAt: string;
520
+ youtubeAccountId: string;
521
+ youtubeAccount: {
522
+ ageRestricted: boolean | null;
523
+ avatarUrl: string | null;
524
+ channelDescription: string | null;
525
+ channelId: string | null;
526
+ channelLocation: string | null;
527
+ channelName: string | null;
528
+ channelUrl: string | null;
529
+ createdAt: string;
530
+ id: string;
531
+ joinedDate: string | null;
532
+ lastRefreshedAt: string | null;
533
+ status: "pending" | "completed" | "failed" | "refreshing";
534
+ subscribersCount: number | null;
535
+ updatedAt: string;
536
+ username: string | null;
537
+ verified: boolean | null;
538
+ videosCount: number | null;
539
+ viewsCount: number | null;
540
+ };
541
+ }[];
542
+ tiktokAccounts: {
543
+ contributorId: string;
544
+ createdAt: string;
545
+ id: string;
546
+ organizationId: string;
547
+ tiktokAccountId: string;
548
+ updatedAt: string;
549
+ tiktokAccount: {
550
+ avatarUrl: string | null;
551
+ bioLink: string | null;
552
+ commerceCategory: string | null;
553
+ commerceUser: boolean | null;
554
+ createdAt: string;
555
+ digg: number | null;
556
+ fans: number | null;
557
+ following: number | null;
558
+ friends: number | null;
559
+ heart: number | null;
560
+ id: string;
561
+ lastRefreshedAt: string | null;
562
+ name: string | null;
563
+ nickName: string | null;
564
+ privateAccount: boolean | null;
565
+ profileUrl: string | null;
566
+ roomId: string | null;
567
+ signature: string | null;
568
+ status: "pending" | "completed" | "failed" | "refreshing";
569
+ tiktokId: string | null;
570
+ ttSeller: boolean | null;
571
+ updatedAt: string;
572
+ verified: boolean | null;
573
+ video: number | null;
574
+ };
575
+ }[];
576
+ twitterAccounts: {
577
+ contributorId: string;
578
+ createdAt: string;
579
+ id: string;
580
+ organizationId: string;
581
+ twitterAccountId: string;
582
+ updatedAt: string;
583
+ twitterAccount: {
584
+ avatarUrl: string | null;
585
+ coverImage: string | null;
586
+ createdAt: string;
587
+ description: string | null;
588
+ followersCount: number | null;
589
+ friendsCount: number | null;
590
+ id: string;
591
+ isBlueVerified: boolean | null;
592
+ lastRefreshedAt: string | null;
593
+ mediaCount: number | null;
594
+ name: string | null;
595
+ screenName: string | null;
596
+ status: "pending" | "completed" | "failed" | "refreshing";
597
+ statusesCount: number | null;
598
+ twitterId: string | null;
599
+ updatedAt: string;
600
+ verified: boolean | null;
601
+ };
602
+ }[];
603
+ linkedinAccounts: {
604
+ contributorId: string;
605
+ createdAt: string;
606
+ id: string;
607
+ linkedinAccountId: string;
608
+ organizationId: string;
609
+ updatedAt: string;
610
+ linkedinAccount: {
611
+ about: string | null;
612
+ avatarUrl: string | null;
613
+ connectionsCount: number | null;
614
+ coverImageUrl: string | null;
615
+ createdAt: string;
616
+ firstName: string | null;
617
+ followerCount: number | null;
618
+ headline: string | null;
619
+ id: string;
620
+ lastName: string | null;
621
+ lastRefreshedAt: string | null;
622
+ linkedinId: string | null;
623
+ publicIdentifier: string | null;
624
+ status: "pending" | "completed" | "failed" | "refreshing";
625
+ updatedAt: string;
626
+ };
627
+ }[];
628
+ redditAccounts: {
629
+ contributorId: string;
630
+ createdAt: string;
631
+ id: string;
632
+ organizationId: string;
633
+ redditAccountId: string;
634
+ updatedAt: string;
635
+ redditAccount: {
636
+ avatarUrl: string | null;
637
+ bannerUrl: string | null;
638
+ bio: string | null;
639
+ commentKarma: number | null;
640
+ createdAt: string;
641
+ displayName: string | null;
642
+ id: string;
643
+ isPremium: boolean | null;
644
+ isVerified: boolean | null;
645
+ lastRefreshedAt: string | null;
646
+ postKarma: number | null;
647
+ redditId: string | null;
648
+ status: "pending" | "completed" | "failed" | "refreshing";
649
+ totalKarma: number | null;
650
+ updatedAt: string;
651
+ username: string | null;
652
+ };
653
+ }[];
654
+ };
655
+ }[];
656
+ totalCount: number;
657
+ _meta: {
658
+ description: string;
659
+ filters: Record<string, string | number>;
660
+ pagination: {
661
+ pageIndex: number;
662
+ pageSize: number;
663
+ from: number;
664
+ to: number;
665
+ };
666
+ };
667
+ }>;
668
+ count: (params: {
669
+ organizationId: string;
670
+ activityId: string;
671
+ }) => Promise<{
672
+ count: number;
673
+ _meta: {
674
+ description: string;
675
+ filters: {
676
+ organizationId: string;
677
+ activityId: string;
678
+ };
679
+ };
680
+ }>;
681
+ };
682
+ metrics: {
683
+ history: (params: {
684
+ activityId: string;
685
+ startDateKey?: string | null;
686
+ maxResults?: number;
687
+ }) => Promise<{
688
+ items: {
689
+ recordedDate: string;
690
+ reach: number | null;
691
+ engagement: number | null;
692
+ response: number | null;
693
+ reachTier: number | null;
694
+ engagementTier: number | null;
695
+ responseTier: number | null;
696
+ }[];
697
+ totalCount: number;
698
+ _meta: {
699
+ description: string;
700
+ filters: Record<string, string | number>;
701
+ };
702
+ }>;
703
+ confidence: (params: {
704
+ organizationId: string;
705
+ startDate?: string | null;
706
+ endDate?: string | null;
707
+ }) => Promise<{
708
+ data: {
709
+ activityCount: number;
710
+ confidenceScore: number;
711
+ engagementConfidenceScore: number;
712
+ engagementPctActual: number;
713
+ pctActual: number;
714
+ pctEngagementEstimated: number;
715
+ pctFollowerEstimated: number;
716
+ responseConfidenceScore: number;
717
+ responsePctActual: number;
718
+ totalEngagement: number;
719
+ totalReach: number;
720
+ totalResponse: number;
721
+ } | null;
722
+ _meta: {
723
+ description: string;
724
+ filters: Record<string, string>;
725
+ };
726
+ }>;
727
+ };
728
+ sparklines: {
729
+ list: (params: {
730
+ organizationId: string;
731
+ activityIds: Array<string>;
732
+ }) => Promise<{
733
+ items: never[];
734
+ totalCount: number;
735
+ _meta: {
736
+ description: string;
737
+ filters: {
738
+ organizationId: string;
739
+ activityCount?: undefined;
740
+ };
741
+ };
742
+ } | {
743
+ items: {
744
+ activity_id: string;
745
+ engagement: number;
746
+ reach: number;
747
+ recorded_date: string;
748
+ response: number;
749
+ }[];
750
+ totalCount: number;
751
+ _meta: {
752
+ description: string;
753
+ filters: {
754
+ organizationId: string;
755
+ activityCount: number;
756
+ };
757
+ };
758
+ }>;
759
+ };
760
+ };
761
+ /** Campaign-related operations */
762
+ campaigns: ((params: {
763
+ id: string;
764
+ }) => Promise<{
765
+ data: {
766
+ activitiesCount: {
767
+ count: number;
768
+ }[];
769
+ budget: number | null;
770
+ cost: number | null;
771
+ costPerThousandEngagement: number | null;
772
+ costPerThousandReach: number | null;
773
+ costPerThousandResponse: number | null;
774
+ createdAt: string;
775
+ endAt: string | null;
776
+ id: string;
777
+ name: string;
778
+ organizationId: string;
779
+ startAt: string | null;
780
+ totalEngagement: number | null;
781
+ totalReach: number | null;
782
+ totalResponse: number | null;
783
+ updatedAt: string;
784
+ campaignActivities: {
785
+ id: string;
786
+ activityId: string;
787
+ activities: {
788
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
789
+ attendeesCount: number | null;
790
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
791
+ contentCaption: string | null;
792
+ contentHref: string | null;
793
+ cost: number | null;
794
+ createdAt: string;
795
+ demosCount: number | null;
796
+ description: string | null;
797
+ endAt: string | null;
798
+ engagement: number | null;
799
+ engagementTier: number | null;
800
+ id: string;
801
+ leadsCount: number | null;
802
+ likeCount: number | null;
803
+ metricsLastRefreshedAt: string | null;
804
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
805
+ organizationId: string;
806
+ publishedAt: string | null;
807
+ reach: number | null;
808
+ reachCount: number | null;
809
+ reachEstimationSource: Json | null
810
+ reachTier: number | null;
811
+ replyCount: number | null;
812
+ response: number | null;
813
+ responseTier: number | null;
814
+ savesCount: number | null;
815
+ sharesCount: number | null;
816
+ startAt: string | null;
817
+ updatedAt: string;
818
+ viewsCount: number | null;
819
+ };
820
+ }[];
821
+ };
822
+ _meta: {
823
+ description: string;
824
+ filters: {
825
+ id: string;
826
+ };
827
+ };
828
+ }>) & {
829
+ list: (params: ListQueryParams) => Promise<{
830
+ items: {
831
+ activitiesCount: number | null;
832
+ budget: number | null;
833
+ cost: number | null;
834
+ costPerThousandEngagement: number | null;
835
+ costPerThousandReach: number | null;
836
+ costPerThousandResponse: number | null;
837
+ createdAt: string;
838
+ endAt: string | null;
839
+ id: string;
840
+ name: string;
841
+ organizationId: string;
842
+ startAt: string | null;
843
+ totalEngagement: number | null;
844
+ totalReach: number | null;
845
+ totalResponse: number | null;
846
+ updatedAt: string;
847
+ }[];
848
+ totalCount: number;
849
+ _meta: {
850
+ description: string;
851
+ filters: Record<string, string | number>;
852
+ pagination: {
853
+ pageIndex: number;
854
+ pageSize: number;
855
+ from: number;
856
+ to: number;
857
+ };
858
+ sorting: {
859
+ sortBy: string;
860
+ sortDirection: "asc" | "desc";
861
+ };
862
+ };
863
+ }>;
864
+ };
865
+ /** Contributor-related operations */
866
+ contributors: ((params: {
867
+ id: string;
868
+ }) => Promise<{
869
+ data: {
870
+ activitiesCount: {
871
+ count: number;
872
+ }[];
873
+ costPerThousandEngagement: number | null;
874
+ costPerThousandReach: number | null;
875
+ costPerThousandResponse: number | null;
876
+ countryCode: string | null;
877
+ createdAt: string;
878
+ id: string;
879
+ name: string;
880
+ organizationId: string;
881
+ role: "person" | "community" | "brand_partner";
882
+ totalActivitiesCost: {
883
+ sum: number;
884
+ }[];
885
+ totalEngagement: number | null;
886
+ totalFollowersCount: number | null;
887
+ totalReach: number | null;
888
+ totalResponse: number | null;
889
+ updatedAt: string;
890
+ instagramAccounts: {
891
+ contributorId: string;
892
+ createdAt: string;
893
+ id: string;
894
+ instagramAccountId: string;
895
+ organizationId: string;
896
+ updatedAt: string;
897
+ instagramAccount: {
898
+ avatarUrl: string | null;
899
+ bio: string | null;
900
+ businessAccount: boolean | null;
901
+ businessCategoryName: string | null;
902
+ createdAt: string;
903
+ externalUrl: string | null;
904
+ facebookId: string | null;
905
+ followersCount: number | null;
906
+ followsCount: number | null;
907
+ fullName: string | null;
908
+ hasChannel: boolean | null;
909
+ highlightReelCount: number | null;
910
+ id: string;
911
+ igtvVideoCount: number | null;
912
+ instagramId: string | null;
913
+ joinedRecently: boolean | null;
914
+ lastRefreshedAt: string | null;
915
+ postsCount: number | null;
916
+ private: boolean | null;
917
+ status: "pending" | "completed" | "failed" | "refreshing";
918
+ updatedAt: string;
919
+ username: string | null;
920
+ verified: boolean | null;
921
+ };
922
+ }[];
923
+ youtubeAccounts: {
924
+ contributorId: string;
925
+ createdAt: string;
926
+ id: string;
927
+ organizationId: string;
928
+ updatedAt: string;
929
+ youtubeAccountId: string;
930
+ youtubeAccount: {
931
+ ageRestricted: boolean | null;
932
+ avatarUrl: string | null;
933
+ channelDescription: string | null;
934
+ channelId: string | null;
935
+ channelLocation: string | null;
936
+ channelName: string | null;
937
+ channelUrl: string | null;
938
+ createdAt: string;
939
+ id: string;
940
+ joinedDate: string | null;
941
+ lastRefreshedAt: string | null;
942
+ status: "pending" | "completed" | "failed" | "refreshing";
943
+ subscribersCount: number | null;
944
+ updatedAt: string;
945
+ username: string | null;
946
+ verified: boolean | null;
947
+ videosCount: number | null;
948
+ viewsCount: number | null;
949
+ };
950
+ }[];
951
+ tiktokAccounts: {
952
+ contributorId: string;
953
+ createdAt: string;
954
+ id: string;
955
+ organizationId: string;
956
+ tiktokAccountId: string;
957
+ updatedAt: string;
958
+ tiktokAccount: {
959
+ avatarUrl: string | null;
960
+ bioLink: string | null;
961
+ commerceCategory: string | null;
962
+ commerceUser: boolean | null;
963
+ createdAt: string;
964
+ digg: number | null;
965
+ fans: number | null;
966
+ following: number | null;
967
+ friends: number | null;
968
+ heart: number | null;
969
+ id: string;
970
+ lastRefreshedAt: string | null;
971
+ name: string | null;
972
+ nickName: string | null;
973
+ privateAccount: boolean | null;
974
+ profileUrl: string | null;
975
+ roomId: string | null;
976
+ signature: string | null;
977
+ status: "pending" | "completed" | "failed" | "refreshing";
978
+ tiktokId: string | null;
979
+ ttSeller: boolean | null;
980
+ updatedAt: string;
981
+ verified: boolean | null;
982
+ video: number | null;
983
+ };
984
+ }[];
985
+ twitterAccounts: {
986
+ contributorId: string;
987
+ createdAt: string;
988
+ id: string;
989
+ organizationId: string;
990
+ twitterAccountId: string;
991
+ updatedAt: string;
992
+ twitterAccount: {
993
+ avatarUrl: string | null;
994
+ coverImage: string | null;
995
+ createdAt: string;
996
+ description: string | null;
997
+ followersCount: number | null;
998
+ friendsCount: number | null;
999
+ id: string;
1000
+ isBlueVerified: boolean | null;
1001
+ lastRefreshedAt: string | null;
1002
+ mediaCount: number | null;
1003
+ name: string | null;
1004
+ screenName: string | null;
1005
+ status: "pending" | "completed" | "failed" | "refreshing";
1006
+ statusesCount: number | null;
1007
+ twitterId: string | null;
1008
+ updatedAt: string;
1009
+ verified: boolean | null;
1010
+ };
1011
+ }[];
1012
+ linkedinAccounts: {
1013
+ contributorId: string;
1014
+ createdAt: string;
1015
+ id: string;
1016
+ linkedinAccountId: string;
1017
+ organizationId: string;
1018
+ updatedAt: string;
1019
+ linkedinAccount: {
1020
+ about: string | null;
1021
+ avatarUrl: string | null;
1022
+ connectionsCount: number | null;
1023
+ coverImageUrl: string | null;
1024
+ createdAt: string;
1025
+ firstName: string | null;
1026
+ followerCount: number | null;
1027
+ headline: string | null;
1028
+ id: string;
1029
+ lastName: string | null;
1030
+ lastRefreshedAt: string | null;
1031
+ linkedinId: string | null;
1032
+ publicIdentifier: string | null;
1033
+ status: "pending" | "completed" | "failed" | "refreshing";
1034
+ updatedAt: string;
1035
+ };
1036
+ }[];
1037
+ redditAccounts: {
1038
+ contributorId: string;
1039
+ createdAt: string;
1040
+ id: string;
1041
+ organizationId: string;
1042
+ redditAccountId: string;
1043
+ updatedAt: string;
1044
+ redditAccount: {
1045
+ avatarUrl: string | null;
1046
+ bannerUrl: string | null;
1047
+ bio: string | null;
1048
+ commentKarma: number | null;
1049
+ createdAt: string;
1050
+ displayName: string | null;
1051
+ id: string;
1052
+ isPremium: boolean | null;
1053
+ isVerified: boolean | null;
1054
+ lastRefreshedAt: string | null;
1055
+ postKarma: number | null;
1056
+ redditId: string | null;
1057
+ status: "pending" | "completed" | "failed" | "refreshing";
1058
+ totalKarma: number | null;
1059
+ updatedAt: string;
1060
+ username: string | null;
1061
+ };
1062
+ }[];
1063
+ };
1064
+ _meta: {
1065
+ description: string;
1066
+ filters: {
1067
+ id: string;
1068
+ };
1069
+ };
1070
+ }>) & {
1071
+ list: (params: PaginationParams & {
1072
+ organizationId: string;
1073
+ searchTerm?: string;
1074
+ sortBy?: string;
1075
+ sortDirection?: "asc" | "desc";
1076
+ maxResults?: number;
1077
+ } & {
1078
+ activityId?: string;
1079
+ role?: "person" | "community" | "brand_partner";
1080
+ }) => Promise<{
1081
+ items: {
1082
+ activitiesCount: number | null;
1083
+ costPerThousandEngagement: number | null;
1084
+ costPerThousandReach: number | null;
1085
+ costPerThousandResponse: number | null;
1086
+ countryCode: string | null;
1087
+ createdAt: string;
1088
+ id: string;
1089
+ name: string;
1090
+ organizationId: string;
1091
+ role: "person" | "community" | "brand_partner";
1092
+ totalActivitiesCost: number | null;
1093
+ totalEngagement: number | null;
1094
+ totalFollowersCount: number | null;
1095
+ totalReach: number | null;
1096
+ totalResponse: number | null;
1097
+ updatedAt: string;
1098
+ instagramAccounts: {
1099
+ contributorId: string;
1100
+ createdAt: string;
1101
+ id: string;
1102
+ instagramAccountId: string;
1103
+ organizationId: string;
1104
+ updatedAt: string;
1105
+ instagramAccount: {
1106
+ avatarUrl: string | null;
1107
+ bio: string | null;
1108
+ businessAccount: boolean | null;
1109
+ businessCategoryName: string | null;
1110
+ createdAt: string;
1111
+ externalUrl: string | null;
1112
+ facebookId: string | null;
1113
+ followersCount: number | null;
1114
+ followsCount: number | null;
1115
+ fullName: string | null;
1116
+ hasChannel: boolean | null;
1117
+ highlightReelCount: number | null;
1118
+ id: string;
1119
+ igtvVideoCount: number | null;
1120
+ instagramId: string | null;
1121
+ joinedRecently: boolean | null;
1122
+ lastRefreshedAt: string | null;
1123
+ postsCount: number | null;
1124
+ private: boolean | null;
1125
+ status: "pending" | "completed" | "failed" | "refreshing";
1126
+ updatedAt: string;
1127
+ username: string | null;
1128
+ verified: boolean | null;
1129
+ };
1130
+ }[];
1131
+ youtubeAccounts: {
1132
+ contributorId: string;
1133
+ createdAt: string;
1134
+ id: string;
1135
+ organizationId: string;
1136
+ updatedAt: string;
1137
+ youtubeAccountId: string;
1138
+ youtubeAccount: {
1139
+ ageRestricted: boolean | null;
1140
+ avatarUrl: string | null;
1141
+ channelDescription: string | null;
1142
+ channelId: string | null;
1143
+ channelLocation: string | null;
1144
+ channelName: string | null;
1145
+ channelUrl: string | null;
1146
+ createdAt: string;
1147
+ id: string;
1148
+ joinedDate: string | null;
1149
+ lastRefreshedAt: string | null;
1150
+ status: "pending" | "completed" | "failed" | "refreshing";
1151
+ subscribersCount: number | null;
1152
+ updatedAt: string;
1153
+ username: string | null;
1154
+ verified: boolean | null;
1155
+ videosCount: number | null;
1156
+ viewsCount: number | null;
1157
+ };
1158
+ }[];
1159
+ tiktokAccounts: {
1160
+ contributorId: string;
1161
+ createdAt: string;
1162
+ id: string;
1163
+ organizationId: string;
1164
+ tiktokAccountId: string;
1165
+ updatedAt: string;
1166
+ tiktokAccount: {
1167
+ avatarUrl: string | null;
1168
+ bioLink: string | null;
1169
+ commerceCategory: string | null;
1170
+ commerceUser: boolean | null;
1171
+ createdAt: string;
1172
+ digg: number | null;
1173
+ fans: number | null;
1174
+ following: number | null;
1175
+ friends: number | null;
1176
+ heart: number | null;
1177
+ id: string;
1178
+ lastRefreshedAt: string | null;
1179
+ name: string | null;
1180
+ nickName: string | null;
1181
+ privateAccount: boolean | null;
1182
+ profileUrl: string | null;
1183
+ roomId: string | null;
1184
+ signature: string | null;
1185
+ status: "pending" | "completed" | "failed" | "refreshing";
1186
+ tiktokId: string | null;
1187
+ ttSeller: boolean | null;
1188
+ updatedAt: string;
1189
+ verified: boolean | null;
1190
+ video: number | null;
1191
+ };
1192
+ }[];
1193
+ twitterAccounts: {
1194
+ contributorId: string;
1195
+ createdAt: string;
1196
+ id: string;
1197
+ organizationId: string;
1198
+ twitterAccountId: string;
1199
+ updatedAt: string;
1200
+ twitterAccount: {
1201
+ avatarUrl: string | null;
1202
+ coverImage: string | null;
1203
+ createdAt: string;
1204
+ description: string | null;
1205
+ followersCount: number | null;
1206
+ friendsCount: number | null;
1207
+ id: string;
1208
+ isBlueVerified: boolean | null;
1209
+ lastRefreshedAt: string | null;
1210
+ mediaCount: number | null;
1211
+ name: string | null;
1212
+ screenName: string | null;
1213
+ status: "pending" | "completed" | "failed" | "refreshing";
1214
+ statusesCount: number | null;
1215
+ twitterId: string | null;
1216
+ updatedAt: string;
1217
+ verified: boolean | null;
1218
+ };
1219
+ }[];
1220
+ linkedinAccounts: {
1221
+ contributorId: string;
1222
+ createdAt: string;
1223
+ id: string;
1224
+ linkedinAccountId: string;
1225
+ organizationId: string;
1226
+ updatedAt: string;
1227
+ linkedinAccount: {
1228
+ about: string | null;
1229
+ avatarUrl: string | null;
1230
+ connectionsCount: number | null;
1231
+ coverImageUrl: string | null;
1232
+ createdAt: string;
1233
+ firstName: string | null;
1234
+ followerCount: number | null;
1235
+ headline: string | null;
1236
+ id: string;
1237
+ lastName: string | null;
1238
+ lastRefreshedAt: string | null;
1239
+ linkedinId: string | null;
1240
+ publicIdentifier: string | null;
1241
+ status: "pending" | "completed" | "failed" | "refreshing";
1242
+ updatedAt: string;
1243
+ };
1244
+ }[];
1245
+ redditAccounts: {
1246
+ contributorId: string;
1247
+ createdAt: string;
1248
+ id: string;
1249
+ organizationId: string;
1250
+ redditAccountId: string;
1251
+ updatedAt: string;
1252
+ redditAccount: {
1253
+ avatarUrl: string | null;
1254
+ bannerUrl: string | null;
1255
+ bio: string | null;
1256
+ commentKarma: number | null;
1257
+ createdAt: string;
1258
+ displayName: string | null;
1259
+ id: string;
1260
+ isPremium: boolean | null;
1261
+ isVerified: boolean | null;
1262
+ lastRefreshedAt: string | null;
1263
+ postKarma: number | null;
1264
+ redditId: string | null;
1265
+ status: "pending" | "completed" | "failed" | "refreshing";
1266
+ totalKarma: number | null;
1267
+ updatedAt: string;
1268
+ username: string | null;
1269
+ };
1270
+ }[];
1271
+ }[];
1272
+ totalCount: number;
1273
+ _meta: {
1274
+ description: string;
1275
+ filters: Record<string, string | number>;
1276
+ pagination: {
1277
+ pageIndex: number;
1278
+ pageSize: number;
1279
+ from: number;
1280
+ to: number;
1281
+ };
1282
+ sorting: {
1283
+ sortBy: string;
1284
+ sortDirection: "asc" | "desc";
1285
+ };
1286
+ };
1287
+ }>;
1288
+ };
1289
+ /** Cost-related operations */
1290
+ costs: {
1291
+ list: (params: PaginationParams & {
1292
+ organizationId: string;
1293
+ activityId: string;
1294
+ maxResults?: number;
1295
+ }) => Promise<{
1296
+ items: {
1297
+ activityId: string;
1298
+ amount: number | null;
1299
+ contributorId: string | null;
1300
+ createdAt: string;
1301
+ currency: string;
1302
+ description: string | null;
1303
+ id: string;
1304
+ organizationId: string;
1305
+ type: string;
1306
+ updatedAt: string;
1307
+ contributor: {
1308
+ activitiesCount: number | null;
1309
+ costPerThousandEngagement: number | null;
1310
+ costPerThousandReach: number | null;
1311
+ costPerThousandResponse: number | null;
1312
+ countryCode: string | null;
1313
+ createdAt: string;
1314
+ id: string;
1315
+ name: string;
1316
+ organizationId: string;
1317
+ role: "person" | "community" | "brand_partner";
1318
+ totalActivitiesCost: {
1319
+ sum: number;
1320
+ }[];
1321
+ totalEngagement: number | null;
1322
+ totalFollowersCount: number | null;
1323
+ totalReach: number | null;
1324
+ totalResponse: number | null;
1325
+ updatedAt: string;
1326
+ instagramAccounts: {
1327
+ contributorId: string;
1328
+ createdAt: string;
1329
+ id: string;
1330
+ instagramAccountId: string;
1331
+ organizationId: string;
1332
+ updatedAt: string;
1333
+ instagramAccount: {
1334
+ avatarUrl: string | null;
1335
+ bio: string | null;
1336
+ businessAccount: boolean | null;
1337
+ businessCategoryName: string | null;
1338
+ createdAt: string;
1339
+ externalUrl: string | null;
1340
+ facebookId: string | null;
1341
+ followersCount: number | null;
1342
+ followsCount: number | null;
1343
+ fullName: string | null;
1344
+ hasChannel: boolean | null;
1345
+ highlightReelCount: number | null;
1346
+ id: string;
1347
+ igtvVideoCount: number | null;
1348
+ instagramId: string | null;
1349
+ joinedRecently: boolean | null;
1350
+ lastRefreshedAt: string | null;
1351
+ postsCount: number | null;
1352
+ private: boolean | null;
1353
+ status: "pending" | "completed" | "failed" | "refreshing";
1354
+ updatedAt: string;
1355
+ username: string | null;
1356
+ verified: boolean | null;
1357
+ };
1358
+ }[];
1359
+ youtubeAccounts: {
1360
+ contributorId: string;
1361
+ createdAt: string;
1362
+ id: string;
1363
+ organizationId: string;
1364
+ updatedAt: string;
1365
+ youtubeAccountId: string;
1366
+ youtubeAccount: {
1367
+ ageRestricted: boolean | null;
1368
+ avatarUrl: string | null;
1369
+ channelDescription: string | null;
1370
+ channelId: string | null;
1371
+ channelLocation: string | null;
1372
+ channelName: string | null;
1373
+ channelUrl: string | null;
1374
+ createdAt: string;
1375
+ id: string;
1376
+ joinedDate: string | null;
1377
+ lastRefreshedAt: string | null;
1378
+ status: "pending" | "completed" | "failed" | "refreshing";
1379
+ subscribersCount: number | null;
1380
+ updatedAt: string;
1381
+ username: string | null;
1382
+ verified: boolean | null;
1383
+ videosCount: number | null;
1384
+ viewsCount: number | null;
1385
+ };
1386
+ }[];
1387
+ tiktokAccounts: {
1388
+ contributorId: string;
1389
+ createdAt: string;
1390
+ id: string;
1391
+ organizationId: string;
1392
+ tiktokAccountId: string;
1393
+ updatedAt: string;
1394
+ tiktokAccount: {
1395
+ avatarUrl: string | null;
1396
+ bioLink: string | null;
1397
+ commerceCategory: string | null;
1398
+ commerceUser: boolean | null;
1399
+ createdAt: string;
1400
+ digg: number | null;
1401
+ fans: number | null;
1402
+ following: number | null;
1403
+ friends: number | null;
1404
+ heart: number | null;
1405
+ id: string;
1406
+ lastRefreshedAt: string | null;
1407
+ name: string | null;
1408
+ nickName: string | null;
1409
+ privateAccount: boolean | null;
1410
+ profileUrl: string | null;
1411
+ roomId: string | null;
1412
+ signature: string | null;
1413
+ status: "pending" | "completed" | "failed" | "refreshing";
1414
+ tiktokId: string | null;
1415
+ ttSeller: boolean | null;
1416
+ updatedAt: string;
1417
+ verified: boolean | null;
1418
+ video: number | null;
1419
+ };
1420
+ }[];
1421
+ twitterAccounts: {
1422
+ contributorId: string;
1423
+ createdAt: string;
1424
+ id: string;
1425
+ organizationId: string;
1426
+ twitterAccountId: string;
1427
+ updatedAt: string;
1428
+ twitterAccount: {
1429
+ avatarUrl: string | null;
1430
+ coverImage: string | null;
1431
+ createdAt: string;
1432
+ description: string | null;
1433
+ followersCount: number | null;
1434
+ friendsCount: number | null;
1435
+ id: string;
1436
+ isBlueVerified: boolean | null;
1437
+ lastRefreshedAt: string | null;
1438
+ mediaCount: number | null;
1439
+ name: string | null;
1440
+ screenName: string | null;
1441
+ status: "pending" | "completed" | "failed" | "refreshing";
1442
+ statusesCount: number | null;
1443
+ twitterId: string | null;
1444
+ updatedAt: string;
1445
+ verified: boolean | null;
1446
+ };
1447
+ }[];
1448
+ linkedinAccounts: {
1449
+ contributorId: string;
1450
+ createdAt: string;
1451
+ id: string;
1452
+ linkedinAccountId: string;
1453
+ organizationId: string;
1454
+ updatedAt: string;
1455
+ linkedinAccount: {
1456
+ about: string | null;
1457
+ avatarUrl: string | null;
1458
+ connectionsCount: number | null;
1459
+ coverImageUrl: string | null;
1460
+ createdAt: string;
1461
+ firstName: string | null;
1462
+ followerCount: number | null;
1463
+ headline: string | null;
1464
+ id: string;
1465
+ lastName: string | null;
1466
+ lastRefreshedAt: string | null;
1467
+ linkedinId: string | null;
1468
+ publicIdentifier: string | null;
1469
+ status: "pending" | "completed" | "failed" | "refreshing";
1470
+ updatedAt: string;
1471
+ };
1472
+ }[];
1473
+ redditAccounts: {
1474
+ contributorId: string;
1475
+ createdAt: string;
1476
+ id: string;
1477
+ organizationId: string;
1478
+ redditAccountId: string;
1479
+ updatedAt: string;
1480
+ redditAccount: {
1481
+ avatarUrl: string | null;
1482
+ bannerUrl: string | null;
1483
+ bio: string | null;
1484
+ commentKarma: number | null;
1485
+ createdAt: string;
1486
+ displayName: string | null;
1487
+ id: string;
1488
+ isPremium: boolean | null;
1489
+ isVerified: boolean | null;
1490
+ lastRefreshedAt: string | null;
1491
+ postKarma: number | null;
1492
+ redditId: string | null;
1493
+ status: "pending" | "completed" | "failed" | "refreshing";
1494
+ totalKarma: number | null;
1495
+ updatedAt: string;
1496
+ username: string | null;
1497
+ };
1498
+ }[];
1499
+ } | null;
1500
+ }[];
1501
+ totalCount: number;
1502
+ _meta: {
1503
+ description: string;
1504
+ filters: Record<string, string | number>;
1505
+ pagination: {
1506
+ pageIndex: number;
1507
+ pageSize: number;
1508
+ from: number;
1509
+ to: number;
1510
+ };
1511
+ };
1512
+ }>;
1513
+ count: (params: {
1514
+ organizationId: string;
1515
+ activityId?: string;
1516
+ contributorId?: string;
1517
+ }) => Promise<{
1518
+ count: number;
1519
+ _meta: {
1520
+ description: string;
1521
+ filters: Record<string, string>;
1522
+ };
1523
+ }>;
1524
+ types: {
1525
+ list: (params: {
1526
+ organizationId: string;
1527
+ maxResults?: number;
1528
+ }) => Promise<{
1529
+ items: string[];
1530
+ totalCount: number;
1531
+ _meta: {
1532
+ description: string;
1533
+ filters: Record<string, string | number>;
1534
+ };
1535
+ }>;
1536
+ };
1537
+ };
1538
+ /** Note-related operations */
1539
+ notes: ((params: {
1540
+ id: string;
1541
+ }) => Promise<{
1542
+ data: {
1543
+ content: string;
1544
+ createdAt: string;
1545
+ createdBy: string | null;
1546
+ createdByName: string;
1547
+ id: string;
1548
+ organizationId: string;
1549
+ updatedAt: string;
1550
+ creator: {
1551
+ createdAt: string;
1552
+ email: string | null;
1553
+ name: string | null;
1554
+ updatedAt: string;
1555
+ userId: string;
1556
+ } | null;
1557
+ };
1558
+ _meta: {
1559
+ description: string;
1560
+ filters: {
1561
+ id: string;
1562
+ };
1563
+ };
1564
+ }>) & {
1565
+ list: (params: {
1566
+ organizationId: string;
1567
+ maxResults?: number;
1568
+ } & ({
1569
+ activityId: string;
1570
+ contributorId?: never;
1571
+ } | {
1572
+ contributorId: string;
1573
+ activityId?: never;
1574
+ })) => Promise<{
1575
+ items: {
1576
+ id: string;
1577
+ createdAt: string;
1578
+ note: {
1579
+ id: string;
1580
+ content: string;
1581
+ createdAt: string;
1582
+ updatedAt: string;
1583
+ createdBy: string | null;
1584
+ createdByName: string;
1585
+ organizationId: string;
1586
+ creator: {
1587
+ createdAt: string;
1588
+ email: string | null;
1589
+ name: string | null;
1590
+ updatedAt: string;
1591
+ userId: string;
1592
+ } | null;
1593
+ };
1594
+ }[];
1595
+ totalCount: number;
1596
+ _meta: {
1597
+ description: string;
1598
+ filters: Record<string, string | number>;
1599
+ };
1600
+ }>;
1601
+ };
1602
+ /** Organization-related operations */
1603
+ organizations: {
1604
+ list: (params: PaginationParams & {
1605
+ userId: string;
1606
+ }) => Promise<{
1607
+ items: {
1608
+ acceptedAt: string | null;
1609
+ createdAt: string;
1610
+ id: string;
1611
+ organizationId: string;
1612
+ role: string;
1613
+ updatedAt: string;
1614
+ userId: string;
1615
+ organization: {
1616
+ costPerThousandEngagement: number | null;
1617
+ costPerThousandReach: number | null;
1618
+ costPerThousandResponse: number | null;
1619
+ countryCode: string | null;
1620
+ createdAt: string;
1621
+ currency: string;
1622
+ gaConnectedAt: string | null;
1623
+ gaPropertyId: string | null;
1624
+ gaPropertyName: string | null;
1625
+ gaTokenExpiresAt: string | null;
1626
+ ianaTimezone: string;
1627
+ name: string;
1628
+ organizationId: string;
1629
+ totalCost: number | null;
1630
+ totalEngagement: number | null;
1631
+ totalReach: number | null;
1632
+ totalResponse: number | null;
1633
+ updatedAt: string;
1634
+ };
1635
+ }[];
1636
+ totalCount: number;
1637
+ _meta: {
1638
+ description: string;
1639
+ filters: {
1640
+ userId: string;
1641
+ };
1642
+ pagination: {
1643
+ pageIndex: number;
1644
+ pageSize: number;
1645
+ from: number;
1646
+ to: number;
1647
+ };
1648
+ };
1649
+ }>;
1650
+ users: {
1651
+ list: (params: ListQueryParams) => Promise<{
1652
+ items: {
1653
+ acceptedAt: string | null;
1654
+ createdAt: string;
1655
+ id: string;
1656
+ organizationId: string;
1657
+ role: string;
1658
+ updatedAt: string;
1659
+ userId: string;
1660
+ user: {
1661
+ createdAt: string;
1662
+ email: string | null;
1663
+ name: string | null;
1664
+ updatedAt: string;
1665
+ userId: string;
1666
+ };
1667
+ }[];
1668
+ totalCount: number;
1669
+ _meta: {
1670
+ description: string;
1671
+ filters: Record<string, string>;
1672
+ pagination: {
1673
+ pageIndex: number;
1674
+ pageSize: number;
1675
+ from: number;
1676
+ to: number;
1677
+ };
1678
+ };
1679
+ }>;
1680
+ };
1681
+ };
1682
+ /** Reporting and efficiency metrics */
1683
+ reporting: {
1684
+ efficiency: {
1685
+ organization: ((params: {
1686
+ organizationId: string;
1687
+ }) => Promise<{
1688
+ data: {
1689
+ organizationId: string;
1690
+ name: string;
1691
+ totalCost: number | null;
1692
+ totalEngagement: number | null;
1693
+ totalReach: number | null;
1694
+ totalResponse: number | null;
1695
+ costPerThousandEngagement: number | null;
1696
+ costPerThousandReach: number | null;
1697
+ costPerThousandResponse: number | null;
1698
+ } | null;
1699
+ _meta: {
1700
+ description: string;
1701
+ filters: {
1702
+ organizationId: string;
1703
+ };
1704
+ };
1705
+ }>) & {
1706
+ history: (params: {
1707
+ organizationId: string;
1708
+ daysBack?: number;
1709
+ maxResults?: number;
1710
+ }) => Promise<{
1711
+ items: {
1712
+ costPerThousandEngagement: number | null;
1713
+ costPerThousandReach: number | null;
1714
+ costPerThousandResponse: number | null;
1715
+ recordedDate: string;
1716
+ }[];
1717
+ totalCount: number;
1718
+ _meta: {
1719
+ description: string;
1720
+ filters: {
1721
+ organizationId: string;
1722
+ daysBack: number;
1723
+ };
1724
+ };
1725
+ }>;
1726
+ };
1727
+ contributor: ((params: {
1728
+ organizationId: string;
1729
+ contributorId: string;
1730
+ }) => Promise<{
1731
+ data: {
1732
+ id: string;
1733
+ name: string;
1734
+ role: "person" | "community" | "brand_partner";
1735
+ countryCode: string | null;
1736
+ activitiesCount: number | null;
1737
+ totalActivitiesCost: number | null;
1738
+ totalEngagement: number | null;
1739
+ totalReach: number | null;
1740
+ totalResponse: number | null;
1741
+ totalFollowersCount: number | null;
1742
+ costPerThousandEngagement: number | null;
1743
+ costPerThousandReach: number | null;
1744
+ costPerThousandResponse: number | null;
1745
+ } | null;
1746
+ _meta: {
1747
+ description: string;
1748
+ filters: {
1749
+ organizationId: string;
1750
+ contributorId: string;
1751
+ };
1752
+ };
1753
+ }>) & {
1754
+ history: (params: {
1755
+ organizationId: string;
1756
+ contributorId: string;
1757
+ daysBack?: number;
1758
+ maxResults?: number;
1759
+ }) => Promise<{
1760
+ items: {
1761
+ costPerThousandEngagement: number | null;
1762
+ costPerThousandReach: number | null;
1763
+ costPerThousandResponse: number | null;
1764
+ recordedDate: string;
1765
+ }[];
1766
+ totalCount: number;
1767
+ _meta: {
1768
+ description: string;
1769
+ filters: {
1770
+ organizationId: string;
1771
+ contributorId: string;
1772
+ daysBack: number;
1773
+ };
1774
+ };
1775
+ }>;
1776
+ };
1777
+ campaign: ((params: {
1778
+ organizationId: string;
1779
+ campaignId: string;
1780
+ }) => Promise<{
1781
+ data: {
1782
+ id: string;
1783
+ name: string;
1784
+ startAt: string | null;
1785
+ endAt: string | null;
1786
+ budget: number | null;
1787
+ cost: number | null;
1788
+ activitiesCount: number | null;
1789
+ totalEngagement: number | null;
1790
+ totalReach: number | null;
1791
+ totalResponse: number | null;
1792
+ costPerThousandEngagement: number | null;
1793
+ costPerThousandReach: number | null;
1794
+ costPerThousandResponse: number | null;
1795
+ } | null;
1796
+ _meta: {
1797
+ description: string;
1798
+ filters: {
1799
+ organizationId: string;
1800
+ campaignId: string;
1801
+ };
1802
+ };
1803
+ }>) & {
1804
+ history: (params: {
1805
+ organizationId: string;
1806
+ campaignId: string;
1807
+ daysBack?: number;
1808
+ maxResults?: number;
1809
+ }) => Promise<{
1810
+ items: {
1811
+ costPerThousandEngagement: number | null;
1812
+ costPerThousandReach: number | null;
1813
+ costPerThousandResponse: number | null;
1814
+ recordedDate: string;
1815
+ }[];
1816
+ totalCount: number;
1817
+ _meta: {
1818
+ description: string;
1819
+ filters: {
1820
+ organizationId: string;
1821
+ campaignId: string;
1822
+ daysBack: number;
1823
+ };
1824
+ };
1825
+ }>;
1826
+ };
1827
+ contributors: {
1828
+ list: (params: Omit<ListQueryParams, "organizationId"> & {
1829
+ organizationId: string;
1830
+ pageIndex: number;
1831
+ pageSize: number;
1832
+ campaignId?: string;
1833
+ }) => Promise<{
1834
+ items: {
1835
+ id: string;
1836
+ name: string;
1837
+ role: "person" | "community" | "brand_partner";
1838
+ countryCode: string | null;
1839
+ createdAt: string;
1840
+ updatedAt: string;
1841
+ organizationId: string;
1842
+ activitiesCount: number | null;
1843
+ totalActivitiesCost: number | null;
1844
+ totalEngagement: number | null;
1845
+ totalReach: number | null;
1846
+ totalResponse: number | null;
1847
+ totalFollowersCount: number | null;
1848
+ costPerThousandEngagement: number | null;
1849
+ costPerThousandReach: number | null;
1850
+ costPerThousandResponse: number | null;
1851
+ instagramAccounts: {
1852
+ contributorId: string;
1853
+ createdAt: string;
1854
+ id: string;
1855
+ instagramAccountId: string;
1856
+ organizationId: string;
1857
+ updatedAt: string;
1858
+ instagramAccount: {
1859
+ avatarUrl: string | null;
1860
+ bio: string | null;
1861
+ businessAccount: boolean | null;
1862
+ businessCategoryName: string | null;
1863
+ createdAt: string;
1864
+ externalUrl: string | null;
1865
+ facebookId: string | null;
1866
+ followersCount: number | null;
1867
+ followsCount: number | null;
1868
+ fullName: string | null;
1869
+ hasChannel: boolean | null;
1870
+ highlightReelCount: number | null;
1871
+ id: string;
1872
+ igtvVideoCount: number | null;
1873
+ instagramId: string | null;
1874
+ joinedRecently: boolean | null;
1875
+ lastRefreshedAt: string | null;
1876
+ postsCount: number | null;
1877
+ private: boolean | null;
1878
+ status: "pending" | "completed" | "failed" | "refreshing";
1879
+ updatedAt: string;
1880
+ username: string | null;
1881
+ verified: boolean | null;
1882
+ };
1883
+ }[];
1884
+ youtubeAccounts: {
1885
+ contributorId: string;
1886
+ createdAt: string;
1887
+ id: string;
1888
+ organizationId: string;
1889
+ updatedAt: string;
1890
+ youtubeAccountId: string;
1891
+ youtubeAccount: {
1892
+ ageRestricted: boolean | null;
1893
+ avatarUrl: string | null;
1894
+ channelDescription: string | null;
1895
+ channelId: string | null;
1896
+ channelLocation: string | null;
1897
+ channelName: string | null;
1898
+ channelUrl: string | null;
1899
+ createdAt: string;
1900
+ id: string;
1901
+ joinedDate: string | null;
1902
+ lastRefreshedAt: string | null;
1903
+ status: "pending" | "completed" | "failed" | "refreshing";
1904
+ subscribersCount: number | null;
1905
+ updatedAt: string;
1906
+ username: string | null;
1907
+ verified: boolean | null;
1908
+ videosCount: number | null;
1909
+ viewsCount: number | null;
1910
+ };
1911
+ }[];
1912
+ tiktokAccounts: {
1913
+ contributorId: string;
1914
+ createdAt: string;
1915
+ id: string;
1916
+ organizationId: string;
1917
+ tiktokAccountId: string;
1918
+ updatedAt: string;
1919
+ tiktokAccount: {
1920
+ avatarUrl: string | null;
1921
+ bioLink: string | null;
1922
+ commerceCategory: string | null;
1923
+ commerceUser: boolean | null;
1924
+ createdAt: string;
1925
+ digg: number | null;
1926
+ fans: number | null;
1927
+ following: number | null;
1928
+ friends: number | null;
1929
+ heart: number | null;
1930
+ id: string;
1931
+ lastRefreshedAt: string | null;
1932
+ name: string | null;
1933
+ nickName: string | null;
1934
+ privateAccount: boolean | null;
1935
+ profileUrl: string | null;
1936
+ roomId: string | null;
1937
+ signature: string | null;
1938
+ status: "pending" | "completed" | "failed" | "refreshing";
1939
+ tiktokId: string | null;
1940
+ ttSeller: boolean | null;
1941
+ updatedAt: string;
1942
+ verified: boolean | null;
1943
+ video: number | null;
1944
+ };
1945
+ }[];
1946
+ twitterAccounts: {
1947
+ contributorId: string;
1948
+ createdAt: string;
1949
+ id: string;
1950
+ organizationId: string;
1951
+ twitterAccountId: string;
1952
+ updatedAt: string;
1953
+ twitterAccount: {
1954
+ avatarUrl: string | null;
1955
+ coverImage: string | null;
1956
+ createdAt: string;
1957
+ description: string | null;
1958
+ followersCount: number | null;
1959
+ friendsCount: number | null;
1960
+ id: string;
1961
+ isBlueVerified: boolean | null;
1962
+ lastRefreshedAt: string | null;
1963
+ mediaCount: number | null;
1964
+ name: string | null;
1965
+ screenName: string | null;
1966
+ status: "pending" | "completed" | "failed" | "refreshing";
1967
+ statusesCount: number | null;
1968
+ twitterId: string | null;
1969
+ updatedAt: string;
1970
+ verified: boolean | null;
1971
+ };
1972
+ }[];
1973
+ linkedinAccounts: {
1974
+ contributorId: string;
1975
+ createdAt: string;
1976
+ id: string;
1977
+ linkedinAccountId: string;
1978
+ organizationId: string;
1979
+ updatedAt: string;
1980
+ linkedinAccount: {
1981
+ about: string | null;
1982
+ avatarUrl: string | null;
1983
+ connectionsCount: number | null;
1984
+ coverImageUrl: string | null;
1985
+ createdAt: string;
1986
+ firstName: string | null;
1987
+ followerCount: number | null;
1988
+ headline: string | null;
1989
+ id: string;
1990
+ lastName: string | null;
1991
+ lastRefreshedAt: string | null;
1992
+ linkedinId: string | null;
1993
+ publicIdentifier: string | null;
1994
+ status: "pending" | "completed" | "failed" | "refreshing";
1995
+ updatedAt: string;
1996
+ };
1997
+ }[];
1998
+ redditAccounts: {
1999
+ contributorId: string;
2000
+ createdAt: string;
2001
+ id: string;
2002
+ organizationId: string;
2003
+ redditAccountId: string;
2004
+ updatedAt: string;
2005
+ redditAccount: {
2006
+ avatarUrl: string | null;
2007
+ bannerUrl: string | null;
2008
+ bio: string | null;
2009
+ commentKarma: number | null;
2010
+ createdAt: string;
2011
+ displayName: string | null;
2012
+ id: string;
2013
+ isPremium: boolean | null;
2014
+ isVerified: boolean | null;
2015
+ lastRefreshedAt: string | null;
2016
+ postKarma: number | null;
2017
+ redditId: string | null;
2018
+ status: "pending" | "completed" | "failed" | "refreshing";
2019
+ totalKarma: number | null;
2020
+ updatedAt: string;
2021
+ username: string | null;
2022
+ };
2023
+ }[];
2024
+ }[];
2025
+ totalCount: number;
2026
+ _meta: {
2027
+ description: string;
2028
+ filters: Record<string, string | number>;
2029
+ pagination: {
2030
+ pageIndex: number;
2031
+ pageSize: number;
2032
+ from: number;
2033
+ to: number;
2034
+ };
2035
+ sorting: {
2036
+ sortBy: string;
2037
+ sortDirection: "asc" | "desc";
2038
+ };
2039
+ };
2040
+ }>;
2041
+ };
2042
+ campaigns: {
2043
+ list: (params: Omit<ListQueryParams, "organizationId"> & {
2044
+ organizationId: string;
2045
+ pageIndex: number;
2046
+ pageSize: number;
2047
+ contributorId?: string;
2048
+ }) => Promise<{
2049
+ items: {
2050
+ id: string;
2051
+ name: string;
2052
+ startAt: string | null;
2053
+ endAt: string | null;
2054
+ budget: number | null;
2055
+ cost: number | null;
2056
+ activitiesCount: number | null;
2057
+ totalEngagement: number | null;
2058
+ totalReach: number | null;
2059
+ totalResponse: number | null;
2060
+ costPerThousandEngagement: number | null;
2061
+ costPerThousandReach: number | null;
2062
+ costPerThousandResponse: number | null;
2063
+ }[];
2064
+ totalCount: number;
2065
+ _meta: {
2066
+ description: string;
2067
+ filters: Record<string, string | number>;
2068
+ pagination: {
2069
+ pageIndex: number;
2070
+ pageSize: number;
2071
+ from: number;
2072
+ to: number;
2073
+ };
2074
+ sorting: {
2075
+ sortBy: string;
2076
+ sortDirection: "asc" | "desc";
2077
+ };
2078
+ };
2079
+ }>;
2080
+ };
2081
+ };
2082
+ };
21
2083
  /** User-related operations */
2084
+ users: ((params: {
2085
+ id: string;
2086
+ }) => Promise<{
2087
+ data: {
2088
+ createdAt: string;
2089
+ email: string | null;
2090
+ name: string | null;
2091
+ updatedAt: string;
2092
+ userId: string;
2093
+ };
2094
+ _meta: {
2095
+ description: string;
2096
+ filters: {
2097
+ id: string;
2098
+ };
2099
+ };
2100
+ }>) & {
2101
+ list: (params: ListQueryParams) => Promise<{
2102
+ items: {
2103
+ createdAt: string;
2104
+ email: string | null;
2105
+ name: string | null;
2106
+ updatedAt: string;
2107
+ userId: string;
2108
+ }[];
2109
+ totalCount: number;
2110
+ _meta: {
2111
+ description: string;
2112
+ filters: Record<string, string>;
2113
+ pagination: {
2114
+ pageIndex: number;
2115
+ pageSize: number;
2116
+ from: number;
2117
+ to: number;
2118
+ };
2119
+ };
2120
+ }>;
2121
+ settings: (params: {
2122
+ userId: string;
2123
+ }) => Promise<{
2124
+ data: null;
2125
+ _meta: {
2126
+ description: string;
2127
+ filters: {
2128
+ userId: string;
2129
+ };
2130
+ };
2131
+ } | {
2132
+ data: {
2133
+ activeOrganizationId: string | null;
2134
+ createdAt: string;
2135
+ updatedAt: string;
2136
+ userId: string;
2137
+ };
2138
+ _meta: {
2139
+ description: string;
2140
+ filters: {
2141
+ userId: string;
2142
+ };
2143
+ };
2144
+ }>;
2145
+ };
2146
+ };
2147
+
2148
+ /**
2149
+ * Creates the activities resource with all activity-related methods.
2150
+ */
2151
+ declare const createActivitiesResource: (db: DbClient) => ((params: {
2152
+ id: string;
2153
+ }) => Promise<{
2154
+ data: {
2155
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
2156
+ attendeesCount: number | null;
2157
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
2158
+ contentCaption: string | null;
2159
+ contentHref: string | null;
2160
+ cost: number | null;
2161
+ createdAt: string;
2162
+ demosCount: number | null;
2163
+ description: string | null;
2164
+ endAt: string | null;
2165
+ engagement: number | null;
2166
+ engagementTier: number | null;
2167
+ id: string;
2168
+ leadsCount: number | null;
2169
+ likeCount: number | null;
2170
+ metricsLastRefreshedAt: string | null;
2171
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
2172
+ organizationId: string;
2173
+ publishedAt: string | null;
2174
+ reach: number | null;
2175
+ reachCount: number | null;
2176
+ reachEstimationSource: Json | null
2177
+ reachTier: number | null;
2178
+ replyCount: number | null;
2179
+ response: number | null;
2180
+ responseTier: number | null;
2181
+ savesCount: number | null;
2182
+ sharesCount: number | null;
2183
+ startAt: string | null;
2184
+ updatedAt: string;
2185
+ viewsCount: number | null;
2186
+ activityCosts: {
2187
+ activityId: string;
2188
+ amount: number | null;
2189
+ contributorId: string | null;
2190
+ createdAt: string;
2191
+ currency: string;
2192
+ description: string | null;
2193
+ id: string;
2194
+ organizationId: string;
2195
+ type: string;
2196
+ updatedAt: string;
2197
+ }[];
2198
+ };
2199
+ _meta: {
2200
+ description: string;
2201
+ filters: {
2202
+ id: string;
2203
+ };
2204
+ };
2205
+ }>) & {
2206
+ /** List activities with pagination */
2207
+ list: (params: PaginationParams & {
2208
+ organizationId: string;
2209
+ searchTerm?: string;
2210
+ sortBy?: string;
2211
+ sortDirection?: "asc" | "desc";
2212
+ maxResults?: number;
2213
+ } & {
2214
+ contributorId?: string;
2215
+ campaignId?: string;
2216
+ }) => Promise<{
2217
+ items: {
2218
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
2219
+ attendeesCount: number | null;
2220
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
2221
+ contentCaption: string | null;
2222
+ contentHref: string | null;
2223
+ cost: number | null;
2224
+ createdAt: string;
2225
+ demosCount: number | null;
2226
+ description: string | null;
2227
+ endAt: string | null;
2228
+ engagement: number | null;
2229
+ engagementTier: number | null;
2230
+ id: string;
2231
+ leadsCount: number | null;
2232
+ likeCount: number | null;
2233
+ metricsLastRefreshedAt: string | null;
2234
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
2235
+ organizationId: string;
2236
+ publishedAt: string | null;
2237
+ reach: number | null;
2238
+ reachCount: number | null;
2239
+ reachEstimationSource: Json | null
2240
+ reachTier: number | null;
2241
+ replyCount: number | null;
2242
+ response: number | null;
2243
+ responseTier: number | null;
2244
+ savesCount: number | null;
2245
+ sharesCount: number | null;
2246
+ startAt: string | null;
2247
+ updatedAt: string;
2248
+ viewsCount: number | null;
2249
+ activityContributors: {
2250
+ activityId: string;
2251
+ contributorId: string;
2252
+ createdAt: string;
2253
+ id: string;
2254
+ organizationId: string;
2255
+ updatedAt: string;
2256
+ contributor: {
2257
+ activitiesCount: number | null;
2258
+ costPerThousandEngagement: number | null;
2259
+ costPerThousandReach: number | null;
2260
+ costPerThousandResponse: number | null;
2261
+ countryCode: string | null;
2262
+ createdAt: string;
2263
+ id: string;
2264
+ name: string;
2265
+ organizationId: string;
2266
+ role: "person" | "community" | "brand_partner";
2267
+ totalActivitiesCost: {
2268
+ sum: number;
2269
+ }[];
2270
+ totalEngagement: number | null;
2271
+ totalFollowersCount: number | null;
2272
+ totalReach: number | null;
2273
+ totalResponse: number | null;
2274
+ updatedAt: string;
2275
+ instagramAccounts: {
2276
+ contributorId: string;
2277
+ createdAt: string;
2278
+ id: string;
2279
+ instagramAccountId: string;
2280
+ organizationId: string;
2281
+ updatedAt: string;
2282
+ instagramAccount: {
2283
+ avatarUrl: string | null;
2284
+ bio: string | null;
2285
+ businessAccount: boolean | null;
2286
+ businessCategoryName: string | null;
2287
+ createdAt: string;
2288
+ externalUrl: string | null;
2289
+ facebookId: string | null;
2290
+ followersCount: number | null;
2291
+ followsCount: number | null;
2292
+ fullName: string | null;
2293
+ hasChannel: boolean | null;
2294
+ highlightReelCount: number | null;
2295
+ id: string;
2296
+ igtvVideoCount: number | null;
2297
+ instagramId: string | null;
2298
+ joinedRecently: boolean | null;
2299
+ lastRefreshedAt: string | null;
2300
+ postsCount: number | null;
2301
+ private: boolean | null;
2302
+ status: "pending" | "completed" | "failed" | "refreshing";
2303
+ updatedAt: string;
2304
+ username: string | null;
2305
+ verified: boolean | null;
2306
+ };
2307
+ }[];
2308
+ youtubeAccounts: {
2309
+ contributorId: string;
2310
+ createdAt: string;
2311
+ id: string;
2312
+ organizationId: string;
2313
+ updatedAt: string;
2314
+ youtubeAccountId: string;
2315
+ youtubeAccount: {
2316
+ ageRestricted: boolean | null;
2317
+ avatarUrl: string | null;
2318
+ channelDescription: string | null;
2319
+ channelId: string | null;
2320
+ channelLocation: string | null;
2321
+ channelName: string | null;
2322
+ channelUrl: string | null;
2323
+ createdAt: string;
2324
+ id: string;
2325
+ joinedDate: string | null;
2326
+ lastRefreshedAt: string | null;
2327
+ status: "pending" | "completed" | "failed" | "refreshing";
2328
+ subscribersCount: number | null;
2329
+ updatedAt: string;
2330
+ username: string | null;
2331
+ verified: boolean | null;
2332
+ videosCount: number | null;
2333
+ viewsCount: number | null;
2334
+ };
2335
+ }[];
2336
+ tiktokAccounts: {
2337
+ contributorId: string;
2338
+ createdAt: string;
2339
+ id: string;
2340
+ organizationId: string;
2341
+ tiktokAccountId: string;
2342
+ updatedAt: string;
2343
+ tiktokAccount: {
2344
+ avatarUrl: string | null;
2345
+ bioLink: string | null;
2346
+ commerceCategory: string | null;
2347
+ commerceUser: boolean | null;
2348
+ createdAt: string;
2349
+ digg: number | null;
2350
+ fans: number | null;
2351
+ following: number | null;
2352
+ friends: number | null;
2353
+ heart: number | null;
2354
+ id: string;
2355
+ lastRefreshedAt: string | null;
2356
+ name: string | null;
2357
+ nickName: string | null;
2358
+ privateAccount: boolean | null;
2359
+ profileUrl: string | null;
2360
+ roomId: string | null;
2361
+ signature: string | null;
2362
+ status: "pending" | "completed" | "failed" | "refreshing";
2363
+ tiktokId: string | null;
2364
+ ttSeller: boolean | null;
2365
+ updatedAt: string;
2366
+ verified: boolean | null;
2367
+ video: number | null;
2368
+ };
2369
+ }[];
2370
+ twitterAccounts: {
2371
+ contributorId: string;
2372
+ createdAt: string;
2373
+ id: string;
2374
+ organizationId: string;
2375
+ twitterAccountId: string;
2376
+ updatedAt: string;
2377
+ twitterAccount: {
2378
+ avatarUrl: string | null;
2379
+ coverImage: string | null;
2380
+ createdAt: string;
2381
+ description: string | null;
2382
+ followersCount: number | null;
2383
+ friendsCount: number | null;
2384
+ id: string;
2385
+ isBlueVerified: boolean | null;
2386
+ lastRefreshedAt: string | null;
2387
+ mediaCount: number | null;
2388
+ name: string | null;
2389
+ screenName: string | null;
2390
+ status: "pending" | "completed" | "failed" | "refreshing";
2391
+ statusesCount: number | null;
2392
+ twitterId: string | null;
2393
+ updatedAt: string;
2394
+ verified: boolean | null;
2395
+ };
2396
+ }[];
2397
+ linkedinAccounts: {
2398
+ contributorId: string;
2399
+ createdAt: string;
2400
+ id: string;
2401
+ linkedinAccountId: string;
2402
+ organizationId: string;
2403
+ updatedAt: string;
2404
+ linkedinAccount: {
2405
+ about: string | null;
2406
+ avatarUrl: string | null;
2407
+ connectionsCount: number | null;
2408
+ coverImageUrl: string | null;
2409
+ createdAt: string;
2410
+ firstName: string | null;
2411
+ followerCount: number | null;
2412
+ headline: string | null;
2413
+ id: string;
2414
+ lastName: string | null;
2415
+ lastRefreshedAt: string | null;
2416
+ linkedinId: string | null;
2417
+ publicIdentifier: string | null;
2418
+ status: "pending" | "completed" | "failed" | "refreshing";
2419
+ updatedAt: string;
2420
+ };
2421
+ }[];
2422
+ redditAccounts: {
2423
+ contributorId: string;
2424
+ createdAt: string;
2425
+ id: string;
2426
+ organizationId: string;
2427
+ redditAccountId: string;
2428
+ updatedAt: string;
2429
+ redditAccount: {
2430
+ avatarUrl: string | null;
2431
+ bannerUrl: string | null;
2432
+ bio: string | null;
2433
+ commentKarma: number | null;
2434
+ createdAt: string;
2435
+ displayName: string | null;
2436
+ id: string;
2437
+ isPremium: boolean | null;
2438
+ isVerified: boolean | null;
2439
+ lastRefreshedAt: string | null;
2440
+ postKarma: number | null;
2441
+ redditId: string | null;
2442
+ status: "pending" | "completed" | "failed" | "refreshing";
2443
+ totalKarma: number | null;
2444
+ updatedAt: string;
2445
+ username: string | null;
2446
+ };
2447
+ }[];
2448
+ };
2449
+ }[];
2450
+ activityCosts: {
2451
+ activityId: string;
2452
+ amount: number | null;
2453
+ contributorId: string | null;
2454
+ createdAt: string;
2455
+ currency: string;
2456
+ description: string | null;
2457
+ id: string;
2458
+ organizationId: string;
2459
+ type: string;
2460
+ updatedAt: string;
2461
+ }[];
2462
+ campaignActivities: {
2463
+ activityId: string;
2464
+ campaignId: string;
2465
+ createdAt: string;
2466
+ id: string;
2467
+ organizationId: string;
2468
+ updatedAt: string;
2469
+ } | null;
2470
+ }[];
2471
+ totalCount: number;
2472
+ _meta: {
2473
+ description: string;
2474
+ filters: Record<string, string | number>;
2475
+ pagination: {
2476
+ pageIndex: number;
2477
+ pageSize: number;
2478
+ from: number;
2479
+ to: number;
2480
+ };
2481
+ sorting: {
2482
+ sortBy: string;
2483
+ sortDirection: "asc" | "desc";
2484
+ };
2485
+ };
2486
+ }>;
2487
+ /** Count activities matching filters */
2488
+ count: (params: {
2489
+ organizationId: string;
2490
+ contributorId?: string;
2491
+ campaignId?: string;
2492
+ }) => Promise<{
2493
+ count: number;
2494
+ _meta: {
2495
+ description: string;
2496
+ filters: Record<string, string>;
2497
+ };
2498
+ }>;
2499
+ /** Contributors on activities */
2500
+ contributors: {
2501
+ list: (params: PaginationParams & {
2502
+ organizationId: string;
2503
+ activityId: string;
2504
+ maxResults?: number;
2505
+ }) => Promise<{
2506
+ items: {
2507
+ activityId: string;
2508
+ contributorId: string;
2509
+ createdAt: string;
2510
+ id: string;
2511
+ organizationId: string;
2512
+ updatedAt: string;
2513
+ contributor: {
2514
+ activitiesCount: number | null;
2515
+ costPerThousandEngagement: number | null;
2516
+ costPerThousandReach: number | null;
2517
+ costPerThousandResponse: number | null;
2518
+ countryCode: string | null;
2519
+ createdAt: string;
2520
+ id: string;
2521
+ name: string;
2522
+ organizationId: string;
2523
+ role: "person" | "community" | "brand_partner";
2524
+ totalActivitiesCost: {
2525
+ sum: number;
2526
+ }[];
2527
+ totalEngagement: number | null;
2528
+ totalFollowersCount: number | null;
2529
+ totalReach: number | null;
2530
+ totalResponse: number | null;
2531
+ updatedAt: string;
2532
+ instagramAccounts: {
2533
+ contributorId: string;
2534
+ createdAt: string;
2535
+ id: string;
2536
+ instagramAccountId: string;
2537
+ organizationId: string;
2538
+ updatedAt: string;
2539
+ instagramAccount: {
2540
+ avatarUrl: string | null;
2541
+ bio: string | null;
2542
+ businessAccount: boolean | null;
2543
+ businessCategoryName: string | null;
2544
+ createdAt: string;
2545
+ externalUrl: string | null;
2546
+ facebookId: string | null;
2547
+ followersCount: number | null;
2548
+ followsCount: number | null;
2549
+ fullName: string | null;
2550
+ hasChannel: boolean | null;
2551
+ highlightReelCount: number | null;
2552
+ id: string;
2553
+ igtvVideoCount: number | null;
2554
+ instagramId: string | null;
2555
+ joinedRecently: boolean | null;
2556
+ lastRefreshedAt: string | null;
2557
+ postsCount: number | null;
2558
+ private: boolean | null;
2559
+ status: "pending" | "completed" | "failed" | "refreshing";
2560
+ updatedAt: string;
2561
+ username: string | null;
2562
+ verified: boolean | null;
2563
+ };
2564
+ }[];
2565
+ youtubeAccounts: {
2566
+ contributorId: string;
2567
+ createdAt: string;
2568
+ id: string;
2569
+ organizationId: string;
2570
+ updatedAt: string;
2571
+ youtubeAccountId: string;
2572
+ youtubeAccount: {
2573
+ ageRestricted: boolean | null;
2574
+ avatarUrl: string | null;
2575
+ channelDescription: string | null;
2576
+ channelId: string | null;
2577
+ channelLocation: string | null;
2578
+ channelName: string | null;
2579
+ channelUrl: string | null;
2580
+ createdAt: string;
2581
+ id: string;
2582
+ joinedDate: string | null;
2583
+ lastRefreshedAt: string | null;
2584
+ status: "pending" | "completed" | "failed" | "refreshing";
2585
+ subscribersCount: number | null;
2586
+ updatedAt: string;
2587
+ username: string | null;
2588
+ verified: boolean | null;
2589
+ videosCount: number | null;
2590
+ viewsCount: number | null;
2591
+ };
2592
+ }[];
2593
+ tiktokAccounts: {
2594
+ contributorId: string;
2595
+ createdAt: string;
2596
+ id: string;
2597
+ organizationId: string;
2598
+ tiktokAccountId: string;
2599
+ updatedAt: string;
2600
+ tiktokAccount: {
2601
+ avatarUrl: string | null;
2602
+ bioLink: string | null;
2603
+ commerceCategory: string | null;
2604
+ commerceUser: boolean | null;
2605
+ createdAt: string;
2606
+ digg: number | null;
2607
+ fans: number | null;
2608
+ following: number | null;
2609
+ friends: number | null;
2610
+ heart: number | null;
2611
+ id: string;
2612
+ lastRefreshedAt: string | null;
2613
+ name: string | null;
2614
+ nickName: string | null;
2615
+ privateAccount: boolean | null;
2616
+ profileUrl: string | null;
2617
+ roomId: string | null;
2618
+ signature: string | null;
2619
+ status: "pending" | "completed" | "failed" | "refreshing";
2620
+ tiktokId: string | null;
2621
+ ttSeller: boolean | null;
2622
+ updatedAt: string;
2623
+ verified: boolean | null;
2624
+ video: number | null;
2625
+ };
2626
+ }[];
2627
+ twitterAccounts: {
2628
+ contributorId: string;
2629
+ createdAt: string;
2630
+ id: string;
2631
+ organizationId: string;
2632
+ twitterAccountId: string;
2633
+ updatedAt: string;
2634
+ twitterAccount: {
2635
+ avatarUrl: string | null;
2636
+ coverImage: string | null;
2637
+ createdAt: string;
2638
+ description: string | null;
2639
+ followersCount: number | null;
2640
+ friendsCount: number | null;
2641
+ id: string;
2642
+ isBlueVerified: boolean | null;
2643
+ lastRefreshedAt: string | null;
2644
+ mediaCount: number | null;
2645
+ name: string | null;
2646
+ screenName: string | null;
2647
+ status: "pending" | "completed" | "failed" | "refreshing";
2648
+ statusesCount: number | null;
2649
+ twitterId: string | null;
2650
+ updatedAt: string;
2651
+ verified: boolean | null;
2652
+ };
2653
+ }[];
2654
+ linkedinAccounts: {
2655
+ contributorId: string;
2656
+ createdAt: string;
2657
+ id: string;
2658
+ linkedinAccountId: string;
2659
+ organizationId: string;
2660
+ updatedAt: string;
2661
+ linkedinAccount: {
2662
+ about: string | null;
2663
+ avatarUrl: string | null;
2664
+ connectionsCount: number | null;
2665
+ coverImageUrl: string | null;
2666
+ createdAt: string;
2667
+ firstName: string | null;
2668
+ followerCount: number | null;
2669
+ headline: string | null;
2670
+ id: string;
2671
+ lastName: string | null;
2672
+ lastRefreshedAt: string | null;
2673
+ linkedinId: string | null;
2674
+ publicIdentifier: string | null;
2675
+ status: "pending" | "completed" | "failed" | "refreshing";
2676
+ updatedAt: string;
2677
+ };
2678
+ }[];
2679
+ redditAccounts: {
2680
+ contributorId: string;
2681
+ createdAt: string;
2682
+ id: string;
2683
+ organizationId: string;
2684
+ redditAccountId: string;
2685
+ updatedAt: string;
2686
+ redditAccount: {
2687
+ avatarUrl: string | null;
2688
+ bannerUrl: string | null;
2689
+ bio: string | null;
2690
+ commentKarma: number | null;
2691
+ createdAt: string;
2692
+ displayName: string | null;
2693
+ id: string;
2694
+ isPremium: boolean | null;
2695
+ isVerified: boolean | null;
2696
+ lastRefreshedAt: string | null;
2697
+ postKarma: number | null;
2698
+ redditId: string | null;
2699
+ status: "pending" | "completed" | "failed" | "refreshing";
2700
+ totalKarma: number | null;
2701
+ updatedAt: string;
2702
+ username: string | null;
2703
+ };
2704
+ }[];
2705
+ };
2706
+ }[];
2707
+ totalCount: number;
2708
+ _meta: {
2709
+ description: string;
2710
+ filters: Record<string, string | number>;
2711
+ pagination: {
2712
+ pageIndex: number;
2713
+ pageSize: number;
2714
+ from: number;
2715
+ to: number;
2716
+ };
2717
+ };
2718
+ }>;
2719
+ count: (params: {
2720
+ organizationId: string;
2721
+ activityId: string;
2722
+ }) => Promise<{
2723
+ count: number;
2724
+ _meta: {
2725
+ description: string;
2726
+ filters: {
2727
+ organizationId: string;
2728
+ activityId: string;
2729
+ };
2730
+ };
2731
+ }>;
2732
+ };
2733
+ /** Activity metrics: history and confidence */
2734
+ metrics: {
2735
+ history: (params: {
2736
+ activityId: string;
2737
+ startDateKey?: string | null;
2738
+ maxResults?: number;
2739
+ }) => Promise<{
2740
+ items: {
2741
+ recordedDate: string;
2742
+ reach: number | null;
2743
+ engagement: number | null;
2744
+ response: number | null;
2745
+ reachTier: number | null;
2746
+ engagementTier: number | null;
2747
+ responseTier: number | null;
2748
+ }[];
2749
+ totalCount: number;
2750
+ _meta: {
2751
+ description: string;
2752
+ filters: Record<string, string | number>;
2753
+ };
2754
+ }>;
2755
+ confidence: (params: {
2756
+ organizationId: string;
2757
+ startDate?: string | null;
2758
+ endDate?: string | null;
2759
+ }) => Promise<{
2760
+ data: {
2761
+ activityCount: number;
2762
+ confidenceScore: number;
2763
+ engagementConfidenceScore: number;
2764
+ engagementPctActual: number;
2765
+ pctActual: number;
2766
+ pctEngagementEstimated: number;
2767
+ pctFollowerEstimated: number;
2768
+ responseConfidenceScore: number;
2769
+ responsePctActual: number;
2770
+ totalEngagement: number;
2771
+ totalReach: number;
2772
+ totalResponse: number;
2773
+ } | null;
2774
+ _meta: {
2775
+ description: string;
2776
+ filters: Record<string, string>;
2777
+ };
2778
+ }>;
2779
+ };
2780
+ /** Sparklines for activity charts */
2781
+ sparklines: {
2782
+ list: (params: {
2783
+ organizationId: string;
2784
+ activityIds: Array<string>;
2785
+ }) => Promise<{
2786
+ items: never[];
2787
+ totalCount: number;
2788
+ _meta: {
2789
+ description: string;
2790
+ filters: {
2791
+ organizationId: string;
2792
+ activityCount?: undefined;
2793
+ };
2794
+ };
2795
+ } | {
2796
+ items: {
2797
+ activity_id: string;
2798
+ engagement: number;
2799
+ reach: number;
2800
+ recorded_date: string;
2801
+ response: number;
2802
+ }[];
2803
+ totalCount: number;
2804
+ _meta: {
2805
+ description: string;
2806
+ filters: {
2807
+ organizationId: string;
2808
+ activityCount: number;
2809
+ };
2810
+ };
2811
+ }>;
2812
+ };
2813
+ };
2814
+ type ActivitiesResource = ReturnType<typeof createActivitiesResource>;
2815
+ /** Single activity with costs */
2816
+ type Activity = Awaited<ReturnType<ActivitiesResource>>['data'];
2817
+ /** Activity in a list/table view */
2818
+ type ActivityInList = Awaited<ReturnType<ActivitiesResource['list']>>['items'][number];
2819
+ /** Contributor linked to an activity */
2820
+ type ActivityContributorInList = Awaited<ReturnType<ActivitiesResource['contributors']['list']>>['items'][number];
2821
+ /** Activity metrics history entry */
2822
+ type ActivityMetricsHistoryEntry = Awaited<ReturnType<ActivitiesResource['metrics']['history']>>['items'][number];
2823
+ /** Metric confidence scores */
2824
+ type MetricConfidence = NonNullable<Awaited<ReturnType<ActivitiesResource['metrics']['confidence']>>['data']>;
2825
+ /** Sparkline data entry for an activity */
2826
+ type ActivitySparklineEntry = Awaited<ReturnType<ActivitiesResource['sparklines']['list']>>['items'][number];
2827
+
2828
+ /**
2829
+ * Creates the campaigns resource with all campaign-related methods.
2830
+ */
2831
+ declare const createCampaignsResource: (db: DbClient) => ((params: {
2832
+ id: string;
2833
+ }) => Promise<{
2834
+ data: {
2835
+ activitiesCount: {
2836
+ count: number;
2837
+ }[];
2838
+ budget: number | null;
2839
+ cost: number | null;
2840
+ costPerThousandEngagement: number | null;
2841
+ costPerThousandReach: number | null;
2842
+ costPerThousandResponse: number | null;
2843
+ createdAt: string;
2844
+ endAt: string | null;
2845
+ id: string;
2846
+ name: string;
2847
+ organizationId: string;
2848
+ startAt: string | null;
2849
+ totalEngagement: number | null;
2850
+ totalReach: number | null;
2851
+ totalResponse: number | null;
2852
+ updatedAt: string;
2853
+ campaignActivities: {
2854
+ id: string;
2855
+ activityId: string;
2856
+ activities: {
2857
+ activity: "instagram_story" | "instagram_post" | "instagram_reel" | "youtube_video" | "youtube_short" | "tiktok_video" | "twitter_post" | "linkedin_post" | "reddit_post" | null;
2858
+ attendeesCount: number | null;
2859
+ channel: "instagram" | "youtube" | "tiktok" | "twitter" | "linkedin" | "event" | "reddit";
2860
+ contentCaption: string | null;
2861
+ contentHref: string | null;
2862
+ cost: number | null;
2863
+ createdAt: string;
2864
+ demosCount: number | null;
2865
+ description: string | null;
2866
+ endAt: string | null;
2867
+ engagement: number | null;
2868
+ engagementTier: number | null;
2869
+ id: string;
2870
+ leadsCount: number | null;
2871
+ likeCount: number | null;
2872
+ metricsLastRefreshedAt: string | null;
2873
+ metricsStatus: "pending" | "completed" | "failed" | "refreshing" | null;
2874
+ organizationId: string;
2875
+ publishedAt: string | null;
2876
+ reach: number | null;
2877
+ reachCount: number | null;
2878
+ reachEstimationSource: Json | null
2879
+ reachTier: number | null;
2880
+ replyCount: number | null;
2881
+ response: number | null;
2882
+ responseTier: number | null;
2883
+ savesCount: number | null;
2884
+ sharesCount: number | null;
2885
+ startAt: string | null;
2886
+ updatedAt: string;
2887
+ viewsCount: number | null;
2888
+ };
2889
+ }[];
2890
+ };
2891
+ _meta: {
2892
+ description: string;
2893
+ filters: {
2894
+ id: string;
2895
+ };
2896
+ };
2897
+ }>) & {
2898
+ /** List campaigns with pagination */
2899
+ list: (params: ListQueryParams) => Promise<{
2900
+ items: {
2901
+ activitiesCount: number | null;
2902
+ budget: number | null;
2903
+ cost: number | null;
2904
+ costPerThousandEngagement: number | null;
2905
+ costPerThousandReach: number | null;
2906
+ costPerThousandResponse: number | null;
2907
+ createdAt: string;
2908
+ endAt: string | null;
2909
+ id: string;
2910
+ name: string;
2911
+ organizationId: string;
2912
+ startAt: string | null;
2913
+ totalEngagement: number | null;
2914
+ totalReach: number | null;
2915
+ totalResponse: number | null;
2916
+ updatedAt: string;
2917
+ }[];
2918
+ totalCount: number;
2919
+ _meta: {
2920
+ description: string;
2921
+ filters: Record<string, string | number>;
2922
+ pagination: {
2923
+ pageIndex: number;
2924
+ pageSize: number;
2925
+ from: number;
2926
+ to: number;
2927
+ };
2928
+ sorting: {
2929
+ sortBy: string;
2930
+ sortDirection: "asc" | "desc";
2931
+ };
2932
+ };
2933
+ }>;
2934
+ };
2935
+ type CampaignsResource = ReturnType<typeof createCampaignsResource>;
2936
+ /** Campaign with activities and counts */
2937
+ type Campaign = Awaited<ReturnType<CampaignsResource>>['data'];
2938
+ /** Campaign in a list/table view */
2939
+ type CampaignInList = Awaited<ReturnType<CampaignsResource['list']>>['items'][number];
2940
+
2941
+ /**
2942
+ * Creates the contributors resource with all contributor-related methods.
2943
+ */
2944
+ declare const createContributorsResource: (db: DbClient) => ((params: {
2945
+ id: string;
2946
+ }) => Promise<{
2947
+ data: {
2948
+ activitiesCount: {
2949
+ count: number;
2950
+ }[];
2951
+ costPerThousandEngagement: number | null;
2952
+ costPerThousandReach: number | null;
2953
+ costPerThousandResponse: number | null;
2954
+ countryCode: string | null;
2955
+ createdAt: string;
2956
+ id: string;
2957
+ name: string;
2958
+ organizationId: string;
2959
+ role: "person" | "community" | "brand_partner";
2960
+ totalActivitiesCost: {
2961
+ sum: number;
2962
+ }[];
2963
+ totalEngagement: number | null;
2964
+ totalFollowersCount: number | null;
2965
+ totalReach: number | null;
2966
+ totalResponse: number | null;
2967
+ updatedAt: string;
2968
+ instagramAccounts: {
2969
+ contributorId: string;
2970
+ createdAt: string;
2971
+ id: string;
2972
+ instagramAccountId: string;
2973
+ organizationId: string;
2974
+ updatedAt: string;
2975
+ instagramAccount: {
2976
+ avatarUrl: string | null;
2977
+ bio: string | null;
2978
+ businessAccount: boolean | null;
2979
+ businessCategoryName: string | null;
2980
+ createdAt: string;
2981
+ externalUrl: string | null;
2982
+ facebookId: string | null;
2983
+ followersCount: number | null;
2984
+ followsCount: number | null;
2985
+ fullName: string | null;
2986
+ hasChannel: boolean | null;
2987
+ highlightReelCount: number | null;
2988
+ id: string;
2989
+ igtvVideoCount: number | null;
2990
+ instagramId: string | null;
2991
+ joinedRecently: boolean | null;
2992
+ lastRefreshedAt: string | null;
2993
+ postsCount: number | null;
2994
+ private: boolean | null;
2995
+ status: "pending" | "completed" | "failed" | "refreshing";
2996
+ updatedAt: string;
2997
+ username: string | null;
2998
+ verified: boolean | null;
2999
+ };
3000
+ }[];
3001
+ youtubeAccounts: {
3002
+ contributorId: string;
3003
+ createdAt: string;
3004
+ id: string;
3005
+ organizationId: string;
3006
+ updatedAt: string;
3007
+ youtubeAccountId: string;
3008
+ youtubeAccount: {
3009
+ ageRestricted: boolean | null;
3010
+ avatarUrl: string | null;
3011
+ channelDescription: string | null;
3012
+ channelId: string | null;
3013
+ channelLocation: string | null;
3014
+ channelName: string | null;
3015
+ channelUrl: string | null;
3016
+ createdAt: string;
3017
+ id: string;
3018
+ joinedDate: string | null;
3019
+ lastRefreshedAt: string | null;
3020
+ status: "pending" | "completed" | "failed" | "refreshing";
3021
+ subscribersCount: number | null;
3022
+ updatedAt: string;
3023
+ username: string | null;
3024
+ verified: boolean | null;
3025
+ videosCount: number | null;
3026
+ viewsCount: number | null;
3027
+ };
3028
+ }[];
3029
+ tiktokAccounts: {
3030
+ contributorId: string;
3031
+ createdAt: string;
3032
+ id: string;
3033
+ organizationId: string;
3034
+ tiktokAccountId: string;
3035
+ updatedAt: string;
3036
+ tiktokAccount: {
3037
+ avatarUrl: string | null;
3038
+ bioLink: string | null;
3039
+ commerceCategory: string | null;
3040
+ commerceUser: boolean | null;
3041
+ createdAt: string;
3042
+ digg: number | null;
3043
+ fans: number | null;
3044
+ following: number | null;
3045
+ friends: number | null;
3046
+ heart: number | null;
3047
+ id: string;
3048
+ lastRefreshedAt: string | null;
3049
+ name: string | null;
3050
+ nickName: string | null;
3051
+ privateAccount: boolean | null;
3052
+ profileUrl: string | null;
3053
+ roomId: string | null;
3054
+ signature: string | null;
3055
+ status: "pending" | "completed" | "failed" | "refreshing";
3056
+ tiktokId: string | null;
3057
+ ttSeller: boolean | null;
3058
+ updatedAt: string;
3059
+ verified: boolean | null;
3060
+ video: number | null;
3061
+ };
3062
+ }[];
3063
+ twitterAccounts: {
3064
+ contributorId: string;
3065
+ createdAt: string;
3066
+ id: string;
3067
+ organizationId: string;
3068
+ twitterAccountId: string;
3069
+ updatedAt: string;
3070
+ twitterAccount: {
3071
+ avatarUrl: string | null;
3072
+ coverImage: string | null;
3073
+ createdAt: string;
3074
+ description: string | null;
3075
+ followersCount: number | null;
3076
+ friendsCount: number | null;
3077
+ id: string;
3078
+ isBlueVerified: boolean | null;
3079
+ lastRefreshedAt: string | null;
3080
+ mediaCount: number | null;
3081
+ name: string | null;
3082
+ screenName: string | null;
3083
+ status: "pending" | "completed" | "failed" | "refreshing";
3084
+ statusesCount: number | null;
3085
+ twitterId: string | null;
3086
+ updatedAt: string;
3087
+ verified: boolean | null;
3088
+ };
3089
+ }[];
3090
+ linkedinAccounts: {
3091
+ contributorId: string;
3092
+ createdAt: string;
3093
+ id: string;
3094
+ linkedinAccountId: string;
3095
+ organizationId: string;
3096
+ updatedAt: string;
3097
+ linkedinAccount: {
3098
+ about: string | null;
3099
+ avatarUrl: string | null;
3100
+ connectionsCount: number | null;
3101
+ coverImageUrl: string | null;
3102
+ createdAt: string;
3103
+ firstName: string | null;
3104
+ followerCount: number | null;
3105
+ headline: string | null;
3106
+ id: string;
3107
+ lastName: string | null;
3108
+ lastRefreshedAt: string | null;
3109
+ linkedinId: string | null;
3110
+ publicIdentifier: string | null;
3111
+ status: "pending" | "completed" | "failed" | "refreshing";
3112
+ updatedAt: string;
3113
+ };
3114
+ }[];
3115
+ redditAccounts: {
3116
+ contributorId: string;
3117
+ createdAt: string;
3118
+ id: string;
3119
+ organizationId: string;
3120
+ redditAccountId: string;
3121
+ updatedAt: string;
3122
+ redditAccount: {
3123
+ avatarUrl: string | null;
3124
+ bannerUrl: string | null;
3125
+ bio: string | null;
3126
+ commentKarma: number | null;
3127
+ createdAt: string;
3128
+ displayName: string | null;
3129
+ id: string;
3130
+ isPremium: boolean | null;
3131
+ isVerified: boolean | null;
3132
+ lastRefreshedAt: string | null;
3133
+ postKarma: number | null;
3134
+ redditId: string | null;
3135
+ status: "pending" | "completed" | "failed" | "refreshing";
3136
+ totalKarma: number | null;
3137
+ updatedAt: string;
3138
+ username: string | null;
3139
+ };
3140
+ }[];
3141
+ };
3142
+ _meta: {
3143
+ description: string;
3144
+ filters: {
3145
+ id: string;
3146
+ };
3147
+ };
3148
+ }>) & {
3149
+ /** List contributors with pagination */
3150
+ list: (params: PaginationParams & {
3151
+ organizationId: string;
3152
+ searchTerm?: string;
3153
+ sortBy?: string;
3154
+ sortDirection?: "asc" | "desc";
3155
+ maxResults?: number;
3156
+ } & {
3157
+ activityId?: string;
3158
+ role?: "person" | "community" | "brand_partner";
3159
+ }) => Promise<{
3160
+ items: {
3161
+ activitiesCount: number | null;
3162
+ costPerThousandEngagement: number | null;
3163
+ costPerThousandReach: number | null;
3164
+ costPerThousandResponse: number | null;
3165
+ countryCode: string | null;
3166
+ createdAt: string;
3167
+ id: string;
3168
+ name: string;
3169
+ organizationId: string;
3170
+ role: "person" | "community" | "brand_partner";
3171
+ totalActivitiesCost: number | null;
3172
+ totalEngagement: number | null;
3173
+ totalFollowersCount: number | null;
3174
+ totalReach: number | null;
3175
+ totalResponse: number | null;
3176
+ updatedAt: string;
3177
+ instagramAccounts: {
3178
+ contributorId: string;
3179
+ createdAt: string;
3180
+ id: string;
3181
+ instagramAccountId: string;
3182
+ organizationId: string;
3183
+ updatedAt: string;
3184
+ instagramAccount: {
3185
+ avatarUrl: string | null;
3186
+ bio: string | null;
3187
+ businessAccount: boolean | null;
3188
+ businessCategoryName: string | null;
3189
+ createdAt: string;
3190
+ externalUrl: string | null;
3191
+ facebookId: string | null;
3192
+ followersCount: number | null;
3193
+ followsCount: number | null;
3194
+ fullName: string | null;
3195
+ hasChannel: boolean | null;
3196
+ highlightReelCount: number | null;
3197
+ id: string;
3198
+ igtvVideoCount: number | null;
3199
+ instagramId: string | null;
3200
+ joinedRecently: boolean | null;
3201
+ lastRefreshedAt: string | null;
3202
+ postsCount: number | null;
3203
+ private: boolean | null;
3204
+ status: "pending" | "completed" | "failed" | "refreshing";
3205
+ updatedAt: string;
3206
+ username: string | null;
3207
+ verified: boolean | null;
3208
+ };
3209
+ }[];
3210
+ youtubeAccounts: {
3211
+ contributorId: string;
3212
+ createdAt: string;
3213
+ id: string;
3214
+ organizationId: string;
3215
+ updatedAt: string;
3216
+ youtubeAccountId: string;
3217
+ youtubeAccount: {
3218
+ ageRestricted: boolean | null;
3219
+ avatarUrl: string | null;
3220
+ channelDescription: string | null;
3221
+ channelId: string | null;
3222
+ channelLocation: string | null;
3223
+ channelName: string | null;
3224
+ channelUrl: string | null;
3225
+ createdAt: string;
3226
+ id: string;
3227
+ joinedDate: string | null;
3228
+ lastRefreshedAt: string | null;
3229
+ status: "pending" | "completed" | "failed" | "refreshing";
3230
+ subscribersCount: number | null;
3231
+ updatedAt: string;
3232
+ username: string | null;
3233
+ verified: boolean | null;
3234
+ videosCount: number | null;
3235
+ viewsCount: number | null;
3236
+ };
3237
+ }[];
3238
+ tiktokAccounts: {
3239
+ contributorId: string;
3240
+ createdAt: string;
3241
+ id: string;
3242
+ organizationId: string;
3243
+ tiktokAccountId: string;
3244
+ updatedAt: string;
3245
+ tiktokAccount: {
3246
+ avatarUrl: string | null;
3247
+ bioLink: string | null;
3248
+ commerceCategory: string | null;
3249
+ commerceUser: boolean | null;
3250
+ createdAt: string;
3251
+ digg: number | null;
3252
+ fans: number | null;
3253
+ following: number | null;
3254
+ friends: number | null;
3255
+ heart: number | null;
3256
+ id: string;
3257
+ lastRefreshedAt: string | null;
3258
+ name: string | null;
3259
+ nickName: string | null;
3260
+ privateAccount: boolean | null;
3261
+ profileUrl: string | null;
3262
+ roomId: string | null;
3263
+ signature: string | null;
3264
+ status: "pending" | "completed" | "failed" | "refreshing";
3265
+ tiktokId: string | null;
3266
+ ttSeller: boolean | null;
3267
+ updatedAt: string;
3268
+ verified: boolean | null;
3269
+ video: number | null;
3270
+ };
3271
+ }[];
3272
+ twitterAccounts: {
3273
+ contributorId: string;
3274
+ createdAt: string;
3275
+ id: string;
3276
+ organizationId: string;
3277
+ twitterAccountId: string;
3278
+ updatedAt: string;
3279
+ twitterAccount: {
3280
+ avatarUrl: string | null;
3281
+ coverImage: string | null;
3282
+ createdAt: string;
3283
+ description: string | null;
3284
+ followersCount: number | null;
3285
+ friendsCount: number | null;
3286
+ id: string;
3287
+ isBlueVerified: boolean | null;
3288
+ lastRefreshedAt: string | null;
3289
+ mediaCount: number | null;
3290
+ name: string | null;
3291
+ screenName: string | null;
3292
+ status: "pending" | "completed" | "failed" | "refreshing";
3293
+ statusesCount: number | null;
3294
+ twitterId: string | null;
3295
+ updatedAt: string;
3296
+ verified: boolean | null;
3297
+ };
3298
+ }[];
3299
+ linkedinAccounts: {
3300
+ contributorId: string;
3301
+ createdAt: string;
3302
+ id: string;
3303
+ linkedinAccountId: string;
3304
+ organizationId: string;
3305
+ updatedAt: string;
3306
+ linkedinAccount: {
3307
+ about: string | null;
3308
+ avatarUrl: string | null;
3309
+ connectionsCount: number | null;
3310
+ coverImageUrl: string | null;
3311
+ createdAt: string;
3312
+ firstName: string | null;
3313
+ followerCount: number | null;
3314
+ headline: string | null;
3315
+ id: string;
3316
+ lastName: string | null;
3317
+ lastRefreshedAt: string | null;
3318
+ linkedinId: string | null;
3319
+ publicIdentifier: string | null;
3320
+ status: "pending" | "completed" | "failed" | "refreshing";
3321
+ updatedAt: string;
3322
+ };
3323
+ }[];
3324
+ redditAccounts: {
3325
+ contributorId: string;
3326
+ createdAt: string;
3327
+ id: string;
3328
+ organizationId: string;
3329
+ redditAccountId: string;
3330
+ updatedAt: string;
3331
+ redditAccount: {
3332
+ avatarUrl: string | null;
3333
+ bannerUrl: string | null;
3334
+ bio: string | null;
3335
+ commentKarma: number | null;
3336
+ createdAt: string;
3337
+ displayName: string | null;
3338
+ id: string;
3339
+ isPremium: boolean | null;
3340
+ isVerified: boolean | null;
3341
+ lastRefreshedAt: string | null;
3342
+ postKarma: number | null;
3343
+ redditId: string | null;
3344
+ status: "pending" | "completed" | "failed" | "refreshing";
3345
+ totalKarma: number | null;
3346
+ updatedAt: string;
3347
+ username: string | null;
3348
+ };
3349
+ }[];
3350
+ }[];
3351
+ totalCount: number;
3352
+ _meta: {
3353
+ description: string;
3354
+ filters: Record<string, string | number>;
3355
+ pagination: {
3356
+ pageIndex: number;
3357
+ pageSize: number;
3358
+ from: number;
3359
+ to: number;
3360
+ };
3361
+ sorting: {
3362
+ sortBy: string;
3363
+ sortDirection: "asc" | "desc";
3364
+ };
3365
+ };
3366
+ }>;
3367
+ };
3368
+ type ContributorsResource = ReturnType<typeof createContributorsResource>;
3369
+ /** Contributor with social accounts and activity counts */
3370
+ type Contributor = Awaited<ReturnType<ContributorsResource>>['data'];
3371
+ /** Contributor in a list/table view */
3372
+ type ContributorInList = Awaited<ReturnType<ContributorsResource['list']>>['items'][number];
3373
+
3374
+ /**
3375
+ * Creates the costs resource with all cost-related methods.
3376
+ */
3377
+ declare const createCostsResource: (db: DbClient) => {
3378
+ /** List costs for an activity with pagination */
3379
+ list: (params: PaginationParams & {
3380
+ organizationId: string;
3381
+ activityId: string;
3382
+ maxResults?: number;
3383
+ }) => Promise<{
3384
+ items: {
3385
+ activityId: string;
3386
+ amount: number | null;
3387
+ contributorId: string | null;
3388
+ createdAt: string;
3389
+ currency: string;
3390
+ description: string | null;
3391
+ id: string;
3392
+ organizationId: string;
3393
+ type: string;
3394
+ updatedAt: string;
3395
+ contributor: {
3396
+ activitiesCount: number | null;
3397
+ costPerThousandEngagement: number | null;
3398
+ costPerThousandReach: number | null;
3399
+ costPerThousandResponse: number | null;
3400
+ countryCode: string | null;
3401
+ createdAt: string;
3402
+ id: string;
3403
+ name: string;
3404
+ organizationId: string;
3405
+ role: "person" | "community" | "brand_partner";
3406
+ totalActivitiesCost: {
3407
+ sum: number;
3408
+ }[];
3409
+ totalEngagement: number | null;
3410
+ totalFollowersCount: number | null;
3411
+ totalReach: number | null;
3412
+ totalResponse: number | null;
3413
+ updatedAt: string;
3414
+ instagramAccounts: {
3415
+ contributorId: string;
3416
+ createdAt: string;
3417
+ id: string;
3418
+ instagramAccountId: string;
3419
+ organizationId: string;
3420
+ updatedAt: string;
3421
+ instagramAccount: {
3422
+ avatarUrl: string | null;
3423
+ bio: string | null;
3424
+ businessAccount: boolean | null;
3425
+ businessCategoryName: string | null;
3426
+ createdAt: string;
3427
+ externalUrl: string | null;
3428
+ facebookId: string | null;
3429
+ followersCount: number | null;
3430
+ followsCount: number | null;
3431
+ fullName: string | null;
3432
+ hasChannel: boolean | null;
3433
+ highlightReelCount: number | null;
3434
+ id: string;
3435
+ igtvVideoCount: number | null;
3436
+ instagramId: string | null;
3437
+ joinedRecently: boolean | null;
3438
+ lastRefreshedAt: string | null;
3439
+ postsCount: number | null;
3440
+ private: boolean | null;
3441
+ status: "pending" | "completed" | "failed" | "refreshing";
3442
+ updatedAt: string;
3443
+ username: string | null;
3444
+ verified: boolean | null;
3445
+ };
3446
+ }[];
3447
+ youtubeAccounts: {
3448
+ contributorId: string;
3449
+ createdAt: string;
3450
+ id: string;
3451
+ organizationId: string;
3452
+ updatedAt: string;
3453
+ youtubeAccountId: string;
3454
+ youtubeAccount: {
3455
+ ageRestricted: boolean | null;
3456
+ avatarUrl: string | null;
3457
+ channelDescription: string | null;
3458
+ channelId: string | null;
3459
+ channelLocation: string | null;
3460
+ channelName: string | null;
3461
+ channelUrl: string | null;
3462
+ createdAt: string;
3463
+ id: string;
3464
+ joinedDate: string | null;
3465
+ lastRefreshedAt: string | null;
3466
+ status: "pending" | "completed" | "failed" | "refreshing";
3467
+ subscribersCount: number | null;
3468
+ updatedAt: string;
3469
+ username: string | null;
3470
+ verified: boolean | null;
3471
+ videosCount: number | null;
3472
+ viewsCount: number | null;
3473
+ };
3474
+ }[];
3475
+ tiktokAccounts: {
3476
+ contributorId: string;
3477
+ createdAt: string;
3478
+ id: string;
3479
+ organizationId: string;
3480
+ tiktokAccountId: string;
3481
+ updatedAt: string;
3482
+ tiktokAccount: {
3483
+ avatarUrl: string | null;
3484
+ bioLink: string | null;
3485
+ commerceCategory: string | null;
3486
+ commerceUser: boolean | null;
3487
+ createdAt: string;
3488
+ digg: number | null;
3489
+ fans: number | null;
3490
+ following: number | null;
3491
+ friends: number | null;
3492
+ heart: number | null;
3493
+ id: string;
3494
+ lastRefreshedAt: string | null;
3495
+ name: string | null;
3496
+ nickName: string | null;
3497
+ privateAccount: boolean | null;
3498
+ profileUrl: string | null;
3499
+ roomId: string | null;
3500
+ signature: string | null;
3501
+ status: "pending" | "completed" | "failed" | "refreshing";
3502
+ tiktokId: string | null;
3503
+ ttSeller: boolean | null;
3504
+ updatedAt: string;
3505
+ verified: boolean | null;
3506
+ video: number | null;
3507
+ };
3508
+ }[];
3509
+ twitterAccounts: {
3510
+ contributorId: string;
3511
+ createdAt: string;
3512
+ id: string;
3513
+ organizationId: string;
3514
+ twitterAccountId: string;
3515
+ updatedAt: string;
3516
+ twitterAccount: {
3517
+ avatarUrl: string | null;
3518
+ coverImage: string | null;
3519
+ createdAt: string;
3520
+ description: string | null;
3521
+ followersCount: number | null;
3522
+ friendsCount: number | null;
3523
+ id: string;
3524
+ isBlueVerified: boolean | null;
3525
+ lastRefreshedAt: string | null;
3526
+ mediaCount: number | null;
3527
+ name: string | null;
3528
+ screenName: string | null;
3529
+ status: "pending" | "completed" | "failed" | "refreshing";
3530
+ statusesCount: number | null;
3531
+ twitterId: string | null;
3532
+ updatedAt: string;
3533
+ verified: boolean | null;
3534
+ };
3535
+ }[];
3536
+ linkedinAccounts: {
3537
+ contributorId: string;
3538
+ createdAt: string;
3539
+ id: string;
3540
+ linkedinAccountId: string;
3541
+ organizationId: string;
3542
+ updatedAt: string;
3543
+ linkedinAccount: {
3544
+ about: string | null;
3545
+ avatarUrl: string | null;
3546
+ connectionsCount: number | null;
3547
+ coverImageUrl: string | null;
3548
+ createdAt: string;
3549
+ firstName: string | null;
3550
+ followerCount: number | null;
3551
+ headline: string | null;
3552
+ id: string;
3553
+ lastName: string | null;
3554
+ lastRefreshedAt: string | null;
3555
+ linkedinId: string | null;
3556
+ publicIdentifier: string | null;
3557
+ status: "pending" | "completed" | "failed" | "refreshing";
3558
+ updatedAt: string;
3559
+ };
3560
+ }[];
3561
+ redditAccounts: {
3562
+ contributorId: string;
3563
+ createdAt: string;
3564
+ id: string;
3565
+ organizationId: string;
3566
+ redditAccountId: string;
3567
+ updatedAt: string;
3568
+ redditAccount: {
3569
+ avatarUrl: string | null;
3570
+ bannerUrl: string | null;
3571
+ bio: string | null;
3572
+ commentKarma: number | null;
3573
+ createdAt: string;
3574
+ displayName: string | null;
3575
+ id: string;
3576
+ isPremium: boolean | null;
3577
+ isVerified: boolean | null;
3578
+ lastRefreshedAt: string | null;
3579
+ postKarma: number | null;
3580
+ redditId: string | null;
3581
+ status: "pending" | "completed" | "failed" | "refreshing";
3582
+ totalKarma: number | null;
3583
+ updatedAt: string;
3584
+ username: string | null;
3585
+ };
3586
+ }[];
3587
+ } | null;
3588
+ }[];
3589
+ totalCount: number;
3590
+ _meta: {
3591
+ description: string;
3592
+ filters: Record<string, string | number>;
3593
+ pagination: {
3594
+ pageIndex: number;
3595
+ pageSize: number;
3596
+ from: number;
3597
+ to: number;
3598
+ };
3599
+ };
3600
+ }>;
3601
+ /** Count costs matching the given filters */
3602
+ count: (params: {
3603
+ organizationId: string;
3604
+ activityId?: string;
3605
+ contributorId?: string;
3606
+ }) => Promise<{
3607
+ count: number;
3608
+ _meta: {
3609
+ description: string;
3610
+ filters: Record<string, string>;
3611
+ };
3612
+ }>;
3613
+ /** Sub-resource for cost types */
3614
+ types: {
3615
+ list: (params: {
3616
+ organizationId: string;
3617
+ maxResults?: number;
3618
+ }) => Promise<{
3619
+ items: string[];
3620
+ totalCount: number;
3621
+ _meta: {
3622
+ description: string;
3623
+ filters: Record<string, string | number>;
3624
+ };
3625
+ }>;
3626
+ };
3627
+ };
3628
+ type CostsResource = ReturnType<typeof createCostsResource>;
3629
+ /** Cost record in a list with contributor information */
3630
+ type CostInList = Awaited<ReturnType<CostsResource['list']>>['items'][number];
3631
+
3632
+ /**
3633
+ * Creates the notes resource with all note-related methods.
3634
+ */
3635
+ declare const createNotesResource: (db: DbClient) => ((params: {
3636
+ id: string;
3637
+ }) => Promise<{
3638
+ data: {
3639
+ content: string;
3640
+ createdAt: string;
3641
+ createdBy: string | null;
3642
+ createdByName: string;
3643
+ id: string;
3644
+ organizationId: string;
3645
+ updatedAt: string;
3646
+ creator: {
3647
+ createdAt: string;
3648
+ email: string | null;
3649
+ name: string | null;
3650
+ updatedAt: string;
3651
+ userId: string;
3652
+ } | null;
3653
+ };
3654
+ _meta: {
3655
+ description: string;
3656
+ filters: {
3657
+ id: string;
3658
+ };
3659
+ };
3660
+ }>) & {
3661
+ /** List notes - requires either activityId or contributorId */
3662
+ list: (params: {
3663
+ organizationId: string;
3664
+ maxResults?: number;
3665
+ } & ({
3666
+ activityId: string;
3667
+ contributorId?: never;
3668
+ } | {
3669
+ contributorId: string;
3670
+ activityId?: never;
3671
+ })) => Promise<{
3672
+ items: {
3673
+ id: string;
3674
+ createdAt: string;
3675
+ note: {
3676
+ id: string;
3677
+ content: string;
3678
+ createdAt: string;
3679
+ updatedAt: string;
3680
+ createdBy: string | null;
3681
+ createdByName: string;
3682
+ organizationId: string;
3683
+ creator: {
3684
+ createdAt: string;
3685
+ email: string | null;
3686
+ name: string | null;
3687
+ updatedAt: string;
3688
+ userId: string;
3689
+ } | null;
3690
+ };
3691
+ }[];
3692
+ totalCount: number;
3693
+ _meta: {
3694
+ description: string;
3695
+ filters: Record<string, string | number>;
3696
+ };
3697
+ }>;
3698
+ };
3699
+ type NotesResource = ReturnType<typeof createNotesResource>;
3700
+ /** Note with creator information */
3701
+ type Note = Awaited<ReturnType<NotesResource>>['data'];
3702
+ /** Note in a list (from activity or contributor) */
3703
+ type NoteInList = Awaited<ReturnType<NotesResource['list']>>['items'][number];
3704
+
3705
+ /**
3706
+ * Creates the organizations resource with all organization-related methods.
3707
+ */
3708
+ declare const createOrganizationsResource: (db: DbClient) => {
3709
+ /** List organizations that a user is a member of */
3710
+ list: (params: PaginationParams & {
3711
+ userId: string;
3712
+ }) => Promise<{
3713
+ items: {
3714
+ acceptedAt: string | null;
3715
+ createdAt: string;
3716
+ id: string;
3717
+ organizationId: string;
3718
+ role: string;
3719
+ updatedAt: string;
3720
+ userId: string;
3721
+ organization: {
3722
+ costPerThousandEngagement: number | null;
3723
+ costPerThousandReach: number | null;
3724
+ costPerThousandResponse: number | null;
3725
+ countryCode: string | null;
3726
+ createdAt: string;
3727
+ currency: string;
3728
+ gaConnectedAt: string | null;
3729
+ gaPropertyId: string | null;
3730
+ gaPropertyName: string | null;
3731
+ gaTokenExpiresAt: string | null;
3732
+ ianaTimezone: string;
3733
+ name: string;
3734
+ organizationId: string;
3735
+ totalCost: number | null;
3736
+ totalEngagement: number | null;
3737
+ totalReach: number | null;
3738
+ totalResponse: number | null;
3739
+ updatedAt: string;
3740
+ };
3741
+ }[];
3742
+ totalCount: number;
3743
+ _meta: {
3744
+ description: string;
3745
+ filters: {
3746
+ userId: string;
3747
+ };
3748
+ pagination: {
3749
+ pageIndex: number;
3750
+ pageSize: number;
3751
+ from: number;
3752
+ to: number;
3753
+ };
3754
+ };
3755
+ }>;
3756
+ /** Organization user membership operations */
22
3757
  users: {
23
- getSettings(userId: string): Promise<{
3758
+ list: (params: ListQueryParams) => Promise<{
3759
+ items: {
3760
+ acceptedAt: string | null;
3761
+ createdAt: string;
3762
+ id: string;
3763
+ organizationId: string;
3764
+ role: string;
3765
+ updatedAt: string;
3766
+ userId: string;
3767
+ user: {
3768
+ createdAt: string;
3769
+ email: string | null;
3770
+ name: string | null;
3771
+ updatedAt: string;
3772
+ userId: string;
3773
+ };
3774
+ }[];
3775
+ totalCount: number;
3776
+ _meta: {
3777
+ description: string;
3778
+ filters: Record<string, string>;
3779
+ pagination: {
3780
+ pageIndex: number;
3781
+ pageSize: number;
3782
+ from: number;
3783
+ to: number;
3784
+ };
3785
+ };
3786
+ }>;
3787
+ };
3788
+ };
3789
+ type OrganizationsResource = ReturnType<typeof createOrganizationsResource>;
3790
+ /** Organization membership with full organization details */
3791
+ type OrganizationInList = Awaited<ReturnType<OrganizationsResource['list']>>['items'][number];
3792
+ /** Organization user membership with full user details */
3793
+ type OrganizationUserInList = Awaited<ReturnType<OrganizationsResource['users']['list']>>['items'][number];
3794
+
3795
+ /**
3796
+ * Creates the reporting resource with all reporting-related methods.
3797
+ */
3798
+ declare const createReportingResource: (db: DbClient) => {
3799
+ efficiency: {
3800
+ /** Get efficiency metrics for an organization */
3801
+ organization: ((params: {
3802
+ organizationId: string;
3803
+ }) => Promise<{
3804
+ data: {
3805
+ organizationId: string;
3806
+ name: string;
3807
+ totalCost: number | null;
3808
+ totalEngagement: number | null;
3809
+ totalReach: number | null;
3810
+ totalResponse: number | null;
3811
+ costPerThousandEngagement: number | null;
3812
+ costPerThousandReach: number | null;
3813
+ costPerThousandResponse: number | null;
3814
+ } | null;
3815
+ _meta: {
3816
+ description: string;
3817
+ filters: {
3818
+ organizationId: string;
3819
+ };
3820
+ };
3821
+ }>) & {
3822
+ history: (params: {
3823
+ organizationId: string;
3824
+ daysBack?: number;
3825
+ maxResults?: number;
3826
+ }) => Promise<{
3827
+ items: {
3828
+ costPerThousandEngagement: number | null;
3829
+ costPerThousandReach: number | null;
3830
+ costPerThousandResponse: number | null;
3831
+ recordedDate: string;
3832
+ }[];
3833
+ totalCount: number;
3834
+ _meta: {
3835
+ description: string;
3836
+ filters: {
3837
+ organizationId: string;
3838
+ daysBack: number;
3839
+ };
3840
+ };
3841
+ }>;
3842
+ };
3843
+ /** Get efficiency metrics for a contributor */
3844
+ contributor: ((params: {
3845
+ organizationId: string;
3846
+ contributorId: string;
3847
+ }) => Promise<{
3848
+ data: {
3849
+ id: string;
3850
+ name: string;
3851
+ role: "person" | "community" | "brand_partner";
3852
+ countryCode: string | null;
3853
+ activitiesCount: number | null;
3854
+ totalActivitiesCost: number | null;
3855
+ totalEngagement: number | null;
3856
+ totalReach: number | null;
3857
+ totalResponse: number | null;
3858
+ totalFollowersCount: number | null;
3859
+ costPerThousandEngagement: number | null;
3860
+ costPerThousandReach: number | null;
3861
+ costPerThousandResponse: number | null;
3862
+ } | null;
3863
+ _meta: {
3864
+ description: string;
3865
+ filters: {
3866
+ organizationId: string;
3867
+ contributorId: string;
3868
+ };
3869
+ };
3870
+ }>) & {
3871
+ history: (params: {
3872
+ organizationId: string;
3873
+ contributorId: string;
3874
+ daysBack?: number;
3875
+ maxResults?: number;
3876
+ }) => Promise<{
3877
+ items: {
3878
+ costPerThousandEngagement: number | null;
3879
+ costPerThousandReach: number | null;
3880
+ costPerThousandResponse: number | null;
3881
+ recordedDate: string;
3882
+ }[];
3883
+ totalCount: number;
3884
+ _meta: {
3885
+ description: string;
3886
+ filters: {
3887
+ organizationId: string;
3888
+ contributorId: string;
3889
+ daysBack: number;
3890
+ };
3891
+ };
3892
+ }>;
3893
+ };
3894
+ /** Get efficiency metrics for a campaign */
3895
+ campaign: ((params: {
3896
+ organizationId: string;
3897
+ campaignId: string;
3898
+ }) => Promise<{
3899
+ data: {
3900
+ id: string;
3901
+ name: string;
3902
+ startAt: string | null;
3903
+ endAt: string | null;
3904
+ budget: number | null;
3905
+ cost: number | null;
3906
+ activitiesCount: number | null;
3907
+ totalEngagement: number | null;
3908
+ totalReach: number | null;
3909
+ totalResponse: number | null;
3910
+ costPerThousandEngagement: number | null;
3911
+ costPerThousandReach: number | null;
3912
+ costPerThousandResponse: number | null;
3913
+ } | null;
3914
+ _meta: {
3915
+ description: string;
3916
+ filters: {
3917
+ organizationId: string;
3918
+ campaignId: string;
3919
+ };
3920
+ };
3921
+ }>) & {
3922
+ history: (params: {
3923
+ organizationId: string;
3924
+ campaignId: string;
3925
+ daysBack?: number;
3926
+ maxResults?: number;
3927
+ }) => Promise<{
3928
+ items: {
3929
+ costPerThousandEngagement: number | null;
3930
+ costPerThousandReach: number | null;
3931
+ costPerThousandResponse: number | null;
3932
+ recordedDate: string;
3933
+ }[];
3934
+ totalCount: number;
3935
+ _meta: {
3936
+ description: string;
3937
+ filters: {
3938
+ organizationId: string;
3939
+ campaignId: string;
3940
+ daysBack: number;
3941
+ };
3942
+ };
3943
+ }>;
3944
+ };
3945
+ /** List contributors with efficiency metrics */
3946
+ contributors: {
3947
+ list: (params: Omit<ListQueryParams, "organizationId"> & {
3948
+ organizationId: string;
3949
+ pageIndex: number;
3950
+ pageSize: number;
3951
+ campaignId?: string;
3952
+ }) => Promise<{
3953
+ items: {
3954
+ id: string;
3955
+ name: string;
3956
+ role: "person" | "community" | "brand_partner";
3957
+ countryCode: string | null;
3958
+ createdAt: string;
3959
+ updatedAt: string;
3960
+ organizationId: string;
3961
+ activitiesCount: number | null;
3962
+ totalActivitiesCost: number | null;
3963
+ totalEngagement: number | null;
3964
+ totalReach: number | null;
3965
+ totalResponse: number | null;
3966
+ totalFollowersCount: number | null;
3967
+ costPerThousandEngagement: number | null;
3968
+ costPerThousandReach: number | null;
3969
+ costPerThousandResponse: number | null;
3970
+ instagramAccounts: {
3971
+ contributorId: string;
3972
+ createdAt: string;
3973
+ id: string;
3974
+ instagramAccountId: string;
3975
+ organizationId: string;
3976
+ updatedAt: string;
3977
+ instagramAccount: {
3978
+ avatarUrl: string | null;
3979
+ bio: string | null;
3980
+ businessAccount: boolean | null;
3981
+ businessCategoryName: string | null;
3982
+ createdAt: string;
3983
+ externalUrl: string | null;
3984
+ facebookId: string | null;
3985
+ followersCount: number | null;
3986
+ followsCount: number | null;
3987
+ fullName: string | null;
3988
+ hasChannel: boolean | null;
3989
+ highlightReelCount: number | null;
3990
+ id: string;
3991
+ igtvVideoCount: number | null;
3992
+ instagramId: string | null;
3993
+ joinedRecently: boolean | null;
3994
+ lastRefreshedAt: string | null;
3995
+ postsCount: number | null;
3996
+ private: boolean | null;
3997
+ status: "pending" | "completed" | "failed" | "refreshing";
3998
+ updatedAt: string;
3999
+ username: string | null;
4000
+ verified: boolean | null;
4001
+ };
4002
+ }[];
4003
+ youtubeAccounts: {
4004
+ contributorId: string;
4005
+ createdAt: string;
4006
+ id: string;
4007
+ organizationId: string;
4008
+ updatedAt: string;
4009
+ youtubeAccountId: string;
4010
+ youtubeAccount: {
4011
+ ageRestricted: boolean | null;
4012
+ avatarUrl: string | null;
4013
+ channelDescription: string | null;
4014
+ channelId: string | null;
4015
+ channelLocation: string | null;
4016
+ channelName: string | null;
4017
+ channelUrl: string | null;
4018
+ createdAt: string;
4019
+ id: string;
4020
+ joinedDate: string | null;
4021
+ lastRefreshedAt: string | null;
4022
+ status: "pending" | "completed" | "failed" | "refreshing";
4023
+ subscribersCount: number | null;
4024
+ updatedAt: string;
4025
+ username: string | null;
4026
+ verified: boolean | null;
4027
+ videosCount: number | null;
4028
+ viewsCount: number | null;
4029
+ };
4030
+ }[];
4031
+ tiktokAccounts: {
4032
+ contributorId: string;
4033
+ createdAt: string;
4034
+ id: string;
4035
+ organizationId: string;
4036
+ tiktokAccountId: string;
4037
+ updatedAt: string;
4038
+ tiktokAccount: {
4039
+ avatarUrl: string | null;
4040
+ bioLink: string | null;
4041
+ commerceCategory: string | null;
4042
+ commerceUser: boolean | null;
4043
+ createdAt: string;
4044
+ digg: number | null;
4045
+ fans: number | null;
4046
+ following: number | null;
4047
+ friends: number | null;
4048
+ heart: number | null;
4049
+ id: string;
4050
+ lastRefreshedAt: string | null;
4051
+ name: string | null;
4052
+ nickName: string | null;
4053
+ privateAccount: boolean | null;
4054
+ profileUrl: string | null;
4055
+ roomId: string | null;
4056
+ signature: string | null;
4057
+ status: "pending" | "completed" | "failed" | "refreshing";
4058
+ tiktokId: string | null;
4059
+ ttSeller: boolean | null;
4060
+ updatedAt: string;
4061
+ verified: boolean | null;
4062
+ video: number | null;
4063
+ };
4064
+ }[];
4065
+ twitterAccounts: {
4066
+ contributorId: string;
4067
+ createdAt: string;
4068
+ id: string;
4069
+ organizationId: string;
4070
+ twitterAccountId: string;
4071
+ updatedAt: string;
4072
+ twitterAccount: {
4073
+ avatarUrl: string | null;
4074
+ coverImage: string | null;
4075
+ createdAt: string;
4076
+ description: string | null;
4077
+ followersCount: number | null;
4078
+ friendsCount: number | null;
4079
+ id: string;
4080
+ isBlueVerified: boolean | null;
4081
+ lastRefreshedAt: string | null;
4082
+ mediaCount: number | null;
4083
+ name: string | null;
4084
+ screenName: string | null;
4085
+ status: "pending" | "completed" | "failed" | "refreshing";
4086
+ statusesCount: number | null;
4087
+ twitterId: string | null;
4088
+ updatedAt: string;
4089
+ verified: boolean | null;
4090
+ };
4091
+ }[];
4092
+ linkedinAccounts: {
4093
+ contributorId: string;
4094
+ createdAt: string;
4095
+ id: string;
4096
+ linkedinAccountId: string;
4097
+ organizationId: string;
4098
+ updatedAt: string;
4099
+ linkedinAccount: {
4100
+ about: string | null;
4101
+ avatarUrl: string | null;
4102
+ connectionsCount: number | null;
4103
+ coverImageUrl: string | null;
4104
+ createdAt: string;
4105
+ firstName: string | null;
4106
+ followerCount: number | null;
4107
+ headline: string | null;
4108
+ id: string;
4109
+ lastName: string | null;
4110
+ lastRefreshedAt: string | null;
4111
+ linkedinId: string | null;
4112
+ publicIdentifier: string | null;
4113
+ status: "pending" | "completed" | "failed" | "refreshing";
4114
+ updatedAt: string;
4115
+ };
4116
+ }[];
4117
+ redditAccounts: {
4118
+ contributorId: string;
4119
+ createdAt: string;
4120
+ id: string;
4121
+ organizationId: string;
4122
+ redditAccountId: string;
4123
+ updatedAt: string;
4124
+ redditAccount: {
4125
+ avatarUrl: string | null;
4126
+ bannerUrl: string | null;
4127
+ bio: string | null;
4128
+ commentKarma: number | null;
4129
+ createdAt: string;
4130
+ displayName: string | null;
4131
+ id: string;
4132
+ isPremium: boolean | null;
4133
+ isVerified: boolean | null;
4134
+ lastRefreshedAt: string | null;
4135
+ postKarma: number | null;
4136
+ redditId: string | null;
4137
+ status: "pending" | "completed" | "failed" | "refreshing";
4138
+ totalKarma: number | null;
4139
+ updatedAt: string;
4140
+ username: string | null;
4141
+ };
4142
+ }[];
4143
+ }[];
4144
+ totalCount: number;
4145
+ _meta: {
4146
+ description: string;
4147
+ filters: Record<string, string | number>;
4148
+ pagination: {
4149
+ pageIndex: number;
4150
+ pageSize: number;
4151
+ from: number;
4152
+ to: number;
4153
+ };
4154
+ sorting: {
4155
+ sortBy: string;
4156
+ sortDirection: "asc" | "desc";
4157
+ };
4158
+ };
4159
+ }>;
4160
+ };
4161
+ /** List campaigns with efficiency metrics */
4162
+ campaigns: {
4163
+ list: (params: Omit<ListQueryParams, "organizationId"> & {
4164
+ organizationId: string;
4165
+ pageIndex: number;
4166
+ pageSize: number;
4167
+ contributorId?: string;
4168
+ }) => Promise<{
4169
+ items: {
4170
+ id: string;
4171
+ name: string;
4172
+ startAt: string | null;
4173
+ endAt: string | null;
4174
+ budget: number | null;
4175
+ cost: number | null;
4176
+ activitiesCount: number | null;
4177
+ totalEngagement: number | null;
4178
+ totalReach: number | null;
4179
+ totalResponse: number | null;
4180
+ costPerThousandEngagement: number | null;
4181
+ costPerThousandReach: number | null;
4182
+ costPerThousandResponse: number | null;
4183
+ }[];
4184
+ totalCount: number;
4185
+ _meta: {
4186
+ description: string;
4187
+ filters: Record<string, string | number>;
4188
+ pagination: {
4189
+ pageIndex: number;
4190
+ pageSize: number;
4191
+ from: number;
4192
+ to: number;
4193
+ };
4194
+ sorting: {
4195
+ sortBy: string;
4196
+ sortDirection: "asc" | "desc";
4197
+ };
4198
+ };
4199
+ }>;
4200
+ };
4201
+ };
4202
+ };
4203
+ type ReportingResource = ReturnType<typeof createReportingResource>;
4204
+ type EfficiencyResource = ReportingResource['efficiency'];
4205
+ type OrganizationEfficiency = NonNullable<Awaited<ReturnType<EfficiencyResource['organization']>>['data']>;
4206
+ type ContributorEfficiency = NonNullable<Awaited<ReturnType<EfficiencyResource['contributor']>>['data']>;
4207
+ type CampaignEfficiency = NonNullable<Awaited<ReturnType<EfficiencyResource['campaign']>>['data']>;
4208
+ type ContributorEfficiencyInList = Awaited<ReturnType<EfficiencyResource['contributors']['list']>>['items'][number];
4209
+ type CampaignEfficiencyInList = Awaited<ReturnType<EfficiencyResource['campaigns']['list']>>['items'][number];
4210
+ type EfficiencyHistoryEntry = Awaited<ReturnType<EfficiencyResource['organization']['history']>>['items'][number];
4211
+
4212
+ /**
4213
+ * Creates the users resource with all user-related methods.
4214
+ */
4215
+ declare const createUsersResource: (db: DbClient) => ((params: {
4216
+ id: string;
4217
+ }) => Promise<{
4218
+ data: {
4219
+ createdAt: string;
4220
+ email: string | null;
4221
+ name: string | null;
4222
+ updatedAt: string;
4223
+ userId: string;
4224
+ };
4225
+ _meta: {
4226
+ description: string;
4227
+ filters: {
4228
+ id: string;
4229
+ };
4230
+ };
4231
+ }>) & {
4232
+ /** List users in an organization */
4233
+ list: (params: ListQueryParams) => Promise<{
4234
+ items: {
4235
+ createdAt: string;
4236
+ email: string | null;
4237
+ name: string | null;
4238
+ updatedAt: string;
4239
+ userId: string;
4240
+ }[];
4241
+ totalCount: number;
4242
+ _meta: {
4243
+ description: string;
4244
+ filters: Record<string, string>;
4245
+ pagination: {
4246
+ pageIndex: number;
4247
+ pageSize: number;
4248
+ from: number;
4249
+ to: number;
4250
+ };
4251
+ };
4252
+ }>;
4253
+ /** User settings - callable function to get settings by user ID */
4254
+ settings: (params: {
4255
+ userId: string;
4256
+ }) => Promise<{
4257
+ data: null;
4258
+ _meta: {
4259
+ description: string;
4260
+ filters: {
4261
+ userId: string;
4262
+ };
4263
+ };
4264
+ } | {
4265
+ data: {
24
4266
  activeOrganizationId: string | null;
25
4267
  createdAt: string;
26
4268
  updatedAt: string;
27
4269
  userId: string;
28
- } | null>;
29
- };
4270
+ };
4271
+ _meta: {
4272
+ description: string;
4273
+ filters: {
4274
+ userId: string;
4275
+ };
4276
+ };
4277
+ }>;
30
4278
  };
4279
+ type UsersResource = ReturnType<typeof createUsersResource>;
4280
+ /** Single user with profile information */
4281
+ type User = Awaited<ReturnType<UsersResource>>['data'];
4282
+ /** User in a list/table view */
4283
+ type UserInList = Awaited<ReturnType<UsersResource['list']>>['items'][number];
4284
+ /** User settings */
4285
+ type UserSettings = NonNullable<Awaited<ReturnType<UsersResource['settings']>>['data']>;
31
4286
 
32
4287
  /**
33
4288
  * Convert snake_case to camelCase
@@ -63,4 +4318,4 @@ declare const toCamelCase: <T>(obj: T) => SnakeToCamelCase<T>;
63
4318
  */
64
4319
  declare const toCamelCaseArray: <T>(arr: Array<T>) => Array<SnakeToCamelCase<T>>;
65
4320
 
66
- export { type BrandwaveOptions, type CamelToSnakeCase, type SnakeToCamelCase, createBrandwave, toCamelCase, toCamelCaseArray, toSnakeCase };
4321
+ export { type Activity, type ActivityContributorInList, type ActivityInList, type ActivityMetricsHistoryEntry, type ActivitySparklineEntry, type BrandwaveOptions, type CamelToSnakeCase, type Campaign, type CampaignEfficiency, type CampaignEfficiencyInList, type CampaignInList, type Contributor, type ContributorEfficiency, type ContributorEfficiencyInList, type ContributorInList, type CostInList, type CountMeta, type CountResult, type EfficiencyHistoryEntry, type ItemMeta, type ItemResult, type ListMeta, type ListQueryParams, type ListResult, type MetricConfidence, type Note, type NoteInList, type OrganizationEfficiency, type OrganizationInList, type OrganizationUserInList, type PaginationParams, type SnakeToCamelCase, type User, type UserInList, type UserSettings, createBrandwave, toCamelCase, toCamelCaseArray, toSnakeCase };