|
20 | 20 | "DataTargetMonitorsPageTarget", |
21 | 21 | "DataTargetMonitorsSitemapTarget", |
22 | 22 | "DataTargetMonitorsExtractTarget", |
| 23 | + "DataBaseline", |
| 24 | + "DataBaselineMonitorsPageBaseline", |
| 25 | + "DataBaselineMonitorsSitemapBaseline", |
| 26 | + "DataBaselineMonitorsExtractBaseline", |
23 | 27 | "DataLastError", |
24 | 28 | "DataWebhook", |
25 | 29 | ] |
@@ -133,6 +137,54 @@ class DataTargetMonitorsExtractTarget(BaseModel): |
133 | 137 | ] |
134 | 138 |
|
135 | 139 |
|
| 140 | +class DataBaselineMonitorsPageBaseline(BaseModel): |
| 141 | + """Current baseline of a `page` monitor: the visible page text as last observed.""" |
| 142 | + |
| 143 | + captured_at: datetime |
| 144 | + """When this baseline was last captured or replaced.""" |
| 145 | + |
| 146 | + text: str |
| 147 | + """The page's visible text as last observed.""" |
| 148 | + |
| 149 | + |
| 150 | +class DataBaselineMonitorsSitemapBaseline(BaseModel): |
| 151 | + """ |
| 152 | + Current baseline of a `sitemap` monitor: the normalized URL set as last observed. |
| 153 | + """ |
| 154 | + |
| 155 | + captured_at: datetime |
| 156 | + """When this baseline was last captured or replaced.""" |
| 157 | + |
| 158 | + url_count: int |
| 159 | + """Number of URLs in the baseline.""" |
| 160 | + |
| 161 | + urls: List[str] |
| 162 | + """The sitemap URLs as last observed (sorted, normalized).""" |
| 163 | + |
| 164 | + |
| 165 | +class DataBaselineMonitorsExtractBaseline(BaseModel): |
| 166 | + """ |
| 167 | + Current baseline of an `extract` monitor: the structured data as last extracted. |
| 168 | + """ |
| 169 | + |
| 170 | + captured_at: datetime |
| 171 | + """When this baseline was last captured or replaced.""" |
| 172 | + |
| 173 | + data: object |
| 174 | + """ |
| 175 | + The extracted structured data, matching the monitor's extraction schema (same |
| 176 | + shape as the /web/extract endpoint's `data`). |
| 177 | + """ |
| 178 | + |
| 179 | + urls_analyzed: List[str] |
| 180 | + """URLs that were analyzed to produce the extracted data.""" |
| 181 | + |
| 182 | + |
| 183 | +DataBaseline: TypeAlias = Union[ |
| 184 | + DataBaselineMonitorsPageBaseline, DataBaselineMonitorsSitemapBaseline, DataBaselineMonitorsExtractBaseline, None |
| 185 | +] |
| 186 | + |
| 187 | + |
136 | 188 | class DataLastError(BaseModel): |
137 | 189 | """Error from the most recent failed run; null when the last run succeeded.""" |
138 | 190 |
|
@@ -198,6 +250,14 @@ class Data(BaseModel): |
198 | 250 |
|
199 | 251 | updated_at: datetime |
200 | 252 |
|
| 253 | + baseline: Optional[DataBaseline] = None |
| 254 | + """ |
| 255 | + Current baseline: the last observed value the monitor compares new snapshots |
| 256 | + against. Its shape follows `target.type` (page/sitemap/extract). Only populated |
| 257 | + on GET /monitors/{monitor_id}; null until the first baseline run completes (and |
| 258 | + after a target or change_detection update, which resets the baseline). |
| 259 | + """ |
| 260 | + |
201 | 261 | last_change_at: Optional[datetime] = None |
202 | 262 |
|
203 | 263 | last_error: Optional[DataLastError] = None |
|
0 commit comments