ebay-mcp 1.13.2 → 1.14.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.
Files changed (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -1,740 +1,1534 @@
1
- import { withApiError } from '../../api/shared/request.js';
2
- /**
3
- * Marketing API - Marketing campaigns and promotions
4
- * Based on: docs/sell-apps/marketing-and-promotions/sell_marketing_v1_oas3.json
5
- */
1
+ import { buildEndpointParams, requestDeleteEffect, requestGetEffect, requestPostEffect, requestPutEffect, } from '../../api/shared/request.js';
2
+ const MARKETING_BASE_PATH = '/sell/marketing/v1';
3
+ const marketplaceHeader = (marketplaceId) => ({
4
+ headers: { 'X-EBAY-C-MARKETPLACE-ID': marketplaceId },
5
+ });
6
+ /** Marketing API - campaigns, ads, promotions, reports, and email campaigns. */
6
7
  export class MarketingApi {
7
8
  client;
8
- basePath = '/sell/marketing/v1';
9
9
  constructor(client) {
10
10
  this.client = client;
11
11
  }
12
12
  /**
13
- * Get campaigns
14
- */
15
- async getCampaigns(campaignStatus, marketplaceId, limit) {
16
- const params = {};
17
- if (campaignStatus)
18
- params.campaign_status = campaignStatus;
19
- if (marketplaceId)
20
- params.marketplace_id = marketplaceId;
21
- if (limit)
22
- params.limit = limit;
23
- return await withApiError('Failed to get campaigns', () => this.client.get(`${this.basePath}/ad_campaign`, params));
24
- }
25
- /**
26
- * Get a specific campaign
27
- */
28
- async getCampaign(campaignId) {
29
- return await withApiError('Failed to get campaign', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}`));
30
- }
31
- /**
32
- * Create a campaign
33
- */
34
- async createCampaign(campaign) {
35
- return await withApiError('Failed to create campaign', () => this.client.post(`${this.basePath}/ad_campaign`, campaign));
36
- }
37
- /**
38
- * Get promotions (discounts), optionally filtered by status and type.
39
- *
40
- * Mirrors eBay's `getPromotions` query parameters: `marketplace_id` selects the
41
- * site, `promotion_status` (DRAFT, SCHEDULED, RUNNING, PAUSED, ENDED) and
42
- * `promotion_type` (e.g. ORDER_DISCOUNT, MARKDOWN_SALE) narrow the result set,
43
- * and `limit`/`offset` page through it.
44
- */
45
- async getPromotions(marketplaceId, limit, offset, promotionStatus, promotionType) {
46
- const params = {};
47
- if (marketplaceId)
48
- params.marketplace_id = marketplaceId;
49
- if (limit)
50
- params.limit = limit;
51
- if (offset)
52
- params.offset = offset;
53
- if (promotionStatus)
54
- params.promotion_status = promotionStatus;
55
- if (promotionType)
56
- params.promotion_type = promotionType;
57
- return await withApiError('Failed to get promotions', () => this.client.get(`${this.basePath}/promotion`, params));
58
- }
59
- /**
60
- * Create a promotion (item promotion)
61
- */
62
- async createPromotion(promotion) {
63
- return await withApiError('Failed to create promotion', () => this.client.post(`${this.basePath}/item_promotion`, promotion));
64
- }
65
- /**
66
- * Get ads for a campaign
67
- */
68
- async getAds(campaignId, adGroupIds, adStatus, limit, listingIds, offset) {
69
- const params = {};
70
- if (adGroupIds)
71
- params.ad_group_ids = adGroupIds;
72
- if (adStatus)
73
- params.ad_status = adStatus;
74
- if (limit)
75
- params.limit = limit;
76
- if (listingIds)
77
- params.listing_ids = listingIds;
78
- if (offset)
79
- params.offset = offset;
80
- return await withApiError('Failed to get ads', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad`, params));
81
- }
82
- /**
83
- * Create an ad for a campaign
84
- */
85
- async createAd(campaignId, ad) {
86
- return await withApiError('Failed to create ad', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad`, ad));
87
- }
88
- /**
89
- * Create ads by inventory reference for a campaign
90
- */
91
- async createAdsByInventoryReference(campaignId, ads) {
92
- return await withApiError('Failed to create ads by inventory reference', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/create_ads_by_inventory_reference`, ads));
93
- }
94
- /**
95
- * Get a specific ad for a campaign
96
- */
97
- async getAd(campaignId, adId) {
98
- return await withApiError('Failed to get ad', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad/${adId}`));
99
- }
100
- /**
101
- * Delete a specific ad from a campaign
102
- */
103
- async deleteAd(campaignId, adId) {
104
- return await withApiError('Failed to delete ad', () => this.client.delete(`${this.basePath}/ad_campaign/${campaignId}/ad/${adId}`));
105
- }
106
- /**
107
- * Clone an ad for a campaign
108
- */
109
- async cloneAd(campaignId, adId, ad) {
110
- return await withApiError('Failed to clone ad', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad/${adId}/clone`, ad));
111
- }
112
- /**
113
- * Get ads by inventory reference for a campaign
114
- */
115
- async getAdsByInventoryReference(campaignId, inventoryReferenceId, inventoryReferenceType) {
116
- const params = {
117
- inventory_reference_id: inventoryReferenceId,
118
- inventory_reference_type: inventoryReferenceType,
119
- };
120
- return await withApiError('Failed to get ads by inventory reference', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/get_ads_by_inventory_reference`, params));
121
- }
122
- /**
123
- * Get ads by listing ID for a campaign
124
- */
125
- async getAdsByListingId(campaignId, listingId) {
126
- const params = {
127
- listing_id: listingId,
128
- };
129
- return await withApiError('Failed to get ads by listing id', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/get_ads_by_listing_id`, params));
130
- }
131
- /**
132
- * Update the bid for an ad in a campaign
133
- */
134
- async updateBid(campaignId, adId, bid) {
135
- return await withApiError('Failed to update bid', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad/${adId}/update_bid`, bid));
136
- }
137
- /**
138
- * Clone a campaign
139
- */
140
- async cloneCampaign(campaignId, campaign) {
141
- return await withApiError('Failed to clone campaign', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/clone`, campaign));
142
- }
143
- /**
144
- * End a campaign
145
- */
146
- async endCampaign(campaignId) {
147
- return await withApiError('Failed to end campaign', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/end`, {}));
148
- }
149
- /**
150
- * Get campaign by name
151
- */
152
- async getCampaignByName(campaignName) {
153
- const params = {
154
- campaign_name: campaignName,
155
- };
156
- return await withApiError('Failed to get campaign by name', () => this.client.get(`${this.basePath}/ad_campaign/get_campaign_by_name`, params));
157
- }
158
- /**
159
- * Bulk create ads by inventory reference
160
- */
161
- async bulkCreateAdsByInventoryReference(campaignId, body) {
162
- return await withApiError('Failed to bulk create ads by inventory reference', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_create_ads_by_inventory_reference`, body));
163
- }
164
- /**
165
- * Bulk create ads by listing id
166
- */
167
- async bulkCreateAdsByListingId(campaignId, body) {
168
- return await withApiError('Failed to bulk create ads by listing id', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_create_ads_by_listing_id`, body));
169
- }
170
- async bulkDeleteAdsByInventoryReference(campaignId, body) {
171
- return await withApiError('Failed to bulk delete ads by inventory reference', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_delete_ads_by_inventory_reference`, body));
172
- }
173
- async deleteAdsByInventoryReference(campaignId, body) {
174
- return await withApiError('Failed to delete ads by inventory reference', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/delete_ads_by_inventory_reference`, body));
175
- }
176
- async bulkDeleteAdsByListingId(campaignId, body) {
177
- return await withApiError('Failed to bulk delete ads by listing id', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_delete_ads_by_listing_id`, body));
178
- }
179
- /**
180
- * Bulk update ads bid by inventory reference
181
- */
182
- async bulkUpdateAdsBidByInventoryReference(campaignId, body) {
183
- return await withApiError('Failed to bulk update ads bid by inventory reference', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_update_ads_bid_by_inventory_reference`, body));
184
- }
185
- /**
186
- * Bulk update ads bid by listing id
187
- */
188
- async bulkUpdateAdsBidByListingId(campaignId, body) {
189
- return await withApiError('Failed to bulk update ads bid by listing id', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_update_ads_bid_by_listing_id`, body));
190
- }
191
- /**
192
- * Bulk update ads status
193
- */
194
- async bulkUpdateAdsStatus(campaignId, body) {
195
- return await withApiError('Failed to bulk update ads status', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_update_ads_status`, body));
196
- }
197
- /**
198
- * Bulk update ads status by listing id
199
- */
200
- async bulkUpdateAdsStatusByListingId(campaignId, body) {
201
- return await withApiError('Failed to bulk update ads status by listing id', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_update_ads_status_by_listing_id`, body));
202
- }
203
- /**
204
- * Pause a campaign
13
+ * Bulk create ads by inventory reference through the eBay Marketing API.
14
+ *
15
+ * @param input - Path, query, header, and request body values for bulkCreateAdsByInventoryReference.
16
+ * @returns An Effect that succeeds with eBay's generated bulkCreateAdsByInventoryReference response DTO.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const response = await Effect.runPromise(marketingApi.bulkCreateAdsByInventoryReference({ campaignId: 'campaign-1', request: { ... } }));
21
+ * ```
22
+ *
23
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkCreateAdsByInventoryReference
205
24
  */
