REST Resource: users.settings.filters

資源:篩選器

Gmail 篩選器的資源定義。篩選器可以套用至特定郵件,而非整個電子郵件會話串。

JSON 表示法
{
  "id": string,
  "criteria": {
    object (Criteria)
  },
  "action": {
    object (Action)
  }
}
欄位
id

string

篩選器的指派給伺服器 ID。

criteria

object (Criteria)

篩選器的符合條件。

action

object (Action)

篩選器執行的動作。

條件

訊息比對條件。

JSON 表示法
{
  "from": string,
  "to": string,
  "subject": string,
  "query": string,
  "negatedQuery": string,
  "hasAttachment": boolean,
  "excludeChats": boolean,
  "size": integer,
  "sizeComparison": enum (SizeComparison)
}
欄位
from

string

寄件者的顯示名稱或電子郵件地址。

to

string

收件者的顯示名稱或電子郵件地址。包括標頭欄位中的「收件者」、「副本」和「密件副本」欄位的收件者。您可以使用電子郵件地址的本機部分。舉例來說,「example」和「example@」的比對結果都會與「example@gmail.com」相符。這個欄位不區分大小寫。

subject

string

在郵件主旨中找到不區分大小寫的詞組。結尾和開頭的空白字元會省略,相鄰的空格則會收合。

query

string

只傳回符合指定查詢的訊息。支援與 Gmail 搜尋框相同的查詢格式。例如 "from:someuser@example.com rfc822msgid:<somemsgid@example.com> is:unread"

negatedQuery

string

只傳回與指定查詢不符的訊息。支援與 Gmail 搜尋框相同的查詢格式。例如 "from:someuser@example.com rfc822msgid:<somemsgid@example.com> is:unread"

hasAttachment

boolean

郵件是否有附件。

excludeChats

boolean

回應是否應排除即時通訊。

size

integer

整個 RFC822 郵件的大小 (以位元組為單位),包括所有標頭和附件。

sizeComparison

enum (SizeComparison)

訊息大小 (以位元組為單位) 相對於大小欄位。

SizeComparison

決定大小欄位與訊息大小的比較方式。

列舉
unspecified
smaller 尋找小於指定大小的郵件。
larger 尋找大於指定大小的郵件。

動作

要對郵件執行的一組動作。

JSON 表示法
{
  "addLabelIds": [
    string
  ],
  "removeLabelIds": [
    string
  ],
  "forward": string
}
欄位
addLabelIds[]

string

要加入郵件的標籤清單。

removeLabelIds[]

string

要從郵件中移除的標籤清單。

forward

string

郵件的轉寄目標電子郵件地址。

方法

create

建立篩選器。

delete

立即永久刪除指定的篩選器。

get

取得篩選器。

list

列出 Gmail 使用者的郵件篩選器。