taboola-backstage-sdk 0.2.1 → 0.3.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
6
6
  [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
7
7
 
8
- A comprehensive TypeScript SDK for the [Taboola Backstage API](https://developers.taboola.com/backstage-api/reference). Manage campaigns, ads, targeting, audiences, pixel tracking, and reporting programmatically.
8
+ A comprehensive TypeScript SDK for the [Taboola Backstage API](https://developers.taboola.com/backstage-api/reference). Manage campaigns, ads, targeting, audiences, pixel tracking, and reporting programmatically with full type safety.
9
9
 
10
10
  ## Features
11
11
 
@@ -108,10 +108,18 @@ const campaign = await client.campaigns.create('account-id', {
108
108
  marketing_objective: 'DRIVE_WEBSITE_TRAFFIC',
109
109
  });
110
110
 
111
- // Update campaign
111
+ // Update campaign (partial updates - only specified fields are changed)
112
112
  await client.campaigns.update('account-id', 'campaign-id', {
113
113
  cpc: 0.75,
114
114
  daily_cap: 500,
115
+ country_targeting: {
116
+ type: 'INCLUDE',
117
+ value: ['US', 'CA', 'GB'],
118
+ },
119
+ platform_targeting: {
120
+ type: 'INCLUDE',
121
+ value: ['DESK', 'PHON'],
122
+ },
115
123
  });
116
124
 
117
125
  // Pause / Unpause
@@ -157,9 +165,19 @@ const item = await client.items.create('account-id', 'campaign-id', {
157
165
  cta: { cta_type: 'LEARN_MORE' },
158
166
  });
159
167
 
160
- // Update item
168
+ // Update item (static or motion ad - partial updates supported)
161
169
  await client.items.update('account-id', 'campaign-id', 'item-id', {
162
170
  title: 'Updated Title',
171
+ url: 'https://example.com/new-landing-page',
172
+ });
173
+
174
+ // Update motion ad with video
175
+ await client.items.update('account-id', 'campaign-id', 'motion-ad-id', {
176
+ title: 'Updated Motion Ad',
177
+ performance_video_data: {
178
+ video_url: 'https://example.com/video.mp4',
179
+ fallback_url: 'https://example.com/fallback.jpg',
180
+ },
163
181
  });
164
182
 
165
183
  // Pause / Unpause
@@ -518,6 +536,39 @@ const client = new TaboolaClient({
518
536
 
519
537
  For detailed API documentation, see the [Taboola Backstage API Reference](https://developers.taboola.com/backstage-api/reference).
520
538
 
539
+ ## Changelog
540
+
541
+ ### v0.3.0 (2024)
542
+
543
+ **Enhanced Update Support** - Comprehensive updates for campaigns and items
544
+
545
+ - **Campaign Updates**: Expanded `UpdateCampaignRequest` to support all updatable fields including:
546
+ - Geographic targeting (DMA, region, city, postal code, sub-country)
547
+ - Advanced targeting (contextual, browser, connection type, auto publisher)
548
+ - Bid modifiers (publisher bid modifiers and bid strategy modifiers)
549
+ - Audience targeting (marketplace, custom, lookalike, marking labels, contextual segments)
550
+ - Additional fields (pricing model, campaign profile, traffic allocation, external brand safety, verification pixels, viewability tags)
551
+
552
+ - **Item Updates**: Expanded `UpdateItemRequest` to support both static items and motion ads:
553
+ - Static items: `url`, `thumbnail_url`, `verification_pixel`, `viewability_tag`, `creative_focus`
554
+ - Motion ads: New `PerformanceVideoData` type with `video_url` and `fallback_url`
555
+ - Enhanced documentation with examples for both item types
556
+
557
+ - **Partial Updates**: Both endpoints properly support partial updates where only specified fields are modified
558
+ - **Improved Documentation**: Added comprehensive JSDoc examples and better API alignment
559
+
560
+ ### v0.2.1 (2024)
561
+
562
+ Minor bug fixes and documentation improvements.
563
+
564
+ ### v0.2.0 (2024)
565
+
566
+ Added support for shared budgets, marking labels, and realtime report signatures.
567
+
568
+ ### v0.1.0 (2024)
569
+
570
+ Initial release with core API support.
571
+
521
572
  ## License
522
573
 
523
574
  MIT
package/dist/index.cjs CHANGED
@@ -519,15 +519,42 @@ var CampaignsAPI = class {
519
519
  /**
520
520
  * Update an existing campaign
521
521
  *
522
+ * Submit only the fields you want to update. Fields that are omitted or null
523
+ * will remain unchanged.
524
+ *
522
525
  * @param accountId - Account ID
523
526
  * @param campaignId - Campaign ID
524
- * @param updates - Fields to update
527
+ * @param updates - Fields to update (partial)
525
528
  *
526
- * @example
529
+ * @example Update a single field
527
530
  * ```typescript
528
531
  * const campaign = await client.campaigns.update('my-account', '12345', {
529
- * cpc: 0.75,
530
- * daily_cap: 500,
532
+ * name: 'DemoCampaign - Edited',
533
+ * });
534
+ * ```
535
+ *
536
+ * @example Update multiple fields including targeting
537
+ * ```typescript
538
+ * const campaign = await client.campaigns.update('my-account', '12345', {
539
+ * name: 'Demo Campaign - Edited Again',
540
+ * branding_text: 'New branding text',
541
+ * spending_limit: 10000,
542
+ * spending_limit_model: 'ENTIRE',
543
+ * country_targeting: {
544
+ * type: 'INCLUDE',
545
+ * value: ['AU', 'GB'],
546
+ * },
547
+ * platform_targeting: {
548
+ * type: 'INCLUDE',
549
+ * value: ['TBLT', 'PHON'],
550
+ * },
551
+ * });
552
+ * ```
553
+ *
554
+ * @example Pause a campaign (alternatively, use pause() method)
555
+ * ```typescript
556
+ * const campaign = await client.campaigns.update('my-account', '12345', {
557
+ * is_active: false,
531
558
  * });
532
559
  * ```
533
560
  */
@@ -772,20 +799,44 @@ var ItemsAPI = class {
772
799
  return this.http.post(`${accountId}/campaigns/${campaignId}/items/`, item);
773
800
  }
774
801
  /**
775
- * Update an existing item
802
+ * Update an existing item (static or motion ad)
803
+ *
804
+ * Submit only the fields you want to update. Fields that are omitted or null
805
+ * will remain unchanged. The endpoint automatically detects the item type.
806
+ *
807
+ * Note: While status is CRAWLING, the Item is in a read-only state - no fields can be modified.
776
808
  *
777
809
  * @param accountId - Account ID
778
810
  * @param campaignId - Campaign ID
779
811
  * @param itemId - Item ID
780
- * @param updates - Fields to update
812
+ * @param updates - Fields to update (partial)
781
813
  *
782
- * @example
814
+ * @example Update a static item
783
815
  * ```typescript
784
816
  * const item = await client.items.update('my-account', '12345', '67890', {
785
817
  * title: 'Updated Title!',
786
818
  * is_active: true,
787
819
  * });
788
820
  * ```
821
+ *
822
+ * @example Update a motion ad
823
+ * ```typescript
824
+ * const item = await client.items.update('my-account', '12345', '67890', {
825
+ * title: 'Updated Motion Ad Title',
826
+ * description: 'New description',
827
+ * performance_video_data: {
828
+ * video_url: 'https://example.com/video.mp4',
829
+ * fallback_url: 'https://example.com/fallback.jpg',
830
+ * },
831
+ * });
832
+ * ```
833
+ *
834
+ * @example Pause an item (alternatively, use pause() method)
835
+ * ```typescript
836
+ * const item = await client.items.update('my-account', '12345', '67890', {
837
+ * is_active: false,
838
+ * });
839
+ * ```
789
840
  */
790
841
  async update(accountId, campaignId, itemId, updates) {
791
842
  return this.http.post(