rcs 2.0.0.pre.rc.4 → 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 +44 -34
- 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/rcs/types/upsert_rcs_agent.rb +4 -4
- 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 +142 -14
- 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/mms/client.rb +2 -2
- data/lib/rcs/messages/rcs/client.rb +1 -1
- data/lib/rcs/messages/sms/client.rb +2 -2
- 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 +330 -0
- data/lib/rcs/status/get/client.rb +34 -18
- 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/create_url_options.rb +4 -2
- data/lib/rcs/types/detached_webhook_info.rb +5 -3
- data/lib/rcs/types/dlc_campaign_status.rb +7 -5
- 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/get_dlc_campaign_status_response_updates.rb +1 -1
- 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/message_list.rb +79 -0
- data/lib/rcs/types/message_schedule.rb +4 -5
- 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/not_found_error_body.rb +59 -0
- 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_agent.rb +4 -4
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +12 -12
- data/lib/rcs/types/rcs_campaign_status.rb +5 -3
- data/lib/rcs/types/rcs_capabilities_result.rb +7 -0
- data/lib/rcs/types/rcs_capability.rb +82 -0
- data/lib/rcs/types/rcs_capability_actions.rb +105 -0
- data/lib/rcs/types/rcs_capability_cards.rb +67 -0
- data/lib/rcs/types/rcs_link_result.rb +75 -0
- data/lib/rcs/types/rcs_validate_content_media.rb +17 -3
- data/lib/rcs/types/rcs_whitelist_response.rb +58 -0
- 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/rcs.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +35 -5
- metadata +40 -9
- data/lib/rcs/types/click_action.rb +0 -73
- data/lib/rcs/types/click_action_data_metadata.rb +0 -69
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "message_event_sms_content"
|
|
5
|
+
require_relative "message_event_mms_content"
|
|
6
|
+
require_relative "message_event_rcs_text_content"
|
|
7
|
+
require_relative "message_event_rcs_media_content"
|
|
8
|
+
require_relative "message_event_rcs_cards_content"
|
|
9
|
+
require_relative "message_event_rcs_button_data"
|
|
10
|
+
require_relative "message_event_rcs_location_data"
|
|
11
|
+
|
|
12
|
+
module Pinnacle
|
|
13
|
+
module Types
|
|
14
|
+
# Content of an incoming or outgoing message. Discriminated by the `type` field.
|
|
15
|
+
class MessageEventContent
|
|
16
|
+
# Deserialize a JSON object to an instance of MessageEventContent
|
|
17
|
+
#
|
|
18
|
+
# @param json_object [String]
|
|
19
|
+
# @return [Pinnacle::Types::MessageEventContent]
|
|
20
|
+
def self.from_json(json_object:)
|
|
21
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
22
|
+
begin
|
|
23
|
+
Pinnacle::Types::MessageEventSmsContent.validate_raw(obj: struct)
|
|
24
|
+
return Pinnacle::Types::MessageEventSmsContent.from_json(json_object: struct) unless struct.nil?
|
|
25
|
+
|
|
26
|
+
return nil
|
|
27
|
+
rescue StandardError
|
|
28
|
+
# noop
|
|
29
|
+
end
|
|
30
|
+
begin
|
|
31
|
+
Pinnacle::Types::MessageEventMmsContent.validate_raw(obj: struct)
|
|
32
|
+
return Pinnacle::Types::MessageEventMmsContent.from_json(json_object: struct) unless struct.nil?
|
|
33
|
+
|
|
34
|
+
return nil
|
|
35
|
+
rescue StandardError
|
|
36
|
+
# noop
|
|
37
|
+
end
|
|
38
|
+
begin
|
|
39
|
+
Pinnacle::Types::MessageEventRcsTextContent.validate_raw(obj: struct)
|
|
40
|
+
return Pinnacle::Types::MessageEventRcsTextContent.from_json(json_object: struct) unless struct.nil?
|
|
41
|
+
|
|
42
|
+
return nil
|
|
43
|
+
rescue StandardError
|
|
44
|
+
# noop
|
|
45
|
+
end
|
|
46
|
+
begin
|
|
47
|
+
Pinnacle::Types::MessageEventRcsMediaContent.validate_raw(obj: struct)
|
|
48
|
+
return Pinnacle::Types::MessageEventRcsMediaContent.from_json(json_object: struct) unless struct.nil?
|
|
49
|
+
|
|
50
|
+
return nil
|
|
51
|
+
rescue StandardError
|
|
52
|
+
# noop
|
|
53
|
+
end
|
|
54
|
+
begin
|
|
55
|
+
Pinnacle::Types::MessageEventRcsCardsContent.validate_raw(obj: struct)
|
|
56
|
+
return Pinnacle::Types::MessageEventRcsCardsContent.from_json(json_object: struct) unless struct.nil?
|
|
57
|
+
|
|
58
|
+
return nil
|
|
59
|
+
rescue StandardError
|
|
60
|
+
# noop
|
|
61
|
+
end
|
|
62
|
+
begin
|
|
63
|
+
Pinnacle::Types::MessageEventRcsButtonData.validate_raw(obj: struct)
|
|
64
|
+
return Pinnacle::Types::MessageEventRcsButtonData.from_json(json_object: struct) unless struct.nil?
|
|
65
|
+
|
|
66
|
+
return nil
|
|
67
|
+
rescue StandardError
|
|
68
|
+
# noop
|
|
69
|
+
end
|
|
70
|
+
begin
|
|
71
|
+
Pinnacle::Types::MessageEventRcsLocationData.validate_raw(obj: struct)
|
|
72
|
+
return Pinnacle::Types::MessageEventRcsLocationData.from_json(json_object: struct) unless struct.nil?
|
|
73
|
+
|
|
74
|
+
return nil
|
|
75
|
+
rescue StandardError
|
|
76
|
+
# noop
|
|
77
|
+
end
|
|
78
|
+
struct
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
82
|
+
# hash and check each fields type against the current object's property
|
|
83
|
+
# definitions.
|
|
84
|
+
#
|
|
85
|
+
# @param obj [Object]
|
|
86
|
+
# @return [Void]
|
|
87
|
+
def self.validate_raw(obj:)
|
|
88
|
+
begin
|
|
89
|
+
return Pinnacle::Types::MessageEventSmsContent.validate_raw(obj: obj)
|
|
90
|
+
rescue StandardError
|
|
91
|
+
# noop
|
|
92
|
+
end
|
|
93
|
+
begin
|
|
94
|
+
return Pinnacle::Types::MessageEventMmsContent.validate_raw(obj: obj)
|
|
95
|
+
rescue StandardError
|
|
96
|
+
# noop
|
|
97
|
+
end
|
|
98
|
+
begin
|
|
99
|
+
return Pinnacle::Types::MessageEventRcsTextContent.validate_raw(obj: obj)
|
|
100
|
+
rescue StandardError
|
|
101
|
+
# noop
|
|
102
|
+
end
|
|
103
|
+
begin
|
|
104
|
+
return Pinnacle::Types::MessageEventRcsMediaContent.validate_raw(obj: obj)
|
|
105
|
+
rescue StandardError
|
|
106
|
+
# noop
|
|
107
|
+
end
|
|
108
|
+
begin
|
|
109
|
+
return Pinnacle::Types::MessageEventRcsCardsContent.validate_raw(obj: obj)
|
|
110
|
+
rescue StandardError
|
|
111
|
+
# noop
|
|
112
|
+
end
|
|
113
|
+
begin
|
|
114
|
+
return Pinnacle::Types::MessageEventRcsButtonData.validate_raw(obj: obj)
|
|
115
|
+
rescue StandardError
|
|
116
|
+
# noop
|
|
117
|
+
end
|
|
118
|
+
begin
|
|
119
|
+
return Pinnacle::Types::MessageEventRcsLocationData.validate_raw(obj: obj)
|
|
120
|
+
rescue StandardError
|
|
121
|
+
# noop
|
|
122
|
+
end
|
|
123
|
+
raise("Passed value matched no type within the union, validation failed.")
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
# Conversation metadata containing the conversation ID, sender, and recipient
|
|
9
|
+
# information.
|
|
10
|
+
class MessageEventConversation
|
|
11
|
+
# @return [String] Unique identifier for the conversation. This identifier is a string that always
|
|
12
|
+
# begins with the prefix `conv_`, for example: `conv_1234567890`. <br><br>
|
|
13
|
+
# To get more conversation details, use the [POST
|
|
14
|
+
# /conversations/get](/api-reference/conversations/get) endpoint.
|
|
15
|
+
attr_reader :id
|
|
16
|
+
# @return [String] Sender's phone number or agent ID.
|
|
17
|
+
attr_reader :from
|
|
18
|
+
# @return [String] Recipient's phone number.
|
|
19
|
+
attr_reader :to
|
|
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 id [String] Unique identifier for the conversation. This identifier is a string that always
|
|
29
|
+
# begins with the prefix `conv_`, for example: `conv_1234567890`. <br><br>
|
|
30
|
+
# To get more conversation details, use the [POST
|
|
31
|
+
# /conversations/get](/api-reference/conversations/get) endpoint.
|
|
32
|
+
# @param from [String] Sender's phone number or agent ID.
|
|
33
|
+
# @param to [String] Recipient's phone number.
|
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
35
|
+
# @return [Pinnacle::Types::MessageEventConversation]
|
|
36
|
+
def initialize(id:, from:, to:, additional_properties: nil)
|
|
37
|
+
@id = id
|
|
38
|
+
@from = from
|
|
39
|
+
@to = to
|
|
40
|
+
@additional_properties = additional_properties
|
|
41
|
+
@_field_set = { "id": id, "from": from, "to": to }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Deserialize a JSON object to an instance of MessageEventConversation
|
|
45
|
+
#
|
|
46
|
+
# @param json_object [String]
|
|
47
|
+
# @return [Pinnacle::Types::MessageEventConversation]
|
|
48
|
+
def self.from_json(json_object:)
|
|
49
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
50
|
+
parsed_json = JSON.parse(json_object)
|
|
51
|
+
id = parsed_json["id"]
|
|
52
|
+
from = parsed_json["from"]
|
|
53
|
+
to = parsed_json["to"]
|
|
54
|
+
new(
|
|
55
|
+
id: id,
|
|
56
|
+
from: from,
|
|
57
|
+
to: to,
|
|
58
|
+
additional_properties: struct
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Serialize an instance of MessageEventConversation to a JSON object
|
|
63
|
+
#
|
|
64
|
+
# @return [String]
|
|
65
|
+
def to_json(*_args)
|
|
66
|
+
@_field_set&.to_json
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
70
|
+
# hash and check each fields type against the current object's property
|
|
71
|
+
# definitions.
|
|
72
|
+
#
|
|
73
|
+
# @param obj [Object]
|
|
74
|
+
# @return [Void]
|
|
75
|
+
def self.validate_raw(obj:)
|
|
76
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
77
|
+
obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
|
|
78
|
+
obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
# MMS message with text and/or media files from a phone number.
|
|
9
|
+
class MessageEventMmsContent
|
|
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 [Array<String>] URLs of media files in this message. <br>
|
|
18
|
+
# See [supported media
|
|
19
|
+
# types](https://app.pinnacle.sh/supported-file-types?type=MMS).
|
|
20
|
+
attr_reader :media_urls
|
|
21
|
+
# @return [String] Text content that may accompany the media files.
|
|
22
|
+
attr_reader :text
|
|
23
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
24
|
+
attr_reader :additional_properties
|
|
25
|
+
# @return [Object]
|
|
26
|
+
attr_reader :_field_set
|
|
27
|
+
protected :_field_set
|
|
28
|
+
|
|
29
|
+
OMIT = Object.new
|
|
30
|
+
|
|
31
|
+
# @param type [String] Message type identifier.
|
|
32
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
33
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
34
|
+
# To get the message details, use the [GET
|
|
35
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
36
|
+
# @param media_urls [Array<String>] URLs of media files in this message. <br>
|
|
37
|
+
# See [supported media
|
|
38
|
+
# types](https://app.pinnacle.sh/supported-file-types?type=MMS).
|
|
39
|
+
# @param text [String] Text content that may accompany the media files.
|
|
40
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
41
|
+
# @return [Pinnacle::Types::MessageEventMmsContent]
|
|
42
|
+
def initialize(type:, id:, media_urls:, text: OMIT, additional_properties: nil)
|
|
43
|
+
@type = type
|
|
44
|
+
@id = id
|
|
45
|
+
@media_urls = media_urls
|
|
46
|
+
@text = text if text != OMIT
|
|
47
|
+
@additional_properties = additional_properties
|
|
48
|
+
@_field_set = { "type": type, "id": id, "mediaUrls": media_urls, "text": text }.reject do |_k, v|
|
|
49
|
+
v == OMIT
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Deserialize a JSON object to an instance of MessageEventMmsContent
|
|
54
|
+
#
|
|
55
|
+
# @param json_object [String]
|
|
56
|
+
# @return [Pinnacle::Types::MessageEventMmsContent]
|
|
57
|
+
def self.from_json(json_object:)
|
|
58
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
59
|
+
parsed_json = JSON.parse(json_object)
|
|
60
|
+
type = parsed_json["type"]
|
|
61
|
+
id = parsed_json["id"]
|
|
62
|
+
media_urls = parsed_json["mediaUrls"]
|
|
63
|
+
text = parsed_json["text"]
|
|
64
|
+
new(
|
|
65
|
+
type: type,
|
|
66
|
+
id: id,
|
|
67
|
+
media_urls: media_urls,
|
|
68
|
+
text: text,
|
|
69
|
+
additional_properties: struct
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Serialize an instance of MessageEventMmsContent 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_urls.is_a?(Array) != false || raise("Passed value for field obj.media_urls is not the expected type, validation failed.")
|
|
90
|
+
obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "button_clicked_data_button"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Types
|
|
9
|
+
# Button click event data received when a user clicks on an RCS button or quick
|
|
10
|
+
# reply (excluding `requestUserLocation` buttons).
|
|
11
|
+
# This event contains information about which button was clicked, how many times
|
|
12
|
+
# it's been clicked, and any payload or metadata attached to the button. Use this
|
|
13
|
+
# data to handle user interactions with your RCS messages.
|
|
14
|
+
class MessageEventRcsButtonData
|
|
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::ButtonClickedDataButton] Information about the button that was clicked.
|
|
23
|
+
attr_reader :button
|
|
24
|
+
# @return [String] ID of the message this button was sent in, or null if not available. To get the
|
|
25
|
+
# message details, use the [GET /messages/{id}](/api-reference/messages/get)
|
|
26
|
+
# endpoint.
|
|
27
|
+
attr_reader :message_id
|
|
28
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
29
|
+
attr_reader :additional_properties
|
|
30
|
+
# @return [Object]
|
|
31
|
+
attr_reader :_field_set
|
|
32
|
+
protected :_field_set
|
|
33
|
+
|
|
34
|
+
OMIT = Object.new
|
|
35
|
+
|
|
36
|
+
# @param type [String] Message type identifier.
|
|
37
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
38
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
39
|
+
# To get the message details, use the [GET
|
|
40
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
41
|
+
# @param button [Pinnacle::Types::ButtonClickedDataButton] Information about the button that was clicked.
|
|
42
|
+
# @param message_id [String] ID of the message this button was sent in, or null if not available. To get the
|
|
43
|
+
# message details, use the [GET /messages/{id}](/api-reference/messages/get)
|
|
44
|
+
# endpoint.
|
|
45
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
46
|
+
# @return [Pinnacle::Types::MessageEventRcsButtonData]
|
|
47
|
+
def initialize(type:, id:, button:, message_id: OMIT, additional_properties: nil)
|
|
48
|
+
@type = type
|
|
49
|
+
@id = id
|
|
50
|
+
@button = button
|
|
51
|
+
@message_id = message_id if message_id != OMIT
|
|
52
|
+
@additional_properties = additional_properties
|
|
53
|
+
@_field_set = { "type": type, "id": id, "button": button, "messageId": message_id }.reject do |_k, v|
|
|
54
|
+
v == OMIT
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Deserialize a JSON object to an instance of MessageEventRcsButtonData
|
|
59
|
+
#
|
|
60
|
+
# @param json_object [String]
|
|
61
|
+
# @return [Pinnacle::Types::MessageEventRcsButtonData]
|
|
62
|
+
def self.from_json(json_object:)
|
|
63
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
64
|
+
parsed_json = JSON.parse(json_object)
|
|
65
|
+
type = parsed_json["type"]
|
|
66
|
+
id = parsed_json["id"]
|
|
67
|
+
if parsed_json["button"].nil?
|
|
68
|
+
button = nil
|
|
69
|
+
else
|
|
70
|
+
button = parsed_json["button"].to_json
|
|
71
|
+
button = Pinnacle::Types::ButtonClickedDataButton.from_json(json_object: button)
|
|
72
|
+
end
|
|
73
|
+
message_id = parsed_json["messageId"]
|
|
74
|
+
new(
|
|
75
|
+
type: type,
|
|
76
|
+
id: id,
|
|
77
|
+
button: button,
|
|
78
|
+
message_id: message_id,
|
|
79
|
+
additional_properties: struct
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Serialize an instance of MessageEventRcsButtonData to a JSON object
|
|
84
|
+
#
|
|
85
|
+
# @return [String]
|
|
86
|
+
def to_json(*_args)
|
|
87
|
+
@_field_set&.to_json
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
91
|
+
# hash and check each fields type against the current object's property
|
|
92
|
+
# definitions.
|
|
93
|
+
#
|
|
94
|
+
# @param obj [Object]
|
|
95
|
+
# @return [Void]
|
|
96
|
+
def self.validate_raw(obj:)
|
|
97
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
98
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
99
|
+
Pinnacle::Types::ButtonClickedDataButton.validate_raw(obj: obj.button)
|
|
100
|
+
obj.message_id&.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.")
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "message_event_rcs_cards_content_cards_item"
|
|
4
|
+
require_relative "rich_button"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module Pinnacle
|
|
9
|
+
module Types
|
|
10
|
+
# RCS message containing cards, each with its own title, subtitle, and/or buttons.
|
|
11
|
+
# Quick replies can also be added. <br>
|
|
12
|
+
# See [supported file
|
|
13
|
+
# types](https://app.pinnacle.sh/supported-file-types?type=RCS-CARD).
|
|
14
|
+
class MessageEventRcsCardsContent
|
|
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 [Array<Pinnacle::Types::MessageEventRcsCardsContentCardsItem>] Collection of cards attached to the message.
|
|
23
|
+
attr_reader :cards
|
|
24
|
+
# @return [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
25
|
+
attr_reader :quick_replies
|
|
26
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
attr_reader :additional_properties
|
|
28
|
+
# @return [Object]
|
|
29
|
+
attr_reader :_field_set
|
|
30
|
+
protected :_field_set
|
|
31
|
+
|
|
32
|
+
OMIT = Object.new
|
|
33
|
+
|
|
34
|
+
# @param type [String] Message type identifier.
|
|
35
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
36
|
+
# with the prefix `msg_`, for example: `msg_1234567890`. <br><br>
|
|
37
|
+
# To get the message details, use the [GET
|
|
38
|
+
# /messages/{id}](/api-reference/messages/get) endpoint.
|
|
39
|
+
# @param cards [Array<Pinnacle::Types::MessageEventRcsCardsContentCardsItem>] Collection of cards attached to the message.
|
|
40
|
+
# @param quick_replies [Array<Pinnacle::Types::RichButton>] List of interactive quick reply buttons in the message.
|
|
41
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
42
|
+
# @return [Pinnacle::Types::MessageEventRcsCardsContent]
|
|
43
|
+
def initialize(type:, id:, cards:, quick_replies:, additional_properties: nil)
|
|
44
|
+
@type = type
|
|
45
|
+
@id = id
|
|
46
|
+
@cards = cards
|
|
47
|
+
@quick_replies = quick_replies
|
|
48
|
+
@additional_properties = additional_properties
|
|
49
|
+
@_field_set = { "type": type, "id": id, "cards": cards, "quickReplies": quick_replies }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Deserialize a JSON object to an instance of MessageEventRcsCardsContent
|
|
53
|
+
#
|
|
54
|
+
# @param json_object [String]
|
|
55
|
+
# @return [Pinnacle::Types::MessageEventRcsCardsContent]
|
|
56
|
+
def self.from_json(json_object:)
|
|
57
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
58
|
+
parsed_json = JSON.parse(json_object)
|
|
59
|
+
type = parsed_json["type"]
|
|
60
|
+
id = parsed_json["id"]
|
|
61
|
+
cards = parsed_json["cards"]&.map do |item|
|
|
62
|
+
item = item.to_json
|
|
63
|
+
Pinnacle::Types::MessageEventRcsCardsContentCardsItem.from_json(json_object: item)
|
|
64
|
+
end
|
|
65
|
+
quick_replies = parsed_json["quickReplies"]&.map do |item|
|
|
66
|
+
item = item.to_json
|
|
67
|
+
Pinnacle::Types::RichButton.from_json(json_object: item)
|
|
68
|
+
end
|
|
69
|
+
new(
|
|
70
|
+
type: type,
|
|
71
|
+
id: id,
|
|
72
|
+
cards: cards,
|
|
73
|
+
quick_replies: quick_replies,
|
|
74
|
+
additional_properties: struct
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Serialize an instance of MessageEventRcsCardsContent to a JSON object
|
|
79
|
+
#
|
|
80
|
+
# @return [String]
|
|
81
|
+
def to_json(*_args)
|
|
82
|
+
@_field_set&.to_json
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
86
|
+
# hash and check each fields type against the current object's property
|
|
87
|
+
# definitions.
|
|
88
|
+
#
|
|
89
|
+
# @param obj [Object]
|
|
90
|
+
# @return [Void]
|
|
91
|
+
def self.validate_raw(obj:)
|
|
92
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
93
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
94
|
+
obj.cards.is_a?(Array) != false || raise("Passed value for field obj.cards is not the expected type, validation failed.")
|
|
95
|
+
obj.quick_replies.is_a?(Array) != false || raise("Passed value for field obj.quick_replies is not the expected type, validation failed.")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -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
|