Class: Knockapi::Resources::Messages::Batch
- Inherits:
-
Object
- Object
- Knockapi::Resources::Messages::Batch
- Defined in:
- lib/knockapi/resources/messages/batch.rb,
sig/knockapi/resources/messages/batch.rbs
Overview
A message sent to a single recipient on a channel.
Instance Method Summary collapse
-
#archive(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as archived.
-
#get_content(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Messages::BatchGetContentResponseItem>
Get the contents of multiple messages in a single request.
-
#initialize(client:) ⇒ Batch
constructor
private
A new instance of Batch.
-
#mark_as_interacted(message_ids:, metadata: nil, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as interacted with by the user.
-
#mark_as_read(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as
read. -
#mark_as_seen(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as
seen. -
#mark_as_unread(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as
unread. -
#mark_as_unseen(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as
unseen. -
#unarchive(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as unarchived.
Constructor Details
#initialize(client:) ⇒ Batch
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Batch.
204 205 206 |
# File 'lib/knockapi/resources/messages/batch.rb', line 204 def initialize(client:) @client = client end |
Instance Method Details
#archive(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as archived. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/knockapi/resources/messages/batch.rb', line 20 def archive(params) parsed, = Knockapi::Messages::BatchArchiveParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/archived", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#get_content(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Messages::BatchGetContentResponseItem>
Get the contents of multiple messages in a single request.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/knockapi/resources/messages/batch.rb', line 42 def get_content(params) parsed, = Knockapi::Messages::BatchGetContentParams.dump_request(params) query = Knockapi::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/messages/batch/content", query: query, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Messages::BatchGetContentResponseItem], options: ) end |
#mark_as_interacted(message_ids:, metadata: nil, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as interacted with by the user. This can include any user action on the message, with optional metadata about the specific interaction. Cannot include more than 5 key-value pairs, must not contain nested data. Read more about message engagement statuses here.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/knockapi/resources/messages/batch.rb', line 71 def mark_as_interacted(params) parsed, = Knockapi::Messages::BatchMarkAsInteractedParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/interacted", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#mark_as_read(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as read. Read more about message engagement statuses
here.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/knockapi/resources/messages/batch.rb', line 94 def mark_as_read(params) parsed, = Knockapi::Messages::BatchMarkAsReadParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/read", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#mark_as_seen(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as seen. This indicates that the user has viewed the
message in their feed or inbox. Read more about message engagement statuses
here.
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/knockapi/resources/messages/batch.rb', line 118 def mark_as_seen(params) parsed, = Knockapi::Messages::BatchMarkAsSeenParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/seen", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#mark_as_unread(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as unread. This reverses the read state. Read more
about message engagement statuses
here.
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/knockapi/resources/messages/batch.rb', line 142 def mark_as_unread(params) parsed, = Knockapi::Messages::BatchMarkAsUnreadParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/unread", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#mark_as_unseen(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as unseen. This reverses the seen state. Read more
about message engagement statuses
here.
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/knockapi/resources/messages/batch.rb', line 166 def mark_as_unseen(params) parsed, = Knockapi::Messages::BatchMarkAsUnseenParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/unseen", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |
#unarchive(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Message>
Marks the given messages as unarchived. This reverses the archived state.
Archived messages are hidden from the default message list in the feed but can
still be accessed and unarchived later.
190 191 192 193 194 195 196 197 198 199 |
# File 'lib/knockapi/resources/messages/batch.rb', line 190 def unarchive(params) parsed, = Knockapi::Messages::BatchUnarchiveParams.dump_request(params) @client.request( method: :post, path: "v1/messages/batch/unarchived", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: ) end |