rcs 2.0.0.pre.rc.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rcs/brands/client.rb +36 -24
- data/lib/rcs/campaigns/dlc/client.rb +36 -26
- data/lib/rcs/campaigns/rcs/client.rb +26 -22
- data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +6 -6
- data/lib/rcs/campaigns/toll_free/client.rb +32 -26
- data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +6 -6
- data/lib/rcs/contacts/client.rb +10 -8
- data/lib/rcs/conversations/client.rb +144 -16
- data/lib/rcs/conversations/types/conversations_list_messages_request_direction.rb +12 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_sort_order.rb +12 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_status.rb +17 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_type.rb +13 -0
- data/lib/rcs/messages/client.rb +12 -29
- data/lib/rcs/messages/rcs/client.rb +1 -1
- data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
- data/lib/rcs/phone_numbers/client.rb +0 -14
- data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
- data/lib/rcs/rcs/client.rb +32 -18
- data/lib/rcs/status/get/client.rb +32 -16
- data/lib/rcs/tools/contact_card/client.rb +18 -8
- data/lib/rcs/tools/file/client.rb +92 -2
- data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
- data/lib/rcs/tools/url/client.rb +4 -2
- data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
- data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
- data/lib/rcs/types/autofill_campaign_params.rb +15 -3
- data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
- data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
- data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
- data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
- data/lib/rcs/types/brand_status.rb +5 -3
- data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
- data/lib/rcs/types/button_clicked_data.rb +80 -0
- data/lib/rcs/types/button_clicked_data_button.rb +118 -0
- data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
- data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
- data/lib/rcs/types/campaign_query.rb +10 -2
- data/lib/rcs/types/contact.rb +5 -3
- data/lib/rcs/types/contact_id.rb +5 -3
- data/lib/rcs/types/conversation.rb +16 -8
- data/lib/rcs/types/conversation_by_id_params.rb +7 -3
- data/lib/rcs/types/conversation_contact.rb +5 -3
- data/lib/rcs/types/conversation_list.rb +50 -28
- data/lib/rcs/types/create_url_options.rb +4 -2
- data/lib/rcs/types/detached_webhook_info.rb +5 -3
- data/lib/rcs/types/dlc_campaign_status.rb +5 -3
- data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
- data/lib/rcs/types/extended_brand.rb +25 -13
- data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
- data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
- data/lib/rcs/types/link_click_event.rb +1 -17
- data/lib/rcs/types/message.rb +5 -3
- data/lib/rcs/types/message_content.rb +4 -4
- data/lib/rcs/types/message_event.rb +143 -0
- data/lib/rcs/types/message_event_content.rb +127 -0
- data/lib/rcs/types/message_event_conversation.rb +82 -0
- data/lib/rcs/types/message_event_direction.rb +11 -0
- data/lib/rcs/types/message_event_mms_content.rb +94 -0
- data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
- data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
- data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
- data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
- data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
- data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
- data/lib/rcs/types/message_event_sms_content.rb +81 -0
- data/lib/rcs/types/{retrieved_conversations.rb → message_list.rb} +26 -25
- data/lib/rcs/types/message_with_reaction.rb +197 -0
- data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
- data/lib/rcs/types/{error_response.rb → not_found_error_body.rb} +7 -7
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
- data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
- data/lib/rcs/types/profile_status_enum.rb +4 -4
- data/lib/rcs/types/rcs_base_options.rb +12 -1
- data/lib/rcs/types/rcs_button_call.rb +11 -2
- data/lib/rcs/types/rcs_button_open_url.rb +11 -2
- data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
- data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
- data/lib/rcs/types/rcs_button_send_location.rb +11 -2
- data/lib/rcs/types/rcs_button_trigger.rb +8 -6
- data/lib/rcs/types/rcs_campaign.rb +3 -3
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +8 -8
- data/lib/rcs/types/rcs_campaign_status.rb +5 -3
- data/lib/rcs/types/reaction_result.rb +10 -6
- data/lib/rcs/types/refreshed_file.rb +67 -0
- data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
- data/lib/rcs/types/scheduled_messaage.rb +5 -3
- data/lib/rcs/types/sent_mms_details.rb +4 -2
- data/lib/rcs/types/sent_rcs_details.rb +12 -13
- data/lib/rcs/types/sent_sms_details.rb +5 -3
- data/lib/rcs/types/toll_free_campaign.rb +3 -3
- data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
- data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
- data/lib/rcs/types/updated_contact_id.rb +5 -3
- data/lib/rcs/types/user_event.rb +83 -0
- data/lib/rcs/types/user_event_conversation.rb +78 -0
- data/lib/rcs/types/v_card_data.rb +5 -3
- data/lib/rcs/types/validate_campaign_params.rb +15 -3
- data/lib/rcs/types/vcard.rb +5 -3
- data/lib/rcs/types/vcard_content.rb +5 -3
- data/lib/rcs/types/vcard_resource.rb +5 -3
- data/lib/rcs/types/webhook_event_enum.rb +1 -0
- data/lib/rcs/types/webhooks.rb +5 -3
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +29 -7
- metadata +33 -11
- data/lib/rcs/types/click_action.rb +0 -73
- data/lib/rcs/types/click_action_data_metadata.rb +0 -69
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "rich_button"
|
|
4
|
+
require_relative "rcs_media_details_content"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module Pinnacle
|
|
9
|
+
module Types
|
|
10
|
+
# Individual card containing title, optional media, and action buttons.
|
|
11
|
+
class MessageEventRcsCardsContentCardsItem
|
|
12
|
+
# @return [Array<Pinnacle::Types::RichButton>] Action buttons attached to the card.
|
|
13
|
+
attr_reader :buttons
|
|
14
|
+
# @return [Pinnacle::Types::RcsMediaDetailsContent]
|
|
15
|
+
attr_reader :media
|
|
16
|
+
# @return [String] Secondary text displayed below the title for additional context.
|
|
17
|
+
attr_reader :subtitle
|
|
18
|
+
# @return [String] Title displayed on the card.
|
|
19
|
+
attr_reader :title
|
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
attr_reader :additional_properties
|
|
22
|
+
# @return [Object]
|
|
23
|
+
attr_reader :_field_set
|
|
24
|
+
protected :_field_set
|
|
25
|
+
|
|
26
|
+
OMIT = Object.new
|
|
27
|
+
|
|
28
|
+
# @param buttons [Array<Pinnacle::Types::RichButton>] Action buttons attached to the card.
|
|
29
|
+
# @param media [Pinnacle::Types::RcsMediaDetailsContent]
|
|
30
|
+
# @param subtitle [String] Secondary text displayed below the title for additional context.
|
|
31
|
+
# @param title [String] Title displayed on the card.
|
|
32
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
33
|
+
# @return [Pinnacle::Types::MessageEventRcsCardsContentCardsItem]
|
|
34
|
+
def initialize(buttons:, title:, media: OMIT, subtitle: OMIT, additional_properties: nil)
|
|
35
|
+
@buttons = buttons
|
|
36
|
+
@media = media if media != OMIT
|
|
37
|
+
@subtitle = subtitle if subtitle != OMIT
|
|
38
|
+
@title = title
|
|
39
|
+
@additional_properties = additional_properties
|
|
40
|
+
@_field_set = { "buttons": buttons, "media": media, "subtitle": subtitle, "title": title }.reject do |_k, v|
|
|
41
|
+
v == OMIT
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Deserialize a JSON object to an instance of MessageEventRcsCardsContentCardsItem
|
|
46
|
+
#
|
|
47
|
+
# @param json_object [String]
|
|
48
|
+
# @return [Pinnacle::Types::MessageEventRcsCardsContentCardsItem]
|
|
49
|
+
def self.from_json(json_object:)
|
|
50
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
51
|
+
parsed_json = JSON.parse(json_object)
|
|
52
|
+
buttons = parsed_json["buttons"]&.map do |item|
|
|
53
|
+
item = item.to_json
|
|
54
|
+
Pinnacle::Types::RichButton.from_json(json_object: item)
|
|
55
|
+
end
|
|
56
|
+
if parsed_json["media"].nil?
|
|
57
|
+
media = nil
|
|
58
|
+
else
|
|
59
|
+
media = parsed_json["media"].to_json
|
|
60
|
+
media = Pinnacle::Types::RcsMediaDetailsContent.from_json(json_object: media)
|
|
61
|
+
end
|
|
62
|
+
subtitle = parsed_json["subtitle"]
|
|
63
|
+
title = parsed_json["title"]
|
|
64
|
+
new(
|
|
65
|
+
buttons: buttons,
|
|
66
|
+
media: media,
|
|
67
|
+
subtitle: subtitle,
|
|
68
|
+
title: title,
|
|
69
|
+
additional_properties: struct
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Serialize an instance of MessageEventRcsCardsContentCardsItem to a JSON object
|
|
74
|
+
#
|
|
75
|
+
# @return [String]
|
|
76
|
+
def to_json(*_args)
|
|
77
|
+
@_field_set&.to_json
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
81
|
+
# hash and check each fields type against the current object's property
|
|
82
|
+
# definitions.
|
|
83
|
+
#
|
|
84
|
+
# @param obj [Object]
|
|
85
|
+
# @return [Void]
|
|
86
|
+
def self.validate_raw(obj:)
|
|
87
|
+
obj.buttons.is_a?(Array) != false || raise("Passed value for field obj.buttons is not the expected type, validation failed.")
|
|
88
|
+
obj.media.nil? || Pinnacle::Types::RcsMediaDetailsContent.validate_raw(obj: obj.media)
|
|
89
|
+
obj.subtitle&.is_a?(String) != false || raise("Passed value for field obj.subtitle is not the expected type, validation failed.")
|
|
90
|
+
obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "location_share_action_data"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Types
|
|
9
|
+
# Location sharing event data received when a user responds to a
|
|
10
|
+
# `requestUserLocation` button and shares their current location.
|
|
11
|
+
# This event contains the geographic coordinates (latitude/longitude) and
|
|
12
|
+
# human-readable address of the location the user chose to share. Use this data to
|
|
13
|
+
# process location-based requests or provide location-specific services.
|
|
14
|
+
class MessageEventRcsLocationData
|
|
15
|
+
# @return [String] Message type identifier.
|
|
16
|
+
attr_reader :type
|
|
17
|
+
# @return [String] Unique identifier of the message. This identifier is a string that always begins
|
|
18
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
19
|
+
# To get the message details, use the [GET
|
|
20
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
21
|
+
attr_reader :id
|
|
22
|
+
# @return [Pinnacle::Types::LocationShareActionData] Location data shared by the user.
|
|
23
|
+
attr_reader :data
|
|
24
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
|
+
attr_reader :additional_properties
|
|
26
|
+
# @return [Object]
|
|
27
|
+
attr_reader :_field_set
|
|
28
|
+
protected :_field_set
|
|
29
|
+
|
|
30
|
+
OMIT = Object.new
|
|
31
|
+
|
|
32
|
+
# @param type [String] Message type identifier.
|
|
33
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
34
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
35
|
+
# To get the message details, use the [GET
|
|
36
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
37
|
+
# @param data [Pinnacle::Types::LocationShareActionData] Location data shared by the user.
|
|
38
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
39
|
+
# @return [Pinnacle::Types::MessageEventRcsLocationData]
|
|
40
|
+
def initialize(type:, id:, data:, additional_properties: nil)
|
|
41
|
+
@type = type
|
|
42
|
+
@id = id
|
|
43
|
+
@data = data
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
@_field_set = { "type": type, "id": id, "data": data }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Deserialize a JSON object to an instance of MessageEventRcsLocationData
|
|
49
|
+
#
|
|
50
|
+
# @param json_object [String]
|
|
51
|
+
# @return [Pinnacle::Types::MessageEventRcsLocationData]
|
|
52
|
+
def self.from_json(json_object:)
|
|
53
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
54
|
+
parsed_json = JSON.parse(json_object)
|
|
55
|
+
type = parsed_json["type"]
|
|
56
|
+
id = parsed_json["id"]
|
|
57
|
+
if parsed_json["data"].nil?
|
|
58
|
+
data = nil
|
|
59
|
+
else
|
|
60
|
+
data = parsed_json["data"].to_json
|
|
61
|
+
data = Pinnacle::Types::LocationShareActionData.from_json(json_object: data)
|
|
62
|
+
end
|
|
63
|
+
new(
|
|
64
|
+
type: type,
|
|
65
|
+
id: id,
|
|
66
|
+
data: data,
|
|
67
|
+
additional_properties: struct
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Serialize an instance of MessageEventRcsLocationData to a JSON object
|
|
72
|
+
#
|
|
73
|
+
# @return [String]
|
|
74
|
+
def to_json(*_args)
|
|
75
|
+
@_field_set&.to_json
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
79
|
+
# hash and check each fields type against the current object's property
|
|
80
|
+
# definitions.
|
|
81
|
+
#
|
|
82
|
+
# @param obj [Object]
|
|
83
|
+
# @return [Void]
|
|
84
|
+
def self.validate_raw(obj:)
|
|
85
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
86
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
87
|
+
Pinnacle::Types::LocationShareActionData.validate_raw(obj: obj.data)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "rich_button"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Types
|
|
9
|
+
# RCS message containing a media file with optional quick reply buttons. <br>
|
|
10
|
+
# See [supported file
|
|
11
|
+
# types](https://app.pinnacle.sh/supported-file-types?type=RCS-MEDIA).
|
|
12
|
+
class MessageEventRcsMediaContent
|
|
13
|
+
# @return [String] Message type identifier.
|
|
14
|
+
attr_reader :type
|
|
15
|
+
# @return [String] Unique identifier of the message. This identifier is a string that always begins
|
|
16
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
17
|
+
# To get the message details, use the [GET
|
|
18
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
19
|
+
attr_reader :id
|
|
20
|
+
# @return [String] URL of the media file.
|
|
21
|
+
attr_reader :media
|
|
22
|
+
# @return [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
23
|
+
attr_reader :quick_replies
|
|
24
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
|
+
attr_reader :additional_properties
|
|
26
|
+
# @return [Object]
|
|
27
|
+
attr_reader :_field_set
|
|
28
|
+
protected :_field_set
|
|
29
|
+
|
|
30
|
+
OMIT = Object.new
|
|
31
|
+
|
|
32
|
+
# @param type [String] Message type identifier.
|
|
33
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
34
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
35
|
+
# To get the message details, use the [GET
|
|
36
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
37
|
+
# @param media [String] URL of the media file.
|
|
38
|
+
# @param quick_replies [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
39
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
40
|
+
# @return [Pinnacle::Types::MessageEventRcsMediaContent]
|
|
41
|
+
def initialize(type:, id:, media:, quick_replies:, additional_properties: nil)
|
|
42
|
+
@type = type
|
|
43
|
+
@id = id
|
|
44
|
+
@media = media
|
|
45
|
+
@quick_replies = quick_replies
|
|
46
|
+
@additional_properties = additional_properties
|
|
47
|
+
@_field_set = { "type": type, "id": id, "media": media, "quickReplies": quick_replies }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Deserialize a JSON object to an instance of MessageEventRcsMediaContent
|
|
51
|
+
#
|
|
52
|
+
# @param json_object [String]
|
|
53
|
+
# @return [Pinnacle::Types::MessageEventRcsMediaContent]
|
|
54
|
+
def self.from_json(json_object:)
|
|
55
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
56
|
+
parsed_json = JSON.parse(json_object)
|
|
57
|
+
type = parsed_json["type"]
|
|
58
|
+
id = parsed_json["id"]
|
|
59
|
+
media = parsed_json["media"]
|
|
60
|
+
quick_replies = parsed_json["quickReplies"]&.map do |item|
|
|
61
|
+
item = item.to_json
|
|
62
|
+
Pinnacle::Types::RichButton.from_json(json_object: item)
|
|
63
|
+
end
|
|
64
|
+
new(
|
|
65
|
+
type: type,
|
|
66
|
+
id: id,
|
|
67
|
+
media: media,
|
|
68
|
+
quick_replies: quick_replies,
|
|
69
|
+
additional_properties: struct
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Serialize an instance of MessageEventRcsMediaContent to a JSON object
|
|
74
|
+
#
|
|
75
|
+
# @return [String]
|
|
76
|
+
def to_json(*_args)
|
|
77
|
+
@_field_set&.to_json
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
81
|
+
# hash and check each fields type against the current object's property
|
|
82
|
+
# definitions.
|
|
83
|
+
#
|
|
84
|
+
# @param obj [Object]
|
|
85
|
+
# @return [Void]
|
|
86
|
+
def self.validate_raw(obj:)
|
|
87
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
88
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
89
|
+
obj.media.is_a?(String) != false || raise("Passed value for field obj.media is not the expected type, validation failed.")
|
|
90
|
+
obj.quick_replies.is_a?(Array) != false || raise("Passed value for field obj.quick_replies is not the expected type, validation failed.")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "rich_button"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Types
|
|
9
|
+
# RCS message containing longer text content with optional quick reply buttons.
|
|
10
|
+
class MessageEventRcsTextContent
|
|
11
|
+
# @return [String] Message type identifier.
|
|
12
|
+
attr_reader :type
|
|
13
|
+
# @return [String] Unique identifier of the message. This identifier is a string that always begins
|
|
14
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
15
|
+
# To get the message details, use the [GET
|
|
16
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
17
|
+
attr_reader :id
|
|
18
|
+
# @return [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
19
|
+
attr_reader :quick_replies
|
|
20
|
+
# @return [String] Text content of the RCS message.
|
|
21
|
+
attr_reader :text
|
|
22
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
attr_reader :additional_properties
|
|
24
|
+
# @return [Object]
|
|
25
|
+
attr_reader :_field_set
|
|
26
|
+
protected :_field_set
|
|
27
|
+
|
|
28
|
+
OMIT = Object.new
|
|
29
|
+
|
|
30
|
+
# @param type [String] Message type identifier.
|
|
31
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
32
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
33
|
+
# To get the message details, use the [GET
|
|
34
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
35
|
+
# @param quick_replies [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
36
|
+
# @param text [String] Text content of the RCS message.
|
|
37
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
38
|
+
# @return [Pinnacle::Types::MessageEventRcsTextContent]
|
|
39
|
+
def initialize(type:, id:, quick_replies:, text:, additional_properties: nil)
|
|
40
|
+
@type = type
|
|
41
|
+
@id = id
|
|
42
|
+
@quick_replies = quick_replies
|
|
43
|
+
@text = text
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
@_field_set = { "type": type, "id": id, "quickReplies": quick_replies, "text": text }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Deserialize a JSON object to an instance of MessageEventRcsTextContent
|
|
49
|
+
#
|
|
50
|
+
# @param json_object [String]
|
|
51
|
+
# @return [Pinnacle::Types::MessageEventRcsTextContent]
|
|
52
|
+
def self.from_json(json_object:)
|
|
53
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
54
|
+
parsed_json = JSON.parse(json_object)
|
|
55
|
+
type = parsed_json["type"]
|
|
56
|
+
id = parsed_json["id"]
|
|
57
|
+
quick_replies = parsed_json["quickReplies"]&.map do |item|
|
|
58
|
+
item = item.to_json
|
|
59
|
+
Pinnacle::Types::RichButton.from_json(json_object: item)
|
|
60
|
+
end
|
|
61
|
+
text = parsed_json["text"]
|
|
62
|
+
new(
|
|
63
|
+
type: type,
|
|
64
|
+
id: id,
|
|
65
|
+
quick_replies: quick_replies,
|
|
66
|
+
text: text,
|
|
67
|
+
additional_properties: struct
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Serialize an instance of MessageEventRcsTextContent to a JSON object
|
|
72
|
+
#
|
|
73
|
+
# @return [String]
|
|
74
|
+
def to_json(*_args)
|
|
75
|
+
@_field_set&.to_json
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
79
|
+
# hash and check each fields type against the current object's property
|
|
80
|
+
# definitions.
|
|
81
|
+
#
|
|
82
|
+
# @param obj [Object]
|
|
83
|
+
# @return [Void]
|
|
84
|
+
def self.validate_raw(obj:)
|
|
85
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
86
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
87
|
+
obj.quick_replies.is_a?(Array) != false || raise("Passed value for field obj.quick_replies is not the expected type, validation failed.")
|
|
88
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
# SMS message containing plain text only.
|
|
9
|
+
class MessageEventSmsContent
|
|
10
|
+
# @return [String] Message type identifier.
|
|
11
|
+
attr_reader :type
|
|
12
|
+
# @return [String] Unique identifier of the message. This identifier is a string that always begins
|
|
13
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
14
|
+
# To get the message details, use the [GET
|
|
15
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
16
|
+
attr_reader :id
|
|
17
|
+
# @return [String] Message content.
|
|
18
|
+
attr_reader :text
|
|
19
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
20
|
+
attr_reader :additional_properties
|
|
21
|
+
# @return [Object]
|
|
22
|
+
attr_reader :_field_set
|
|
23
|
+
protected :_field_set
|
|
24
|
+
|
|
25
|
+
OMIT = Object.new
|
|
26
|
+
|
|
27
|
+
# @param type [String] Message type identifier.
|
|
28
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
29
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
30
|
+
# To get the message details, use the [GET
|
|
31
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
32
|
+
# @param text [String] Message content.
|
|
33
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
34
|
+
# @return [Pinnacle::Types::MessageEventSmsContent]
|
|
35
|
+
def initialize(type:, id:, text:, additional_properties: nil)
|
|
36
|
+
@type = type
|
|
37
|
+
@id = id
|
|
38
|
+
@text = text
|
|
39
|
+
@additional_properties = additional_properties
|
|
40
|
+
@_field_set = { "type": type, "id": id, "text": text }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Deserialize a JSON object to an instance of MessageEventSmsContent
|
|
44
|
+
#
|
|
45
|
+
# @param json_object [String]
|
|
46
|
+
# @return [Pinnacle::Types::MessageEventSmsContent]
|
|
47
|
+
def self.from_json(json_object:)
|
|
48
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
49
|
+
parsed_json = JSON.parse(json_object)
|
|
50
|
+
type = parsed_json["type"]
|
|
51
|
+
id = parsed_json["id"]
|
|
52
|
+
text = parsed_json["text"]
|
|
53
|
+
new(
|
|
54
|
+
type: type,
|
|
55
|
+
id: id,
|
|
56
|
+
text: text,
|
|
57
|
+
additional_properties: struct
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Serialize an instance of MessageEventSmsContent to a JSON object
|
|
62
|
+
#
|
|
63
|
+
# @return [String]
|
|
64
|
+
def to_json(*_args)
|
|
65
|
+
@_field_set&.to_json
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
69
|
+
# hash and check each fields type against the current object's property
|
|
70
|
+
# definitions.
|
|
71
|
+
#
|
|
72
|
+
# @param obj [Object]
|
|
73
|
+
# @return [Void]
|
|
74
|
+
def self.validate_raw(obj:)
|
|
75
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
76
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
77
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "message_with_reaction"
|
|
4
4
|
require "ostruct"
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
7
7
|
module Pinnacle
|
|
8
8
|
module Types
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# @return [Boolean] Indicates if more conversations are available beyond the current page.
|
|
9
|
+
# Paginated list of messages in a conversation.
|
|
10
|
+
class MessageList
|
|
11
|
+
# @return [Array<Pinnacle::Types::MessageWithReaction>] Array of messages in the conversation.
|
|
12
|
+
attr_reader :messages
|
|
13
|
+
# @return [Boolean] Indicates if more messages are available beyond the current page.
|
|
15
14
|
attr_reader :has_more
|
|
15
|
+
# @return [Integer] Total number of messages in the conversation.
|
|
16
|
+
attr_reader :count
|
|
16
17
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
18
|
attr_reader :additional_properties
|
|
18
19
|
# @return [Object]
|
|
@@ -21,41 +22,41 @@ module Pinnacle
|
|
|
21
22
|
|
|
22
23
|
OMIT = Object.new
|
|
23
24
|
|
|
24
|
-
# @param
|
|
25
|
-
# @param
|
|
26
|
-
# @param
|
|
25
|
+
# @param messages [Array<Pinnacle::Types::MessageWithReaction>] Array of messages in the conversation.
|
|
26
|
+
# @param has_more [Boolean] Indicates if more messages are available beyond the current page.
|
|
27
|
+
# @param count [Integer] Total number of messages in the conversation.
|
|
27
28
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
28
|
-
# @return [Pinnacle::Types::
|
|
29
|
-
def initialize(
|
|
30
|
-
@
|
|
31
|
-
@conversations = conversations
|
|
29
|
+
# @return [Pinnacle::Types::MessageList]
|
|
30
|
+
def initialize(messages:, has_more:, count:, additional_properties: nil)
|
|
31
|
+
@messages = messages
|
|
32
32
|
@has_more = has_more
|
|
33
|
+
@count = count
|
|
33
34
|
@additional_properties = additional_properties
|
|
34
|
-
@_field_set = { "
|
|
35
|
+
@_field_set = { "messages": messages, "hasMore": has_more, "count": count }
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
# Deserialize a JSON object to an instance of
|
|
38
|
+
# Deserialize a JSON object to an instance of MessageList
|
|
38
39
|
#
|
|
39
40
|
# @param json_object [String]
|
|
40
|
-
# @return [Pinnacle::Types::
|
|
41
|
+
# @return [Pinnacle::Types::MessageList]
|
|
41
42
|
def self.from_json(json_object:)
|
|
42
43
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
43
44
|
parsed_json = JSON.parse(json_object)
|
|
44
|
-
|
|
45
|
-
conversations = parsed_json["conversations"]&.map do |item|
|
|
45
|
+
messages = parsed_json["messages"]&.map do |item|
|
|
46
46
|
item = item.to_json
|
|
47
|
-
Pinnacle::Types::
|
|
47
|
+
Pinnacle::Types::MessageWithReaction.from_json(json_object: item)
|
|
48
48
|
end
|
|
49
49
|
has_more = parsed_json["hasMore"]
|
|
50
|
+
count = parsed_json["count"]
|
|
50
51
|
new(
|
|
51
|
-
|
|
52
|
-
conversations: conversations,
|
|
52
|
+
messages: messages,
|
|
53
53
|
has_more: has_more,
|
|
54
|
+
count: count,
|
|
54
55
|
additional_properties: struct
|
|
55
56
|
)
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
# Serialize an instance of
|
|
59
|
+
# Serialize an instance of MessageList to a JSON object
|
|
59
60
|
#
|
|
60
61
|
# @return [String]
|
|
61
62
|
def to_json(*_args)
|
|
@@ -69,9 +70,9 @@ module Pinnacle
|
|
|
69
70
|
# @param obj [Object]
|
|
70
71
|
# @return [Void]
|
|
71
72
|
def self.validate_raw(obj:)
|
|
72
|
-
obj.
|
|
73
|
-
obj.conversations.is_a?(Array) != false || raise("Passed value for field obj.conversations is not the expected type, validation failed.")
|
|
73
|
+
obj.messages.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
|
74
74
|
obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.")
|
|
75
|
+
obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
|
|
75
76
|
end
|
|
76
77
|
end
|
|
77
78
|
end
|