Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/line/bot/v2/messaging_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ model/location_action.rb
model/location_message.rb
model/lottery_acquisition_condition_request.rb
model/lottery_acquisition_condition_response.rb
model/mark_messages_as_read_by_token_request.rb
model/mark_messages_as_read_request.rb
model/members_ids_response.rb
model/membership.rb
Expand Down
53 changes: 53 additions & 0 deletions lib/line/bot/v2/messaging_api/api/messaging_api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2527,6 +2527,59 @@ def mark_messages_as_read(
response_body
end

# Mark messages from users as read by token
# This requests to <code>POST https://api.line.me/v2/bot/chat/markAsRead</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
#
# @param mark_messages_as_read_by_token_request [MarkMessagesAsReadByTokenRequest]
# @see https://developers.line.biz/en/reference/messaging-api/#mark-as-read
# @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is 200
# @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 400
# @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
def mark_messages_as_read_by_token_with_http_info( # steep:ignore MethodBodyTypeMismatch
mark_messages_as_read_by_token_request:
)
path = "/v2/bot/chat/markAsRead"

response = @http_client.post(
path: path,
body_params: mark_messages_as_read_by_token_request,
)

case response.code.to_i
when 200
[response.body, 200, response.each_header.to_h]
when 400
json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
json.transform_keys! do |key|
Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
end
response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
[response_body, 400, response.each_header.to_h]
else
[response.body, response.code.to_i, response.each_header.to_h]
end
end

# Mark messages from users as read by token
# This requests to <code>POST https://api.line.me/v2/bot/chat/markAsRead</code>
# When you want to get HTTP status code or response headers, use {#mark_messages_as_read_by_token_with_http_info} instead of this.
#
# @param mark_messages_as_read_by_token_request [MarkMessagesAsReadByTokenRequest]
# @see https://developers.line.biz/en/reference/messaging-api/#mark-as-read
# @return [String, nil] when HTTP status code is 200
# @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 400
# @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
def mark_messages_as_read_by_token(
mark_messages_as_read_by_token_request:
)
response_body, _status_code, _headers = mark_messages_as_read_by_token_with_http_info(
mark_messages_as_read_by_token_request: mark_messages_as_read_by_token_request
)

response_body
end

# An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats.
# This requests to <code>POST https://api.line.me/v2/bot/message/multicast</code>
# This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
Expand Down
1 change: 1 addition & 0 deletions lib/line/bot/v2/messaging_api/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
require_relative './model/location_message'
require_relative './model/lottery_acquisition_condition_request'
require_relative './model/lottery_acquisition_condition_response'
require_relative './model/mark_messages_as_read_by_token_request'
require_relative './model/mark_messages_as_read_request'
require_relative './model/members_ids_response'
require_relative './model/membership'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# LINE Messaging API
# This document describes LINE Messaging API.
#
# The version of the OpenAPI document: 0.0.1
#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.

module Line
module Bot
module V2
module MessagingApi
# @see https://developers.line.biz/en/reference/messaging-api/#mark-as-read-request-body
class MarkMessagesAsReadByTokenRequest
# @!attribute [rw] mark_as_read_token
# @return [String] Token used to mark messages as read.
attr_accessor :mark_as_read_token

# @param mark_as_read_token [String] Token used to mark messages as read.
def initialize(
mark_as_read_token:,
**dynamic_attributes
)

@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key

if value.is_a?(Hash)
struct_klass = Struct.new(*value.keys.map(&:to_sym))
struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v }
instance_variable_set("@#{key}", struct_klass.new(*struct_values))
else
instance_variable_set("@#{key}", value)
end
end
end

# Create an instance of the class from a hash
# @param args [Hash] Hash containing all the required attributes
# @return [Line::Bot::V2::MessagingApi::MarkMessagesAsReadByTokenRequest] Instance of the class
def self.create(args) # steep:ignore
symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args)
return new(**symbolized_args) # steep:ignore
end

# @param other [Object] Object to compare
# @return [Boolean] true if the objects are equal, false otherwise
def ==(other)
return false unless self.class == other.class

instance_variables.all? do |var|
instance_variable_get(var) == other.instance_variable_get(var)
end
end

