# Content Item Filters Reference Documentation for `WFContentItemFilter` used in Find/Filter actions like FindPhotos, FindFiles, FindReminders, etc. ## Filter Structure Filters are used in actions like `is.workflow.actions.filter.photos` to specify criteria for finding content. ### Basic Filter Template ```xml WFContentItemFilter Value WFActionParameterFilterPrefix 1 WFContentPredicateBoundedDate WFActionParameterFilterTemplates WFSerializationType WFContentPredicateTableTemplate ``` --- ## Operator Reference Operators define the comparison type. These were discovered from Shortcuts internal JavaScript: | Operator | Meaning | Use Case | |----------|---------|----------| | 3 | `>=` | Greater than or equal | | 4 | `is` | Exact match | | 5 | `is not` | Not equal | | 8 | `begins with` | String prefix | | 9 | `ends with` | String suffix | | 99 | `contains` | String contains | | 100 | `has any value` | Not empty | | 101 | `does not have any value` | Is empty | | 999 | `does not contain` | String not contains | | 1000 | `is in the next` | Future date range | | 1001 | `is in the last` | Past date range | | 1002 | `is today` | Date is today | | 1003 | `is between` | Date range | --- ## Unit Reference Units are used with date/time and enumeration filters: ### Date Units (for operators 1000, 1001) | Unit | Meaning | |------|---------| | 4 | years | | 8 | months | | 8192 | weeks | | (TBD) | days | ### Boolean/Enum Unit | Unit | Context | |------|---------| | 4 | Standard unit for boolean and enumeration values | --- ## Filter Templates by Type ### Boolean Filter (e.g., Is a Screenshot) ```xml Operator 4 Property Is a Screenshot Removable Values Bool Unit 4 ``` ### "Is Today" Date Filter The `is today` operator (1002) does NOT require Values: ```xml Operator 1002 Property Date Taken Removable ``` ### "Is in the Last X" Date Filter The `is in the last` operator (1001) requires Number and Unit: ```xml Operator 1001 Property Date Taken Removable Values Number 1 Unit 8192 ``` ### Enumeration Filter (e.g., Media Type) **IMPORTANT**: Media Type only accepts: `Image`, `Video`, `Live Photo` Do NOT use `Screenshot` - use the `Is a Screenshot` boolean filter instead. ```xml Operator 4 Property Media Type Removable Values Unit 4 Enumeration Value Image WFSerializationType WFStringSubstitutableState ``` ### String Filter (e.g., Album name) ```xml Operator 4 Property Album Removable Values String Favorites Unit 4 ``` --- ## FindPhotos Complete Example Find screenshots taken today: ```xml WFWorkflowActionIdentifier is.workflow.actions.filter.photos WFWorkflowActionParameters UUID FIND-PHOTOS-UUID WFContentItemFilter Value WFActionParameterFilterPrefix 1 WFContentPredicateBoundedDate WFActionParameterFilterTemplates Operator 4 Property Is a Screenshot Removable Values Bool Unit 4 Operator 1002 Property Date Taken Removable WFSerializationType WFContentPredicateTableTemplate WFContentItemSortProperty Date Taken WFContentItemSortOrder Latest First ``` --- ## DeletePhotos Action **CRITICAL**: DeletePhotos uses `photos` as the parameter key, NOT `WFInput`: ```xml WFWorkflowActionIdentifier is.workflow.actions.deletephotos WFWorkflowActionParameters UUID DELETE-UUID photos Value OutputName Photos OutputUUID FIND-PHOTOS-UUID Type ActionOutput WFSerializationType WFTextTokenAttachment ``` --- ## Available Filter Properties by Content Type ### Photos (WFPhotoMediaContentItem) | Property | Type | Values | |----------|------|--------| | `Album` | Enumeration | Album names | | `Media Type` | Enumeration | `Image`, `Video`, `Live Photo` | | `Is a Screenshot` | Boolean | true/false | | `Is Hidden` | Boolean | true/false | | `Is Favorite` | Boolean | true/false | | `Date Taken` | Date | Use date operators | | `Creation Date` | Date | Use date operators | | `Width` | Number | Pixels | | `Height` | Number | Pixels | | `Orientation` | Enumeration | `Up`, `Down`, `Left`, `Right` | | `Photo Type` | Enumeration | `HDR`, `Panorama`, etc. | | `Frame Rate` | Number | FPS (for videos) | | `Duration` | Number | Seconds (for videos) | | `Camera Make` | String | Camera manufacturer | | `Camera Model` | String | Camera model | | `File Extension` | String | e.g., `png`, `jpg` | ### Files (WFGenericFileContentItem) | Property | Type | Values | |----------|------|--------| | `Name` | String | Filename | | `File Extension` | String | Extension without dot | | `Creation Date` | Date | Use date operators | | `File Size` | Number | Bytes | | `Last Modified Date` | Date | Use date operators | ### Reminders (WFReminderContentItem) | Property | Type | Values | |----------|------|--------| | `Title` | String | Reminder title | | `Is Completed` | Boolean | true/false | | `Priority` | Enumeration | `None`, `Low`, `Medium`, `High` | | `Due Date` | Date | Use date operators | | `Creation Date` | Date | Use date operators | | `List` | Enumeration | List names | --- ## Common Mistakes to Avoid 1. **Using `media_type="Screenshot"`** - This is WRONG. Use `Is a Screenshot` boolean filter instead. 2. **Using Operator 4 for "is today"** - WRONG. Use Operator 1002. 3. **Using `WFInput` for DeletePhotos** - WRONG. Use `photos` (lowercase). 4. **Adding Values to "is today" filter** - WRONG. Operator 1002 doesn't need Values. 5. **Forgetting OutputUUID reference** - When passing results between actions, you must reference the source action's UUID.