amazon-ads-mcp 0.2.7__py3-none-any.whl

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 (82) hide show
  1. amazon_ads_mcp/__init__.py +11 -0
  2. amazon_ads_mcp/auth/__init__.py +33 -0
  3. amazon_ads_mcp/auth/base.py +211 -0
  4. amazon_ads_mcp/auth/hooks.py +172 -0
  5. amazon_ads_mcp/auth/manager.py +791 -0
  6. amazon_ads_mcp/auth/oauth_state_store.py +277 -0
  7. amazon_ads_mcp/auth/providers/__init__.py +14 -0
  8. amazon_ads_mcp/auth/providers/direct.py +393 -0
  9. amazon_ads_mcp/auth/providers/example_auth0.py.example +216 -0
  10. amazon_ads_mcp/auth/providers/openbridge.py +512 -0
  11. amazon_ads_mcp/auth/registry.py +146 -0
  12. amazon_ads_mcp/auth/secure_token_store.py +297 -0
  13. amazon_ads_mcp/auth/token_store.py +723 -0
  14. amazon_ads_mcp/config/__init__.py +5 -0
  15. amazon_ads_mcp/config/sampling.py +111 -0
  16. amazon_ads_mcp/config/settings.py +366 -0
  17. amazon_ads_mcp/exceptions.py +314 -0
  18. amazon_ads_mcp/middleware/__init__.py +11 -0
  19. amazon_ads_mcp/middleware/authentication.py +1474 -0
  20. amazon_ads_mcp/middleware/caching.py +177 -0
  21. amazon_ads_mcp/middleware/oauth.py +175 -0
  22. amazon_ads_mcp/middleware/sampling.py +112 -0
  23. amazon_ads_mcp/models/__init__.py +320 -0
  24. amazon_ads_mcp/models/amc_models.py +837 -0
  25. amazon_ads_mcp/models/api_responses.py +847 -0
  26. amazon_ads_mcp/models/base_models.py +215 -0
  27. amazon_ads_mcp/models/builtin_responses.py +496 -0
  28. amazon_ads_mcp/models/dsp_models.py +556 -0
  29. amazon_ads_mcp/models/stores_brands.py +610 -0
  30. amazon_ads_mcp/server/__init__.py +6 -0
  31. amazon_ads_mcp/server/__main__.py +6 -0
  32. amazon_ads_mcp/server/builtin_prompts.py +269 -0
  33. amazon_ads_mcp/server/builtin_tools.py +962 -0
  34. amazon_ads_mcp/server/file_routes.py +547 -0
  35. amazon_ads_mcp/server/html_templates.py +149 -0
  36. amazon_ads_mcp/server/mcp_server.py +327 -0
  37. amazon_ads_mcp/server/openapi_utils.py +158 -0
  38. amazon_ads_mcp/server/sampling_handler.py +251 -0
  39. amazon_ads_mcp/server/server_builder.py +751 -0
  40. amazon_ads_mcp/server/sidecar_loader.py +178 -0
  41. amazon_ads_mcp/server/transform_executor.py +827 -0
  42. amazon_ads_mcp/tools/__init__.py +22 -0
  43. amazon_ads_mcp/tools/cache_management.py +105 -0
  44. amazon_ads_mcp/tools/download_tools.py +267 -0
  45. amazon_ads_mcp/tools/identity.py +236 -0
  46. amazon_ads_mcp/tools/oauth.py +598 -0
  47. amazon_ads_mcp/tools/profile.py +150 -0
  48. amazon_ads_mcp/tools/profile_listing.py +285 -0
  49. amazon_ads_mcp/tools/region.py +320 -0
  50. amazon_ads_mcp/tools/region_identity.py +175 -0
  51. amazon_ads_mcp/utils/__init__.py +6 -0
  52. amazon_ads_mcp/utils/async_compat.py +215 -0
  53. amazon_ads_mcp/utils/errors.py +452 -0
  54. amazon_ads_mcp/utils/export_content_type_resolver.py +249 -0
  55. amazon_ads_mcp/utils/export_download_handler.py +579 -0
  56. amazon_ads_mcp/utils/header_resolver.py +81 -0
  57. amazon_ads_mcp/utils/http/__init__.py +56 -0
  58. amazon_ads_mcp/utils/http/circuit_breaker.py +127 -0
  59. amazon_ads_mcp/utils/http/client_manager.py +329 -0
  60. amazon_ads_mcp/utils/http/request.py +207 -0
  61. amazon_ads_mcp/utils/http/resilience.py +512 -0
  62. amazon_ads_mcp/utils/http/resilient_client.py +195 -0
  63. amazon_ads_mcp/utils/http/retry.py +76 -0
  64. amazon_ads_mcp/utils/http_client.py +873 -0
  65. amazon_ads_mcp/utils/media/__init__.py +21 -0
  66. amazon_ads_mcp/utils/media/negotiator.py +243 -0
  67. amazon_ads_mcp/utils/media/types.py +199 -0
  68. amazon_ads_mcp/utils/openapi/__init__.py +16 -0
  69. amazon_ads_mcp/utils/openapi/json.py +55 -0
  70. amazon_ads_mcp/utils/openapi/loader.py +263 -0
  71. amazon_ads_mcp/utils/openapi/refs.py +46 -0
  72. amazon_ads_mcp/utils/region_config.py +200 -0
  73. amazon_ads_mcp/utils/response_wrapper.py +171 -0
  74. amazon_ads_mcp/utils/sampling_helpers.py +156 -0
  75. amazon_ads_mcp/utils/sampling_wrapper.py +173 -0
  76. amazon_ads_mcp/utils/security.py +630 -0
  77. amazon_ads_mcp/utils/tool_naming.py +137 -0
  78. amazon_ads_mcp-0.2.7.dist-info/METADATA +664 -0
  79. amazon_ads_mcp-0.2.7.dist-info/RECORD +82 -0
  80. amazon_ads_mcp-0.2.7.dist-info/WHEEL +4 -0
  81. amazon_ads_mcp-0.2.7.dist-info/entry_points.txt +3 -0
  82. amazon_ads_mcp-0.2.7.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,556 @@
