दस्तावेज़ पर जाएँ
Ruby

client.suppressions

इस नेमस्पेस का हर मेथड: उसका सिग्नेचर, उसके पैरामीटर, वह क्या लौटाता है और एक उदाहरण।

मेथड

The addresses this workspace will not send to: hard bounces, complaints and the ones you block by hand.

suppressions.list

List one page of the suppression list

स्कोपsettings:readनतीजों को पेज दर पेज लाता है
सिग्नेचर
list(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil) -> OpenEmail::Page

Returns one page of the addresses this workspace will not send to, newest first: every address that bounced hard, complained, or was added by hand. list_all collects every page and iterate walks them lazily.

A send to a suppressed address is refused for that recipient before anything leaves, and a message whose recipients are all suppressed fails outright. The list belongs to the whole workspace, so a key limited to some addresses reads all of it, and a row names the recipient, never which of your addresses sent to it.

removable says whether remove will take the address off. A hard bounce is permanent here, because the address could not take mail. A complaint or a manual entry can be removed.

पैरामीटर

qString

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

reasonString

Keeps one kind: bounce, complaint or manual.

limitInteger

Page size, from 1 to 100. The server defaults to 25.

cursorString

The next_cursor of the previous page. Leave it out for the first page.

api_keyString

Overrides the client API key for this call only.

लौटाता है

An OpenEmail::Page of Hashes, with items, has_more? and next_cursor. Each item has id, email, reason, detail, removable and createdAt.

उदाहरण

page = client.suppressions.list(reason: "complaint") p page.items.map { |row| [row[:email], row[:createdAt]] }

टिप्पणियाँ

  • Needs settings:read, the scope the Blocked addresses screen in Settings is gated on.

  • The cursor is opaque and holds where the last row sat, so an address removed between pages never breaks the walk. A cursor this list did not hand out is a 400 invalid_cursor.

इनमें भी उपलब्ध

API
GET /suppressions
TypeScript
suppressions.list()
Python
suppressions.list()
CLI
openemail suppressions list

suppressions.list_all

Collect the whole suppression list into one array

स्कोपsettings:readनतीजों को पेज दर पेज लाता है
सिग्नेचर
list_all(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil) -> Array<Hash>

Walks every page of list and returns every suppressed address in one Array, newest first. One request per page, with the same filters on each.

पैरामीटर

qString

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

reasonString

Keeps one kind: bounce, complaint or manual.

limitInteger

Page size for each request, from 1 to 100. The server defaults to 25.

cursorString

Starts the walk after this cursor instead of the first page.

api_keyString

Overrides the client API key for every page of this walk.

लौटाता है

An Array of Hashes holding every suppressed address, each with the fields list returns.

उदाहरण

all = client.suppressions.list_all(limit: 100) blocked = all.map { |row| row[:email] }.to_set puts blocked.include?("[email protected]")

टिप्पणियाँ

  • If any page fails, the error is raised and the rows already fetched are discarded.

इनमें भी उपलब्ध

API
GET /suppressions
TypeScript
suppressions.listAll()
Python
suppressions.list_all()

suppressions.iterate

Stream the suppression list one address at a time

स्कोपsettings:readनतीजों को पेज दर पेज लाता है
सिग्नेचर
iterate(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil, &block) -> Enumerator<Hash>

Returns an Enumerator that yields one suppressed address at a time, newest first, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests. Given a block, it yields each row to the block instead.

पैरामीटर

qString

Searches the address, the reason and the detail. Words match loosely, and a close spelling is tried when nothing matches exactly.

reasonString

Keeps one kind: bounce, complaint or manual.

limitInteger

Page size for each request, from 1 to 100. The server defaults to 25.

cursorString

Starts the walk after this cursor instead of the first page.

api_keyString

Overrides the client API key for every page of this walk.

लौटाता है

An Enumerator of Hashes, one suppressed address per step (or yields each one to a block).

उदाहरण

client.suppressions.iterate(q: "example.com") do |row|  puts "#{row[:email]} #{row[:reason]}"end

टिप्पणियाँ

  • Pages are fetched only as they are needed, so an abandoned loop costs only the pages you consumed.

इनमें भी उपलब्ध

API
GET /suppressions
TypeScript
suppressions.iterate()
Python
suppressions.iterate()

suppressions.get

Read one suppressed address by id

स्कोपsettings:read
सिग्नेचर
get(id, api_key: nil) -> Hash

Returns one row of the suppression list: the address, why it is there, the detail the bounce or complaint carried, whether it can be removed and when it was added.

पैरामीटर

idStringआवश्यक

The id from list.

api_keyString

Overrides the client API key for this call only.

लौटाता है

A Hash with id, email, reason, detail, removable and createdAt.

उदाहरण

row = client.suppressions.get("7b1e2c3d-4f5a-4b6c-8d7e-9f0a1b2c3d4e") puts row[:email], row[:removable]

टिप्पणियाँ

इनमें भी उपलब्ध

API
GET /suppressions/{id}
TypeScript
suppressions.get()
Python
suppressions.get()
CLI
openemail suppressions get

suppressions.add

Stop sending to an address

स्कोपsettings:write
सिग्नेचर
add(body = nil, api_key: nil, **fields) -> Hash

Puts an address on the suppression list by hand, with reason: "manual", so no address in the workspace sends to it again until it is removed. It is the Block an address control on the Blocked addresses screen.

Adding an address that is already there changes nothing: the server answers 200 with the row it already holds, whatever its reason, where a new entry answers 201. Either way you get the row back. A new entry fires suppression.added to the webhooks that asked for it.

पैरामीटर

emailStringआवश्यक

The address to stop sending to. It is trimmed and lower cased.

api_keyString

Overrides the client API key for this call only.

लौटाता है

A Hash for the address, new or already there, with the fields get returns.

उदाहरण

row = client.suppressions.add(email: "[email protected]") puts row[:reason], row[:createdAt]

टिप्पणियाँ

  • Safe to repeat: a second add finds the first entry, so the SDK retries it after a network failure.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported, because the list stops mail from every address in the workspace. So is an app connected by anybody but the owner.

इनमें भी उपलब्ध

API
POST /suppressions
TypeScript
suppressions.add()
Python
suppressions.add()
CLI
openemail suppressions add

suppressions.remove

Allow mail to an address again

स्कोपsettings:write
सिग्नेचर
remove(id, api_key: nil) -> Hash

Takes an address off the suppression list, so mail may go to it again. It is Allow again on the Blocked addresses screen, and it fires suppression.removed.

Only a complaint or a manual entry can be removed. A hard bounce answers 409 suppression_not_removable and stays, because the address could not take mail: check it is spelled right and send to the corrected one instead.

पैरामीटर

idStringआवश्यक

The id from list.

api_keyString

Overrides the client API key for this call only.

लौटाता है

A Hash with object set to suppression, the id, the email, and deleted set to true.

उदाहरण

row = client.suppressions.list(q: "[email protected]").items.first begin  client.suppressions.remove(row[:id]) if rowrescue OpenEmail::ConflictError  puts "#{row[:email]} bounced hard, so it stays on the list"end

टिप्पणियाँ

  • The SDK does not retry a delete. A 404 on your own second attempt after a lost response means the first one worked.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported.

इनमें भी उपलब्ध

API
DELETE /suppressions/{id}
TypeScript
suppressions.remove()
Python
suppressions.remove()
CLI
openemail suppressions remove