@adport/provider-microsoft 0.8.0 → 0.9.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 { WriteOperation, WriteGuard, WritePreview, MediaResolver, Creative, AdProvider, ProviderCapabilities, StandardActions, Account, NormalizedQuery, Report, WriteResult, AnyToolDefinition, CredentialStore, ProviderModule } from '@adport/core';
2
+ import { z } from 'zod';
2
3
 
3
4
  interface MicrosoftCredentials {
4
5
  developerToken: string;
@@ -11,7 +12,7 @@ interface MicrosoftCredentials {
11
12
  declare const MSADS_SCOPE = "https://ads.microsoft.com/msads.manage offline_access";
12
13
  /** Published universal sandbox developer token (anyone may use it in sandbox). */
13
14
  declare const SANDBOX_DEVELOPER_TOKEN = "BBD37VB98";
14
- type MicrosoftService = 'campaign' | 'customer' | 'reporting';
15
+ type MicrosoftService = 'campaign' | 'customer' | 'reporting' | 'adinsight';
15
16
  interface RequestScope {
16
17
  /** Manager account (customer) id header. */
17
18
  customerId?: string;
@@ -31,7 +32,9 @@ declare class MicrosoftAdsClient {
31
32
  readonly sandbox: boolean;
32
33
  constructor(credentials: MicrosoftCredentials, onRefreshTokenRotated?: ((token: string) => Promise<void>) | undefined, fetchImpl?: typeof fetch);
33
34
  getAccessToken(): Promise<string>;
34
- request<T>(service: MicrosoftService, method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, body: unknown, scope?: RequestScope): Promise<T>;
35
+ request<T>(service: MicrosoftService, method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, body: unknown, scope?: RequestScope, options?: {
36
+ privatePayload?: boolean;
37
+ }): Promise<T>;
35
38
  /** Plain authorized download (report files); returns raw bytes. */
36
39
  download(url: string): Promise<Uint8Array>;
37
40
  }
@@ -49,7 +52,1065 @@ interface BatchErrorItem {
49
52
  * {OperationErrors, BatchErrors}, AdApiFaultDetail {Errors}, plus TrackingId.
50
53
  */
51
54
  declare function formatMicrosoftError(status: number, raw: string): string;
52
- declare function formatPartialErrors(partialErrors: BatchErrorItem[] | undefined): string | undefined;
55
+ declare function formatPartialErrors(partialErrors: Array<BatchErrorItem | null> | undefined): string | undefined;
56
+
57
+ type Row$1 = Record<string, unknown>;
58
+ interface Plan {
59
+ summary: string;
60
+ changes: string[];
61
+ coercions: string[];
62
+ budgetDeltas: WritePreview['budgetDeltas'];
63
+ execute: () => Promise<string[]>;
64
+ }
65
+ type Parent = {
66
+ account_id: string;
67
+ campaign_id: string;
68
+ ad_group_id: string;
69
+ };
70
+ /** REST wire shapes pinned in MicrosoftDocs/Advertising (2026-11-02). */
71
+ declare class MicrosoftChildService {
72
+ private readonly client;
73
+ private readonly scope;
74
+ private readonly campaign;
75
+ constructor(client: MicrosoftAdsClient, scope: (accountId: string) => Promise<RequestScope>, campaign: (accountId: string, campaignId: string) => Promise<unknown>);
76
+ private request;
77
+ listGroups(input: {
78
+ account_id: string;
79
+ campaign_id: string;
80
+ }): Promise<{
81
+ rows: Row$1[];
82
+ truncated: boolean;
83
+ }>;
84
+ private group;
85
+ listKeywords(input: Parent): Promise<{
86
+ rows: Row$1[];
87
+ truncated: boolean;
88
+ }>;
89
+ listAds(input: Parent & {
90
+ ad_types: string[];
91
+ limit: number;
92
+ }): Promise<{
93
+ ads: Row$1[];
94
+ truncated: boolean;
95
+ creatives: {
96
+ id: string;
97
+ provider: string;
98
+ account_id: string;
99
+ name: string;
100
+ type: string;
101
+ headlines: string[];
102
+ descriptions: string[];
103
+ landing_urls: string[];
104
+ media: {
105
+ type: "image" | "video" | "audio";
106
+ url: string;
107
+ alt?: string | undefined;
108
+ poster_url?: string | undefined;
109
+ open_url?: string | undefined;
110
+ }[];
111
+ actions: {
112
+ label: string;
113
+ tool: string;
114
+ arguments: Record<string, unknown>;
115
+ fields: {
116
+ key: string;
117
+ label: string;
118
+ type: "text" | "text_list" | "url_list" | "select";
119
+ value: string | string[];
120
+ options?: {
121
+ label: string;
122
+ value: string;
123
+ }[] | undefined;
124
+ max_length?: number | undefined;
125
+ }[];
126
+ }[];
127
+ status?: string | undefined;
128
+ campaign_id?: string | undefined;
129
+ ad_group_id?: string | undefined;
130
+ }[];
131
+ }>;
132
+ private card;
133
+ private ad;
134
+ private keywords;
135
+ plan(op: WriteOperation, guard: WriteGuard): Promise<Plan>;
136
+ }
137
+
138
+ type Row = Record<string, unknown>;
139
+ type ImagePlan = Omit<WritePreview, 'serverValidated'> & {
140
+ execute: () => Promise<string[]>;
141
+ };
142
+ /** MicrosoftDocs/Advertising@fdee2fcf and official Python SDK@4b6fb31c; live-verified CSV flags. */
143
+ declare class MicrosoftImageService {
144
+ private readonly client;
145
+ private readonly scope;
146
+ private readonly media;
147
+ constructor(client: MicrosoftAdsClient, scope: (account: string) => Promise<RequestScope>, media?: MediaResolver);
148
+ private request;
149
+ private page;
150
+ private find;
151
+ private owned;
152
+ private gallery;
153
+ list(input: {
154
+ account_id: string;
155
+ page_index: number;
156
+ page_size: number;
157
+ }): Promise<{
158
+ creatives: {
159
+ id: string;
160
+ provider: string;
161
+ account_id: string;
162
+ name: string;
163
+ type: string;
164
+ headlines: string[];
165
+ descriptions: string[];
166
+ landing_urls: string[];
167
+ media: {
168
+ type: "image" | "video" | "audio";
169
+ url: string;
170
+ alt?: string | undefined;
171
+ poster_url?: string | undefined;
172
+ open_url?: string | undefined;
173
+ }[];
174
+ actions: {
175
+ label: string;
176
+ tool: string;
177
+ arguments: Record<string, unknown>;
178
+ fields: {
179
+ key: string;
180
+ label: string;
181
+ type: "text" | "text_list" | "url_list" | "select";
182
+ value: string | string[];
183
+ options?: {
184
+ label: string;
185
+ value: string;
186
+ }[] | undefined;
187
+ max_length?: number | undefined;
188
+ }[];
189
+ }[];
190
+ status?: string | undefined;
191
+ campaign_id?: string | undefined;
192
+ ad_group_id?: string | undefined;
193
+ }[];
194
+ truncated: boolean;
195
+ images: Record<string, unknown>[];
196
+ next_cursor?: string | undefined;
197
+ next_page_index?: number | undefined;
198
+ }>;
199
+ get(input: {
200
+ account_id: string;
201
+ image_id: string;
202
+ }): Promise<{
203
+ creatives: {
204
+ id: string;
205
+ provider: string;
206
+ account_id: string;
207
+ name: string;
208
+ type: string;
209
+ headlines: string[];
210
+ descriptions: string[];
211
+ landing_urls: string[];
212
+ media: {
213
+ type: "image" | "video" | "audio";
214
+ url: string;
215
+ alt?: string | undefined;
216
+ poster_url?: string | undefined;
217
+ open_url?: string | undefined;
218
+ }[];
219
+ actions: {
220
+ label: string;
221
+ tool: string;
222
+ arguments: Record<string, unknown>;
223
+ fields: {
224
+ key: string;
225
+ label: string;
226
+ type: "text" | "text_list" | "url_list" | "select";
227
+ value: string | string[];
228
+ options?: {
229
+ label: string;
230
+ value: string;
231
+ }[] | undefined;
232
+ max_length?: number | undefined;
233
+ }[];
234
+ }[];
235
+ status?: string | undefined;
236
+ campaign_id?: string | undefined;
237
+ ad_group_id?: string | undefined;
238
+ }[];
239
+ truncated: boolean;
240
+ images: Record<string, unknown>[];
241
+ next_cursor?: string | undefined;
242
+ next_page_index?: number | undefined;
243
+ }>;
244
+ lookupMany(account: string, imageIds: string[]): Promise<{
245
+ missing_image_ids: string[];
246
+ creatives: {
247
+ id: string;
248
+ provider: string;
249
+ account_id: string;
250
+ name: string;
251
+ type: string;
252
+ headlines: string[];
253
+ descriptions: string[];
254
+ landing_urls: string[];
255
+ media: {
256
+ type: "image" | "video" | "audio";
257
+ url: string;
258
+ alt?: string | undefined;
259
+ poster_url?: string | undefined;
260
+ open_url?: string | undefined;
261
+ }[];
262
+ actions: {
263
+ label: string;
264
+ tool: string;
265
+ arguments: Record<string, unknown>;
266
+ fields: {
267
+ key: string;
268
+ label: string;
269
+ type: "text" | "text_list" | "url_list" | "select";
270
+ value: string | string[];
271
+ options?: {
272
+ label: string;
273
+ value: string;
274
+ }[] | undefined;
275
+ max_length?: number | undefined;
276
+ }[];
277
+ }[];
278
+ status?: string | undefined;
279
+ campaign_id?: string | undefined;
280
+ ad_group_id?: string | undefined;
281
+ }[];
282
+ truncated: boolean;
283
+ images: Record<string, unknown>[];
284
+ next_cursor?: string | undefined;
285
+ next_page_index?: number | undefined;
286
+ }>;
287
+ extensionUses(input: {
288
+ account_id: string;
289
+ image_id: string;
290
+ }): Promise<{
291
+ image_id: string;
292
+ associations: Row[];
293
+ coverage: string;
294
+ truncated: boolean;
295
+ }>;
296
+ plan(op: WriteOperation): Promise<ImagePlan>;
297
+ }
298
+
299
+ type MicrosoftRow = Record<string, unknown>;
300
+ type MicrosoftPlan = Omit<WritePreview, 'serverValidated'> & {
301
+ execute: () => Promise<string[]>;
302
+ resultDetails?: () => unknown;
303
+ resultWarnings?: () => string[];
304
+ };
305
+ /** Shared scoped REST access. NestedPartialErrors are not interchangeable with PartialErrors. */
306
+ declare class MicrosoftNativeService {
307
+ protected readonly client: MicrosoftAdsClient;
308
+ private readonly scope;
309
+ private readonly lookupCampaign;
310
+ constructor(client: MicrosoftAdsClient, scope: (account: string, refresh?: boolean) => Promise<RequestScope>, lookupCampaign: (account: string, campaign: string) => Promise<unknown>);
311
+ protected accountScope(account: string, refresh?: boolean): Promise<RequestScope>;
312
+ protected request(account: string, path: string, body: MicrosoftRow, method?: 'POST' | 'PUT' | 'DELETE', service?: MicrosoftService): Promise<MicrosoftRow>;
313
+ protected campaign(account: string, campaign: string): Promise<MicrosoftRow>;
314
+ }
315
+
316
+ declare const extensionType: z.ZodEnum<{
317
+ ImageAdExtension: "ImageAdExtension";
318
+ CalloutAdExtension: "CalloutAdExtension";
319
+ SitelinkAdExtension: "SitelinkAdExtension";
320
+ StructuredSnippetAdExtension: "StructuredSnippetAdExtension";
321
+ }>;
322
+ declare const target$2: z.ZodDiscriminatedUnion<[z.ZodObject<{
323
+ type: z.ZodLiteral<"Account">;
324
+ }, z.core.$strip>, z.ZodObject<{
325
+ type: z.ZodLiteral<"Campaign">;
326
+ campaign_id: z.ZodString;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ type: z.ZodLiteral<"AdGroup">;
329
+ campaign_id: z.ZodString;
330
+ ad_group_id: z.ZodString;
331
+ }, z.core.$strip>], "type">;
332
+ type Target$2 = z.infer<typeof target$2>;
333
+ /** REST contracts pinned at MicrosoftDocs/Advertising@fdee2fcf; flags use native REST CSV. */
334
+ declare class MicrosoftExtensionService extends MicrosoftNativeService {
335
+ private readonly imageLookup;
336
+ constructor(client: MicrosoftAdsClient, scope: (account: string) => Promise<RequestScope>, campaign: (account: string, campaign: string) => Promise<unknown>, imageLookup: (account: string, ids: string[]) => Promise<{
337
+ creatives: Creative[];
338
+ missing_image_ids: string[];
339
+ }>);
340
+ getRaw(account: string, extensionId: string, type: z.infer<typeof extensionType>): Promise<MicrosoftRow>;
341
+ private card;
342
+ private imageIds;
343
+ private gallery;
344
+ get(input: {
345
+ account_id: string;
346
+ extension_id: string;
347
+ extension_type: z.infer<typeof extensionType>;
348
+ }): Promise<{
349
+ creatives: {
350
+ id: string;
351
+ provider: string;
352
+ account_id: string;
353
+ name: string;
354
+ type: string;
355
+ headlines: string[];
356
+ descriptions: string[];
357
+ landing_urls: string[];
358
+ media: {
359
+ type: "image" | "video" | "audio";
360
+ url: string;
361
+ alt?: string | undefined;
362
+ poster_url?: string | undefined;
363
+ open_url?: string | undefined;
364
+ }[];
365
+ actions: {
366
+ label: string;
367
+ tool: string;
368
+ arguments: Record<string, unknown>;
369
+ fields: {
370
+ key: string;
371
+ label: string;
372
+ type: "text" | "text_list" | "url_list" | "select";
373
+ value: string | string[];
374
+ options?: {
375
+ label: string;
376
+ value: string;
377
+ }[] | undefined;
378
+ max_length?: number | undefined;
379
+ }[];
380
+ }[];
381
+ status?: string | undefined;
382
+ campaign_id?: string | undefined;
383
+ ad_group_id?: string | undefined;
384
+ }[];
385
+ truncated: boolean;
386
+ extensions: Record<string, unknown>[];
387
+ next_cursor?: string | undefined;
388
+ }>;
389
+ list(input: {
390
+ account_id: string;
391
+ extension_types: Array<z.infer<typeof extensionType>>;
392
+ after_extension_id?: string;
393
+ limit: number;
394
+ }): Promise<{
395
+ creatives: {
396
+ id: string;
397
+ provider: string;
398
+ account_id: string;
399
+ name: string;
400
+ type: string;
401
+ headlines: string[];
402
+ descriptions: string[];
403
+ landing_urls: string[];
404
+ media: {
405
+ type: "image" | "video" | "audio";
406
+ url: string;
407
+ alt?: string | undefined;
408
+ poster_url?: string | undefined;
409
+ open_url?: string | undefined;
410
+ }[];
411
+ actions: {
412
+ label: string;
413
+ tool: string;
414
+ arguments: Record<string, unknown>;
415
+ fields: {
416
+ key: string;
417
+ label: string;
418
+ type: "text" | "text_list" | "url_list" | "select";
419
+ value: string | string[];
420
+ options?: {
421
+ label: string;
422
+ value: string;
423
+ }[] | undefined;
424
+ max_length?: number | undefined;
425
+ }[];
426
+ }[];
427
+ status?: string | undefined;
428
+ campaign_id?: string | undefined;
429
+ ad_group_id?: string | undefined;
430
+ }[];
431
+ truncated: boolean;
432
+ extensions: Record<string, unknown>[];
433
+ next_cursor?: string | undefined;
434
+ }>;
435
+ private entity;
436
+ associations(input: {
437
+ account_id: string;
438
+ target: Target$2;
439
+ extension_type: z.infer<typeof extensionType>;
440
+ }): Promise<{
441
+ associations: MicrosoftRow[];
442
+ truncated: boolean;
443
+ }>;
444
+ private nativeContent;
445
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
446
+ private confirm;
447
+ private verifyImages;
448
+ }
449
+
450
+ declare const criterionType: z.ZodEnum<{
451
+ Age: "Age";
452
+ Location: "Location";
453
+ Gender: "Gender";
454
+ Device: "Device";
455
+ DayTime: "DayTime";
456
+ LocationIntent: "LocationIntent";
457
+ Radius: "Radius";
458
+ }>;
459
+
460
+ /** Native REST uses concrete read selectors, Targets mutation selector and percentage bid adjustments. */
461
+ declare class MicrosoftTargetingService extends MicrosoftNativeService {
462
+ private subtype;
463
+ private key;
464
+ private confirm;
465
+ private query;
466
+ list(input: {
467
+ account_id: string;
468
+ campaign_id: string;
469
+ criterion_type: z.infer<typeof criterionType>;
470
+ }): Promise<{
471
+ rows: MicrosoftRow[];
472
+ truncated: boolean;
473
+ }>;
474
+ private owned;
475
+ geoFile(input: {
476
+ account_id: string;
477
+ language_locale: string;
478
+ }): Promise<{
479
+ FileUrl: string;
480
+ FileUrlExpiryTimeUtc: string;
481
+ LastModifiedTimeUtc: string;
482
+ }>;
483
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
484
+ }
485
+
486
+ declare const target$1: z.ZodDiscriminatedUnion<[z.ZodObject<{
487
+ type: z.ZodLiteral<"Campaign">;
488
+ campaign_id: z.ZodString;
489
+ }, z.core.$strip>, z.ZodObject<{
490
+ type: z.ZodLiteral<"AdGroup">;
491
+ campaign_id: z.ZodString;
492
+ ad_group_id: z.ZodString;
493
+ }, z.core.$strip>], "type">;
494
+ type Target$1 = z.infer<typeof target$1>;
495
+ /** MicrosoftDocs/Advertising@fdee2fcf; campaign empty-list envelope also live-verified. */
496
+ declare class MicrosoftNegativeKeywordService extends MicrosoftNativeService {
497
+ private entity;
498
+ private query;
499
+ list(input: {
500
+ account_id: string;
501
+ target: Target$1;
502
+ after_keyword_id?: string;
503
+ limit: number;
504
+ }): Promise<{
505
+ next_cursor?: string | undefined;
506
+ rows: MicrosoftRow[];
507
+ truncated: boolean;
508
+ }>;
509
+ plan(op: WriteOperation): Promise<MicrosoftPlan>;
510
+ }
511
+
512
+ declare const viewSchema: z.ZodObject<{
513
+ budget: z.ZodObject<{
514
+ Id: z.ZodString;
515
+ Name: z.ZodString;
516
+ Amount: z.ZodNumber;
517
+ BudgetType: z.ZodString;
518
+ AssociationCount: z.ZodNumber;
519
+ }, z.core.$strip>;
520
+ currency: z.ZodOptional<z.ZodString>;
521
+ members: z.ZodArray<z.ZodObject<{
522
+ Id: z.ZodString;
523
+ Name: z.ZodString;
524
+ Status: z.ZodString;
525
+ CampaignType: z.ZodString;
526
+ SubType: z.ZodNullable<z.ZodString>;
527
+ ExperimentId: z.ZodNullable<z.ZodString>;
528
+ }, z.core.$strip>>;
529
+ membership_complete: z.ZodBoolean;
530
+ snapshot_hash: z.ZodString;
531
+ }, z.core.$strip>;
532
+ declare const contextSchema$1: z.ZodObject<{
533
+ campaign: z.ZodObject<{
534
+ Id: z.ZodString;
535
+ Name: z.ZodString;
536
+ Status: z.ZodString;
537
+ CampaignType: z.ZodString;
538
+ SubType: z.ZodNullable<z.ZodString>;
539
+ ExperimentId: z.ZodNullable<z.ZodString>;
540
+ }, z.core.$strip>;
541
+ budget_id: z.ZodNullable<z.ZodString>;
542
+ effective_daily_amount: z.ZodNumber;
543
+ budget_type: z.ZodString;
544
+ currency: z.ZodOptional<z.ZodString>;
545
+ shared_budget: z.ZodOptional<z.ZodObject<{
546
+ budget: z.ZodObject<{
547
+ Id: z.ZodString;
548
+ Name: z.ZodString;
549
+ Amount: z.ZodNumber;
550
+ BudgetType: z.ZodString;
551
+ AssociationCount: z.ZodNumber;
552
+ }, z.core.$strip>;
553
+ currency: z.ZodOptional<z.ZodString>;
554
+ members: z.ZodArray<z.ZodObject<{
555
+ Id: z.ZodString;
556
+ Name: z.ZodString;
557
+ Status: z.ZodString;
558
+ CampaignType: z.ZodString;
559
+ SubType: z.ZodNullable<z.ZodString>;
560
+ ExperimentId: z.ZodNullable<z.ZodString>;
561
+ }, z.core.$strip>>;
562
+ membership_complete: z.ZodBoolean;
563
+ snapshot_hash: z.ZodString;
564
+ }, z.core.$strip>>;
565
+ snapshot_hash: z.ZodString;
566
+ }, z.core.$strip>;
567
+ type View = z.infer<typeof viewSchema>;
568
+ type Context$1 = z.infer<typeof contextSchema$1>;
569
+ /** MicrosoftDocs/Advertising@fdee2fcf, Budget and Campaign REST v13 contracts. */
570
+ declare class MicrosoftBudgetService extends MicrosoftNativeService {
571
+ private readonly campaigns;
572
+ private readonly currency;
573
+ constructor(client: MicrosoftAdsClient, scope: (account: string) => Promise<RequestScope>, lookupCampaign: (account: string, campaign: string) => Promise<unknown>, campaigns: (account: string) => Promise<unknown>, currency: (account: string) => Promise<string | undefined>);
574
+ private inventory;
575
+ private view;
576
+ private context;
577
+ list(input: {
578
+ account_id: string;
579
+ after_budget_id?: string;
580
+ limit: number;
581
+ }): Promise<{
582
+ next_cursor?: string | undefined;
583
+ rows: {
584
+ budget: {
585
+ Id: string;
586
+ Name: string;
587
+ Amount: number;
588
+ BudgetType: string;
589
+ AssociationCount: number;
590
+ };
591
+ members: {
592
+ Id: string;
593
+ Name: string;
594
+ Status: string;
595
+ CampaignType: string;
596
+ SubType: string | null;
597
+ ExperimentId: string | null;
598
+ }[];
599
+ membership_complete: boolean;
600
+ snapshot_hash: string;
601
+ currency?: string | undefined;
602
+ }[];
603
+ truncated: boolean;
604
+ }>;
605
+ get(account: string, budgetId: string): Promise<View>;
606
+ campaignBudget(account: string, campaignId: string): Promise<Context$1>;
607
+ private complete;
608
+ private expected;
609
+ private eligible;
610
+ private verify;
611
+ plan(op: WriteOperation): Promise<MicrosoftPlan>;
612
+ }
613
+
614
+ declare const ideas: z.ZodObject<{
615
+ account_id: z.ZodString;
616
+ language: z.ZodEnum<{
617
+ English: "English";
618
+ French: "French";
619
+ German: "German";
620
+ }>;
621
+ location_ids: z.ZodArray<z.ZodString>;
622
+ network: z.ZodDefault<z.ZodEnum<{
623
+ OwnedAndOperatedAndSyndicatedSearch: "OwnedAndOperatedAndSyndicatedSearch";
624
+ OwnedAndOperatedOnly: "OwnedAndOperatedOnly";
625
+ }>>;
626
+ date_range: z.ZodOptional<z.ZodObject<{
627
+ start: z.ZodISODate;
628
+ end: z.ZodISODate;
629
+ }, z.core.$strip>>;
630
+ limit: z.ZodDefault<z.ZodNumber>;
631
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
632
+ url: z.ZodOptional<z.ZodURL>;
633
+ category_id: z.ZodOptional<z.ZodString>;
634
+ }, z.core.$strip>;
635
+ declare const historical: z.ZodObject<{
636
+ account_id: z.ZodString;
637
+ language: z.ZodEnum<{
638
+ English: "English";
639
+ French: "French";
640
+ German: "German";
641
+ }>;
642
+ location_ids: z.ZodArray<z.ZodString>;
643
+ network: z.ZodDefault<z.ZodEnum<{
644
+ OwnedAndOperatedAndSyndicatedSearch: "OwnedAndOperatedAndSyndicatedSearch";
645
+ OwnedAndOperatedOnly: "OwnedAndOperatedOnly";
646
+ }>>;
647
+ date_range: z.ZodOptional<z.ZodObject<{
648
+ start: z.ZodISODate;
649
+ end: z.ZodISODate;
650
+ }, z.core.$strip>>;
651
+ limit: z.ZodDefault<z.ZodNumber>;
652
+ keywords: z.ZodArray<z.ZodString>;
653
+ }, z.core.$strip>;
654
+ declare const traffic: z.ZodObject<{
655
+ account_id: z.ZodString;
656
+ language: z.ZodEnum<{
657
+ English: "English";
658
+ French: "French";
659
+ German: "German";
660
+ }>;
661
+ location_ids: z.ZodArray<z.ZodString>;
662
+ network: z.ZodDefault<z.ZodEnum<{
663
+ OwnedAndOperatedAndSyndicatedSearch: "OwnedAndOperatedAndSyndicatedSearch";
664
+ OwnedAndOperatedOnly: "OwnedAndOperatedOnly";
665
+ }>>;
666
+ keywords: z.ZodArray<z.ZodObject<{
667
+ text: z.ZodString;
668
+ match_type: z.ZodEnum<{
669
+ Phrase: "Phrase";
670
+ Broad: "Broad";
671
+ }>;
672
+ max_cpc: z.ZodOptional<z.ZodNumber>;
673
+ }, z.core.$strip>>;
674
+ max_cpc: z.ZodNumber;
675
+ daily_budget: z.ZodOptional<z.ZodNumber>;
676
+ negative_keywords: z.ZodOptional<z.ZodArray<z.ZodObject<{
677
+ text: z.ZodString;
678
+ match_type: z.ZodEnum<{
679
+ Exact: "Exact";
680
+ Phrase: "Phrase";
681
+ }>;
682
+ }, z.core.$strip>>>;
683
+ }, z.core.$strip>;
684
+ /** Ad Insight REST v13 shapes from MicrosoftDocs/Advertising@fdee2fcf. */
685
+ declare class MicrosoftPlanningService extends MicrosoftNativeService {
686
+ private readonly currency;
687
+ constructor(client: MicrosoftAdsClient, scope: (account: string) => Promise<RequestScope>, lookupCampaign: (account: string, campaign: string) => Promise<unknown>, currency: (account: string) => string | undefined);
688
+ keywordIdeas(input: z.infer<typeof ideas> | z.infer<typeof historical>, expand: boolean): Promise<{
689
+ notes: string[];
690
+ date_range?: {
691
+ start: string;
692
+ end: string;
693
+ } | undefined;
694
+ currency?: string | undefined;
695
+ rows: MicrosoftRow[];
696
+ truncated: boolean;
697
+ returned_count: number;
698
+ native_result_count: number;
699
+ }>;
700
+ trafficEstimates(input: z.infer<typeof traffic>): Promise<{
701
+ notes: string[];
702
+ currency?: string | undefined;
703
+ rows: MicrosoftRow[];
704
+ estimate_period: "week";
705
+ deprecated_metrics: string[];
706
+ }>;
707
+ }
708
+
709
+ declare const goalType: z.ZodEnum<{
710
+ Url: "Url";
711
+ AppDownload: "AppDownload";
712
+ AppInstall: "AppInstall";
713
+ Duration: "Duration";
714
+ Event: "Event";
715
+ InStoreTransaction: "InStoreTransaction";
716
+ OfflineConversion: "OfflineConversion";
717
+ PagesViewedPerVisit: "PagesViewedPerVisit";
718
+ }>;
719
+ /** Campaign Management v13; EventGoal omissions delete criteria, unlike ordinary optional update fields. */
720
+ declare class MicrosoftConversionService extends MicrosoftNativeService {
721
+ private autoTagging;
722
+ private query;
723
+ private snapshot;
724
+ list(input: {
725
+ account_id: string;
726
+ goal_types: z.infer<typeof goalType>[];
727
+ after_goal_id?: string;
728
+ limit: number;
729
+ }): Promise<{
730
+ next_cursor?: string | undefined;
731
+ account_id: string;
732
+ rows: {
733
+ account_id: string;
734
+ goal: MicrosoftRow;
735
+ auto_tagging_enabled: boolean;
736
+ auto_tagging_scope: "Account";
737
+ snapshot_hash: string;
738
+ }[];
739
+ auto_tagging_enabled: boolean;
740
+ auto_tagging_scope: "Account";
741
+ truncated: boolean;
742
+ }>;
743
+ get(account: string, goalId: string, type: z.infer<typeof goalType>): Promise<{
744
+ account_id: string;
745
+ goal: MicrosoftRow;
746
+ auto_tagging_enabled: boolean;
747
+ auto_tagging_scope: "Account";
748
+ snapshot_hash: string;
749
+ }>;
750
+ linkedTags(input: {
751
+ account_id: string;
752
+ after_tag_id?: string;
753
+ limit: number;
754
+ }): Promise<{
755
+ next_cursor?: string | undefined;
756
+ native_customer_id: string;
757
+ rows: {
758
+ tag: {
759
+ Id: string;
760
+ };
761
+ goal_ids: string[];
762
+ native_scope: "Customer";
763
+ }[];
764
+ truncated: boolean;
765
+ }>;
766
+ private tag;
767
+ private verify;
768
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
769
+ }
770
+
771
+ declare const audienceType$1: z.ZodEnum<{
772
+ RemarketingList: "RemarketingList";
773
+ Custom: "Custom";
774
+ InMarket: "InMarket";
775
+ Product: "Product";
776
+ SimilarRemarketingList: "SimilarRemarketingList";
777
+ CombinedList: "CombinedList";
778
+ CustomerList: "CustomerList";
779
+ ImpressionBasedRemarketingList: "ImpressionBasedRemarketingList";
780
+ CustomSegment: "CustomSegment";
781
+ }>;
782
+ /** Campaign Management v13: explicit Account ownership, replacement-rule semantics and bounded deletion-use checks. */
783
+ declare class MicrosoftAudienceService extends MicrosoftNativeService {
784
+ constructor(...args: [...ConstructorParameters<typeof MicrosoftNativeService>, (account: string) => Promise<unknown[]>]);
785
+ private readonly campaigns;
786
+ private query;
787
+ private shared;
788
+ private snapshot;
789
+ list(input: {
790
+ account_id: string;
791
+ audience_types: z.infer<typeof audienceType$1>[];
792
+ after_audience_id?: string;
793
+ limit: number;
794
+ }): Promise<{
795
+ next_cursor?: string | undefined;
796
+ rows: {
797
+ account_id: string;
798
+ audience: {
799
+ [x: string]: unknown;
800
+ };
801
+ shared: boolean;
802
+ snapshot_hash: string;
803
+ }[];
804
+ truncated: boolean;
805
+ }>;
806
+ private find;
807
+ get(account: string, audience: string, type: z.infer<typeof audienceType$1>): Promise<{
808
+ account_id: string;
809
+ audience: {
810
+ [x: string]: unknown;
811
+ };
812
+ shared: boolean;
813
+ snapshot_hash: string;
814
+ }>;
815
+ private owned;
816
+ private tag;
817
+ usage(account: string, audience: string): Promise<{
818
+ audience_id: string;
819
+ derived_audience_ids: string[];
820
+ associations: MicrosoftRow[];
821
+ combined_list_ids: string[];
822
+ audience_signal_ids: string[];
823
+ campaigns_scanned: number;
824
+ ad_groups_scanned: number;
825
+ complete: true;
826
+ }>;
827
+ private confirm;
828
+ plan(op: WriteOperation): Promise<MicrosoftPlan>;
829
+ }
830
+
831
+ declare const audienceType: z.ZodEnum<{
832
+ RemarketingList: "RemarketingList";
833
+ Custom: "Custom";
834
+ InMarket: "InMarket";
835
+ Product: "Product";
836
+ SimilarRemarketingList: "SimilarRemarketingList";
837
+ CombinedList: "CombinedList";
838
+ CustomerList: "CustomerList";
839
+ ImpressionBasedRemarketingList: "ImpressionBasedRemarketingList";
840
+ }>;
841
+ declare const target: z.ZodDiscriminatedUnion<[z.ZodObject<{
842
+ type: z.ZodLiteral<"Campaign">;
843
+ campaign_id: z.ZodString;
844
+ }, z.core.$strip>, z.ZodObject<{
845
+ type: z.ZodLiteral<"AdGroup">;
846
+ campaign_id: z.ZodString;
847
+ ad_group_id: z.ZodString;
848
+ }, z.core.$strip>], "type">;
849
+ type Target = z.infer<typeof target>;
850
+ type AudienceType = z.infer<typeof audienceType>;
851
+ type Source = {
852
+ audience: MicrosoftRow;
853
+ snapshot_hash: string;
854
+ };
855
+ /** Audience selector on mutations; concrete native selectors on reads. TargetSetting.Details updates replace the complete list. */
856
+ declare class MicrosoftAudienceTargetingService extends MicrosoftNativeService {
857
+ constructor(...args: [...ConstructorParameters<typeof MicrosoftNativeService>, (account: string, audience: string, type: AudienceType) => Promise<Source>]);
858
+ private readonly source;
859
+ private entity;
860
+ private query;
861
+ private snapshot;
862
+ list(input: {
863
+ account_id: string;
864
+ target: Target;
865
+ audience_type: AudienceType;
866
+ after_criterion_id?: string;
867
+ limit: number;
868
+ }): Promise<{
869
+ next_cursor?: string | undefined;
870
+ context: {
871
+ context_hash: string;
872
+ target_and_bid: boolean;
873
+ audience_target_option: "TargetAndBid" | "BidOnly";
874
+ ad_group_status?: string | undefined;
875
+ account_id: string;
876
+ target: {
877
+ type: "Campaign";
878
+ campaign_id: string;
879
+ } | {
880
+ type: "AdGroup";
881
+ campaign_id: string;
882
+ ad_group_id: string;
883
+ };
884
+ campaign_status: unknown;
885
+ };
886
+ rows: {
887
+ criterion: MicrosoftRow;
888
+ snapshot_hash: string;
889
+ }[];
890
+ truncated: boolean;
891
+ }>;
892
+ private all;
893
+ private exclusive;
894
+ private confirm;
895
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
896
+ }
897
+
898
+ declare const accountInput: z.ZodObject<{
899
+ account_id: z.ZodString;
900
+ date_range: z.ZodObject<{
901
+ start_utc: z.ZodISODateTime;
902
+ end_utc: z.ZodISODateTime;
903
+ }, z.core.$strip>;
904
+ }, z.core.$strip>;
905
+ declare const goalInput: z.ZodObject<{
906
+ account_id: z.ZodString;
907
+ date_range: z.ZodObject<{
908
+ start_utc: z.ZodISODateTime;
909
+ end_utc: z.ZodISODateTime;
910
+ }, z.core.$strip>;
911
+ goal_ids: z.ZodArray<z.ZodString>;
912
+ upload_channels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
913
+ Unknown: "Unknown";
914
+ CampaignManagementAPI: "CampaignManagementAPI";
915
+ BulkAPI: "BulkAPI";
916
+ WebUpload: "WebUpload";
917
+ }>>>;
918
+ }, z.core.$strip>;
919
+ /** Campaign Management v13 report aggregates only; never expose signed report files or pilot event records. */
920
+ declare class MicrosoftOfflineReportService extends MicrosoftNativeService {
921
+ daily(input: z.infer<typeof accountInput>): Promise<{
922
+ account_id: string;
923
+ date_range: {
924
+ start_utc: string;
925
+ end_utc: string;
926
+ };
927
+ rows: {
928
+ UploadDate: string;
929
+ file_available: boolean;
930
+ SuccessCount?: string | number | null | undefined;
931
+ FailureCount?: string | number | null | undefined;
932
+ FileUrlExpiryTimeUtc?: string | null | undefined;
933
+ }[];
934
+ notes: string[];
935
+ }>;
936
+ goals(input: z.infer<typeof goalInput>): Promise<{
937
+ account_id: string;
938
+ date_range: {
939
+ start_utc: string;
940
+ end_utc: string;
941
+ };
942
+ rows: {
943
+ GoalId: string;
944
+ ConversionName?: string | null | undefined;
945
+ OverallSuccessCount?: string | number | null | undefined;
946
+ OverallUnattributedCount?: string | number | null | undefined;
947
+ OverallSuccessRate?: string | number | null | undefined;
948
+ OverallAlerts?: {
949
+ Count?: string | number | null | undefined;
950
+ UnattributedReason?: string | null | undefined;
951
+ }[] | null | undefined;
952
+ DailySummaries?: {
953
+ GoalId: string;
954
+ UploadDate: string;
955
+ SuccessCount?: string | number | null | undefined;
956
+ UnattributedCount?: string | number | null | undefined;
957
+ SuccessRate?: string | number | null | undefined;
958
+ Alerts?: {
959
+ Count?: string | number | null | undefined;
960
+ UnattributedReason?: string | null | undefined;
961
+ }[] | null | undefined;
962
+ }[] | null | undefined;
963
+ }[];
964
+ errors: {
965
+ index?: number | undefined;
966
+ goal_id?: string | undefined;
967
+ code?: number | undefined;
968
+ error_code?: string | undefined;
969
+ }[];
970
+ not_returned_goal_ids: string[];
971
+ notes: string[];
972
+ }>;
973
+ }
974
+
975
+ /** Official MicrosoftDocs@5bde65c3 and BingAds Python REST SDK@4b6fb31c, refreshed2026-11-06. */
976
+ declare class MicrosoftOfflineConversionService extends MicrosoftNativeService {
977
+ private readonly conversions;
978
+ constructor(client: MicrosoftAdsClient, scope: (account: string, refresh?: boolean) => Promise<RequestScope>, campaign: (account: string, campaign: string) => Promise<unknown>, conversions: MicrosoftConversionService);
979
+ plan(op: WriteOperation): Promise<MicrosoftPlan>;
980
+ }
981
+
982
+ declare const targetingRead: z.ZodObject<{
983
+ account_id: z.ZodString;
984
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
985
+ type: z.ZodLiteral<"Campaign">;
986
+ campaign_id: z.ZodString;
987
+ }, z.core.$strict>, z.ZodObject<{
988
+ type: z.ZodLiteral<"AdGroup">;
989
+ campaign_id: z.ZodString;
990
+ ad_group_id: z.ZodString;
991
+ }, z.core.$strict>], "type">;
992
+ criterion_types: z.ZodDefault<z.ZodArray<z.ZodEnum<{
993
+ Age: "Age";
994
+ Location: "Location";
995
+ Gender: "Gender";
996
+ Device: "Device";
997
+ DayTime: "DayTime";
998
+ LocationIntent: "LocationIntent";
999
+ Radius: "Radius";
1000
+ }>>>;
1001
+ page_size: z.ZodDefault<z.ZodNumber>;
1002
+ cursor: z.ZodOptional<z.ZodString>;
1003
+ }, z.core.$strict>;
1004
+
1005
+ /** MicrosoftDocs@5bde65c3, BingAds REST SDK@4b6fb31c; one native mutation per approval. */
1006
+ declare class MicrosoftGeneralTargetingService extends MicrosoftNativeService {
1007
+ private query;
1008
+ private all;
1009
+ private context;
1010
+ private inherited;
1011
+ private clock;
1012
+ private geography;
1013
+ list(raw: z.input<typeof targetingRead>): Promise<{
1014
+ notes: string[];
1015
+ next_cursor?: string | undefined;
1016
+ account_id: string;
1017
+ target: {
1018
+ type: "Campaign";
1019
+ campaign_id: string;
1020
+ } | {
1021
+ type: "AdGroup";
1022
+ campaign_id: string;
1023
+ ad_group_id: string;
1024
+ };
1025
+ context_hash: string;
1026
+ account: {
1027
+ [k: string]: unknown;
1028
+ };
1029
+ campaign: {
1030
+ [k: string]: unknown;
1031
+ };
1032
+ ad_group: MicrosoftRow | undefined;
1033
+ inheritance: {
1034
+ [k: string]: {
1035
+ source: "AdGroup" | "Campaign";
1036
+ criterion_count: number;
1037
+ };
1038
+ };
1039
+ schedule_clock: {
1040
+ source: "AdGroup" | "Campaign";
1041
+ use_searcher_time_zone: boolean | null;
1042
+ timezone: {};
1043
+ };
1044
+ total_criteria: number;
1045
+ criteria: {
1046
+ source: "AdGroup" | "Campaign";
1047
+ criterion: MicrosoftRow;
1048
+ }[];
1049
+ records: {
1050
+ id: string;
1051
+ criterion_id: string;
1052
+ kind: "Age" | "Location" | "Gender" | "Device" | "DayTime" | "LocationIntent" | "Radius";
1053
+ name: string;
1054
+ source: "AdGroup" | "Campaign";
1055
+ effective: boolean;
1056
+ status: {};
1057
+ bid_adjustment: string;
1058
+ }[];
1059
+ truncated: boolean;
1060
+ }>;
1061
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
1062
+ private validateResultingCriteria;
1063
+ }
1064
+
1065
+ declare const contextSchema: z.ZodObject<{
1066
+ account_id: z.ZodString;
1067
+ base_campaign: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1068
+ active_experiments: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1069
+ currency: z.ZodOptional<z.ZodString>;
1070
+ snapshot_hash: z.ZodString;
1071
+ }, z.core.$strip>;
1072
+ type Context = z.infer<typeof contextSchema>;
1073
+ /** Native v13 experiments: Active is the required setup input, not an independently pausable branch status. */
1074
+ declare class MicrosoftExperimentService extends MicrosoftNativeService {
1075
+ constructor(...args: [...ConstructorParameters<typeof MicrosoftNativeService>, (account: string) => Promise<unknown>, (account: string) => Promise<string | undefined>]);
1076
+ private readonly campaigns;
1077
+ private readonly currency;
1078
+ private query;
1079
+ private campaignById;
1080
+ base(account: string, campaignId: string, refresh?: boolean): Promise<Context>;
1081
+ list(input: {
1082
+ account_id: string;
1083
+ after_experiment_id?: string;
1084
+ limit: number;
1085
+ }): Promise<{
1086
+ visibility: string;
1087
+ notes: string[];
1088
+ next_cursor?: string | undefined;
1089
+ rows: MicrosoftRow[];
1090
+ truncated: boolean;
1091
+ }>;
1092
+ get(account: string, experimentId: string, refresh?: boolean): Promise<{
1093
+ snapshot_hash: string;
1094
+ notes: string[];
1095
+ experiment_campaign?: MicrosoftRow | undefined;
1096
+ account_id: string;
1097
+ experiment: MicrosoftRow;
1098
+ base_context: {
1099
+ account_id: string;
1100
+ base_campaign: Record<string, unknown>;
1101
+ active_experiments: Record<string, unknown>[];
1102
+ snapshot_hash: string;
1103
+ currency?: string | undefined;
1104
+ };
1105
+ }>;
1106
+ private eligible;
1107
+ private budget;
1108
+ private unique;
1109
+ private interval;
1110
+ private confirmed;
1111
+ private removedAfterDelete;
1112
+ plan(op: WriteOperation, guard: WriteGuard): Promise<MicrosoftPlan>;
1113
+ }
53
1114
 
54
1115
  /** DailyBudget is a double in whole account-currency units. */
55
1116
  declare const UNITS_TO_MICROS = 1000000;
@@ -62,6 +1123,8 @@ interface MicrosoftCampaign {
62
1123
  BudgetId?: number | string | null;
63
1124
  TimeZone?: string;
64
1125
  CampaignType?: string;
1126
+ SubType?: string | null;
1127
+ ExperimentId?: number | string | null;
65
1128
  }
66
1129
  declare class MicrosoftAdsProvider implements AdProvider {
67
1130
  private readonly client;
@@ -69,10 +1132,25 @@ declare class MicrosoftAdsProvider implements AdProvider {
69
1132
  readonly id = "microsoft";
70
1133
  /** accountId → parent customer id, learned from SearchAccounts. */
71
1134
  private customerIds;
1135
+ private currencies;
1136
+ readonly children: MicrosoftChildService;
1137
+ readonly images: MicrosoftImageService;
1138
+ readonly extensions: MicrosoftExtensionService;
1139
+ readonly targeting: MicrosoftTargetingService;
1140
+ readonly generalTargeting: MicrosoftGeneralTargetingService;
1141
+ readonly negativeKeywords: MicrosoftNegativeKeywordService;
1142
+ readonly budgets: MicrosoftBudgetService;
1143
+ readonly planning: MicrosoftPlanningService;
1144
+ readonly conversions: MicrosoftConversionService;
1145
+ readonly audiences: MicrosoftAudienceService;
1146
+ readonly audienceTargeting: MicrosoftAudienceTargetingService;
1147
+ readonly offlineReports: MicrosoftOfflineReportService;
1148
+ readonly offlineConversions: MicrosoftOfflineConversionService;
1149
+ readonly experiments: MicrosoftExperimentService;
72
1150
  constructor(client: MicrosoftAdsClient, options?: {
73
1151
  pollIntervalMs?: number;
74
1152
  pollMaxAttempts?: number;
75
- });
1153
+ }, media?: MediaResolver);
76
1154
  capabilities(): ProviderCapabilities;
77
1155
  standardActions(): StandardActions;
78
1156
  listAccounts(): Promise<Account[]>;
@@ -85,7 +1163,19 @@ declare class MicrosoftAdsProvider implements AdProvider {
85
1163
  body?: Record<string, unknown>;
86
1164
  }): Promise<unknown>;
87
1165
  report(query: NormalizedQuery): Promise<Report>;
88
- private campaignReport;
1166
+ private performanceReport;
1167
+ nativeReport(input: {
1168
+ account_id: string;
1169
+ kind: 'keyword' | 'search_term';
1170
+ date_range: NormalizedQuery['dateRange'];
1171
+ limit: number;
1172
+ }): Promise<{
1173
+ rows: Record<string, string>[];
1174
+ truncated: boolean;
1175
+ report_type: string;
1176
+ }>;
1177
+ private reportCsv;
1178
+ private reportObjects;
89
1179
  private parseReport;
90
1180
  previewWrite(op: WriteOperation, guard: WriteGuard): Promise<WritePreview>;
91
1181
  applyWrite(op: WriteOperation, guard: WriteGuard): Promise<WriteResult>;