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 使用者的郵件篩選器。