@adport/provider-reddit 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AdProvider, ProviderCapabilities, StandardActions, Account, NormalizedQuery, Report, WriteOperation, WriteGuard, WritePreview, WriteResult, AnyToolDefinition, CredentialStore, ProviderModule } from '@adport/core';
1
+ import { MediaResolver, WriteOperation, WriteGuard, WritePreview, WriteResult, AdProvider, ProviderCapabilities, StandardActions, Account, NormalizedQuery, Report, AnyToolDefinition, CredentialStore, ProviderModule } from '@adport/core';
2
+ import { z } from 'zod';
2
3
 
3
4
  interface RedditCredentials {
4
5
  clientId: string;
@@ -26,15 +27,775 @@ declare class RedditAdsClient {
26
27
  private readonly fetchImpl;
27
28
  private token?;
28
29
  private refreshToken;
30
+ private refreshing?;
29
31
  constructor(credentials: RedditCredentials, fetchImpl?: typeof fetch);
32
+ /** Bind account-less native async job IDs to their approved create request. */
33
+ resourceReceipt(kind: 'post_job' | 'asset_upload', accountId: string, profileId: string, resourceId: string): string;
34
+ verifyResourceReceipt(receipt: string, kind: 'post_job' | 'asset_upload', accountId: string, resourceId: string): {
35
+ profile_id: string;
36
+ };
37
+ private receiptMac;
38
+ diagnostic(value: unknown): string | undefined;
30
39
  get<T>(pathOrUrl: string, params?: Record<string, unknown>): Promise<RedditEnvelope<T>>;
31
40
  post<T>(pathOrUrl: string, body: Record<string, unknown>): Promise<RedditEnvelope<T>>;
32
41
  patch<T>(pathOrUrl: string, body: Record<string, unknown>): Promise<RedditEnvelope<T>>;
33
42
  delete<T>(pathOrUrl: string): Promise<RedditEnvelope<T>>;
34
43
  getPaged<T>(path: string, params?: Record<string, unknown>, limit?: number): Promise<T[]>;
44
+ nextUrl(next: string, current: string): string;
35
45
  private url;
36
46
  private send;
37
47
  private accessToken;
48
+ private redact;
49
+ private refresh;
50
+ }
51
+
52
+ type Row$1 = Record<string, unknown>;
53
+ type Entity = 'campaigns' | 'ad_groups' | 'ads';
54
+ interface Page {
55
+ account_id: string;
56
+ page_size: number;
57
+ cursor?: string;
58
+ }
59
+ interface RedditCreativePlan extends Omit<WritePreview, 'serverValidated'> {
60
+ execute: () => Promise<WriteResult>;
61
+ }
62
+ /** Typed manual campaign children and current structured-post/asset APIs. */
63
+ declare class RedditCreativeService {
64
+ private readonly client;
65
+ private readonly media;
66
+ constructor(client: RedditAdsClient, media?: MediaResolver);
67
+ private one;
68
+ owned(account: string, entity: Entity, resource: string): Promise<Row$1>;
69
+ private page;
70
+ profiles(account: string): Promise<{
71
+ [x: string]: unknown;
72
+ id: string;
73
+ }[]>;
74
+ private profile;
75
+ private profileMatch;
76
+ groups(input: Page & {
77
+ campaign_id?: string;
78
+ ad_group_ids?: string[];
79
+ }): Promise<{
80
+ next_cursor?: string | undefined;
81
+ items: Row$1[];
82
+ truncated: boolean;
83
+ }>;
84
+ private post;
85
+ private ownedPost;
86
+ assertPostOwned(account: string, postId: string): Promise<void>;
87
+ assertProfileAvailable(account: string, profileId: string): Promise<void>;
88
+ assertTargetingAvailable(account: string, value: unknown): Promise<void>;
89
+ posts(input: Page & {
90
+ profile_id: string;
91
+ }): Promise<{
92
+ creatives: {
93
+ id: string;
94
+ provider: string;
95
+ account_id: string;
96
+ name: string;
97
+ type: string;
98
+ headlines: string[];
99
+ descriptions: string[];
100
+ landing_urls: string[];
101
+ media: {
102
+ type: "image" | "video" | "audio";
103
+ url: string;
104
+ alt?: string | undefined;
105
+ poster_url?: string | undefined;
106
+ open_url?: string | undefined;
107
+ }[];
108
+ actions: {
109
+ label: string;
110
+ tool: string;
111
+ arguments: Record<string, unknown>;
112
+ fields: {
113
+ key: string;
114
+ label: string;
115
+ type: "text" | "text_list" | "url_list" | "select";
116
+ value: string | string[];
117
+ options?: {
118
+ label: string;
119
+ value: string;
120
+ }[] | undefined;
121
+ max_length?: number | undefined;
122
+ }[];
123
+ }[];
124
+ status?: string | undefined;
125
+ campaign_id?: string | undefined;
126
+ ad_group_id?: string | undefined;
127
+ }[];
128
+ next_cursor?: string | undefined;
129
+ items: Row$1[];
130
+ truncated: boolean;
131
+ }>;
132
+ private asset;
133
+ private readyAsset;
134
+ assets(input: Page & {
135
+ profile_id: string;
136
+ }): Promise<{
137
+ items: {
138
+ [x: string]: unknown;
139
+ id: string;
140
+ }[];
141
+ creatives: {
142
+ id: string;
143
+ provider: string;
144
+ account_id: string;
145
+ name: string;
146
+ type: string;
147
+ headlines: string[];
148
+ descriptions: string[];
149
+ landing_urls: string[];
150
+ media: {
151
+ type: "image" | "video" | "audio";
152
+ url: string;
153
+ alt?: string | undefined;
154
+ poster_url?: string | undefined;
155
+ open_url?: string | undefined;
156
+ }[];
157
+ actions: {
158
+ label: string;
159
+ tool: string;
160
+ arguments: Record<string, unknown>;
161
+ fields: {
162
+ key: string;
163
+ label: string;
164
+ type: "text" | "text_list" | "url_list" | "select";
165
+ value: string | string[];
166
+ options?: {
167
+ label: string;
168
+ value: string;
169
+ }[] | undefined;
170
+ max_length?: number | undefined;
171
+ }[];
172
+ }[];
173
+ status?: string | undefined;
174
+ campaign_id?: string | undefined;
175
+ ad_group_id?: string | undefined;
176
+ }[];
177
+ next_cursor?: string | undefined;
178
+ truncated: boolean;
179
+ }>;
180
+ ads(input: Page & {
181
+ ad_ids?: string[];
182
+ ad_group_ids?: string[];
183
+ campaign_ids?: string[];
184
+ include_post_details: boolean;
185
+ }): Promise<{
186
+ creatives: {
187
+ id: string;
188
+ provider: string;
189
+ account_id: string;
190
+ name: string;
191
+ type: string;
192
+ headlines: string[];
193
+ descriptions: string[];
194
+ landing_urls: string[];
195
+ media: {
196
+ type: "image" | "video" | "audio";
197
+ url: string;
198
+ alt?: string | undefined;
199
+ poster_url?: string | undefined;
200
+ open_url?: string | undefined;
201
+ }[];
202
+ actions: {
203
+ label: string;
204
+ tool: string;
205
+ arguments: Record<string, unknown>;
206
+ fields: {
207
+ key: string;
208
+ label: string;
209
+ type: "text" | "text_list" | "url_list" | "select";
210
+ value: string | string[];
211
+ options?: {
212
+ label: string;
213
+ value: string;
214
+ }[] | undefined;
215
+ max_length?: number | undefined;
216
+ }[];
217
+ }[];
218
+ status?: string | undefined;
219
+ campaign_id?: string | undefined;
220
+ ad_group_id?: string | undefined;
221
+ }[];
222
+ warnings: {
223
+ provider: string;
224
+ message: string;
225
+ }[];
226
+ next_cursor?: string | undefined;
227
+ items: Row$1[];
228
+ truncated: boolean;
229
+ }>;
230
+ postJob(input: {
231
+ account_id: string;
232
+ job_id: string;
233
+ resource_receipt: string;
234
+ }): Promise<{
235
+ error_message?: string | undefined;
236
+ job_id: string;
237
+ status: unknown;
238
+ post_id: {} | null;
239
+ }>;
240
+ uploadStatus(input: {
241
+ account_id: string;
242
+ upload_id: string;
243
+ resource_receipt: string;
244
+ }): Promise<{
245
+ warning?: string | undefined;
246
+ result?: {} | undefined;
247
+ upload_id: string;
248
+ status: unknown;
249
+ }>;
250
+ targetingOptions(input: Page & {
251
+ dimension: string;
252
+ query?: string;
253
+ country?: string;
254
+ postal_code?: string;
255
+ cities_search?: string;
256
+ }): Promise<{
257
+ next_cursor?: string | undefined;
258
+ items: Row$1[];
259
+ truncated: boolean;
260
+ } | {
261
+ warning?: string | undefined;
262
+ items: any[];
263
+ truncated: boolean;
264
+ }>;
265
+ private verifyTargeting;
266
+ private mutation;
267
+ private assetUpload;
268
+ private postCreate;
269
+ plan(op: WriteOperation, guard: WriteGuard): Promise<RedditCreativePlan>;
270
+ }
271
+
272
+ declare const redditBusinessId: z.ZodString;
273
+ declare const redditCatalogId: z.ZodString;
274
+ declare const catalogScope: z.ZodObject<{
275
+ accountId: z.ZodString;
276
+ businessId: z.ZodString;
277
+ resourceId: z.ZodString;
278
+ kind: z.ZodEnum<{
279
+ catalog: "catalog";
280
+ catalog_creation: "catalog_creation";
281
+ }>;
282
+ }, z.core.$strict>;
283
+ type RedditCatalogScope = z.infer<typeof catalogScope>;
284
+ declare const catalogAccessMode: z.ZodEnum<{
285
+ none: "none";
286
+ read: "read";
287
+ write: "write";
288
+ create: "create";
289
+ }>;
290
+ type RedditCatalogAccessMode = z.infer<typeof catalogAccessMode>;
291
+ interface RedditCatalogGrant {
292
+ scope: RedditCatalogScope;
293
+ mode: RedditCatalogAccessMode;
294
+ revision: number;
295
+ hash: string;
296
+ }
297
+ interface RedditCatalogAccessStore {
298
+ readonly canManage: boolean;
299
+ readonly canWrite: boolean;
300
+ get(scope: RedditCatalogScope): Promise<RedditCatalogGrant>;
301
+ /** Recheck active account/principal scope before native resource access. */
302
+ authorize(scope: RedditCatalogScope, write: boolean): Promise<RedditCatalogGrant>;
303
+ list(accountId: string): Promise<RedditCatalogGrant[]>;
304
+ /** Only the local owner or authenticated dashboard owner/admin may change access. */
305
+ compareAndSet(scope: RedditCatalogScope, expectedHash: string, mode: RedditCatalogAccessMode): Promise<RedditCatalogGrant>;
306
+ /** Internal creation receipt: adopt only a freshly created, independently verified native catalog. */
307
+ adoptCreated?(scope: RedditCatalogScope, expectedCreationHash: string): Promise<RedditCatalogGrant>;
308
+ }
309
+ declare function catalogGrant(scope: RedditCatalogScope, mode?: RedditCatalogAccessMode, revision?: number): RedditCatalogGrant;
310
+ declare function catalogScopeKey(scope: RedditCatalogScope): string;
311
+ declare function requireCatalogAccess(store: RedditCatalogAccessStore | undefined, scope: RedditCatalogScope, write?: boolean): Promise<RedditCatalogGrant>;
312
+ declare const creationScope: (accountId: string, businessId: string) => RedditCatalogScope;
313
+ declare function requireCatalogCreationAccess(store: RedditCatalogAccessStore | undefined, scope: RedditCatalogScope, write?: boolean): Promise<RedditCatalogGrant>;
314
+ /** Local-owner scope, separate from OAuth secrets. No default Business wildcard. */
315
+ declare class FileRedditCatalogAccessStore implements RedditCatalogAccessStore {
316
+ private readonly dir;
317
+ readonly canManage = true;
318
+ readonly canWrite = true;
319
+ constructor(dir?: string);
320
+ private file;
321
+ authorize(scope: RedditCatalogScope, _write: boolean): Promise<RedditCatalogGrant>;
322
+ get(scope: RedditCatalogScope): Promise<RedditCatalogGrant>;
323
+ list(accountId: string): Promise<RedditCatalogGrant[]>;
324
+ adoptCreated(value: RedditCatalogScope, expectedCreationHash: string): Promise<RedditCatalogGrant>;
325
+ compareAndSet(scope: RedditCatalogScope, expectedHash: string, mode: RedditCatalogAccessMode): Promise<RedditCatalogGrant>;
326
+ }
327
+
328
+ type Plan$3 = Omit<WritePreview, 'serverValidated'> & {
329
+ execute(): Promise<string[]>;
330
+ };
331
+ /** Explicit Business-resource permissions are independent from enabled ad-account access. */
332
+ declare class RedditCatalogService {
333
+ private readonly client;
334
+ private readonly store?;
335
+ constructor(client: Pick<RedditAdsClient, 'get' | 'post' | 'patch' | 'delete' | 'getPaged'>, store?: RedditCatalogAccessStore | undefined);
336
+ private manager;
337
+ private read;
338
+ private native;
339
+ private parent;
340
+ authorize(value: unknown, write?: boolean): Promise<{
341
+ configuration_hash: string;
342
+ id: string;
343
+ business_id: string;
344
+ name: string;
345
+ default_language: string;
346
+ default_currency: string;
347
+ event_sources?: string[] | undefined;
348
+ data_sources?: string[] | undefined;
349
+ summary?: {
350
+ products_count?: number | undefined;
351
+ approved_products_count?: number | undefined;
352
+ rejected_products_count?: number | undefined;
353
+ invalid_products_count?: number | undefined;
354
+ } | undefined;
355
+ }>;
356
+ private business;
357
+ private selectedSources;
358
+ access(account: string): Promise<{
359
+ grants: RedditCatalogGrant[];
360
+ records: {
361
+ id: string;
362
+ name: string;
363
+ business_id: string;
364
+ access: "none" | "read" | "write" | "create";
365
+ }[];
366
+ notes: string[];
367
+ }>;
368
+ snapshot(value: unknown): Promise<{
369
+ grant: RedditCatalogGrant;
370
+ records: {
371
+ id: string;
372
+ name: string;
373
+ business_id: string;
374
+ access: "none" | "read" | "write" | "create";
375
+ }[];
376
+ }>;
377
+ get(value: unknown): Promise<{
378
+ catalog: {
379
+ configuration_hash: string;
380
+ id: string;
381
+ business_id: string;
382
+ name: string;
383
+ default_language: string;
384
+ default_currency: string;
385
+ event_sources?: string[] | undefined;
386
+ data_sources?: string[] | undefined;
387
+ summary?: {
388
+ products_count?: number | undefined;
389
+ approved_products_count?: number | undefined;
390
+ rejected_products_count?: number | undefined;
391
+ invalid_products_count?: number | undefined;
392
+ } | undefined;
393
+ };
394
+ records: {
395
+ id: string;
396
+ name: string;
397
+ business_id: string;
398
+ currency: string;
399
+ language: string;
400
+ products: number | undefined;
401
+ event_source_count: number | undefined;
402
+ }[];
403
+ notes: string[];
404
+ }>;
405
+ creationContext(value: unknown): Promise<{
406
+ expected_creation_access_hash: string;
407
+ expected_event_sources_hash: string;
408
+ event_sources: string[];
409
+ business: {
410
+ id: string;
411
+ name: string;
412
+ };
413
+ records: {
414
+ id: string;
415
+ name: string;
416
+ access: string;
417
+ selected_event_sources: number;
418
+ }[];
419
+ complete: boolean;
420
+ truncated: boolean;
421
+ notes: string[];
422
+ }>;
423
+ sourceContext(value: unknown): Promise<{
424
+ expected_configuration_hash: string;
425
+ expected_event_sources_hash: string;
426
+ current_event_sources: string[];
427
+ event_sources: string[];
428
+ records: {
429
+ id: string;
430
+ name: string;
431
+ previous_sources: number;
432
+ selected_sources: number;
433
+ }[];
434
+ complete: boolean;
435
+ truncated: boolean;
436
+ notes: string[];
437
+ }>;
438
+ plan(op: WriteOperation): Promise<Plan$3>;
439
+ }
440
+
441
+ type Plan$2 = Omit<WritePreview, 'serverValidated'> & {
442
+ execute(): Promise<string[]>;
443
+ };
444
+ type Client = Pick<RedditAdsClient, 'get' | 'post' | 'patch' | 'delete' | 'nextUrl' | 'diagnostic'>;
445
+ /** Catalog grants cover children only after independent native parent/catalog verification. */
446
+ declare class RedditCatalogContentService {
447
+ private readonly client;
448
+ private readonly catalogs;
449
+ constructor(client: Client, catalogs: RedditCatalogService);
450
+ private request;
451
+ private url;
452
+ private page;
453
+ private set;
454
+ sets(value: unknown): Promise<{
455
+ product_sets: {
456
+ configuration_hash: string;
457
+ id: string;
458
+ catalog_id: string;
459
+ name: string;
460
+ filter: string;
461
+ summary?: {
462
+ products_count?: number | undefined;
463
+ approved_products_count?: number | null | undefined;
464
+ rejected_products_count?: number | null | undefined;
465
+ invalid_products_count?: number | null | undefined;
466
+ } | undefined;
467
+ }[];
468
+ records: {
469
+ id: string;
470
+ name: string;
471
+ filter: string;
472
+ products: number | undefined;
473
+ }[];
474
+ next_cursor: string | undefined;
475
+ truncated: boolean;
476
+ complete: boolean;
477
+ }>;
478
+ getSet(value: unknown): Promise<{
479
+ product_set: {
480
+ configuration_hash: string;
481
+ id: string;
482
+ catalog_id: string;
483
+ name: string;
484
+ filter: string;
485
+ summary?: {
486
+ products_count?: number | undefined;
487
+ approved_products_count?: number | null | undefined;
488
+ rejected_products_count?: number | null | undefined;
489
+ invalid_products_count?: number | null | undefined;
490
+ } | undefined;
491
+ };
492
+ records: {
493
+ id: string;
494
+ name: string;
495
+ filter: string;
496
+ products: number | undefined;
497
+ }[];
498
+ complete: boolean;
499
+ truncated: boolean;
500
+ notes: string[];
501
+ }>;
502
+ products(value: unknown, inSet?: boolean): Promise<{
503
+ products: {
504
+ link: string | undefined;
505
+ image_link: string | undefined;
506
+ reddit: {
507
+ image_link: string | undefined;
508
+ issues: {
509
+ message: string | undefined;
510
+ severity: "WARNING" | "CRITICAL";
511
+ code: string;
512
+ field?: string | null | undefined;
513
+ }[] | undefined;
514
+ catalog_id: string;
515
+ id?: string | undefined;
516
+ approval_decision?: "PENDING" | "APPROVED" | "REJECTED" | undefined;
517
+ };
518
+ id: string;
519
+ title?: string | null | undefined;
520
+ description?: string | null | undefined;
521
+ price?: string | undefined;
522
+ item_group_id?: string | null | undefined;
523
+ brand?: string | null | undefined;
524
+ availability?: "BACKORDER" | "IN_STOCK" | "OUT_OF_STOCK" | "PREORDER" | null | undefined;
525
+ }[];
526
+ creatives: {
527
+ id: string;
528
+ provider: string;
529
+ account_id: string;
530
+ name: string;
531
+ type: string;
532
+ headlines: string[];
533
+ descriptions: string[];
534
+ landing_urls: string[];
535
+ media: {
536
+ type: "image" | "video" | "audio";
537
+ url: string;
538
+ alt?: string | undefined;
539
+ poster_url?: string | undefined;
540
+ open_url?: string | undefined;
541
+ }[];
542
+ actions: {
543
+ label: string;
544
+ tool: string;
545
+ arguments: Record<string, unknown>;
546
+ fields: {
547
+ key: string;
548
+ label: string;
549
+ type: "text" | "text_list" | "url_list" | "select";
550
+ value: string | string[];
551
+ options?: {
552
+ label: string;
553
+ value: string;
554
+ }[] | undefined;
555
+ max_length?: number | undefined;
556
+ }[];
557
+ }[];
558
+ status?: string | undefined;
559
+ campaign_id?: string | undefined;
560
+ ad_group_id?: string | undefined;
561
+ }[];
562
+ next_cursor: string | undefined;
563
+ truncated: boolean;
564
+ complete: boolean;
565
+ notes: string[];
566
+ }>;
567
+ imports(value: unknown): Promise<{
568
+ imports: {
569
+ id: string;
570
+ catalog_id: string;
571
+ status: "PROCESSING" | "PENDING" | "COMPLETED" | "FAILED" | "SKIPPED";
572
+ feed_id?: string | undefined;
573
+ filename?: string | undefined;
574
+ summary?: {
575
+ added_products_count?: number | null | undefined;
576
+ modified_products_count?: number | null | undefined;
577
+ deleted_products_count?: number | null | undefined;
578
+ invalid_products_count?: number | null | undefined;
579
+ } | null | undefined;
580
+ }[];
581
+ records: {
582
+ added_products_count?: number | null | undefined;
583
+ modified_products_count?: number | null | undefined;
584
+ deleted_products_count?: number | null | undefined;
585
+ invalid_products_count?: number | null | undefined;
586
+ id: string;
587
+ name: string;
588
+ status: "PROCESSING" | "PENDING" | "COMPLETED" | "FAILED" | "SKIPPED";
589
+ feed_id: string | undefined;
590
+ }[];
591
+ next_cursor: string | undefined;
592
+ truncated: boolean;
593
+ complete: boolean;
594
+ }>;
595
+ private selectedImport;
596
+ issues(value: unknown): Promise<{
597
+ issues: {
598
+ message: string | undefined;
599
+ severity: "WARNING" | "CRITICAL";
600
+ code: string;
601
+ id: string;
602
+ import_id: string;
603
+ field?: string | null | undefined;
604
+ line?: number | null | undefined;
605
+ product_id?: string | null | undefined;
606
+ }[];
607
+ records: {
608
+ name: string;
609
+ message: string | undefined;
610
+ severity: "WARNING" | "CRITICAL";
611
+ code: string;
612
+ id: string;
613
+ import_id: string;
614
+ field?: string | null | undefined;
615
+ line?: number | null | undefined;
616
+ product_id?: string | null | undefined;
617
+ }[];
618
+ next_cursor: string | undefined;
619
+ truncated: boolean;
620
+ complete: boolean;
621
+ }>;
622
+ report(value: unknown): Promise<{
623
+ report_available: boolean;
624
+ records: {
625
+ id: string;
626
+ name: string;
627
+ }[];
628
+ notes: string[];
629
+ import_id?: undefined;
630
+ download_url?: undefined;
631
+ expires_at?: undefined;
632
+ } | {
633
+ report_available: boolean;
634
+ import_id: string;
635
+ download_url: string;
636
+ expires_at: string;
637
+ records: {
638
+ id: string;
639
+ name: string;
640
+ expires_at: string;
641
+ }[];
642
+ notes: string[];
643
+ }>;
644
+ plan(op: WriteOperation): Promise<Plan$2>;
645
+ }
646
+
647
+ type Plan$1 = Omit<WritePreview, 'serverValidated'> & {
648
+ execute(): Promise<WriteResult>;
649
+ };
650
+ /** Native unpaged feeds with exact catalog grants and private source handling. */
651
+ declare class RedditCatalogFeeds {
652
+ private readonly client;
653
+ private readonly catalogs;
654
+ constructor(client: Pick<RedditAdsClient, 'get' | 'post' | 'patch' | 'delete'>, catalogs: RedditCatalogService);
655
+ private native;
656
+ list(value: unknown): Promise<{
657
+ notes: string[];
658
+ next_cursor?: string | undefined;
659
+ feeds: {
660
+ feed_id: string;
661
+ catalog_id: string;
662
+ name: string | null | undefined;
663
+ mode: "REPLACE" | "UPDATE";
664
+ source_origin: string;
665
+ source_fingerprint: string;
666
+ schedule: {
667
+ timezone: string | null | undefined;
668
+ next_import_at: string | null | undefined;
669
+ day_of_month?: number | null | undefined;
670
+ day_of_week?: "MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY" | "SUNDAY" | null | undefined;
671
+ is_paused?: boolean | null | undefined;
672
+ interval?: "HOURLY" | "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
673
+ interval_count?: number | null | undefined;
674
+ hour?: number | null | undefined;
675
+ minute?: number | null | undefined;
676
+ } | null | undefined;
677
+ configuration_hash: string;
678
+ authentication_values_reported: boolean;
679
+ }[];
680
+ records: {
681
+ id: string;
682
+ name: string;
683
+ mode: "REPLACE" | "UPDATE";
684
+ source: string;
685
+ schedule: string;
686
+ }[];
687
+ complete: boolean;
688
+ truncated: boolean;
689
+ }>;
690
+ get(value: unknown): Promise<{
691
+ feed: {
692
+ feed_id: string;
693
+ catalog_id: string;
694
+ name: string | null | undefined;
695
+ mode: "REPLACE" | "UPDATE";
696
+ source_origin: string;
697
+ source_fingerprint: string;
698
+ schedule: {
699
+ timezone: string | null | undefined;
700
+ next_import_at: string | null | undefined;
701
+ day_of_month?: number | null | undefined;
702
+ day_of_week?: "MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY" | "SUNDAY" | null | undefined;
703
+ is_paused?: boolean | null | undefined;
704
+ interval?: "HOURLY" | "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
705
+ interval_count?: number | null | undefined;
706
+ hour?: number | null | undefined;
707
+ minute?: number | null | undefined;
708
+ } | null | undefined;
709
+ configuration_hash: string;
710
+ authentication_values_reported: boolean;
711
+ };
712
+ records: {
713
+ id: string;
714
+ name: string;
715
+ mode: "REPLACE" | "UPDATE";
716
+ source: string;
717
+ }[];
718
+ complete: boolean;
719
+ truncated: boolean;
720
+ notes: string[];
721
+ }>;
722
+ plan(op: WriteOperation): Promise<Plan$1>;
723
+ }
724
+
725
+ type Plan = Omit<WritePreview, 'serverValidated'> & {
726
+ execute(): Promise<WriteResult>;
727
+ };
728
+ declare class RedditCatalogProducts {
729
+ private readonly client;
730
+ private readonly catalogs;
731
+ constructor(client: Pick<RedditAdsClient, 'get' | 'post' | 'nextUrl'>, catalogs: RedditCatalogService);
732
+ private selected;
733
+ private selection;
734
+ context(value: unknown): Promise<{
735
+ selection_hash: string;
736
+ records: {
737
+ id: string;
738
+ name: string;
739
+ state: string;
740
+ }[];
741
+ products: {
742
+ reddit_id: string | undefined;
743
+ }[];
744
+ missing_product_ids: string[];
745
+ complete: boolean;
746
+ truncated: boolean;
747
+ notes: string[];
748
+ }>;
749
+ plan(op: WriteOperation): Promise<Plan>;
750
+ }
751
+
752
+ type Row = Record<string, unknown>;
753
+ type Collection = 'custom_audiences' | 'saved_audiences' | 'pixels';
754
+ declare class RedditManagementService {
755
+ private readonly client;
756
+ private readonly creatives;
757
+ constructor(client: RedditAdsClient, creatives: RedditCreativeService);
758
+ list(input: {
759
+ account_id: string;
760
+ page_size: number;
761
+ cursor?: string;
762
+ name?: string;
763
+ }, collection: Collection): Promise<{
764
+ next_cursor?: string | undefined;
765
+ items: Row[];
766
+ truncated: boolean;
767
+ }>;
768
+ private available;
769
+ audience(account: string, resource: string, requireOwned?: boolean): Promise<Row>;
770
+ saved(account: string, resource: string): Promise<Row>;
771
+ lastFired(account: string, pixel: string): Promise<{
772
+ pixel_id: string;
773
+ last_fired_at: object;
774
+ }>;
775
+ validateAudienceSource(account: string, payload: unknown): Promise<{
776
+ name: string;
777
+ type: "CUSTOMER_LIST";
778
+ } | {
779
+ name: string;
780
+ type: "PIXEL_RETARGETING";
781
+ pixel_audience_config: {
782
+ pixel_ids: string[];
783
+ targetings: ("PAGE_VISIT" | "VIEW_CONTENT" | "SEARCH" | "ADD_TO_CART" | "ADD_TO_WISHLIST" | "PURCHASE" | "LEAD" | "SIGN_UP" | "CUSTOM")[];
784
+ lookback_window_days: number;
785
+ custom_targetings?: string[] | undefined;
786
+ };
787
+ } | {
788
+ name: string;
789
+ type: "ENGAGEMENT_RETARGETING";
790
+ engagement_audience_config: {
791
+ campaign_ids: string[];
792
+ tracking_types: ("CLICKS" | "IMPRESSIONS" | "UPVOTES" | "COMMENT_SUBMISSIONS" | "VIDEO_WATCHED_50_PERCENT" | "VIDEO_WATCHED_100_PERCENT" | "VIDEO_STARTED")[];
793
+ lookback_window_days: number;
794
+ };
795
+ }>;
796
+ private receipt;
797
+ private empty;
798
+ plan(op: WriteOperation, _guard: WriteGuard): Promise<RedditCreativePlan>;
38
799
  }
39
800
 
40
801
  /** Reddit budget, bid, spend, CPC, and CPM fields are integer micros. */
@@ -55,10 +816,24 @@ interface RedditCampaign {
55
816
  declare class RedditAdsProvider implements AdProvider {
56
817
  private readonly client;
57
818
  readonly id = "reddit";
58
- constructor(client: RedditAdsClient);
819
+ readonly creatives: RedditCreativeService;
820
+ readonly management: RedditManagementService;
821
+ readonly catalogs: RedditCatalogService;
822
+ readonly catalogContent: RedditCatalogContentService;
823
+ readonly catalogProducts: RedditCatalogProducts;
824
+ readonly catalogFeeds: RedditCatalogFeeds;
825
+ constructor(client: RedditAdsClient, media?: MediaResolver, catalogAccess?: RedditCatalogAccessStore);
59
826
  capabilities(): ProviderCapabilities;
60
827
  standardActions(): StandardActions;
61
828
  listAccounts(): Promise<Account[]>;
829
+ accountContext(accountId: string): Promise<{
830
+ id: string;
831
+ catalog_access: "EXPLICIT_PROJECT_GRANT_REQUIRED";
832
+ name?: string | undefined;
833
+ business_id?: string | undefined;
834
+ currency?: string | undefined;
835
+ admin_approval?: string | undefined;
836
+ }>;
62
837
  report(query: NormalizedQuery): Promise<Report>;
63
838
  rawReport(input: {
64
839
  account_id: string;
@@ -72,6 +847,7 @@ declare class RedditAdsProvider implements AdProvider {
72
847
  }): Promise<{
73
848
  metrics: Array<Record<string, unknown>>;
74
849
  metrics_updated_at?: string;
850
+ truncated: boolean;
75
851
  }>;
76
852
  apiRead(input: {
77
853
  account_id: string;
@@ -97,9 +873,15 @@ declare class RedditAdsProvider implements AdProvider {
97
873
  private assertOwnedResource;
98
874
  }
99
875
 
100
- declare function redditTools(provider: RedditAdsProvider): AnyToolDefinition[];
876
+ declare function redditTools(provider: RedditAdsProvider, options?: {
877
+ catalogAccessManagement?: boolean;
878
+ }): AnyToolDefinition[];
879
+
880
+ declare function redditCatalogTools(provider: {
881
+ catalogs: RedditCatalogService;
882
+ }, administration?: boolean): AnyToolDefinition[];
101
883
 
102
884
  declare function resolveRedditCredentials(store: CredentialStore): Promise<RedditCredentials | undefined>;
103
885
  declare function createRedditModule(store: CredentialStore): Promise<ProviderModule | undefined>;
104
886
 
105
- export { REDDIT_API_BASE, REDDIT_API_VERSION, REDDIT_MICROS, REDDIT_TOKEN_URL, RedditAdsClient, RedditAdsProvider, type RedditCampaign, type RedditCredentials, type RedditEnvelope, createRedditModule, redditTools, resolveRedditCredentials };
887
+ export { FileRedditCatalogAccessStore, REDDIT_API_BASE, REDDIT_API_VERSION, REDDIT_MICROS, REDDIT_TOKEN_URL, RedditAdsClient, RedditAdsProvider, type RedditCampaign, type RedditCatalogAccessMode, type RedditCatalogAccessStore, type RedditCatalogGrant, type RedditCatalogScope, RedditCatalogService, type RedditCredentials, type RedditEnvelope, catalogGrant, catalogScope, catalogScopeKey, createRedditModule, creationScope, redditBusinessId, redditCatalogId, redditCatalogTools, redditTools, requireCatalogAccess, requireCatalogCreationAccess, resolveRedditCredentials };