Build Drive search queries (the q parameter of list-files) without
hand-escaping. String values are single-quoted with \\ and '
escaped; terms combine with all-of, any-of and negate. See
https://developers.google.com/workspace/drive/api/guides/ref-search-terms.
::q ::google::drive::query
q ::q/all-of(
::q/in-folder("1AbCfolder"),
::q/any-of(::q/mime-type-is(::google::drive/DOCUMENT_MIME), ::q/mime-type-is("application/pdf")),
::q/modified-after("2026-10-01T00:00:00Z"),
::q/not-trashed()
)
// "'1AbCfolder' in parents and (mimeType = 'application/vnd.google-apps.document'
// or mimeType = 'application/pdf') and modifiedTime > '2026-10-01T00:00:00Z'
// and trashed = false"
Values
BACKSLASH
BACKSLASH: Str "\\"
QUOTE
QUOTE: Str "'"
Functions
all-of
fn (terms: Any): Str
Join terms with and. Empty or null terms are skipped; compound terms (containing and/or) are parenthesised.
any-of
fn (terms: Any): Str
Join terms with or. Empty or null terms are skipped; compound terms are parenthesised, and all-of parenthesises the result when you combine it further.
app-property
fn (key: Str, value: Str): Str
appProperties has { key='k' and value='v' } (private to your OAuth client).
created-after
fn (timestamp: Str): Str
createdTime > '<RFC 3339>'.
full-text-contains
fn (text: Str): Str
fullText contains '...' (name, description, indexable text and content; whole tokens). Wrap the text in double quotes for a phrase.
group
fn (terms: Vec, joiner: Str): Str
has-property
fn (key: Str, value: Str): Str
properties has { key='k' and value='v' } (public custom properties). Use app-property for appProperties.
in-folder
fn (folder-id: Str): Str
'<id>' in parents: direct children of a folder (not descendants).
in-parents
fn (folder-id: Str): Str
Alias of in-folder.
is-folder
fn (): Str
Folders only.
mime-type-is
fn (mime-type: Str): Str
mimeType = '...'.
mime-type-is-not
fn (mime-type: Str): Str
mimeType != '...'.
modified-after
fn (timestamp: Str): Str
modifiedTime > '<RFC 3339>', e.g. "2026-10-01T00:00:00Z" (UTC unless an offset is given).
modified-before
fn (timestamp: Str): Str
modifiedTime < '<RFC 3339>'.
name-contains
fn (text: Str): Str
name contains '...' (Drive matches name prefixes / word starts).
name-is
fn (name: Str): Str
name = '...' (exact name).
negate
fn (term: Str): Str
not (<term>).
not-folder
fn (): Str
Everything except folders.
not-trashed
fn (): Str
trashed = false. Drive includes trashed files unless you ask otherwise.
owned-by
fn (email: Str): Str
'<email>' in owners.
quote
fn (value: Str): Str
Quote a string value for a Drive query: wraps in single quotes, escaping \\ as \\\\ and ' as \\'. quote("Valentine's Day") is 'Valentine\\'s Day'.
shared-with-me
fn (): Str
sharedWithMe = true.
shortcut-to
fn (target-id: Str): Str
shortcutDetails.targetId = '<id>': shortcuts pointing at a file.
starred
fn (): Str
starred = true.
term
fn (field: Str, operator: Str, value: Str): Str
A raw field operator 'value' term with the value quoted, e.g. term("name", "=", "a.txt"). Escape hatch for terms without a helper.
trashed
fn (): Str
trashed = true.