|
| 1 | +# Expectation |
| 2 | + |
| 3 | +## Example Expectation Object |
| 4 | + |
| 5 | +``` |
| 6 | +{ |
| 7 | + "id": 1, |
| 8 | + "workspace_id": 1, |
| 9 | + "name": "Daily Vendor Feed", |
| 10 | + "description": "Wait for the vendor CSV every morning.", |
| 11 | + "path": "incoming/vendor_a", |
| 12 | + "source": "*.csv", |
| 13 | + "exclude_pattern": "*.tmp", |
| 14 | + "disabled": true, |
| 15 | + "expectations_version": 1, |
| 16 | + "trigger": "manual", |
| 17 | + "interval": "day", |
| 18 | + "recurring_day": 3, |
| 19 | + "schedule_days_of_week": [ |
| 20 | + 1, |
| 21 | + 3, |
| 22 | + 5 |
| 23 | + ], |
| 24 | + "schedule_times_of_day": [ |
| 25 | + "06:00" |
| 26 | + ], |
| 27 | + "schedule_time_zone": "UTC", |
| 28 | + "holiday_region": "us", |
| 29 | + "lookback_interval": 3600, |
| 30 | + "late_acceptance_interval": 900, |
| 31 | + "inactivity_interval": 300, |
| 32 | + "max_open_interval": 43200, |
| 33 | + "criteria": { |
| 34 | + "count": { |
| 35 | + "exact": 1 |
| 36 | + }, |
| 37 | + "extensions": [ |
| 38 | + "csv" |
| 39 | + ] |
| 40 | + }, |
| 41 | + "last_evaluated_at": "2000-01-01T01:00:00Z", |
| 42 | + "last_success_at": "2000-01-01T01:00:00Z", |
| 43 | + "last_failure_at": "2000-01-01T01:00:00Z", |
| 44 | + "last_result": "success", |
| 45 | + "created_at": "2000-01-01T01:00:00Z", |
| 46 | + "updated_at": "2000-01-01T01:00:00Z" |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +* `id` (int64): Expectation ID |
| 51 | +* `workspace_id` (int64): Workspace ID. `0` means the default workspace. |
| 52 | +* `name` (string): Expectation name. |
| 53 | +* `description` (string): Expectation description. |
| 54 | +* `path` (string): Path scope for the expectation. Supports workspace-relative presentation. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. |
| 55 | +* `source` (string): Source glob used to select candidate files. |
| 56 | +* `exclude_pattern` (string): Optional source exclusion glob. |
| 57 | +* `disabled` (boolean): If true, the expectation is disabled. |
| 58 | +* `expectations_version` (int64): Criteria schema version for this expectation. |
| 59 | +* `trigger` (string): How this expectation opens windows. |
| 60 | +* `interval` (string): If trigger is `daily`, this specifies how often to run the expectation. |
| 61 | +* `recurring_day` (int64): If trigger is `daily`, this selects the day number inside the chosen interval. |
| 62 | +* `schedule_days_of_week` (array(int64)): If trigger is `custom_schedule`, the 0-based weekdays used by the schedule. |
| 63 | +* `schedule_times_of_day` (array(string)): Times of day in HH:MM format for schedule-driven expectations. |
| 64 | +* `schedule_time_zone` (string): Time zone used by the expectation schedule. |
| 65 | +* `holiday_region` (string): Optional holiday region used by schedule-driven expectations. |
| 66 | +* `lookback_interval` (int64): How many seconds before the due boundary the window starts. |
| 67 | +* `late_acceptance_interval` (int64): How many seconds a schedule-driven window may remain eligible to close as late. |
| 68 | +* `inactivity_interval` (int64): How many quiet seconds are required before final closure. |
| 69 | +* `max_open_interval` (int64): Hard-stop duration in seconds for unscheduled expectations. |
| 70 | +* `criteria` (object): Structured criteria v1 definition for the expectation. |
| 71 | +* `last_evaluated_at` (date-time): Last time this expectation was evaluated. |
| 72 | +* `last_success_at` (date-time): Last time this expectation closed successfully. |
| 73 | +* `last_failure_at` (date-time): Last time this expectation closed with a failure result. |
| 74 | +* `last_result` (string): Most recent terminal result for this expectation. |
| 75 | +* `created_at` (date-time): Creation time. |
| 76 | +* `updated_at` (date-time): Last update time. |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## List Expectations |
| 81 | + |
| 82 | +``` |
| 83 | +await Expectation.list |
| 84 | +``` |
| 85 | + |
| 86 | + |
| 87 | +### Parameters |
| 88 | + |
| 89 | +* `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. |
| 90 | +* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). |
| 91 | +* `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name` or `disabled`. |
| 92 | +* `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled` and `workspace_id`. Valid field combinations are `[ workspace_id, disabled ]`. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Show Expectation |
| 97 | + |
| 98 | +``` |
| 99 | +await Expectation.find(id) |
| 100 | +``` |
| 101 | + |
| 102 | + |
| 103 | +### Parameters |
| 104 | + |
| 105 | +* `id` (int64): Required - Expectation ID. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## Create Expectation |
| 110 | + |
| 111 | +``` |
| 112 | +await Expectation.create({ |
| 113 | + 'name': "Daily Vendor Feed", |
| 114 | + 'description': "Wait for the vendor CSV every morning.", |
| 115 | + 'path': "incoming/vendor_a", |
| 116 | + 'source': "*.csv", |
| 117 | + 'exclude_pattern': "*.tmp", |
| 118 | + 'disabled': true, |
| 119 | + 'trigger': "manual", |
| 120 | + 'interval': "day", |
| 121 | + 'recurring_day': 3, |
| 122 | + 'schedule_days_of_week': [1,3,5], |
| 123 | + 'schedule_times_of_day': ["06:00"], |
| 124 | + 'schedule_time_zone': "UTC", |
| 125 | + 'holiday_region': "us", |
| 126 | + 'lookback_interval': 3600, |
| 127 | + 'late_acceptance_interval': 900, |
| 128 | + 'inactivity_interval': 300, |
| 129 | + 'max_open_interval': 43200, |
| 130 | + 'criteria': {"count":{"exact":1},"extensions":["csv"]}, |
| 131 | + 'workspace_id': 0, |
| 132 | +}) |
| 133 | +``` |
| 134 | + |
| 135 | + |
| 136 | +### Parameters |
| 137 | + |
| 138 | +* `name` (string): Expectation name. |
| 139 | +* `description` (string): Expectation description. |
| 140 | +* `path` (string): Path scope for the expectation. Supports workspace-relative presentation. |
| 141 | +* `source` (string): Source glob used to select candidate files. |
| 142 | +* `exclude_pattern` (string): Optional source exclusion glob. |
| 143 | +* `disabled` (boolean): If true, the expectation is disabled. |
| 144 | +* `trigger` (string): How this expectation opens windows. |
| 145 | +* `interval` (string): If trigger is `daily`, this specifies how often to run the expectation. |
| 146 | +* `recurring_day` (int64): If trigger is `daily`, this selects the day number inside the chosen interval. |
| 147 | +* `schedule_days_of_week` (array(int64)): If trigger is `custom_schedule`, the 0-based weekdays used by the schedule. |
| 148 | +* `schedule_times_of_day` (array(string)): Times of day in HH:MM format for schedule-driven expectations. |
| 149 | +* `schedule_time_zone` (string): Time zone used by the expectation schedule. |
| 150 | +* `holiday_region` (string): Optional holiday region used by schedule-driven expectations. |
| 151 | +* `lookback_interval` (int64): How many seconds before the due boundary the window starts. |
| 152 | +* `late_acceptance_interval` (int64): How many seconds a schedule-driven window may remain eligible to close as late. |
| 153 | +* `inactivity_interval` (int64): How many quiet seconds are required before final closure. |
| 154 | +* `max_open_interval` (int64): Hard-stop duration in seconds for unscheduled expectations. |
| 155 | +* `criteria` (object): Structured criteria v1 definition for the expectation. |
| 156 | +* `workspace_id` (int64): Workspace ID. `0` means the default workspace. |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +## Manually open an Expectation window |
| 161 | + |
| 162 | +``` |
| 163 | +const expectation = await Expectation.find(id) |
| 164 | +
|
| 165 | +await expectation.trigger() |
| 166 | +``` |
| 167 | + |
| 168 | +### Parameters |
| 169 | + |
| 170 | +* `id` (int64): Required - Expectation ID. |
| 171 | + |
| 172 | +### Example Response |
| 173 | + |
| 174 | +```json |
| 175 | +{ |
| 176 | + "id": 1, |
| 177 | + "workspace_id": 1, |
| 178 | + "expectation_id": 1, |
| 179 | + "status": "open", |
| 180 | + "opened_via": "manual", |
| 181 | + "opened_at": "2000-01-01T01:00:00Z", |
| 182 | + "window_start_at": "2000-01-01T01:00:00Z", |
| 183 | + "window_end_at": "2000-01-01T01:00:00Z", |
| 184 | + "deadline_at": "2000-01-01T01:00:00Z", |
| 185 | + "late_acceptance_cutoff_at": "2000-01-01T01:00:00Z", |
| 186 | + "hard_close_at": "2000-01-01T01:00:00Z", |
| 187 | + "closed_at": "2000-01-01T01:00:00Z", |
| 188 | + "matched_files": [ |
| 189 | + |
| 190 | + ], |
| 191 | + "missing_files": [ |
| 192 | + |
| 193 | + ], |
| 194 | + "criteria_errors": [ |
| 195 | + |
| 196 | + ], |
| 197 | + "summary": null, |
| 198 | + "created_at": "2000-01-01T01:00:00Z", |
| 199 | + "updated_at": "2000-01-01T01:00:00Z" |
| 200 | +} |
| 201 | +``` |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +## Update Expectation |
| 206 | + |
| 207 | +``` |
| 208 | +const expectation = await Expectation.find(id) |
| 209 | +
|
| 210 | +await expectation.update({ |
| 211 | + 'name': "Daily Vendor Feed", |
| 212 | + 'description': "Wait for the vendor CSV every morning.", |
| 213 | + 'path': "incoming/vendor_a", |
| 214 | + 'source': "*.csv", |
| 215 | + 'exclude_pattern': "*.tmp", |
| 216 | + 'disabled': true, |
| 217 | + 'trigger': "manual", |
| 218 | + 'interval': "day", |
| 219 | + 'recurring_day': 3, |
| 220 | + 'schedule_days_of_week': [1,3,5], |
| 221 | + 'schedule_times_of_day': ["06:00"], |
| 222 | + 'schedule_time_zone': "UTC", |
| 223 | + 'holiday_region': "us", |
| 224 | + 'lookback_interval': 3600, |
| 225 | + 'late_acceptance_interval': 900, |
| 226 | + 'inactivity_interval': 300, |
| 227 | + 'max_open_interval': 43200, |
| 228 | + 'criteria': {"count":{"exact":1},"extensions":["csv"]}, |
| 229 | + 'workspace_id': 0, |
| 230 | +}) |
| 231 | +``` |
| 232 | + |
| 233 | +### Parameters |
| 234 | + |
| 235 | +* `id` (int64): Required - Expectation ID. |
| 236 | +* `name` (string): Expectation name. |
| 237 | +* `description` (string): Expectation description. |
| 238 | +* `path` (string): Path scope for the expectation. Supports workspace-relative presentation. |
| 239 | +* `source` (string): Source glob used to select candidate files. |
| 240 | +* `exclude_pattern` (string): Optional source exclusion glob. |
| 241 | +* `disabled` (boolean): If true, the expectation is disabled. |
| 242 | +* `trigger` (string): How this expectation opens windows. |
| 243 | +* `interval` (string): If trigger is `daily`, this specifies how often to run the expectation. |
| 244 | +* `recurring_day` (int64): If trigger is `daily`, this selects the day number inside the chosen interval. |
| 245 | +* `schedule_days_of_week` (array(int64)): If trigger is `custom_schedule`, the 0-based weekdays used by the schedule. |
| 246 | +* `schedule_times_of_day` (array(string)): Times of day in HH:MM format for schedule-driven expectations. |
| 247 | +* `schedule_time_zone` (string): Time zone used by the expectation schedule. |
| 248 | +* `holiday_region` (string): Optional holiday region used by schedule-driven expectations. |
| 249 | +* `lookback_interval` (int64): How many seconds before the due boundary the window starts. |
| 250 | +* `late_acceptance_interval` (int64): How many seconds a schedule-driven window may remain eligible to close as late. |
| 251 | +* `inactivity_interval` (int64): How many quiet seconds are required before final closure. |
| 252 | +* `max_open_interval` (int64): Hard-stop duration in seconds for unscheduled expectations. |
| 253 | +* `criteria` (object): Structured criteria v1 definition for the expectation. |
| 254 | +* `workspace_id` (int64): Workspace ID. `0` means the default workspace. |
| 255 | + |
| 256 | +### Example Response |
| 257 | + |
| 258 | +```json |
| 259 | +{ |
| 260 | + "id": 1, |
| 261 | + "workspace_id": 1, |
| 262 | + "name": "Daily Vendor Feed", |
| 263 | + "description": "Wait for the vendor CSV every morning.", |
| 264 | + "path": "incoming/vendor_a", |
| 265 | + "source": "*.csv", |
| 266 | + "exclude_pattern": "*.tmp", |
| 267 | + "disabled": true, |
| 268 | + "expectations_version": 1, |
| 269 | + "trigger": "manual", |
| 270 | + "interval": "day", |
| 271 | + "recurring_day": 3, |
| 272 | + "schedule_days_of_week": [ |
| 273 | + 1, |
| 274 | + 3, |
| 275 | + 5 |
| 276 | + ], |
| 277 | + "schedule_times_of_day": [ |
| 278 | + "06:00" |
| 279 | + ], |
| 280 | + "schedule_time_zone": "UTC", |
| 281 | + "holiday_region": "us", |
| 282 | + "lookback_interval": 3600, |
| 283 | + "late_acceptance_interval": 900, |
| 284 | + "inactivity_interval": 300, |
| 285 | + "max_open_interval": 43200, |
| 286 | + "criteria": { |
| 287 | + "count": { |
| 288 | + "exact": 1 |
| 289 | + }, |
| 290 | + "extensions": [ |
| 291 | + "csv" |
| 292 | + ] |
| 293 | + }, |
| 294 | + "last_evaluated_at": "2000-01-01T01:00:00Z", |
| 295 | + "last_success_at": "2000-01-01T01:00:00Z", |
| 296 | + "last_failure_at": "2000-01-01T01:00:00Z", |
| 297 | + "last_result": "success", |
| 298 | + "created_at": "2000-01-01T01:00:00Z", |
| 299 | + "updated_at": "2000-01-01T01:00:00Z" |
| 300 | +} |
| 301 | +``` |
| 302 | + |
| 303 | +--- |
| 304 | + |
| 305 | +## Delete Expectation |
| 306 | + |
| 307 | +``` |
| 308 | +const expectation = await Expectation.find(id) |
| 309 | +
|
| 310 | +await expectation.delete() |
| 311 | +``` |
| 312 | + |
| 313 | +### Parameters |
| 314 | + |
| 315 | +* `id` (int64): Required - Expectation ID. |
| 316 | + |
0 commit comments