# @return [Integer] Hash code of the object
def hash
[self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash
end
end
end
end
end
end
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/audio_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,27 @@ class AudioMessageContent < MessageContent
# @!attribute [rw] duration
# @return [Integer,nil] Length of audio file (milliseconds)
attr_accessor :duration
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param content_provider [ContentProvider, Hash[Symbol, untyped]]
# @param duration [Integer,nil] Length of audio file (milliseconds)
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
content_provider:,
duration: nil,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "audio"

@id = id
@content_provider = content_provider.is_a?(Line::Bot::V2::Webhook::ContentProvider) ? content_provider : Line::Bot::V2::Webhook::ContentProvider.create(**content_provider) # steep:ignore
@duration = duration
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/file_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,27 @@ class FileMessageContent < MessageContent
# @!attribute [rw] file_size
# @return [Integer] File size in bytes
attr_accessor :file_size
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param file_name [String] File name
# @param file_size [Integer] File size in bytes
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
file_name:,
file_size:,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "file"

@id = id
@file_name = file_name
@file_size = file_size
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/image_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,21 @@ class ImageMessageContent < MessageContent
# @!attribute [rw] quote_token
# @return [String] Quote token to quote this message.
attr_accessor :quote_token
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param content_provider [ContentProvider, Hash[Symbol, untyped]]
# @param image_set [ImageSet, Hash[Symbol, untyped], nil]
# @param quote_token [String] Quote token to quote this message.
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
content_provider:,
image_set: nil,
quote_token:,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "image"
Expand All @@ -47,6 +52,7 @@ def initialize(
@content_provider = content_provider.is_a?(Line::Bot::V2::Webhook::ContentProvider) ? content_provider : Line::Bot::V2::Webhook::ContentProvider.create(**content_provider) # steep:ignore
@image_set = image_set.is_a?(Line::Bot::V2::Webhook::ImageSet) || image_set.nil? ? image_set : Line::Bot::V2::Webhook::ImageSet.create(**image_set) # steep:ignore
@quote_token = quote_token
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/location_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ class LocationMessageContent < MessageContent
# @!attribute [rw] longitude
# @return [Float] Longitude
attr_accessor :longitude
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param title [String,nil] Title
# @param address [String,nil] Address
# @param latitude [Float] Latitude
# @param longitude [Float] Longitude
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
title: nil,
address: nil,
latitude:,
longitude:,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "location"
Expand All @@ -53,6 +58,7 @@ def initialize(
@address = address
@latitude = latitude
@longitude = longitude
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
10 changes: 8 additions & 2 deletions lib/line/bot/v2/webhook/model/sticker_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ class StickerMessageContent < MessageContent
# @return [String] Quote token to quote this message.
attr_accessor :quote_token
# @!attribute [rw] quoted_message_id
# @return [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
# @return [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
attr_accessor :quoted_message_id
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param package_id [String] Package ID
Expand All @@ -50,7 +53,8 @@ class StickerMessageContent < MessageContent
# @param keywords [Array[String],nil] Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker.
# @param text [String,nil] Any text entered by the user. This property is only included for message stickers. Max character limit: 100
# @param quote_token [String] Quote token to quote this message.
# @param quoted_message_id [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
# @param quoted_message_id [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
package_id:,
Expand All @@ -60,6 +64,7 @@ def initialize(
text: nil,
quote_token:,
quoted_message_id: nil,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "sticker"
Expand All @@ -72,6 +77,7 @@ def initialize(
@text = text
@quote_token = quote_token
@quoted_message_id = quoted_message_id
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/text_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,25 @@ class TextMessageContent < MessageContent
# @!attribute [rw] quoted_message_id
# @return [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
attr_accessor :quoted_message_id
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param text [String] Message text.
# @param emojis [Array[Emoji, Hash[Symbol, untyped]],nil] Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji.
# @param mention [Mention, Hash[Symbol, untyped], nil]
# @param quote_token [String] Quote token to quote this message.
# @param quoted_message_id [String,nil] Message ID of a quoted message. Only included when the received message quotes a past message.
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
text:,
emojis: nil,
mention: nil,
quote_token:,
quoted_message_id: nil,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "text"
Expand All @@ -65,6 +70,7 @@ def initialize(
@mention = mention.is_a?(Line::Bot::V2::Webhook::Mention) || mention.nil? ? mention : Line::Bot::V2::Webhook::Mention.create(**mention) # steep:ignore
@quote_token = quote_token
@quoted_message_id = quoted_message_id
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
6 changes: 6 additions & 0 deletions lib/line/bot/v2/webhook/model/video_message_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,21 @@ class VideoMessageContent < MessageContent
# @!attribute [rw] quote_token
# @return [String] Quote token to quote this message.
attr_accessor :quote_token
# @!attribute [rw] mark_as_read_token
# @return [String,nil] Token used to mark the message as read.
attr_accessor :mark_as_read_token

# @param id [String] Message ID
# @param duration [Integer,nil] Length of video file (milliseconds)
# @param content_provider [ContentProvider, Hash[Symbol, untyped]]
# @param quote_token [String] Quote token to quote this message.
# @param mark_as_read_token [String,nil] Token used to mark the message as read.
def initialize(
id:,
duration: nil,
content_provider:,
quote_token:,
mark_as_read_token: nil,
**dynamic_attributes
)
@type = "video"
Expand All @@ -47,6 +52,7 @@ def initialize(
@duration = duration
@content_provider = content_provider.is_a?(Line::Bot::V2::Webhook::ContentProvider) ? content_provider : Line::Bot::V2::Webhook::ContentProvider.create(**content_provider) # steep:ignore
@quote_token = quote_token
@mark_as_read_token = mark_as_read_token

dynamic_attributes.each do |key, value|
self.class.attr_accessor key
Expand Down
2 changes: 1 addition & 1 deletion line-openapi
1 change: 1 addition & 0 deletions sig/line/bot/v2/messaging_api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ model/location_action.rbs
model/location_message.rbs
model/lottery_acquisition_condition_request.rbs
model/lottery_acquisition_condition_response.rbs
model/mark_messages_as_read_by_token_request.rbs
model/mark_messages_as_read_request.rbs
model/members_ids_response.rbs
model/membership.rbs
Expand Down
Loading