1
+ """Pydantic models for Amazon DSP (Demand-Side Platform) API responses.
2
+
3
+ This module provides comprehensive type definitions for Amazon DSP API responses,
4
+ including programmatic advertising, audiences, and creative management.
5
+
6
+ The models cover all major DSP functionality including:
7
+ - Order (campaign) management
8
+ - Line item management
9
+ - Creative asset management
10
+ - Audience targeting and management
11
+ - Conversion tracking with pixels
12
+ - Reporting and analytics
13
+ - Performance metrics
14
+ """
15
+
16
+ from datetime import datetime
17
+ from decimal import Decimal
18
+ from enum import Enum
19
+ from typing import Any, Dict, List, Optional
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field
22
+
23
+
24
+ class DSPEntityState(str, Enum):
25
+ """DSP entity states.
26
+
27
+ Defines the possible states for DSP entities like
28
+ orders, line items, creatives, and audiences.
29
+ """
30
+
31
+ ACTIVE = "ACTIVE"
32
+ PAUSED = "PAUSED"
33
+ ARCHIVED = "ARCHIVED"
34
+ DRAFT = "DRAFT"
35
+
36
+
37
+ class CreativeType(str, Enum):
38
+ """Creative types.
39
+
40
+ Defines the different types of creative assets
41
+ that can be used in DSP campaigns.
42
+ """
43
+
44
+ DISPLAY = "DISPLAY"
45
+ VIDEO = "VIDEO"
46
+ AUDIO = "AUDIO"
47
+ NATIVE = "NATIVE"
48
+ CUSTOM = "CUSTOM"
49
+
50
+
51
+ class AudienceType(str, Enum):
52
+ """Audience types.
53
+
54
+ Defines the different types of audiences available
55
+ for targeting in DSP campaigns.
56
+ """
57
+
58
+ REMARKETING = "REMARKETING"
59
+ LOOKALIKE = "LOOKALIKE"
60
+ CUSTOM = "CUSTOM"
61
+ CONTEXTUAL = "CONTEXTUAL"
62
+ DEMOGRAPHIC = "DEMOGRAPHIC"
63
+ IN_MARKET = "IN_MARKET"
64
+
65
+
66
+ class OrderGoalType(str, Enum):
67
+ """Order goal types.
68
+
69
+ Defines the different campaign objectives available
70
+ for DSP orders.
71
+ """
72
+
73
+ AWARENESS = "AWARENESS"
74
+ CONSIDERATION = "CONSIDERATION"
75
+ PERFORMANCE = "PERFORMANCE"
76
+ REACH = "REACH"
77
+
78
+
79
+ # Base DSP Model
80
+ class BaseDSPModel(BaseModel):
81
+ """Base model for DSP entities.
82
+
83
+ Provides common configuration for all DSP models including
84
+ extra field handling, alias population, and string processing.
85
+ """
86
+
87
+ model_config = ConfigDict(
88
+ extra="allow",
89
+ populate_by_name=True,
90
+ str_strip_whitespace=True,
91
+ )
92
+
93
+
94
+ # Order Models
95
+ class DSPOrder(BaseDSPModel):
96
+ """DSP order (campaign) model.
97
+
98
+ Represents a DSP advertising order with budget,
99
+ targeting, and performance settings.
100
+
101
+ :param orderId: Unique identifier for the order
102
+ :type orderId: str
103
+ :param orderName: Human-readable name for the order
104
+ :type orderName: str
105
+ :param advertiserId: Associated advertiser identifier
106
+ :type advertiserId: str
107
+ :param state: Current state of the order
108
+ :type state: DSPEntityState
109
+ :param orderGoalType: Campaign objective for the order
110
+ :type orderGoalType: OrderGoalType
111
+ :param budget: Total budget for the order
112
+ :type budget: Decimal
113
+ :param startDateTime: When the order starts
114
+ :type startDateTime: datetime
115
+ :param endDateTime: When the order ends (optional)
116
+ :type endDateTime: Optional[datetime]
117
+ :param currency: Currency code for budget amounts
118
+ :type currency: str
119
+ :param createdAt: When the order was created
120
+ :type createdAt: datetime
121
+ :param lastUpdatedAt: When the order was last updated
122
+ :type lastUpdatedAt: datetime
123
+ """
124
+
125
+ orderId: str = Field(..., description="Order ID")
126
+ orderName: str = Field(..., description="Order name")
127
+ advertiserId: str = Field(..., description="Advertiser ID")
128
+ state: DSPEntityState = Field(..., description="Order state")
129
+ orderGoalType: OrderGoalType = Field(..., description="Order goal type")
130
+ budget: Decimal = Field(..., description="Total budget")
131
+ startDateTime: datetime = Field(..., description="Start date and time")
132
+ endDateTime: Optional[datetime] = Field(None, description="End date and time")
133
+ currency: str = Field(..., description="Currency code")
134
+ createdAt: datetime = Field(..., description="Creation timestamp")
135
+ lastUpdatedAt: datetime = Field(..., description="Last update timestamp")
136
+
137
+
138
+ class DSPOrderListResponse(BaseDSPModel):
139
+ """Response for DSP order list operations.
140
+
141
+ Contains a list of DSP orders with pagination support.
142
+
143
+ :param orders: List of DSP orders
144
+ :type orders: List[DSPOrder]
145
+ :param nextToken: Token for retrieving the next page of results
146
+ :type nextToken: Optional[str]
147
+ :param totalResults: Total number of orders available
148
+ :type totalResults: Optional[int]
149
+ """
150
+
151
+ orders: List[DSPOrder] = Field(default_factory=list)
152
+ nextToken: Optional[str] = Field(None)
153
+ totalResults: Optional[int] = Field(None)
154
+
155
+
156
+ # Line Item Models
157
+ class DSPLineItem(BaseDSPModel):
158
+ """DSP line item model.
159
+
160
+ Represents a line item within a DSP order with
161
+ targeting, budget, and bid settings.
162
+
163
+ :param lineItemId: Unique identifier for the line item
164
+ :type lineItemId: str
165
+ :param lineItemName: Human-readable name for the line item
166
+ :type lineItemName: str
167
+ :param orderId: Parent order identifier
168
+ :type orderId: str
169
+ :param state: Current state of the line item
170
+ :type state: DSPEntityState
171
+ :param budget: Budget allocated to the line item
172
+ :type budget: Decimal
173
+ :param bidPrice: Bid price for the line item
174
+ :type bidPrice: Decimal
175
+ :param startDateTime: When the line item starts
176
+ :type startDateTime: datetime
177
+ :param endDateTime: When the line item ends (optional)
178
+ :type endDateTime: Optional[datetime]
179
+ :param frequencyCap: Frequency cap settings for the line item
180
+ :type frequencyCap: Optional[Dict[str, Any]]
181
+ :param targetingClauses: Targeting rules for the line item
182
+ :type targetingClauses: List[Dict[str, Any]]
183
+ :param createdAt: When the line item was created
184
+ :type createdAt: datetime
185
+ :param lastUpdatedAt: When the line item was last updated
186
+ :type lastUpdatedAt: datetime
187
+ """
188
+
189
+ lineItemId: str = Field(..., description="Line item ID")
190
+ lineItemName: str = Field(..., description="Line item name")
191
+ orderId: str = Field(..., description="Parent order ID")
192
+ state: DSPEntityState = Field(..., description="Line item state")
193
+ budget: Decimal = Field(..., description="Line item budget")
194
+ bidPrice: Decimal = Field(..., description="Bid price")
195
+ startDateTime: datetime = Field(..., description="Start date and time")
196
+ endDateTime: Optional[datetime] = Field(None, description="End date and time")
197
+ frequencyCap: Optional[Dict[str, Any]] = Field(
198
+ None, description="Frequency cap settings"
199
+ )
200
+ targetingClauses: List[Dict[str, Any]] = Field(
201
+ default_factory=list, description="Targeting clauses"
202
+ )
203
+ createdAt: datetime = Field(..., description="Creation timestamp")
204
+ lastUpdatedAt: datetime = Field(..., description="Last update timestamp")
205
+
206
+
207
+ class DSPLineItemListResponse(BaseDSPModel):
208
+ """Response for DSP line item list operations.
209
+
210
+ Contains a list of DSP line items with pagination support.
211
+
212
+ :param lineItems: List of DSP line items
213
+ :type lineItems: List[DSPLineItem]
214
+ :param nextToken: Token for retrieving the next page of results
215
+ :type nextToken: Optional[str]
216
+ :param totalResults: Total number of line items available
217
+ :type totalResults: Optional[int]
218
+ """
219
+
220
+ lineItems: List[DSPLineItem] = Field(default_factory=list)
221
+ nextToken: Optional[str] = Field(None)
222
+ totalResults: Optional[int] = Field(None)
223
+
224
+
225
+ # Creative Models
226
+ class DSPCreative(BaseDSPModel):
227
+ """DSP creative model.
228
+
229
+ Represents a creative asset that can be used in
230
+ DSP advertising campaigns.
231
+
232
+ :param creativeId: Unique identifier for the creative
233
+ :type creativeId: str
234
+ :param creativeName: Human-readable name for the creative
235
+ :type creativeName: str
236
+ :param advertiserId: Associated advertiser identifier
237
+ :type advertiserId: str
238
+ :param creativeType: Type of creative asset
239
+ :type creativeType: CreativeType
240
+ :param state: Current state of the creative
241
+ :type state: DSPEntityState
242
+ :param dimensions: Creative dimensions (width x height)
243
+ :type dimensions: Dict[str, int]
244
+ :param fileSize: Size of the creative file in bytes
245
+ :type fileSize: Optional[int]
246
+ :param duration: Duration in seconds (for video/audio creatives)
247
+ :type duration: Optional[int]
248
+ :param clickThroughUrl: Click-through URL for the creative
249
+ :type clickThroughUrl: Optional[str]
250
+ :param createdAt: When the creative was created
251
+ :type createdAt: datetime
252
+ :param lastUpdatedAt: When the creative was last updated
253
+ :type lastUpdatedAt: datetime
254
+ """
255
+
256
+ creativeId: str = Field(..., description="Creative ID")
257
+ creativeName: str = Field(..., description="Creative name")
258
+ advertiserId: str = Field(..., description="Advertiser ID")
259
+ creativeType: CreativeType = Field(..., description="Creative type")
260
+ state: DSPEntityState = Field(..., description="Creative state")
261
+ dimensions: Dict[str, int] = Field(..., description="Creative dimensions")
262
+ fileSize: Optional[int] = Field(None, description="File size in bytes")
263
+ duration: Optional[int] = Field(
264
+ None, description="Duration in seconds (for video/audio)"
265
+ )
266
+ clickThroughUrl: Optional[str] = Field(None, description="Click-through URL")
267
+ createdAt: datetime = Field(..., description="Creation timestamp")
268
+ lastUpdatedAt: datetime = Field(..., description="Last update timestamp")
269
+
270
+
271
+ class DSPCreativeListResponse(BaseDSPModel):
272
+ """Response for DSP creative list operations.
273
+
274
+ Contains a list of DSP creatives with pagination support.
275
+
276
+ :param creatives: List of DSP creatives
277
+ :type creatives: List[DSPCreative]
278
+ :param nextToken: Token for retrieving the next page of results
279
+ :type nextToken: Optional[str]
280
+ :param totalResults: Total number of creatives available
281
+ :type totalResults: Optional[int]
282
+ """
283
+
284
+ creatives: List[DSPCreative] = Field(default_factory=list)
285
+ nextToken: Optional[str] = Field(None)
286
+ totalResults: Optional[int] = Field(None)
287
+
288
+
289
+ # Audience Models
290
+ class DSPAudience(BaseDSPModel):
291
+ """DSP audience model.
292
+
293
+ Represents a targetable audience for DSP campaigns
294
+ with targeting rules and size estimates.
295
+
296
+ :param audienceId: Unique identifier for the audience
297
+ :type audienceId: str
298
+ :param audienceName: Human-readable name for the audience
299
+ :type audienceName: str
300
+ :param advertiserId: Associated advertiser identifier
301
+ :type advertiserId: str
302
+ :param audienceType: Type of audience targeting
303
+ :type audienceType: AudienceType
304
+ :param state: Current state of the audience
305
+ :type state: DSPEntityState
306
+ :param audienceSize: Estimated number of users in the audience
307
+ :type audienceSize: Optional[int]
308
+ :param description: Optional description of the audience
309
+ :type description: Optional[str]
310
+ :param rules: Targeting rules that define the audience
311
+ :type rules: List[Dict[str, Any]]
312
+ :param createdAt: When the audience was created
313
+ :type createdAt: datetime
314
+ :param lastUpdatedAt: When the audience was last updated
315
+ :type lastUpdatedAt: datetime
316
+ """
317
+
318
+ audienceId: str = Field(..., description="Audience ID")
319
+ audienceName: str = Field(..., description="Audience name")
320
+ advertiserId: str = Field(..., description="Advertiser ID")
321
+ audienceType: AudienceType = Field(..., description="Audience type")
322
+ state: DSPEntityState = Field(..., description="Audience state")
323
+ audienceSize: Optional[int] = Field(None, description="Estimated audience size")
324
+ description: Optional[str] = Field(None, description="Audience description")
325
+ rules: List[Dict[str, Any]] = Field(
326
+ default_factory=list, description="Audience rules"
327
+ )
328
+ createdAt: datetime = Field(..., description="Creation timestamp")
329
+ lastUpdatedAt: datetime = Field(..., description="Last update timestamp")
330
+
331
+
332
+ class DSPAudienceListResponse(BaseDSPModel):
333
+ """Response for DSP audience list operations.
334
+
335
+ Contains a list of DSP audiences with pagination support.
336
+
337
+ :param audiences: List of DSP audiences
338
+ :type audiences: List[DSPAudience]
339
+ :param nextToken: Token for retrieving the next page of results
340
+ :type nextToken: Optional[str]
341
+ :param totalResults: Total number of audiences available
342
+ :type totalResults: Optional[int]
343
+ """
344
+
345
+ audiences: List[DSPAudience] = Field(default_factory=list)
346
+ nextToken: Optional[str] = Field(None)
347
+ totalResults: Optional[int] = Field(None)
348
+
349
+
350
+ # Pixel Models
351
+ class DSPPixel(BaseDSPModel):
352
+ """DSP pixel model for conversion tracking.
353
+
354
+ Represents a tracking pixel that can be placed on
355
+ websites to track conversions and user behavior.
356
+
357
+ :param pixelId: Unique identifier for the pixel
358
+ :type pixelId: str
359
+ :param pixelName: Human-readable name for the pixel
360
+ :type pixelName: str
361
+ :param advertiserId: Associated advertiser identifier
362
+ :type advertiserId: str
363
+ :param pixelType: Type of tracking pixel
364
+ :type pixelType: str
365
+ :param state: Current state of the pixel
366
+ :type state: DSPEntityState
367
+ :param pixelCode: HTML/JavaScript code for the pixel
368
+ :type pixelCode: str
369
+ :param conversionEvents: Events that the pixel tracks
370
+ :type conversionEvents: List[Dict[str, Any]]
371
+ :param createdAt: When the pixel was created
372
+ :type createdAt: datetime
373
+ :param lastUpdatedAt: When the pixel was last updated
374
+ :type lastUpdatedAt: datetime
375
+ """
376
+
377
+ pixelId: str = Field(..., description="Pixel ID")
378
+ pixelName: str = Field(..., description="Pixel name")
379
+ advertiserId: str = Field(..., description="Advertiser ID")
380
+ pixelType: str = Field(..., description="Pixel type")
381
+ state: DSPEntityState = Field(..., description="Pixel state")
382
+ pixelCode: str = Field(..., description="Pixel implementation code")
383
+ conversionEvents: List[Dict[str, Any]] = Field(
384
+ default_factory=list, description="Conversion events"
385
+ )
386
+ createdAt: datetime = Field(..., description="Creation timestamp")
387
+ lastUpdatedAt: datetime = Field(..., description="Last update timestamp")
388
+
389
+
390
+ # Report Models
391
+ class DSPReportRequest(BaseDSPModel):
392
+ """Request to generate a DSP report.
393
+
394
+ Contains all parameters needed to request
395
+ a report from the Amazon DSP API.
396
+
397
+ :param reportType: Type of DSP report to generate
398
+ :type reportType: str
399
+ :param startDate: Start date for the report data
400
+ :type startDate: datetime
401
+ :param endDate: End date for the report data
402
+ :type endDate: datetime
403
+ :param dimensions: Data dimensions to include in the report
404
+ :type dimensions: List[str]
405
+ :param metrics: Performance metrics to include in the report
406
+ :type metrics: List[str]
407
+ :param filters: Optional filters for the report data
408
+ :type filters: Optional[Dict[str, Any]]
409
+ :param granularity: Time granularity for the report (default: "DAILY")
410
+ :type granularity: Optional[str]
411
+ """
412
+
413
+ reportType: str = Field(..., description="Type of DSP report")
414
+ startDate: datetime = Field(..., description="Report start date")
415
+ endDate: datetime = Field(..., description="Report end date")
416
+ dimensions: List[str] = Field(..., description="Report dimensions")
417
+ metrics: List[str] = Field(..., description="Report metrics")
418
+ filters: Optional[Dict[str, Any]] = Field(None, description="Report filters")
419
+ granularity: Optional[str] = Field("DAILY", description="Report granularity")
420
+
421
+
422
+ class DSPReportResponse(BaseDSPModel):
423
+ """Response for DSP report generation.
424
+
425
+ Contains information about a requested DSP report
426
+ including status and download location.
427
+
428
+ :param reportId: Unique identifier for the report
429
+ :type reportId: str
430
+ :param reportType: Type of report requested
431
+ :type reportType: str
432
+ :param status: Current status of report generation
433
+ :type status: str
434
+ :param downloadUrl: URL for downloading the completed report
435
+ :type downloadUrl: Optional[str]
436
+ :param expiresAt: When the download URL expires
437
+ :type expiresAt: Optional[datetime]
438
+ :param createdAt: When the report was requested
439
+ :type createdAt: datetime
440
+ """
441
+
442
+ reportId: str = Field(..., description="Report ID")
443
+ reportType: str = Field(..., description="Report type")
444
+ status: str = Field(..., description="Report status")
445
+ downloadUrl: Optional[str] = Field(None, description="Report download URL")
446
+ expiresAt: Optional[datetime] = Field(None, description="URL expiration time")
447
+ createdAt: datetime = Field(..., description="Creation timestamp")
448
+
449
+
450
+ # Metrics Models
451
+ class DSPMetrics(BaseDSPModel):
452
+ """DSP performance metrics.
453
+
454
+ Contains comprehensive performance data for
455
+ DSP advertising campaigns and line items.
456
+
457
+ :param impressions: Number of ad impressions
458
+ :type impressions: int
459
+ :param clicks: Number of ad clicks
460
+ :type clicks: int
461
+ :param conversions: Number of conversions
462
+ :type conversions: int
463
+ :param spend: Total advertising spend
464
+ :type spend: Decimal
465
+ :param ctr: Click-through rate
466
+ :type ctr: Decimal
467
+ :param cvr: Conversion rate
468
+ :type cvr: Decimal
469
+ :param cpc: Cost per click
470
+ :type cpc: Decimal
471
+ :param cpm: Cost per mille (thousand impressions)
472
+ :type cpm: Decimal
473
+ :param cpa: Cost per acquisition
474
+ :type cpa: Decimal
475
+ :param viewability: Viewability rate percentage
476
+ :type viewability: Optional[Decimal]
477
+ :param videoCompletionRate: Video completion rate percentage
478
+ :type videoCompletionRate: Optional[Decimal]
479
+ """
480
+
481
+ impressions: int = Field(..., description="Number of impressions")
482
+ clicks: int = Field(..., description="Number of clicks")
483
+ conversions: int = Field(..., description="Number of conversions")
484
+ spend: Decimal = Field(..., description="Total spend")
485
+ ctr: Decimal = Field(..., description="Click-through rate")
486
+ cvr: Decimal = Field(..., description="Conversion rate")
487
+ cpc: Decimal = Field(..., description="Cost per click")
488
+ cpm: Decimal = Field(..., description="Cost per mille")
489
+ cpa: Decimal = Field(..., description="Cost per acquisition")
490
+ viewability: Optional[Decimal] = Field(None, description="Viewability rate")
491
+ videoCompletionRate: Optional[Decimal] = Field(
492
+ None, description="Video completion rate"
493
+ )
494
+
495
+
496
+ class DSPOrderMetrics(DSPMetrics):
497
+ """DSP order-level metrics.
498
+
499
+ Contains performance metrics for a specific
500
+ DSP order (campaign).
501
+
502
+ :param orderId: Order identifier
503
+ :type orderId: str
504
+ :param date: Date for the metrics data
505
+ :type date: datetime
506
+ """
507
+
508
+ orderId: str = Field(..., description="Order ID")
509
+ date: datetime = Field(..., description="Metrics date")
510
+
511
+
512
+ class DSPLineItemMetrics(DSPMetrics):
513
+ """DSP line item-level metrics.
514
+
515
+ Contains performance metrics for a specific
516
+ DSP line item.
517
+
518
+ :param lineItemId: Line item identifier
519
+ :type lineItemId: str
520
+ :param date: Date for the metrics data
521
+ :type date: datetime
522
+ """
523
+
524
+ lineItemId: str = Field(..., description="Line item ID")
525
+ date: datetime = Field(..., description="Metrics date")
526
+
527
+
528
+ # Export all models
529
+ __all__ = [
530
+ # Enums
531
+ "DSPEntityState",
532
+ "CreativeType",
533
+ "AudienceType",
534
+ "OrderGoalType",
535
+ # Order models
536
+ "DSPOrder",
537
+ "DSPOrderListResponse",
538
+ # Line item models
539
+ "DSPLineItem",
540
+ "DSPLineItemListResponse",
541
+ # Creative models
542
+ "DSPCreative",
543
+ "DSPCreativeListResponse",
544
+ # Audience models
545
+ "DSPAudience",
546
+ "DSPAudienceListResponse",
547
+ # Pixel models
548
+ "DSPPixel",
549
+ # Report models
550
+ "DSPReportRequest",
551
+ "DSPReportResponse",
552
+ # Metrics models
553
+ "DSPMetrics",
554
+ "DSPOrderMetrics",
555
+ "DSPLineItemMetrics",
556
+ ]