206
- async pauseCampaign(campaignId) {
207
- return await withApiError('Failed to pause campaign', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/pause`, {}));
208
- }
25
+ bulkCreateAdsByInventoryReference = (input) => {
26
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_create_ads_by_inventory_reference`;
27
+ return requestPostEffect(this.client, path, input.request);
28
+ };
209
29
  /**
210
- * Resume a campaign
211
- */
212
- async resumeCampaign(campaignId) {
213
- return await withApiError('Failed to resume campaign', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/resume`, {}));
214
- }
215
- /**
216
- * Update campaign identification
30
+ * Bulk create ads by listing id through the eBay Marketing API.
31
+ *
32
+ * @param input - Path, query, header, and request body values for bulkCreateAdsByListingId.
33
+ * @returns An Effect that succeeds with eBay's generated bulkCreateAdsByListingId response DTO.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const response = await Effect.runPromise(marketingApi.bulkCreateAdsByListingId({ campaignId: 'campaign-1', request: { ... } }));
38
+ * ```
39
+ *
40
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkCreateAdsByListingId
217
41
  */
218
- async updateCampaignIdentification(campaignId, body) {
219
- return await withApiError('Failed to update campaign identification', () => this.client.put(`${this.basePath}/ad_campaign/${campaignId}/update_campaign_identification`, body));
220
- }
42
+ bulkCreateAdsByListingId = (input) => {
43
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_create_ads_by_listing_id`;
44
+ return requestPostEffect(this.client, path, input.request);
45
+ };
221
46
  /**
222
- * Create an ad group
47
+ * Bulk delete ads by inventory reference through the eBay Marketing API.
48
+ *
49
+ * @param input - Path, query, header, and request body values for bulkDeleteAdsByInventoryReference.
50
+ * @returns An Effect that succeeds with eBay's generated bulkDeleteAdsByInventoryReference response DTO.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const response = await Effect.runPromise(marketingApi.bulkDeleteAdsByInventoryReference({ campaignId: 'campaign-1', request: { ... } }));
55
+ * ```
56
+ *
57
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkDeleteAdsByInventoryReference
223
58
  */
224
- async createAdGroup(campaignId, body) {
225
- return await withApiError('Failed to create ad group', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group`, body));
226
- }
59
+ bulkDeleteAdsByInventoryReference = (input) => {
60
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_delete_ads_by_inventory_reference`;
61
+ return requestPostEffect(this.client, path, input.request);
62
+ };
227
63
  /**
228
- * Clone an ad group
64
+ * Bulk delete ads by listing id through the eBay Marketing API.
65
+ *
66
+ * @param input - Path, query, header, and request body values for bulkDeleteAdsByListingId.
67
+ * @returns An Effect that succeeds with eBay's generated bulkDeleteAdsByListingId response DTO.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const response = await Effect.runPromise(marketingApi.bulkDeleteAdsByListingId({ campaignId: 'campaign-1', request: { ... } }));
72
+ * ```
73
+ *
74
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkDeleteAdsByListingId
229
75
  */
230
- async cloneAdGroup(campaignId, adGroupId, body) {
231
- return await withApiError('Failed to clone ad group', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/clone`, body));
232
- }
233
- /**
234
- * Get ad groups
235
- */
236
- async getAdGroups(campaignId, adGroupStatus, limit, offset) {
237
- const params = {};
238
- if (adGroupStatus)
239
- params.ad_group_status = adGroupStatus;
240
- if (limit)
241
- params.limit = limit;
242
- if (offset)
243
- params.offset = offset;
244
- return await withApiError('Failed to get ad groups', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad_group`, params));
245
- }
76
+ bulkDeleteAdsByListingId = (input) => {
77
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_delete_ads_by_listing_id`;
78
+ return requestPostEffect(this.client, path, input.request);
79
+ };
246
80
  /**
247
- * Get an ad group
81
+ * Bulk update ads bid by inventory reference through the eBay Marketing API.
82
+ *
83
+ * @param input - Path, query, header, and request body values for bulkUpdateAdsBidByInventoryReference.
84
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateAdsBidByInventoryReference response DTO.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateAdsBidByInventoryReference({ campaignId: 'campaign-1', request: { ... } }));
89
+ * ```
90
+ *
91
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkUpdateAdsBidByInventoryReference
248
92
  */
249
- async getAdGroup(campaignId, adGroupId) {
250
- return await withApiError('Failed to get ad group', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}`));
251
- }
93
+ bulkUpdateAdsBidByInventoryReference = (input) => {
94
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_update_ads_bid_by_inventory_reference`;
95
+ return requestPostEffect(this.client, path, input.request);
96
+ };
252
97
  /**
253
- * Suggest bids for an ad group
98
+ * Bulk update ads bid by listing id through the eBay Marketing API.
99
+ *
100
+ * @param input - Path, query, header, and request body values for bulkUpdateAdsBidByListingId.
101
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateAdsBidByListingId response DTO.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateAdsBidByListingId({ campaignId: 'campaign-1', request: { ... } }));
106
+ * ```
107
+ *
108
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkUpdateAdsBidByListingId
254
109
  */
255
- async suggestBids(campaignId, adGroupId) {
256
- return await withApiError('Failed to suggest bids', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/suggest_bids`, {}));
257
- }
110
+ bulkUpdateAdsBidByListingId = (input) => {
111
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_update_ads_bid_by_listing_id`;
112
+ return requestPostEffect(this.client, path, input.request);
113
+ };
258
114
  /**
259
- * Update ad group bids
115
+ * Bulk update ads status through the eBay Marketing API.
116
+ *
117
+ * @param input - Path, query, header, and request body values for bulkUpdateAdsStatus.
118
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateAdsStatus response DTO.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateAdsStatus({ campaignId: 'campaign-1', request: { ... } }));
123
+ * ```
124
+ *
125
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkUpdateAdsStatus
260
126
  */
261
- async updateAdGroupBids(campaignId, adGroupId, body) {
262
- return await withApiError('Failed to update ad group bids', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/update_ad_group_bids`, body));
263
- }
127
+ bulkUpdateAdsStatus = (input) => {
128
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_update_ads_status`;
129
+ return requestPostEffect(this.client, path, input.request);
130
+ };
264
131
  /**
265
- * Update ad group keywords
132
+ * Bulk update ads status by listing id through the eBay Marketing API.
133
+ *
134
+ * @param input - Path, query, header, and request body values for bulkUpdateAdsStatusByListingId.
135
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateAdsStatusByListingId response DTO.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateAdsStatusByListingId({ campaignId: 'campaign-1', request: { ... } }));
140
+ * ```
141
+ *
142
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/bulkUpdateAdsStatusByListingId
266
143
  */
267
- async updateAdGroupKeywords(campaignId, adGroupId, body) {
268
- return await withApiError('Failed to update ad group keywords', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/update_ad_group_keywords`, body));
269
- }
144
+ bulkUpdateAdsStatusByListingId = (input) => {
145
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_update_ads_status_by_listing_id`;
146
+ return requestPostEffect(this.client, path, input.request);
147
+ };
270
148
  /**
271
- * Suggest keywords
149
+ * Get ads through the eBay Marketing API.
150
+ *
151
+ * @param input - Path, query, header, and request body values for getAds.
152
+ * @returns An Effect that succeeds with eBay's generated getAds response DTO.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const response = await Effect.runPromise(marketingApi.getAds({ campaignId: 'campaign-1' }));
157
+ * ```
158
+ *
159
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/getAds
160
+ */
161
+ getAds = (input) => {
162
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad`;
163
+ const params = buildEndpointParams({
164
+ adGroupIds: { wireName: 'ad_group_ids', value: input.adGroupIds },
165
+ adStatus: { wireName: 'ad_status', value: input.adStatus },
166
+ limit: { wireName: 'limit', value: input.limit },
167
+ listingIds: { wireName: 'listing_ids', value: input.listingIds },
168
+ offset: { wireName: 'offset', value: input.offset },
169
+ });
170
+ return requestGetEffect(this.client, path, params);
171
+ };
172
+ /**
173
+ * Create ad by listing id through the eBay Marketing API.
174
+ *
175
+ * @param input - Path, query, header, and request body values for createAdByListingId.
176
+ * @returns An Effect that succeeds with eBay's generated createAdByListingId response DTO.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const response = await Effect.runPromise(marketingApi.createAdByListingId({ campaignId: 'campaign-1', request: { ... } }));
181
+ * ```
182
+ *
183
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/createAdByListingId
272
184
  */
273
- async suggestKeywords(campaignId, adGroupId, body) {
274
- return await withApiError('Failed to suggest keywords', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/suggest_keywords`, body));
275
- }
276
- /**
277
- * Get keywords
278
- */
279
- async getKeywords(campaignId, adGroupId, keywordStatus, limit, offset) {
280
- const params = {};
281
- if (keywordStatus)
282
- params.keyword_status = keywordStatus;
283
- if (limit)
284
- params.limit = limit;
285
- if (offset)
286
- params.offset = offset;
287
- return await withApiError('Failed to get keywords', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/keyword`, params));
288
- }
185
+ createAdByListingId = (input) => {
186
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad`;
187
+ return requestPostEffect(this.client, path, input.request);
188
+ };
289
189
  /**
290
- * Bulk create keywords
190
+ * Create ads by inventory reference through the eBay Marketing API.
191
+ *
192
+ * @param input - Path, query, header, and request body values for createAdsByInventoryReference.
193
+ * @returns An Effect that succeeds with eBay's generated createAdsByInventoryReference response DTO.
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * const response = await Effect.runPromise(marketingApi.createAdsByInventoryReference({ campaignId: 'campaign-1', request: { ... } }));
198
+ * ```
199
+ *
200
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/createAdsByInventoryReference
291
201
  */
292
- async bulkCreateKeywords(campaignId, adGroupId, body) {
293
- return await withApiError('Failed to bulk create keywords', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/bulk_create_keywords`, body));
294
- }
202
+ createAdsByInventoryReference = (input) => {
203
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/create_ads_by_inventory_reference`;
204
+ return requestPostEffect(this.client, path, input.request);
205
+ };
295
206
  /**
296
- * Bulk delete keywords
207
+ * Get ad through the eBay Marketing API.
208
+ *
209
+ * @param input - Path, query, header, and request body values for getAd.
210
+ * @returns An Effect that succeeds with eBay's generated getAd response DTO.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * const response = await Effect.runPromise(marketingApi.getAd({ adId: 'ad-1', campaignId: 'campaign-1' }));
215
+ * ```
216
+ *
217
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/getAd
297
218
  */
298
- async bulkDeleteKeywords(campaignId, adGroupId, body) {
299
- return await withApiError('Failed to bulk delete keywords', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/bulk_delete_keywords`, body));
300
- }
219
+ getAd = (input) => {
220
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad/${input.adId}`;
221
+ return requestGetEffect(this.client, path);
222
+ };
301
223
  /**
302
- * Bulk update keyword bids
224
+ * Delete ad through the eBay Marketing API.
225
+ *
226
+ * @param input - Path, query, header, and request body values for deleteAd.
227
+ * @returns An Effect that succeeds with eBay's generated deleteAd response DTO.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * const response = await Effect.runPromise(marketingApi.deleteAd({ adId: 'ad-1', campaignId: 'campaign-1' }));
232
+ * ```
233
+ *
234
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/deleteAd
303
235
  */
304
- async bulkUpdateKeywordBids(campaignId, adGroupId, body) {
305
- return await withApiError('Failed to bulk update keyword bids', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/bulk_update_keyword_bids`, body));
306
- }
236
+ deleteAd = (input) => {
237
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad/${input.adId}`;
238
+ return requestDeleteEffect(this.client, path);
239
+ };
307
240
  /**
308
- * Create a keyword
241
+ * Delete ads by inventory reference through the eBay Marketing API.
242
+ *
243
+ * @param input - Path, query, header, and request body values for deleteAdsByInventoryReference.
244
+ * @returns An Effect that succeeds with eBay's generated deleteAdsByInventoryReference response DTO.
245
+ *
246
+ * @example
247
+ * ```ts
248
+ * const response = await Effect.runPromise(marketingApi.deleteAdsByInventoryReference({ campaignId: 'campaign-1', request: { ... } }));
249
+ * ```
250
+ *
251
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/deleteAdsByInventoryReference
309
252
  */
310
- async createKeyword(campaignId, adGroupId, body) {
311
- return await withApiError('Failed to create keyword', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/create_keyword`, body));
312
- }
253
+ deleteAdsByInventoryReference = (input) => {
254
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/delete_ads_by_inventory_reference`;
255
+ return requestPostEffect(this.client, path, input.request);
256
+ };
313
257
  /**
314
- * Get a keyword
258
+ * Get ads by inventory reference through the eBay Marketing API.
259
+ *
260
+ * @param input - Path, query, header, and request body values for getAdsByInventoryReference.
261
+ * @returns An Effect that succeeds with eBay's generated getAdsByInventoryReference response DTO.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * const response = await Effect.runPromise(marketingApi.getAdsByInventoryReference({ campaignId: 'campaign-1', inventoryReferenceId: 'inventoryReference-1', inventoryReferenceType: 'inventoryReferenceType-1' }));
266
+ * ```
267
+ *
268
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/getAdsByInventoryReference
269
+ */
270
+ getAdsByInventoryReference = (input) => {
271
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/get_ads_by_inventory_reference`;
272
+ const params = buildEndpointParams({
273
+ inventoryReferenceId: {
274
+ wireName: 'inventory_reference_id',
275
+ value: input.inventoryReferenceId,
276
+ },
277
+ inventoryReferenceType: {
278
+ wireName: 'inventory_reference_type',
279
+ value: input.inventoryReferenceType,
280
+ },
281
+ });
282
+ return requestGetEffect(this.client, path, params);
283
+ };
284
+ /**
285
+ * Update bid through the eBay Marketing API.
286
+ *
287
+ * @param input - Path, query, header, and request body values for updateBid.
288
+ * @returns An Effect that succeeds with eBay's generated updateBid response DTO.
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * const response = await Effect.runPromise(marketingApi.updateBid({ adId: 'ad-1', campaignId: 'campaign-1', request: { ... } }));
293
+ * ```
294
+ *
295
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad/methods/updateBid
315
296
  */
316
- async getKeyword(campaignId, adGroupId, keywordId) {
317
- return await withApiError('Failed to get keyword', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/keyword/${keywordId}`));
318
- }
297
+ updateBid = (input) => {
298
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad/${input.adId}/update_bid`;
299
+ return requestPostEffect(this.client, path, input.request);
300
+ };
319
301
  /**
320
- * Delete a keyword
302
+ * Get ad groups through the eBay Marketing API.
303
+ *
304
+ * @param input - Path, query, header, and request body values for getAdGroups.
305
+ * @returns An Effect that succeeds with eBay's generated getAdGroups response DTO.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const response = await Effect.runPromise(marketingApi.getAdGroups({ campaignId: 'campaign-1' }));
310
+ * ```
311
+ *
312
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/getAdGroups
313
+ */
314
+ getAdGroups = (input) => {
315
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group`;
316
+ const params = buildEndpointParams({
317
+ adGroupStatus: { wireName: 'ad_group_status', value: input.adGroupStatus },
318
+ limit: { wireName: 'limit', value: input.limit },
319
+ offset: { wireName: 'offset', value: input.offset },
320
+ });
321
+ return requestGetEffect(this.client, path, params);
322
+ };
323
+ /**
324
+ * Create ad group through the eBay Marketing API.
325
+ *
326
+ * @param input - Path, query, header, and request body values for createAdGroup.
327
+ * @returns An Effect that succeeds with eBay's generated createAdGroup response DTO.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * const response = await Effect.runPromise(marketingApi.createAdGroup({ campaignId: 'campaign-1', request: { ... } }));
332
+ * ```
333
+ *
334
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/createAdGroup
321
335
  */
322
- async deleteKeyword(campaignId, adGroupId, keywordId) {
323
- return await withApiError('Failed to delete keyword', () => this.client.delete(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/keyword/${keywordId}`));
324
- }
336
+ createAdGroup = (input) => {
337
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group`;
338
+ return requestPostEffect(this.client, path, input.request);
339
+ };
325
340
  /**
326
- * Update a keyword's bid
341
+ * Get ad group through the eBay Marketing API.
342
+ *
343
+ * @param input - Path, query, header, and request body values for getAdGroup.
344
+ * @returns An Effect that succeeds with eBay's generated getAdGroup response DTO.
345
+ *
346
+ * @example
347
+ * ```ts
348
+ * const response = await Effect.runPromise(marketingApi.getAdGroup({ adGroupId: 'adGroup-1', campaignId: 'campaign-1' }));
349
+ * ```
350
+ *
351
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/getAdGroup
327
352
  */
328
- async updateKeywordBid(campaignId, adGroupId, keywordId, body) {
329
- return await withApiError('Failed to update keyword bid', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}/keyword/${keywordId}/update_bid`, body));
330
- }
331
- /**
332
- * Get ad report
333
- */
334
- async getAdReport(dimension, metric, startDate, endDate, sort, listingIds, marketplaceId) {
335
- const params = {
336
- dimension,
337
- metric,
338
- start_date: startDate,
339
- end_date: endDate,
340
- };
341
- if (sort)
342
- params.sort = sort;
343
- if (listingIds)
344
- params.listing_ids = listingIds;
345
- if (marketplaceId)
346
- params.marketplace_id = marketplaceId;
347
- return await withApiError('Failed to get ad report', () => this.client.get(`${this.basePath}/ad_report`, params));
348
- }
353
+ getAdGroup = (input) => {
354
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group/${input.adGroupId}`;
355
+ return requestGetEffect(this.client, path);
356
+ };
349
357
  /**
350
- * Get ad report metadata
358
+ * Update ad group through the eBay Marketing API.
359
+ *
360
+ * @param input - Path, query, header, and request body values for updateAdGroup.
361
+ * @returns An Effect that succeeds with eBay's generated updateAdGroup response DTO.
362
+ *
363
+ * @example
364
+ * ```ts
365
+ * const response = await Effect.runPromise(marketingApi.updateAdGroup({ adGroupId: 'adGroup-1', campaignId: 'campaign-1', request: { ... } }));
366
+ * ```
367
+ *
368
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/updateAdGroup
351
369
  */
352
- async getAdReportMetadata() {
353
- return await withApiError('Failed to get ad report metadata', () => this.client.get(`${this.basePath}/ad_report_metadata`));
354
- }
370
+ updateAdGroup = (input) => {
371
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group/${input.adGroupId}`;
372
+ return requestPutEffect(this.client, path, input.request);
373
+ };
355
374
  /**
356
- * Get ad report metadata for a report type
375
+ * Suggest bids through the eBay Marketing API.
376
+ *
377
+ * @param input - Path, query, header, and request body values for suggestBids.
378
+ * @returns An Effect that succeeds with eBay's generated suggestBids response DTO.
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * const response = await Effect.runPromise(marketingApi.suggestBids({ adGroupId: 'adGroup-1', campaignId: 'campaign-1', request: { ... } }));
383
+ * ```
384
+ *
385
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/suggestBids
357
386
  */
358
- async getAdReportMetadataForReportType(reportType) {
359
- return await withApiError('Failed to get ad report metadata for report type', () => this.client.get(`${this.basePath}/ad_report_metadata/${reportType}`));
360
- }
387
+ suggestBids = (input) => {
388
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group/${input.adGroupId}/suggest_bids`;
389
+ return requestPostEffect(this.client, path, input.request);
390
+ };
361
391
  /**
362
- * Create a report task
392
+ * Suggest keywords through the eBay Marketing API.
393
+ *
394
+ * @param input - Path, query, header, and request body values for suggestKeywords.
395
+ * @returns An Effect that succeeds with eBay's generated suggestKeywords response DTO.
396
+ *
397
+ * @example
398
+ * ```ts
399
+ * const response = await Effect.runPromise(marketingApi.suggestKeywords({ adGroupId: 'adGroup-1', campaignId: 'campaign-1', request: { ... } }));
400
+ * ```
401
+ *
402
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_group/methods/suggestKeywords
363
403
  */
364
- async createReportTask(body) {
365
- return await withApiError('Failed to create report task', () => this.client.post(`${this.basePath}/ad_report_task`, body));
366
- }
367
- /**
368
- * Get report tasks
369
- */
370
- async getReportTasks(reportTaskStatuses, limit, offset) {
371
- const params = {};
372
- if (reportTaskStatuses)
373
- params.report_task_statuses = reportTaskStatuses;
374
- if (limit)
375
- params.limit = limit;
376
- if (offset)
377
- params.offset = offset;
378
- return await withApiError('Failed to get report tasks', () => this.client.get(`${this.basePath}/ad_report_task`, params));
379
- }
404
+ suggestKeywords = (input) => {
405
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/ad_group/${input.adGroupId}/suggest_keywords`;
406
+ return requestPostEffect(this.client, path, input.request);
407
+ };
380
408
  /**
381
- * Get a report task
409
+ * Clone campaign through the eBay Marketing API.
410
+ *
411
+ * @param input - Path, query, header, and request body values for cloneCampaign.
412
+ * @returns An Effect that succeeds with eBay's generated cloneCampaign response DTO.
413
+ *
414
+ * @example
415
+ * ```ts
416
+ * const response = await Effect.runPromise(marketingApi.cloneCampaign({ campaignId: 'campaign-1', request: { ... } }));
417
+ * ```
418
+ *
419
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/cloneCampaign
382
420
  */
383
- async getReportTask(reportTaskId) {
384
- return await withApiError('Failed to get report task', () => this.client.get(`${this.basePath}/ad_report_task/${reportTaskId}`));
385
- }
421
+ cloneCampaign = (input) => {
422
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/clone`;
423
+ return requestPostEffect(this.client, path, input.request);
424
+ };
386
425
  /**
387
- * Get an item promotion
426
+ * Get campaigns through the eBay Marketing API.
427
+ *
428
+ * @param input - Path, query, header, and request body values for getCampaigns.
429
+ * @returns An Effect that succeeds with eBay's generated getCampaigns response DTO.
430
+ *
431
+ * @example
432
+ * ```ts
433
+ * const response = await Effect.runPromise(marketingApi.getCampaigns());
434
+ * ```
435
+ *
436
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/getCampaigns
437
+ */
438
+ getCampaigns = (input = {}) => {
439
+ const path = `${MARKETING_BASE_PATH}/ad_campaign`;
440
+ const params = buildEndpointParams({
441
+ campaignName: { wireName: 'campaign_name', value: input.campaignName },
442
+ campaignStatus: { wireName: 'campaign_status', value: input.campaignStatus },
443
+ campaignTargetingTypes: {
444
+ wireName: 'campaign_targeting_types',
445
+ value: input.campaignTargetingTypes,
446
+ },
447
+ channels: { wireName: 'channels', value: input.channels },
448
+ endDateRange: { wireName: 'end_date_range', value: input.endDateRange },
449
+ fundingStrategy: { wireName: 'funding_strategy', value: input.fundingStrategy },
450
+ limit: { wireName: 'limit', value: input.limit },
451
+ offset: { wireName: 'offset', value: input.offset },
452
+ startDateRange: { wireName: 'start_date_range', value: input.startDateRange },
453
+ });
454
+ return requestGetEffect(this.client, path, params);
455
+ };
456
+ /**
457
+ * Create campaign through the eBay Marketing API.
458
+ *
459
+ * @param input - Path, query, header, and request body values for createCampaign.
460
+ * @returns An Effect that succeeds with eBay's generated createCampaign response DTO.
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * const response = await Effect.runPromise(marketingApi.createCampaign({ request: { ... } }));
465
+ * ```
466
+ *
467
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/createCampaign
388
468
  */
389
- async getItemPromotion(promotionId) {
390
- return await withApiError('Failed to get item promotion', () => this.client.get(`${this.basePath}/item_promotion/${promotionId}`));
391
- }
469
+ createCampaign = (input) => {
470
+ const path = `${MARKETING_BASE_PATH}/ad_campaign`;
471
+ return requestPostEffect(this.client, path, input.request);
472
+ };
392
473
  /**
393
- * Delete an item promotion
474
+ * Get campaign through the eBay Marketing API.
475
+ *
476
+ * @param input - Path, query, header, and request body values for getCampaign.
477
+ * @returns An Effect that succeeds with eBay's generated getCampaign response DTO.
478
+ *
479
+ * @example
480
+ * ```ts
481
+ * const response = await Effect.runPromise(marketingApi.getCampaign({ campaignId: 'campaign-1' }));
482
+ * ```
483
+ *
484
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/getCampaign
394
485
  */
395
- async deleteItemPromotion(promotionId) {
396
- return await withApiError('Failed to delete item promotion', () => this.client.delete(`${this.basePath}/item_promotion/${promotionId}`));
397
- }
486
+ getCampaign = (input) => {
487
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}`;
488
+ return requestGetEffect(this.client, path);
489
+ };
398
490
  /**
399
- * Pause an item promotion
491
+ * Delete campaign through the eBay Marketing API.
492
+ *
493
+ * @param input - Path, query, header, and request body values for deleteCampaign.
494
+ * @returns An Effect that succeeds with eBay's generated deleteCampaign response DTO.
495
+ *
496
+ * @example
497
+ * ```ts
498
+ * const response = await Effect.runPromise(marketingApi.deleteCampaign({ campaignId: 'campaign-1' }));
499
+ * ```
500
+ *
501
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/deleteCampaign
400
502
  */
401
- async pauseItemPromotion(promotionId) {
402
- return await withApiError('Failed to pause item promotion', () => this.client.post(`${this.basePath}/item_promotion/${promotionId}/pause`, {}));
403
- }
503
+ deleteCampaign = (input) => {
504
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}`;
505
+ return requestDeleteEffect(this.client, path);
506
+ };
404
507
  /**
405
- * Resume an item promotion
508
+ * End campaign through the eBay Marketing API.
509
+ *
510
+ * @param input - Path, query, header, and request body values for endCampaign.
511
+ * @returns An Effect that succeeds with eBay's generated endCampaign response DTO.
512
+ *
513
+ * @example
514
+ * ```ts
515
+ * const response = await Effect.runPromise(marketingApi.endCampaign({ campaignId: 'campaign-1' }));
516
+ * ```
517
+ *
518
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/endCampaign
406
519
  */
407
- async resumeItemPromotion(promotionId) {
408
- return await withApiError('Failed to resume item promotion', () => this.client.post(`${this.basePath}/item_promotion/${promotionId}/resume`, {}));
409
- }
520
+ endCampaign = (input) => {
521
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/end`;
522
+ return requestPostEffect(this.client, path);
523
+ };
410
524
  /**
411
- * Update an item promotion
525
+ * Find campaign by ad reference through the eBay Marketing API.
526
+ *
527
+ * @param input - Path, query, header, and request body values for findCampaignByAdReference.
528
+ * @returns An Effect that succeeds with eBay's generated findCampaignByAdReference response DTO.
529
+ *
530
+ * @example
531
+ * ```ts
532
+ * const response = await Effect.runPromise(marketingApi.findCampaignByAdReference());
533
+ * ```
534
+ *
535
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/findCampaignByAdReference
536
+ */
537
+ findCampaignByAdReference = (input = {}) => {
538
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/find_campaign_by_ad_reference`;
539
+ const params = buildEndpointParams({
540
+ inventoryReferenceId: {
541
+ wireName: 'inventory_reference_id',
542
+ value: input.inventoryReferenceId,
543
+ },
544
+ inventoryReferenceType: {
545
+ wireName: 'inventory_reference_type',
546
+ value: input.inventoryReferenceType,
547
+ },
548
+ listingId: { wireName: 'listing_id', value: input.listingId },
549
+ });
550
+ return requestGetEffect(this.client, path, params);
551
+ };
552
+ /**
553
+ * Get campaign by name through the eBay Marketing API.
554
+ *
555
+ * @param input - Path, query, header, and request body values for getCampaignByName.
556
+ * @returns An Effect that succeeds with eBay's generated getCampaignByName response DTO.
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * const response = await Effect.runPromise(marketingApi.getCampaignByName({ campaignName: 'campaignName-1' }));
561
+ * ```
562
+ *
563
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/getCampaignByName
412
564
  */
413
- async updateItemPromotion(promotionId, body) {
414
- return await withApiError('Failed to update item promotion', () => this.client.put(`${this.basePath}/item_promotion/${promotionId}`, body));
415
- }
416
- /**
417
- * Get a promotion report
418
- */
419
- async getPromotionReport(marketplaceId, promotionStatus, limit, offset) {
420
- const params = {
421
- marketplace_id: marketplaceId,
422
- };
423
- if (promotionStatus)
424
- params.promotion_status = promotionStatus;
425
- if (limit)
426
- params.limit = limit;
427
- if (offset)
428
- params.offset = offset;
429
- return await withApiError('Failed to get promotion report', () => this.client.get(`${this.basePath}/promotion_report`, params));
430
- }
565
+ getCampaignByName = (input) => {
566
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/get_campaign_by_name`;
567
+ const params = buildEndpointParams({
568
+ campaignName: { wireName: 'campaign_name', value: input.campaignName },
569
+ });
570
+ return requestGetEffect(this.client, path, params);
571
+ };
431
572
  /**
432
- * Get a promotion summary report
573
+ * Launch campaign through the eBay Marketing API.
574
+ *
575
+ * @param input - Path, query, header, and request body values for launchCampaign.
576
+ * @returns An Effect that succeeds with eBay's generated launchCampaign response DTO.
577
+ *
578
+ * @example
579
+ * ```ts
580
+ * const response = await Effect.runPromise(marketingApi.launchCampaign({ campaignId: 'campaign-1' }));
581
+ * ```
582
+ *
583
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/launchCampaign
433
584
  */
434
- async getPromotionSummaryReport(marketplaceId) {
435
- const params = { marketplace_id: marketplaceId };
436
- return await withApiError('Failed to get promotion summary report', () => this.client.get(`${this.basePath}/promotion_summary_report`, params));
437
- }
585
+ launchCampaign = (input) => {
586
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/launch`;
587
+ return requestPostEffect(this.client, path);
588
+ };
438
589
  /**
439
- * Get promotion summary (alias for getPromotionSummaryReport)
590
+ * Pause campaign through the eBay Marketing API.
591
+ *
592
+ * @param input - Path, query, header, and request body values for pauseCampaign.
593
+ * @returns An Effect that succeeds with eBay's generated pauseCampaign response DTO.
594
+ *
595
+ * @example
596
+ * ```ts
597
+ * const response = await Effect.runPromise(marketingApi.pauseCampaign({ campaignId: 'campaign-1' }));
598
+ * ```
599
+ *
600
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/pauseCampaign
440
601
  */
441
- async getPromotionSummary(marketplaceId) {
442
- return await this.getPromotionSummaryReport(marketplaceId);
443
- }
602
+ pauseCampaign = (input) => {
603
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/pause`;
604
+ return requestPostEffect(this.client, path);
605
+ };
444
606
  /**
445
- * Get promotion reports (alias for getPromotionReport)
607
+ * Resume campaign through the eBay Marketing API.
608
+ *
609
+ * @param input - Path, query, header, and request body values for resumeCampaign.
610
+ * @returns An Effect that succeeds with eBay's generated resumeCampaign response DTO.
611
+ *
612
+ * @example
613
+ * ```ts
614
+ * const response = await Effect.runPromise(marketingApi.resumeCampaign({ campaignId: 'campaign-1' }));
615
+ * ```
616
+ *
617
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/resumeCampaign
446
618
  */
447
- async getPromotionReports(marketplaceId, promotionStatus, limit, offset) {
448
- return await this.getPromotionReport(marketplaceId, promotionStatus, limit, offset);
449
- }
619
+ resumeCampaign = (input) => {
620
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/resume`;
621
+ return requestPostEffect(this.client, path);
622
+ };
450
623
  /**
451
- * Get targeting for a campaign
624
+ * Setup quick campaign through the eBay Marketing API.
625
+ *
626
+ * @param input - Path, query, header, and request body values for setupQuickCampaign.
627
+ * @returns An Effect that succeeds with eBay's generated setupQuickCampaign response DTO.
628
+ *
629
+ * @example
630
+ * ```ts
631
+ * const response = await Effect.runPromise(marketingApi.setupQuickCampaign({ request: { ... } }));
632
+ * ```
633
+ *
634
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/setupQuickCampaign
452
635
  */
453
- async getTargeting(campaignId) {
454
- return await withApiError('Failed to get targeting', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/targeting`));
455
- }
636
+ setupQuickCampaign = (input) => {
637
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/setup_quick_campaign`;
638
+ return requestPostEffect(this.client, path, input.request);
639
+ };
456
640
  /**
457
- * Create targeting for a campaign
641
+ * Suggest budget through the eBay Marketing API.
642
+ *
643
+ * @param input - Path, query, header, and request body values for suggestBudget.
644
+ * @returns An Effect that succeeds with eBay's generated suggestBudget response DTO.
645
+ *
646
+ * @example
647
+ * ```ts
648
+ * const response = await Effect.runPromise(marketingApi.suggestBudget({ marketplaceId: 'EBAY_US' }));
649
+ * ```
650
+ *
651
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/suggestBudget
458
652
  */
459
- async createTargeting(campaignId, body) {
460
- return await withApiError('Failed to create targeting', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/targeting`, body));
461
- }
653
+ suggestBudget = (input) => {
654
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/suggest_budget`;
655
+ const config = marketplaceHeader(input.marketplaceId);
656
+ return requestGetEffect(this.client, path, undefined, config);
657
+ };
462
658
  /**
463
- * Update targeting for a campaign
659
+ * Suggest items through the eBay Marketing API.
660
+ *
661
+ * @param input - Path, query, header, and request body values for suggestItems.
662
+ * @returns An Effect that succeeds with eBay's generated suggestItems response DTO.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * const response = await Effect.runPromise(marketingApi.suggestItems({ campaignId: 'campaign-1' }));
667
+ * ```
668
+ *
669
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/suggestItems
670
+ */
671
+ suggestItems = (input) => {
672
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/suggest_items`;
673
+ const params = buildEndpointParams({
674
+ categoryIds: { wireName: 'category_ids', value: input.categoryIds },
675
+ limit: { wireName: 'limit', value: input.limit },
676
+ offset: { wireName: 'offset', value: input.offset },
677
+ });
678
+ return requestGetEffect(this.client, path, params);
679
+ };
680
+ /**
681
+ * Suggest max cpc through the eBay Marketing API.
682
+ *
683
+ * @param input - Path, query, header, and request body values for suggestMaxCpc.
684
+ * @returns An Effect that succeeds with eBay's generated suggestMaxCpc response DTO.
685
+ *
686
+ * @example
687
+ * ```ts
688
+ * const response = await Effect.runPromise(marketingApi.suggestMaxCpc({ request: { ... } }));
689
+ * ```
690
+ *
691
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/suggestMaxCpc
464
692
  */
465
- async updateTargeting(campaignId, body) {
466
- return await withApiError('Failed to update targeting', () => this.client.put(`${this.basePath}/ad_campaign/${campaignId}/targeting`, body));
467
- }
468
- /**
469
- * Get negative keywords for priority-strategy CPC campaigns.
470
- *
471
- * Maps to `GET /negative_keyword`. Negative keywords are not nested under a
472
- * campaign or ad group path — association is expressed through the optional
473
- * `campaign_ids` / `ad_group_ids` filters (only one campaign ID is supported
474
- * per request). Requires eBay priority strategy program access.
475
- */
476
- async getNegativeKeywords(campaignIds, adGroupIds, negativeKeywordStatus, limit, offset) {
477
- const params = {};
478
- if (campaignIds)
479
- params.campaign_ids = campaignIds;
480
- if (adGroupIds)
481
- params.ad_group_ids = adGroupIds;
482
- if (negativeKeywordStatus)
483
- params.negative_keyword_status = negativeKeywordStatus;
484
- if (limit)
485
- params.limit = limit;
486
- if (offset)
487
- params.offset = offset;
488
- return await withApiError('Failed to get negative keywords', () => this.client.get(`${this.basePath}/negative_keyword`, params));
489
- }
693
+ suggestMaxCpc = (input) => {
694
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/suggest_max_cpc`;
695
+ return requestPostEffect(this.client, path, input.request);
696
+ };
490
697
  /**
491
- * Create a negative keyword in a priority-strategy CPC campaign.
698
+ * Update ad rate strategy through the eBay Marketing API.
492
699
  *
493
- * Maps to `POST /negative_keyword`. The target campaign and ad group are
494
- * carried in the request body (`campaignId` / `adGroupId`), not the path.
700
+ * @param input - Path, query, header, and request body values for updateAdRateStrategy.
701
+ * @returns An Effect that succeeds with eBay's generated updateAdRateStrategy response DTO.
702
+ *
703
+ * @example
704
+ * ```ts
705
+ * const response = await Effect.runPromise(marketingApi.updateAdRateStrategy({ campaignId: 'campaign-1', request: { ... } }));
706
+ * ```
707
+ *
708
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/updateAdRateStrategy
495
709
  */
496
- async createNegativeKeyword(body) {
497
- return await withApiError('Failed to create negative keyword', () => this.client.post(`${this.basePath}/negative_keyword`, body));
498
- }
710
+ updateAdRateStrategy = (input) => {
711
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/update_ad_rate_strategy`;
712
+ return requestPostEffect(this.client, path, input.request);
713
+ };
499
714
  /**
500
- * Get a single negative keyword by its ID.
715
+ * Update bidding strategy through the eBay Marketing API.
501
716
  *
502
- * Maps to `GET /negative_keyword/{negative_keyword_id}`.
717
+ * @param input - Path, query, header, and request body values for updateBiddingStrategy.
718
+ * @returns An Effect that succeeds with eBay's generated updateBiddingStrategy response DTO.
719
+ *
720
+ * @example
721
+ * ```ts
722
+ * const response = await Effect.runPromise(marketingApi.updateBiddingStrategy({ campaignId: 'campaign-1', request: { ... } }));
723
+ * ```
724
+ *
725
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/updateBiddingStrategy
503
726
  */
504
- async getNegativeKeyword(negativeKeywordId) {
505
- return await withApiError('Failed to get negative keyword', () => this.client.get(`${this.basePath}/negative_keyword/${negativeKeywordId}`));
506
- }
727
+ updateBiddingStrategy = (input) => {
728
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/update_bidding_strategy`;
729
+ return requestPostEffect(this.client, path, input.request);
730
+ };
507
731
  /**
508
- * Update a negative keyword's status (for example, to archive it).
732
+ * Update campaign budget through the eBay Marketing API.
509
733
  *
510
- * Maps to `PUT /negative_keyword/{negative_keyword_id}`. eBay exposes no
511
- * delete endpoint for negative keywords — a status change (such as `ARCHIVED`)
512
- * is the removal mechanism.
734
+ * @param input - Path, query, header, and request body values for updateCampaignBudget.
735
+ * @returns An Effect that succeeds with eBay's generated updateCampaignBudget response DTO.
736
+ *
737
+ * @example
738
+ * ```ts
739
+ * const response = await Effect.runPromise(marketingApi.updateCampaignBudget({ campaignId: 'campaign-1', request: { ... } }));
740
+ * ```
741
+ *
742
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/updateCampaignBudget
513
743
  */
514
- async updateNegativeKeyword(negativeKeywordId, body) {
515
- return await withApiError('Failed to update negative keyword', () => this.client.put(`${this.basePath}/negative_keyword/${negativeKeywordId}`, body));
516
- }
744
+ updateCampaignBudget = (input) => {
745
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/update_campaign_budget`;
746
+ return requestPostEffect(this.client, path, input.request);
747
+ };
517
748
  /**
518
- * Create multiple negative keywords in one request.
749
+ * Update campaign identification through the eBay Marketing API.
519
750
  *
520
- * Maps to `POST /bulk_create_negative_keyword`. Each entry in `requests`
521
- * carries its own `campaignId` / `adGroupId`.
751
+ * @param input - Path, query, header, and request body values for updateCampaignIdentification.
752
+ * @returns An Effect that succeeds with eBay's generated updateCampaignIdentification response DTO.
753
+ *
754
+ * @example
755
+ * ```ts
756
+ * const response = await Effect.runPromise(marketingApi.updateCampaignIdentification({ campaignId: 'campaign-1', request: { ... } }));
757
+ * ```
758
+ *
759
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/updateCampaignIdentification
522
760
  */
523
- async bulkCreateNegativeKeywords(body) {
524
- return await withApiError('Failed to bulk create negative keywords', () => this.client.post(`${this.basePath}/bulk_create_negative_keyword`, body));
525
- }
761
+ updateCampaignIdentification = (input) => {
762
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/update_campaign_identification`;
763
+ return requestPostEffect(this.client, path, input.request);
764
+ };
526
765
  /**
527
- * Update the status of multiple negative keywords in one request.
766
+ * Bulk create keyword through the eBay Marketing API.
528
767
  *
529
- * Maps to `POST /bulk_update_negative_keyword`.
768
+ * @param input - Path, query, header, and request body values for bulkCreateKeyword.
769
+ * @returns An Effect that succeeds with eBay's generated bulkCreateKeyword response DTO.
770
+ *
771
+ * @example
772
+ * ```ts
773
+ * const response = await Effect.runPromise(marketingApi.bulkCreateKeyword({ campaignId: 'campaign-1', request: { ... } }));
774
+ * ```
775
+ *
776
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/bulkCreateKeyword
530
777
  */
531
- async bulkUpdateNegativeKeywords(body) {
532
- return await withApiError('Failed to bulk update negative keywords', () => this.client.post(`${this.basePath}/bulk_update_negative_keyword`, body));
533
- }
778
+ bulkCreateKeyword = (input) => {
779
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_create_keyword`;
780
+ return requestPostEffect(this.client, path, input.request);
781
+ };
534
782
  /**
535
- * Delete a campaign
783
+ * Bulk update keyword through the eBay Marketing API.
784
+ *
785
+ * @param input - Path, query, header, and request body values for bulkUpdateKeyword.
786
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateKeyword response DTO.
787
+ *
788
+ * @example
789
+ * ```ts
790
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateKeyword({ campaignId: 'campaign-1', request: { ... } }));
791
+ * ```
792
+ *
793
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/bulkUpdateKeyword
536
794
  */
537
- async deleteCampaign(campaignId) {
538
- return await withApiError('Failed to delete campaign', () => this.client.delete(`${this.basePath}/ad_campaign/${campaignId}`));
539
- }
795
+ bulkUpdateKeyword = (input) => {
796
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/bulk_update_keyword`;
797
+ return requestPostEffect(this.client, path, input.request);
798
+ };
540
799
  /**
541
- * Launch a campaign
800
+ * Get keywords through the eBay Marketing API.
801
+ *
802
+ * @param input - Path, query, header, and request body values for getKeywords.
803
+ * @returns An Effect that succeeds with eBay's generated getKeywords response DTO.
804
+ *
805
+ * @example
806
+ * ```ts
807
+ * const response = await Effect.runPromise(marketingApi.getKeywords({ campaignId: 'campaign-1' }));
808
+ * ```
809
+ *
810
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/getKeywords
811
+ */
812
+ getKeywords = (input) => {
813
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/keyword`;
814
+ const params = buildEndpointParams({
815
+ adGroupIds: { wireName: 'ad_group_ids', value: input.adGroupIds },
816
+ keywordStatus: { wireName: 'keyword_status', value: input.keywordStatus },
817
+ limit: { wireName: 'limit', value: input.limit },
818
+ offset: { wireName: 'offset', value: input.offset },
819
+ });
820
+ return requestGetEffect(this.client, path, params);
821
+ };
822
+ /**
823
+ * Create keyword through the eBay Marketing API.
824
+ *
825
+ * @param input - Path, query, header, and request body values for createKeyword.
826
+ * @returns An Effect that succeeds with eBay's generated createKeyword response DTO.
827
+ *
828
+ * @example
829
+ * ```ts
830
+ * const response = await Effect.runPromise(marketingApi.createKeyword({ campaignId: 'campaign-1', request: { ... } }));
831
+ * ```
832
+ *
833
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/createKeyword
542
834
  */
543
- async launchCampaign(campaignId) {
544
- return await withApiError('Failed to launch campaign', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/launch`, {}));
545
- }
546
- /**
547
- * Find campaign by ad reference
548
- */
549
- async findCampaignByAdReference(inventoryReferenceId, inventoryReferenceType, listingId) {
550
- const params = {};
551
- if (inventoryReferenceId)
552
- params.inventory_reference_id = inventoryReferenceId;
553
- if (inventoryReferenceType)
554
- params.inventory_reference_type = inventoryReferenceType;
555
- if (listingId)
556
- params.listing_id = listingId;
557
- return await withApiError('Failed to find campaign by ad reference', () => this.client.get(`${this.basePath}/ad_campaign/find_campaign_by_ad_reference`, params));
558
- }
835
+ createKeyword = (input) => {
836
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/keyword`;
837
+ return requestPostEffect(this.client, path, input.request);
838
+ };
559
839
  /**
560
- * Setup quick campaign
840
+ * Get keyword through the eBay Marketing API.
841
+ *
842
+ * @param input - Path, query, header, and request body values for getKeyword.
843
+ * @returns An Effect that succeeds with eBay's generated getKeyword response DTO.
844
+ *
845
+ * @example
846
+ * ```ts
847
+ * const response = await Effect.runPromise(marketingApi.getKeyword({ campaignId: 'campaign-1', keywordId: 'keyword-1' }));
848
+ * ```
849
+ *
850
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/getKeyword
561
851
  */
562
- async setupQuickCampaign(body) {
563
- return await withApiError('Failed to setup quick campaign', () => this.client.post(`${this.basePath}/ad_campaign/setup_quick_campaign`, body));
564
- }
852
+ getKeyword = (input) => {
853
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/keyword/${input.keywordId}`;
854
+ return requestGetEffect(this.client, path);
855
+ };
565
856
  /**
566
- * Suggest budget for a campaign
857
+ * Update keyword through the eBay Marketing API.
858
+ *
859
+ * @param input - Path, query, header, and request body values for updateKeyword.
860
+ * @returns An Effect that succeeds with eBay's generated updateKeyword response DTO.
861
+ *
862
+ * @example
863
+ * ```ts
864
+ * const response = await Effect.runPromise(marketingApi.updateKeyword({ campaignId: 'campaign-1', keywordId: 'keyword-1', request: { ... } }));
865
+ * ```
866
+ *
867
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/keyword/methods/updateKeyword
567
868
  */
568
- async suggestBudget(campaignId) {
569
- const params = {};
570
- if (campaignId)
571
- params.campaign_id = campaignId;
572
- return await withApiError('Failed to suggest budget', () => this.client.get(`${this.basePath}/ad_campaign/suggest_budget`, params));
573
- }
869
+ updateKeyword = (input) => {
870
+ const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/keyword/${input.keywordId}`;
871
+ return requestPutEffect(this.client, path, input.request);
872
+ };
574
873
  /**
575
- * Suggest items for a campaign
874
+ * Bulk create negative keyword through the eBay Marketing API.
875
+ *
876
+ * @param input - Path, query, header, and request body values for bulkCreateNegativeKeyword.
877
+ * @returns An Effect that succeeds with eBay's generated bulkCreateNegativeKeyword response DTO.
878
+ *
879
+ * @example
880
+ * ```ts
881
+ * const response = await Effect.runPromise(marketingApi.bulkCreateNegativeKeyword({ request: { ... } }));
882
+ * ```
883
+ *
884
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/bulkCreateNegativeKeyword
576
885
  */
577
- async suggestItems(campaignId) {
578
- return await withApiError('Failed to suggest items', () => this.client.get(`${this.basePath}/ad_campaign/${campaignId}/suggest_items`));
579
- }
886
+ bulkCreateNegativeKeyword = (input) => {
887
+ const path = `${MARKETING_BASE_PATH}/bulk_create_negative_keyword`;
888
+ return requestPostEffect(this.client, path, input.request);
889
+ };
580
890
  /**
581
- * Suggest max CPC for ads
891
+ * Bulk update negative keyword through the eBay Marketing API.
892
+ *
893
+ * @param input - Path, query, header, and request body values for bulkUpdateNegativeKeyword.
894
+ * @returns An Effect that succeeds with eBay's generated bulkUpdateNegativeKeyword response DTO.
895
+ *
896
+ * @example
897
+ * ```ts
898
+ * const response = await Effect.runPromise(marketingApi.bulkUpdateNegativeKeyword({ request: { ... } }));
899
+ * ```
900
+ *
901
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/bulkUpdateNegativeKeyword
582
902
  */
583
- async suggestMaxCpc(body) {
584
- return await withApiError('Failed to suggest max cpc', () => this.client.post(`${this.basePath}/ad_campaign/suggest_max_cpc`, body));
585
- }
903
+ bulkUpdateNegativeKeyword = (input) => {
904
+ const path = `${MARKETING_BASE_PATH}/bulk_update_negative_keyword`;
905
+ return requestPostEffect(this.client, path, input.request);
906
+ };
586
907
  /**
587
- * Update ad rate strategy for a campaign
908
+ * Get negative keywords through the eBay Marketing API.
909
+ *
910
+ * @param input - Path, query, header, and request body values for getNegativeKeywords.
911
+ * @returns An Effect that succeeds with eBay's generated getNegativeKeywords response DTO.
912
+ *
913
+ * @example
914
+ * ```ts
915
+ * const response = await Effect.runPromise(marketingApi.getNegativeKeywords());
916
+ * ```
917
+ *
918
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/getNegativeKeywords
919
+ */
920
+ getNegativeKeywords = (input = {}) => {
921
+ const path = `${MARKETING_BASE_PATH}/negative_keyword`;
922
+ const params = buildEndpointParams({
923
+ adGroupIds: { wireName: 'ad_group_ids', value: input.adGroupIds },
924
+ campaignIds: { wireName: 'campaign_ids', value: input.campaignIds },
925
+ limit: { wireName: 'limit', value: input.limit },
926
+ negativeKeywordStatus: {
927
+ wireName: 'negative_keyword_status',
928
+ value: input.negativeKeywordStatus,
929
+ },
930
+ offset: { wireName: 'offset', value: input.offset },
931
+ });
932
+ return requestGetEffect(this.client, path, params);
933
+ };
934
+ /**
935
+ * Create negative keyword through the eBay Marketing API.
936
+ *
937
+ * @param input - Path, query, header, and request body values for createNegativeKeyword.
938
+ * @returns An Effect that succeeds with eBay's generated createNegativeKeyword response DTO.
939
+ *
940
+ * @example
941
+ * ```ts
942
+ * const response = await Effect.runPromise(marketingApi.createNegativeKeyword({ request: { ... } }));
943
+ * ```
944
+ *
945
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/createNegativeKeyword
588
946
  */
589
- async updateAdRateStrategy(campaignId, body) {
590
- return await withApiError('Failed to update ad rate strategy', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/update_ad_rate_strategy`, body));
591
- }
947
+ createNegativeKeyword = (input) => {
948
+ const path = `${MARKETING_BASE_PATH}/negative_keyword`;
949
+ return requestPostEffect(this.client, path, input.request);
950
+ };
592
951
  /**
593
- * Update bidding strategy for a campaign
952
+ * Get negative keyword through the eBay Marketing API.
953
+ *
954
+ * @param input - Path, query, header, and request body values for getNegativeKeyword.
955
+ * @returns An Effect that succeeds with eBay's generated getNegativeKeyword response DTO.
956
+ *
957
+ * @example
958
+ * ```ts
959
+ * const response = await Effect.runPromise(marketingApi.getNegativeKeyword({ negativeKeywordId: 'negativeKeyword-1' }));
960
+ * ```
961
+ *
962
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/getNegativeKeyword
594
963
  */
595
- async updateBiddingStrategy(campaignId, body) {
596
- return await withApiError('Failed to update bidding strategy', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/update_bidding_strategy`, body));
597
- }
964
+ getNegativeKeyword = (input) => {
965
+ const path = `${MARKETING_BASE_PATH}/negative_keyword/${input.negativeKeywordId}`;
966
+ return requestGetEffect(this.client, path);
967
+ };
598
968
  /**
599
- * Update campaign budget
969
+ * Update negative keyword through the eBay Marketing API.
970
+ *
971
+ * @param input - Path, query, header, and request body values for updateNegativeKeyword.
972
+ * @returns An Effect that succeeds with eBay's generated updateNegativeKeyword response DTO.
973
+ *
974
+ * @example
975
+ * ```ts
976
+ * const response = await Effect.runPromise(marketingApi.updateNegativeKeyword({ negativeKeywordId: 'negativeKeyword-1', request: { ... } }));
977
+ * ```
978
+ *
979
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/negative_keyword/methods/updateNegativeKeyword
600
980
  */
601
- async updateCampaignBudget(campaignId, body) {
602
- return await withApiError('Failed to update campaign budget', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/update_campaign_budget`, body));
603
- }
981
+ updateNegativeKeyword = (input) => {
982
+ const path = `${MARKETING_BASE_PATH}/negative_keyword/${input.negativeKeywordId}`;
983
+ return requestPutEffect(this.client, path, input.request);
984
+ };
604
985
  /**
605
- * Update an ad group
986
+ * Get report through the eBay Marketing API.
987
+ *
988
+ * @param input - Path, query, header, and request body values for getReport.
989
+ * @returns An Effect that succeeds with eBay's generated getReport response DTO.
990
+ *
991
+ * @example
992
+ * ```ts
993
+ * const response = await Effect.runPromise(marketingApi.getReport({ reportId: 'report-1' }));
994
+ * ```
995
+ *
996
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report/methods/getReport
606
997
  */
607
- async updateAdGroup(campaignId, adGroupId, body) {
608
- return await withApiError('Failed to update ad group', () => this.client.put(`${this.basePath}/ad_campaign/${campaignId}/ad_group/${adGroupId}`, body));
609
- }
998
+ getReport = (input) => {
999
+ const path = `${MARKETING_BASE_PATH}/ad_report/${input.reportId}`;
1000
+ return requestGetEffect(this.client, path);
1001
+ };
610
1002
  /**
611
- * Update a keyword
1003
+ * Get report metadata through the eBay Marketing API.
1004
+ *
1005
+ * @param input - Path, query, header, and request body values for getReportMetadata.
1006
+ * @returns An Effect that succeeds with eBay's generated getReportMetadata response DTO.
1007
+ *
1008
+ * @example
1009
+ * ```ts
1010
+ * const response = await Effect.runPromise(marketingApi.getReportMetadata());
1011
+ * ```
1012
+ *
1013
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_metadata/methods/getReportMetadata
1014
+ */
1015
+ getReportMetadata = (input = {}) => {
1016
+ const path = `${MARKETING_BASE_PATH}/ad_report_metadata`;
1017
+ const params = buildEndpointParams({
1018
+ fundingModel: { wireName: 'funding_model', value: input.fundingModel },
1019
+ channel: { wireName: 'channel', value: input.channel },
1020
+ });
1021
+ return requestGetEffect(this.client, path, params);
1022
+ };
1023
+ /**
1024
+ * Get report metadata for report type through the eBay Marketing API.
1025
+ *
1026
+ * @param input - Path, query, header, and request body values for getReportMetadataForReportType.
1027
+ * @returns An Effect that succeeds with eBay's generated getReportMetadataForReportType response DTO.
1028
+ *
1029
+ * @example
1030
+ * ```ts
1031
+ * const response = await Effect.runPromise(marketingApi.getReportMetadataForReportType({ reportType: 'reportType-1' }));
1032
+ * ```
1033
+ *
1034
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_metadata/methods/getReportMetadataForReportType
1035
+ */
1036
+ getReportMetadataForReportType = (input) => {
1037
+ const path = `${MARKETING_BASE_PATH}/ad_report_metadata/${input.reportType}`;
1038
+ const params = buildEndpointParams({
1039
+ fundingModel: { wireName: 'funding_model', value: input.fundingModel },
1040
+ channel: { wireName: 'channel', value: input.channel },
1041
+ });
1042
+ return requestGetEffect(this.client, path, params);
1043
+ };
1044
+ /**
1045
+ * Get report tasks through the eBay Marketing API.
1046
+ *
1047
+ * @param input - Path, query, header, and request body values for getReportTasks.
1048
+ * @returns An Effect that succeeds with eBay's generated getReportTasks response DTO.
1049
+ *
1050
+ * @example
1051
+ * ```ts
1052
+ * const response = await Effect.runPromise(marketingApi.getReportTasks());
1053
+ * ```
1054
+ *
1055
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/getReportTasks
1056
+ */
1057
+ getReportTasks = (input = {}) => {
1058
+ const path = `${MARKETING_BASE_PATH}/ad_report_task`;
1059
+ const params = buildEndpointParams({
1060
+ limit: { wireName: 'limit', value: input.limit },
1061
+ offset: { wireName: 'offset', value: input.offset },
1062
+ reportTaskStatuses: { wireName: 'report_task_statuses', value: input.reportTaskStatuses },
1063
+ });
1064
+ return requestGetEffect(this.client, path, params);
1065
+ };
1066
+ /**
1067
+ * Create report task through the eBay Marketing API.
1068
+ *
1069
+ * @param input - Path, query, header, and request body values for createReportTask.
1070
+ * @returns An Effect that succeeds with eBay's generated createReportTask response DTO.
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * const response = await Effect.runPromise(marketingApi.createReportTask({ request: { ... } }));
1075
+ * ```
1076
+ *
1077
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/createReportTask
612
1078
  */
613
- async updateKeyword(campaignId, keywordId, body) {
614
- return await withApiError('Failed to update keyword', () => this.client.put(`${this.basePath}/ad_campaign/${campaignId}/keyword/${keywordId}`, body));
615
- }
1079
+ createReportTask = (input) => {
1080
+ const path = `${MARKETING_BASE_PATH}/ad_report_task`;
1081
+ return requestPostEffect(this.client, path, input.request);
1082
+ };
616
1083
  /**
617
- * Bulk create keywords (campaign level)
1084
+ * Get report task through the eBay Marketing API.
1085
+ *
1086
+ * @param input - Path, query, header, and request body values for getReportTask.
1087
+ * @returns An Effect that succeeds with eBay's generated getReportTask response DTO.
1088
+ *
1089
+ * @example
1090
+ * ```ts
1091
+ * const response = await Effect.runPromise(marketingApi.getReportTask({ reportTaskId: 'reportTask-1' }));
1092
+ * ```
1093
+ *
1094
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/getReportTask
618
1095
  */
619
- async bulkCreateKeyword(campaignId, body) {
620
- return await withApiError('Failed to bulk create keyword', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_create_keyword`, body));
621
- }
1096
+ getReportTask = (input) => {
1097
+ const path = `${MARKETING_BASE_PATH}/ad_report_task/${input.reportTaskId}`;
1098
+ return requestGetEffect(this.client, path);
1099
+ };
622
1100
  /**
623
- * Bulk update keywords (campaign level)
1101
+ * Delete report task through the eBay Marketing API.
1102
+ *
1103
+ * @param input - Path, query, header, and request body values for deleteReportTask.
1104
+ * @returns An Effect that succeeds with eBay's generated deleteReportTask response DTO.
1105
+ *
1106
+ * @example
1107
+ * ```ts
1108
+ * const response = await Effect.runPromise(marketingApi.deleteReportTask({ reportTaskId: 'reportTask-1' }));
1109
+ * ```
1110
+ *
1111
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/deleteReportTask
624
1112
  */
625
- async bulkUpdateKeyword(campaignId, body) {
626
- return await withApiError('Failed to bulk update keyword', () => this.client.post(`${this.basePath}/ad_campaign/${campaignId}/bulk_update_keyword`, body));
627
- }
1113
+ deleteReportTask = (input) => {
1114
+ const path = `${MARKETING_BASE_PATH}/ad_report_task/${input.reportTaskId}`;
1115
+ return requestDeleteEffect(this.client, path);
1116
+ };
628
1117
  /**
629
- * Get a report by ID
1118
+ * Create item price markdown promotion through the eBay Marketing API.
1119
+ *
1120
+ * @param input - Path, query, header, and request body values for createItemPriceMarkdownPromotion.
1121
+ * @returns An Effect that succeeds with eBay's generated createItemPriceMarkdownPromotion response DTO.
1122
+ *
1123
+ * @example
1124
+ * ```ts
1125
+ * const response = await Effect.runPromise(marketingApi.createItemPriceMarkdownPromotion({ request: { ... } }));
1126
+ * ```
1127
+ *
1128
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/createItemPriceMarkdownPromotion
630
1129
  */
631
- async getReport(reportId) {
632
- return await withApiError('Failed to get report', () => this.client.get(`${this.basePath}/ad_report/${reportId}`));
633
- }
1130
+ createItemPriceMarkdownPromotion = (input) => {
1131
+ const path = `${MARKETING_BASE_PATH}/item_price_markdown`;
1132
+ return requestPostEffect(this.client, path, input.request);
1133
+ };
634
1134
  /**
635
- * Delete a report task
1135
+ * Get item price markdown promotion through the eBay Marketing API.
1136
+ *
1137
+ * @param input - Path, query, header, and request body values for getItemPriceMarkdownPromotion.
1138
+ * @returns An Effect that succeeds with eBay's generated getItemPriceMarkdownPromotion response DTO.
1139
+ *
1140
+ * @example
1141
+ * ```ts
1142
+ * const response = await Effect.runPromise(marketingApi.getItemPriceMarkdownPromotion({ promotionId: 'promotion-1' }));
1143
+ * ```
1144
+ *
1145
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/getItemPriceMarkdownPromotion
636
1146
  */
637
- async deleteReportTask(reportTaskId) {
638
- return await withApiError('Failed to delete report task', () => this.client.delete(`${this.basePath}/ad_report_task/${reportTaskId}`));
639
- }
1147
+ getItemPriceMarkdownPromotion = (input) => {
1148
+ const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
1149
+ return requestGetEffect(this.client, path);
1150
+ };
640
1151
  /**
641
- * Create an item price markdown promotion
1152
+ * Update item price markdown promotion through the eBay Marketing API.
1153
+ *
1154
+ * @param input - Path, query, header, and request body values for updateItemPriceMarkdownPromotion.
1155
+ * @returns An Effect that succeeds with eBay's generated updateItemPriceMarkdownPromotion response DTO.
1156
+ *
1157
+ * @example
1158
+ * ```ts
1159
+ * const response = await Effect.runPromise(marketingApi.updateItemPriceMarkdownPromotion({ promotionId: 'promotion-1', request: { ... } }));
1160
+ * ```
1161
+ *
1162
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/updateItemPriceMarkdownPromotion
642
1163
  */
643
- async createItemPriceMarkdownPromotion(body) {
644
- return await withApiError('Failed to create item price markdown promotion', () => this.client.post(`${this.basePath}/item_price_markdown`, body));
645
- }
1164
+ updateItemPriceMarkdownPromotion = (input) => {
1165
+ const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
1166
+ return requestPutEffect(this.client, path, input.request);
1167
+ };
646
1168
  /**
647
- * Get an item price markdown promotion
1169
+ * Delete item price markdown promotion through the eBay Marketing API.
1170
+ *
1171
+ * @param input - Path, query, header, and request body values for deleteItemPriceMarkdownPromotion.
1172
+ * @returns An Effect that succeeds with eBay's generated deleteItemPriceMarkdownPromotion response DTO.
1173
+ *
1174
+ * @example
1175
+ * ```ts
1176
+ * const response = await Effect.runPromise(marketingApi.deleteItemPriceMarkdownPromotion({ promotionId: 'promotion-1' }));
1177
+ * ```
1178
+ *
1179
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/deleteItemPriceMarkdownPromotion
648
1180
  */
649
- async getItemPriceMarkdownPromotion(promotionId) {
650
- return await withApiError('Failed to get item price markdown promotion', () => this.client.get(`${this.basePath}/item_price_markdown/${promotionId}`));
651
- }
1181
+ deleteItemPriceMarkdownPromotion = (input) => {
1182
+ const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
1183
+ return requestDeleteEffect(this.client, path);
1184
+ };
652
1185
  /**
653
- * Update an item price markdown promotion
1186
+ * Create item promotion through the eBay Marketing API.
1187
+ *
1188
+ * @param input - Path, query, header, and request body values for createItemPromotion.
1189
+ * @returns An Effect that succeeds with eBay's generated createItemPromotion response DTO.
1190
+ *
1191
+ * @example
1192
+ * ```ts
1193
+ * const response = await Effect.runPromise(marketingApi.createItemPromotion({ request: { ... } }));
1194
+ * ```
1195
+ *
1196
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/createItemPromotion
654
1197
  */
655
- async updateItemPriceMarkdownPromotion(promotionId, body) {
656
- return await withApiError('Failed to update item price markdown promotion', () => this.client.put(`${this.basePath}/item_price_markdown/${promotionId}`, body));
657
- }
1198
+ createItemPromotion = (input) => {
1199
+ const path = `${MARKETING_BASE_PATH}/item_promotion`;
1200
+ return requestPostEffect(this.client, path, input.request);
1201
+ };
658
1202
  /**
659
- * Delete an item price markdown promotion
1203
+ * Get item promotion through the eBay Marketing API.
1204
+ *
1205
+ * @param input - Path, query, header, and request body values for getItemPromotion.
1206
+ * @returns An Effect that succeeds with eBay's generated getItemPromotion response DTO.
1207
+ *
1208
+ * @example
1209
+ * ```ts
1210
+ * const response = await Effect.runPromise(marketingApi.getItemPromotion({ promotionId: 'promotion-1' }));
1211
+ * ```
1212
+ *
1213
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/getItemPromotion
660
1214
  */
661
- async deleteItemPriceMarkdownPromotion(promotionId) {
662
- return await withApiError('Failed to delete item price markdown promotion', () => this.client.delete(`${this.basePath}/item_price_markdown/${promotionId}`));
663
- }
1215
+ getItemPromotion = (input) => {
1216
+ const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
1217
+ return requestGetEffect(this.client, path);
1218
+ };
664
1219
  /**
665
- * Get listing set for a promotion
1220
+ * Update item promotion through the eBay Marketing API.
1221
+ *
1222
+ * @param input - Path, query, header, and request body values for updateItemPromotion.
1223
+ * @returns An Effect that succeeds with eBay's generated updateItemPromotion response DTO.
1224
+ *
1225
+ * @example
1226
+ * ```ts
1227
+ * const response = await Effect.runPromise(marketingApi.updateItemPromotion({ promotionId: 'promotion-1', request: { ... } }));
1228
+ * ```
1229
+ *
1230
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/updateItemPromotion
666
1231
  */
667
- async getListingSet(promotionId) {
668
- return await withApiError('Failed to get listing set', () => this.client.get(`${this.basePath}/promotion/${promotionId}/get_listing_set`));
669
- }
1232
+ updateItemPromotion = (input) => {
1233
+ const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
1234
+ return requestPutEffect(this.client, path, input.request);
1235
+ };
670
1236
  /**
671
- * Pause a promotion
1237
+ * Delete item promotion through the eBay Marketing API.
1238
+ *
1239
+ * @param input - Path, query, header, and request body values for deleteItemPromotion.
1240
+ * @returns An Effect that succeeds with eBay's generated deleteItemPromotion response DTO.
1241
+ *
1242
+ * @example
1243
+ * ```ts
1244
+ * const response = await Effect.runPromise(marketingApi.deleteItemPromotion({ promotionId: 'promotion-1' }));
1245
+ * ```
1246
+ *
1247
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/deleteItemPromotion
672
1248
  */
673
- async pausePromotion(promotionId) {
674
- return await withApiError('Failed to pause promotion', () => this.client.post(`${this.basePath}/promotion/${promotionId}/pause`, {}));
675
- }
1249
+ deleteItemPromotion = (input) => {
1250
+ const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
1251
+ return requestDeleteEffect(this.client, path);
1252
+ };
676
1253
  /**
677
- * Resume a promotion
1254
+ * Get listing set through the eBay Marketing API.
1255
+ *
1256
+ * @param input - Path, query, header, and request body values for getListingSet.
1257
+ * @returns An Effect that succeeds with eBay's generated getListingSet response DTO.
1258
+ *
1259
+ * @example
1260
+ * ```ts
1261
+ * const response = await Effect.runPromise(marketingApi.getListingSet({ promotionId: 'promotion-1' }));
1262
+ * ```
1263
+ *
1264
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/getListingSet
1265
+ */
1266
+ getListingSet = (input) => {
1267
+ const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/get_listing_set`;
1268
+ const params = buildEndpointParams({
1269
+ limit: { wireName: 'limit', value: input.limit },
1270
+ offset: { wireName: 'offset', value: input.offset },
1271
+ q: { wireName: 'q', value: input.q },
1272
+ sort: { wireName: 'sort', value: input.sort },
1273
+ status: { wireName: 'status', value: input.status },
1274
+ });
1275
+ return requestGetEffect(this.client, path, params);
1276
+ };
1277
+ /**
1278
+ * Get promotions through the eBay Marketing API.
1279
+ *
1280
+ * @param input - Path, query, header, and request body values for getPromotions.
1281
+ * @returns An Effect that succeeds with eBay's generated getPromotions response DTO.
1282
+ *
1283
+ * @example
1284
+ * ```ts
1285
+ * const response = await Effect.runPromise(marketingApi.getPromotions({ marketplaceId: 'marketplace-1' }));
1286
+ * ```
1287
+ *
1288
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/getPromotions
1289
+ */
1290
+ getPromotions = (input) => {
1291
+ const path = `${MARKETING_BASE_PATH}/promotion`;
1292
+ const params = buildEndpointParams({
1293
+ limit: { wireName: 'limit', value: input.limit },
1294
+ marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
1295
+ offset: { wireName: 'offset', value: input.offset },
1296
+ promotionStatus: { wireName: 'promotion_status', value: input.promotionStatus },
1297
+ promotionType: { wireName: 'promotion_type', value: input.promotionType },
1298
+ q: { wireName: 'q', value: input.q },
1299
+ sort: { wireName: 'sort', value: input.sort },
1300
+ });
1301
+ return requestGetEffect(this.client, path, params);
1302
+ };
1303
+ /**
1304
+ * Pause promotion through the eBay Marketing API.
1305
+ *
1306
+ * @param input - Path, query, header, and request body values for pausePromotion.
1307
+ * @returns An Effect that succeeds with eBay's generated pausePromotion response DTO.
1308
+ *
1309
+ * @example
1310
+ * ```ts
1311
+ * const response = await Effect.runPromise(marketingApi.pausePromotion({ promotionId: 'promotion-1' }));
1312
+ * ```
1313
+ *
1314
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/pausePromotion
678
1315
  */
679
- async resumePromotion(promotionId) {
680
- return await withApiError('Failed to resume promotion', () => this.client.post(`${this.basePath}/promotion/${promotionId}/resume`, {}));
681
- }
1316
+ pausePromotion = (input) => {
1317
+ const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/pause`;
1318
+ return requestPostEffect(this.client, path);
1319
+ };
682
1320
  /**
683
- * Get email campaigns
1321
+ * Resume promotion through the eBay Marketing API.
1322
+ *
1323
+ * @param input - Path, query, header, and request body values for resumePromotion.
1324
+ * @returns An Effect that succeeds with eBay's generated resumePromotion response DTO.
1325
+ *
1326
+ * @example
1327
+ * ```ts
1328
+ * const response = await Effect.runPromise(marketingApi.resumePromotion({ promotionId: 'promotion-1' }));
1329
+ * ```
1330
+ *
1331
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/resumePromotion
684
1332
  */
685
- async getEmailCampaigns(limit, offset) {
686
- const params = {};
687
- if (limit)
688
- params.limit = limit;
689
- if (offset)
690
- params.offset = offset;
691
- return await withApiError('Failed to get email campaigns', () => this.client.get(`${this.basePath}/email_campaign`, params));
692
- }
1333
+ resumePromotion = (input) => {
1334
+ const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/resume`;
1335
+ return requestPostEffect(this.client, path);
1336
+ };
693
1337
  /**
694
- * Create an email campaign
1338
+ * Get promotion reports through the eBay Marketing API.
1339
+ *
1340
+ * @param input - Path, query, header, and request body values for getPromotionReports.
1341
+ * @returns An Effect that succeeds with eBay's generated getPromotionReports response DTO.
1342
+ *
1343
+ * @example
1344
+ * ```ts
1345
+ * const response = await Effect.runPromise(marketingApi.getPromotionReports({ marketplaceId: 'marketplace-1' }));
1346
+ * ```
1347
+ *
1348
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion_report/methods/getPromotionReports
1349
+ */
1350
+ getPromotionReports = (input) => {
1351
+ const path = `${MARKETING_BASE_PATH}/promotion_report`;
1352
+ const params = buildEndpointParams({
1353
+ limit: { wireName: 'limit', value: input.limit },
1354
+ marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
1355
+ offset: { wireName: 'offset', value: input.offset },
1356
+ promotionStatus: { wireName: 'promotion_status', value: input.promotionStatus },
1357
+ promotionType: { wireName: 'promotion_type', value: input.promotionType },
1358
+ q: { wireName: 'q', value: input.q },
1359
+ });
1360
+ return requestGetEffect(this.client, path, params);
1361
+ };
1362
+ /**
1363
+ * Get promotion summary report through the eBay Marketing API.
1364
+ *
1365
+ * @param input - Path, query, header, and request body values for getPromotionSummaryReport.
1366
+ * @returns An Effect that succeeds with eBay's generated getPromotionSummaryReport response DTO.
1367
+ *
1368
+ * @example
1369
+ * ```ts
1370
+ * const response = await Effect.runPromise(marketingApi.getPromotionSummaryReport({ marketplaceId: 'marketplace-1' }));
1371
+ * ```
1372
+ *
1373
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion_summary_report/methods/getPromotionSummaryReport
695
1374
  */
696
- async createEmailCampaign(body) {
697
- return await withApiError('Failed to create email campaign', () => this.client.post(`${this.basePath}/email_campaign`, body));
698
- }
1375
+ getPromotionSummaryReport = (input) => {
1376
+ const path = `${MARKETING_BASE_PATH}/promotion_summary_report`;
1377
+ const params = buildEndpointParams({
1378
+ marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
1379
+ });
1380
+ return requestGetEffect(this.client, path, params);
1381
+ };
699
1382
  /**
700
- * Get an email campaign
1383
+ * Get email campaigns through the eBay Marketing API.
1384
+ *
1385
+ * @param input - Path, query, header, and request body values for getEmailCampaigns.
1386
+ * @returns An Effect that succeeds with eBay's generated getEmailCampaigns response DTO.
1387
+ *
1388
+ * @example
1389
+ * ```ts
1390
+ * const response = await Effect.runPromise(marketingApi.getEmailCampaigns());
1391
+ * ```
1392
+ *
1393
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailCampaigns
1394
+ */
1395
+ getEmailCampaigns = (input = {}) => {
1396
+ const path = `${MARKETING_BASE_PATH}/email_campaign`;
1397
+ const params = buildEndpointParams({
1398
+ limit: { wireName: 'limit', value: input.limit },
1399
+ offset: { wireName: 'offset', value: input.offset },
1400
+ q: { wireName: 'q', value: input.q },
1401
+ sort: { wireName: 'sort', value: input.sort },
1402
+ });
1403
+ return requestGetEffect(this.client, path, params);
1404
+ };
1405
+ /**
1406
+ * Create email campaign through the eBay Marketing API.
1407
+ *
1408
+ * @param input - Path, query, header, and request body values for createEmailCampaign.
1409
+ * @returns An Effect that succeeds with eBay's generated createEmailCampaign response DTO.
1410
+ *
1411
+ * @example
1412
+ * ```ts
1413
+ * const response = await Effect.runPromise(marketingApi.createEmailCampaign({ marketplaceId: 'EBAY_US', request: { ... } }));
1414
+ * ```
1415
+ *
1416
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/createEmailCampaign
701
1417
  */
702
- async getEmailCampaign(emailCampaignId) {
703
- return await withApiError('Failed to get email campaign', () => this.client.get(`${this.basePath}/email_campaign/${emailCampaignId}`));
704
- }
1418
+ createEmailCampaign = (input) => {
1419
+ const path = `${MARKETING_BASE_PATH}/email_campaign`;
1420
+ const config = marketplaceHeader(input.marketplaceId);
1421
+ return requestPostEffect(this.client, path, input.request, config);
1422
+ };
705
1423
  /**
706
- * Update an email campaign
1424
+ * Get email campaign through the eBay Marketing API.
1425
+ *
1426
+ * @param input - Path, query, header, and request body values for getEmailCampaign.
1427
+ * @returns An Effect that succeeds with eBay's generated getEmailCampaign response DTO.
1428
+ *
1429
+ * @example
1430
+ * ```ts
1431
+ * const response = await Effect.runPromise(marketingApi.getEmailCampaign({ emailCampaignId: 'emailCampaign-1' }));
1432
+ * ```
1433
+ *
1434
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailCampaign
707
1435
  */
708
- async updateEmailCampaign(emailCampaignId, body) {
709
- return await withApiError('Failed to update email campaign', () => this.client.put(`${this.basePath}/email_campaign/${emailCampaignId}`, body));
710
- }
1436
+ getEmailCampaign = (input) => {
1437
+ const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
1438
+ return requestGetEffect(this.client, path);
1439
+ };
711
1440
  /**
712
- * Delete an email campaign
1441
+ * Update email campaign through the eBay Marketing API.
1442
+ *
1443
+ * @param input - Path, query, header, and request body values for updateEmailCampaign.
1444
+ * @returns An Effect that succeeds with eBay's generated updateEmailCampaign response DTO.
1445
+ *
1446
+ * @example
1447
+ * ```ts
1448
+ * const response = await Effect.runPromise(marketingApi.updateEmailCampaign({ emailCampaignId: 'emailCampaign-1', request: { ... } }));
1449
+ * ```
1450
+ *
1451
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/updateEmailCampaign
713
1452
  */
714
- async deleteEmailCampaign(emailCampaignId) {
715
- return await withApiError('Failed to delete email campaign', () => this.client.delete(`${this.basePath}/email_campaign/${emailCampaignId}`));
716
- }
1453
+ updateEmailCampaign = (input) => {
1454
+ const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
1455
+ return requestPutEffect(this.client, path, input.request);
1456
+ };
717
1457
  /**
718
- * Get email campaign audiences
1458
+ * Delete email campaign through the eBay Marketing API.
1459
+ *
1460
+ * @param input - Path, query, header, and request body values for deleteEmailCampaign.
1461
+ * @returns An Effect that succeeds with eBay's generated deleteEmailCampaign response DTO.
1462
+ *
1463
+ * @example
1464
+ * ```ts
1465
+ * const response = await Effect.runPromise(marketingApi.deleteEmailCampaign({ emailCampaignId: 'emailCampaign-1' }));
1466
+ * ```
1467
+ *
1468
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/deleteEmailCampaign
719
1469
  */
720
- async getAudiences() {
721
- return await withApiError('Failed to get audiences', () => this.client.get(`${this.basePath}/email_campaign/audience`));
722
- }
1470
+ deleteEmailCampaign = (input) => {
1471
+ const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
1472
+ return requestDeleteEffect(this.client, path);
1473
+ };
723
1474
  /**
724
- * Get email preview for a campaign
1475
+ * Get audiences through the eBay Marketing API.
1476
+ *
1477
+ * @param input - Path, query, header, and request body values for getAudiences.
1478
+ * @returns An Effect that succeeds with eBay's generated getAudiences response DTO.
1479
+ *
1480
+ * @example
1481
+ * ```ts
1482
+ * const response = await Effect.runPromise(marketingApi.getAudiences({ emailCampaignType: 'emailCampaignType-1' }));
1483
+ * ```
1484
+ *
1485
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getAudiences
1486
+ */
1487
+ getAudiences = (input) => {
1488
+ const path = `${MARKETING_BASE_PATH}/email_campaign/audience`;
1489
+ const params = buildEndpointParams({
1490
+ emailCampaignType: { wireName: 'emailCampaignType', value: input.emailCampaignType },
1491
+ limit: { wireName: 'limit', value: input.limit },
1492
+ offset: { wireName: 'offset', value: input.offset },
1493
+ });
1494
+ return requestGetEffect(this.client, path, params);
1495
+ };
1496
+ /**
1497
+ * Get email preview through the eBay Marketing API.
1498
+ *
1499
+ * @param input - Path, query, header, and request body values for getEmailPreview.
1500
+ * @returns An Effect that succeeds with eBay's generated getEmailPreview response DTO.
1501
+ *
1502
+ * @example
1503
+ * ```ts
1504
+ * const response = await Effect.runPromise(marketingApi.getEmailPreview({ emailCampaignId: 'emailCampaign-1' }));
1505
+ * ```
1506
+ *
1507
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailPreview
725
1508
  */
726
- async getEmailPreview(emailCampaignId) {
727
- return await withApiError('Failed to get email preview', () => this.client.get(`${this.basePath}/email_campaign/${emailCampaignId}/email_preview`));
728
- }
1509
+ getEmailPreview = (input) => {
1510
+ const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}/email_preview`;
1511
+ return requestGetEffect(this.client, path);
1512
+ };
729
1513
  /**
730
- * Get email campaign report
731
- */
732
- async getEmailReport(limit, offset) {
733
- const params = {};
734
- if (limit)
735
- params.limit = limit;
736
- if (offset)
737
- params.offset = offset;
738
- return await withApiError('Failed to get email report', () => this.client.get(`${this.basePath}/email_campaign/report`, params));
739
- }
1514
+ * Get email report through the eBay Marketing API.
1515
+ *
1516
+ * @param input - Path, query, header, and request body values for getEmailReport.
1517
+ * @returns An Effect that succeeds with eBay's generated getEmailReport response DTO.
1518
+ *
1519
+ * @example
1520
+ * ```ts
1521
+ * const response = await Effect.runPromise(marketingApi.getEmailReport({ endDate: 'endDate-1', startDate: 'startDate-1' }));
1522
+ * ```
1523
+ *
1524
+ * @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailReport
1525
+ */
1526
+ getEmailReport = (input) => {
1527
+ const path = `${MARKETING_BASE_PATH}/email_campaign/report`;
1528
+ const params = buildEndpointParams({
1529
+ endDate: { wireName: 'endDate', value: input.endDate },
1530
+ startDate: { wireName: 'startDate', value: input.startDate },
1531
+ });
1532
+ return requestGetEffect(this.client, path, params);
1533
+ };
740
1534
  }