Class: Knockapi::Resources::Messages::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/messages/batch.rb

Instance Method Summary collapse

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.

Parameters:



202
203
204
# File 'lib/knockapi/resources/messages/batch.rb', line 202

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.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
27
28
# File 'lib/knockapi/resources/messages/batch.rb', line 19

def archive(params)
  parsed, options = 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: options
  )
end

#get_content(message_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Messages::BatchGetContentResponseItem>

Get the contents of multiple messages in a single request.

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
# File 'lib/knockapi/resources/messages/batch.rb', line 41

def get_content(params)
  parsed, options = Knockapi::Messages::BatchGetContentParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v1/messages/batch/content",
    query: parsed,
    model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Messages::BatchGetContentResponseItem],
    options: 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](/send-notifications/message-statuses#engagement-status).

Parameters:

  • message_ids (Array<String>)

    The message IDs to batch mark as interacted with.

  • metadata (Hash{Symbol=>Object}, nil)

    Metadata about the interaction.

  • request_options (Knockapi::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
# File 'lib/knockapi/resources/messages/batch.rb', line 69

def mark_as_interacted(params)
  parsed, options = 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: 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](/send-notifications/message-statuses#engagement-status).

Parameters:

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
# File 'lib/knockapi/resources/messages/batch.rb', line 92

def mark_as_read(params)
  parsed, options = 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: 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](/send-notifications/message-statuses#engagement-status).

Parameters:

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
# File 'lib/knockapi/resources/messages/batch.rb', line 116

def mark_as_seen(params)
  parsed, options = 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: 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](/send-notifications/message-statuses#engagement-status).

Parameters:

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
# File 'lib/knockapi/resources/messages/batch.rb', line 140

def mark_as_unread(params)
  parsed, options = 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: 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](/send-notifications/message-statuses#engagement-status).

Parameters:

Returns:

See Also:



164
165
166
167
168
169
170
171
172
173
# File 'lib/knockapi/resources/messages/batch.rb', line 164

def mark_as_unseen(params)
  parsed, options = 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: 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.

Parameters:

Returns:

See Also:



188
189
190
191
192
193
194
195
196
197
# File 'lib/knockapi/resources/messages/batch.rb', line 188

def unarchive(params)
  parsed, options = 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: options
  )
end