rcs 2.0.0.pre.rc.5 → 2.0.1

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rcs/brands/client.rb +36 -24
  3. data/lib/rcs/campaigns/dlc/client.rb +36 -26
  4. data/lib/rcs/campaigns/rcs/client.rb +26 -22
  5. data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +6 -6
  6. data/lib/rcs/campaigns/toll_free/client.rb +32 -26
  7. data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +6 -6
  8. data/lib/rcs/contacts/client.rb +10 -8
  9. data/lib/rcs/conversations/client.rb +144 -16
  10. data/lib/rcs/conversations/types/conversations_list_messages_request_direction.rb +12 -0
  11. data/lib/rcs/conversations/types/conversations_list_messages_request_sort_order.rb +12 -0
  12. data/lib/rcs/conversations/types/conversations_list_messages_request_status.rb +17 -0
  13. data/lib/rcs/conversations/types/conversations_list_messages_request_type.rb +13 -0
  14. data/lib/rcs/messages/client.rb +12 -29
  15. data/lib/rcs/messages/rcs/client.rb +125 -1
  16. data/lib/rcs/messages/rcs/types/send_typing_indicator_schema_options.rb +66 -0
  17. data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
  18. data/lib/rcs/phone_numbers/client.rb +0 -14
  19. data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
  20. data/lib/rcs/rcs/client.rb +32 -18
  21. data/lib/rcs/status/get/client.rb +32 -16
  22. data/lib/rcs/tools/contact_card/client.rb +18 -8
  23. data/lib/rcs/tools/file/client.rb +92 -2
  24. data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
  25. data/lib/rcs/tools/url/client.rb +4 -2
  26. data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
  27. data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
  28. data/lib/rcs/types/autofill_campaign_params.rb +15 -3
  29. data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
  30. data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
  31. data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
  32. data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
  33. data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
  34. data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
  35. data/lib/rcs/types/brand_status.rb +5 -3
  36. data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
  37. data/lib/rcs/types/button_clicked_data.rb +80 -0
  38. data/lib/rcs/types/button_clicked_data_button.rb +118 -0
  39. data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
  40. data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
  41. data/lib/rcs/types/campaign_query.rb +10 -2
  42. data/lib/rcs/types/contact.rb +5 -3
  43. data/lib/rcs/types/contact_id.rb +5 -3
  44. data/lib/rcs/types/conversation.rb +16 -8
  45. data/lib/rcs/types/conversation_by_id_params.rb +7 -3
  46. data/lib/rcs/types/conversation_contact.rb +5 -3
  47. data/lib/rcs/types/conversation_list.rb +50 -28
  48. data/lib/rcs/types/create_url_options.rb +4 -2
  49. data/lib/rcs/types/detached_webhook_info.rb +5 -3
  50. data/lib/rcs/types/dlc_campaign_status.rb +5 -3
  51. data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
  52. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
  53. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
  54. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
  55. data/lib/rcs/types/extended_brand.rb +25 -13
  56. data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
  57. data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
  58. data/lib/rcs/types/link_click_event.rb +1 -17
  59. data/lib/rcs/types/message.rb +5 -3
  60. data/lib/rcs/types/message_content.rb +4 -4
  61. data/lib/rcs/types/message_event.rb +143 -0
  62. data/lib/rcs/types/message_event_content.rb +127 -0
  63. data/lib/rcs/types/message_event_conversation.rb +82 -0
  64. data/lib/rcs/types/message_event_direction.rb +11 -0
  65. data/lib/rcs/types/message_event_mms_content.rb +94 -0
  66. data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
  67. data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
  68. data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
  69. data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
  70. data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
  71. data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
  72. data/lib/rcs/types/message_event_sms_content.rb +81 -0
  73. data/lib/rcs/types/{retrieved_conversations.rb → message_list.rb} +26 -25
  74. data/lib/rcs/types/message_with_reaction.rb +197 -0
  75. data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
  76. data/lib/rcs/types/{error_response.rb → not_found_error_body.rb} +7 -7
  77. data/lib/rcs/types/options.rb +111 -0
  78. data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
  79. data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
  80. data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
  81. data/lib/rcs/types/profile_status_enum.rb +4 -4
  82. data/lib/rcs/types/rcs_base_options.rb +12 -1
  83. data/lib/rcs/types/rcs_button_call.rb +11 -2
  84. data/lib/rcs/types/rcs_button_open_url.rb +38 -2
  85. data/lib/rcs/types/rcs_button_open_url_webview_mode.rb +19 -0
  86. data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
  87. data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
  88. data/lib/rcs/types/rcs_button_send_location.rb +22 -2
  89. data/lib/rcs/types/rcs_button_trigger.rb +8 -6
  90. data/lib/rcs/types/rcs_campaign.rb +3 -3
  91. data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +8 -8
  92. data/lib/rcs/types/rcs_campaign_status.rb +5 -3
  93. data/lib/rcs/types/reaction_result.rb +10 -6
  94. data/lib/rcs/types/refreshed_file.rb +67 -0
  95. data/lib/rcs/types/rich_cards_message.rb +10 -10
  96. data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
  97. data/lib/rcs/types/scheduled_messaage.rb +5 -3
  98. data/lib/rcs/types/send_rcs_card_options.rb +132 -0
  99. data/lib/rcs/types/send_rcs_card_options_standalone_card.rb +78 -0
  100. data/lib/rcs/types/send_rcs_card_options_standalone_card_image_alignment.rb +12 -0
  101. data/lib/rcs/types/send_rcs_card_options_standalone_card_orientation.rb +11 -0
  102. data/lib/rcs/types/send_typing_indicator_response.rb +100 -0
  103. data/lib/rcs/types/sent_mms_details.rb +4 -2
  104. data/lib/rcs/types/sent_rcs_details.rb +12 -13
  105. data/lib/rcs/types/sent_sms_details.rb +5 -3
  106. data/lib/rcs/types/toll_free_campaign.rb +3 -3
  107. data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
  108. data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
  109. data/lib/rcs/types/updated_contact_id.rb +5 -3
  110. data/lib/rcs/types/user_event.rb +83 -0
  111. data/lib/rcs/types/user_event_conversation.rb +78 -0
  112. data/lib/rcs/types/v_card_data.rb +5 -3
  113. data/lib/rcs/types/validate_campaign_params.rb +15 -3
  114. data/lib/rcs/types/vcard.rb +5 -3
  115. data/lib/rcs/types/vcard_content.rb +5 -3
  116. data/lib/rcs/types/vcard_resource.rb +5 -3
  117. data/lib/rcs/types/webhook_event_enum.rb +1 -0
  118. data/lib/rcs/types/webhooks.rb +5 -3
  119. data/lib/requests.rb +2 -2
  120. data/lib/types_export.rb +37 -7
  121. metadata +41 -11
  122. data/lib/rcs/types/click_action.rb +0 -73
  123. data/lib/rcs/types/click_action_data_metadata.rb +0 -69
@@ -40,8 +40,6 @@ module Pinnacle
40
40
  attr_reader :fingerprint_id
41
41
  # @return [String] Google Click Identifier.
42
42
  attr_reader :gclid
43
- # @return [Integer] Unique identifier for the click event.
44
- attr_reader :id
45
43
  # @return [String] IP address of the visitor (may be anonymized).
46
44
  attr_reader :ip_address
47
45
  # @return [Array<String>] Chain of IP addresses for proxied requests.
@@ -52,8 +50,6 @@ module Pinnacle
52
50
  attr_reader :latency_ms
53
51
  # @return [Float] Geographic latitude.
54
52
  attr_reader :latitude
55
- # @return [Integer] ID of your shortened URL.
56
- attr_reader :link_id
57
53
  # @return [Float] Geographic longitude.
58
54
  attr_reader :longitude
59
55
  # @return [Hash{String => Object}] Additional metadata as JSON object.
@@ -133,13 +129,11 @@ module Pinnacle
133
129
  # @param final_url [String] Final resolved URL after redirects.
134
130
  # @param fingerprint_id [String] Unique fingerprint identifier for the client.
135
131
  # @param gclid [String] Google Click Identifier.
136
- # @param id [Integer] Unique identifier for the click event.
137
132
  # @param ip_address [String] IP address of the visitor (may be anonymized).
138
133
  # @param ip_chain [Array<String>] Chain of IP addresses for proxied requests.
139
134
  # @param is_bot [Boolean] Whether the request was identified as coming from a bot.
140
135
  # @param latency_ms [Integer] Request latency in milliseconds.
141
136
  # @param latitude [Float] Geographic latitude.
142
- # @param link_id [Integer] ID of your shortened URL.
143
137
  # @param longitude [Float] Geographic longitude.
144
138
  # @param metadata [Hash{String => Object}] Additional metadata as JSON object.
145
139
  # @param method_ [String] HTTP method used.
@@ -169,7 +163,7 @@ module Pinnacle
169
163
  # @param utm_term [String] UTM term.
170
164
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
171
165
  # @return [Pinnacle::Types::LinkClickEvent]
172
- def initialize(created_at:, id:, link_id:, accept_language: OMIT, accuracy_radius_km: OMIT, asn: OMIT, blocked_reason: OMIT,
166
+ def initialize(created_at:, accept_language: OMIT, accuracy_radius_km: OMIT, asn: OMIT, blocked_reason: OMIT,
173
167
  ch_ua_brand: OMIT, ch_ua_mobile: OMIT, ch_ua_platform: OMIT, city: OMIT, color_depth: OMIT, connection_type: OMIT, country: OMIT, error_details: OMIT, fbclid: OMIT, final_url: OMIT, fingerprint_id: OMIT, gclid: OMIT, ip_address: OMIT, ip_chain: OMIT, is_bot: OMIT, latency_ms: OMIT, latitude: OMIT, longitude: OMIT, metadata: OMIT, method_: OMIT, metro_code: OMIT, network_downlink: OMIT, network_rtt: OMIT, performance_ttfb_ms: OMIT, postal_code: OMIT, redirect_hops: OMIT, referrer: OMIT, referrer_domain: OMIT, region: OMIT, resolved_at: OMIT, screen_res: OMIT, status_code: OMIT, timezone_offset_min: OMIT, tor_exit_node: OMIT, ua_browser: OMIT, ua_device: OMIT, ua_os: OMIT, ua_version: OMIT, user_agent: OMIT, utm_campaign: OMIT, utm_content: OMIT, utm_medium: OMIT, utm_source: OMIT, utm_term: OMIT, additional_properties: nil)
174
168
  @accept_language = accept_language if accept_language != OMIT
175
169
  @accuracy_radius_km = accuracy_radius_km if accuracy_radius_km != OMIT
@@ -188,13 +182,11 @@ module Pinnacle
188
182
  @final_url = final_url if final_url != OMIT
189
183
  @fingerprint_id = fingerprint_id if fingerprint_id != OMIT
190
184
  @gclid = gclid if gclid != OMIT
191
- @id = id
192
185
  @ip_address = ip_address if ip_address != OMIT
193
186
  @ip_chain = ip_chain if ip_chain != OMIT
194
187
  @is_bot = is_bot if is_bot != OMIT
195
188
  @latency_ms = latency_ms if latency_ms != OMIT
196
189
  @latitude = latitude if latitude != OMIT
197
- @link_id = link_id
198
190
  @longitude = longitude if longitude != OMIT
199
191
  @metadata = metadata if metadata != OMIT
200
192
  @method_ = method_ if method_ != OMIT
@@ -241,13 +233,11 @@ module Pinnacle
241
233
  "final_url": final_url,
242
234
  "fingerprint_id": fingerprint_id,
243
235
  "gclid": gclid,
244
- "id": id,
245
236
  "ip_address": ip_address,
246
237
  "ip_chain": ip_chain,
247
238
  "is_bot": is_bot,
248
239
  "latency_ms": latency_ms,
249
240
  "latitude": latitude,
250
- "link_id": link_id,
251
241
  "longitude": longitude,
252
242
  "metadata": metadata,
253
243
  "method": method_,
@@ -304,13 +294,11 @@ module Pinnacle
304
294
  final_url = parsed_json["final_url"]
305
295
  fingerprint_id = parsed_json["fingerprint_id"]
306
296
  gclid = parsed_json["gclid"]
307
- id = parsed_json["id"]
308
297
  ip_address = parsed_json["ip_address"]
309
298
  ip_chain = parsed_json["ip_chain"]
310
299
  is_bot = parsed_json["is_bot"]
311
300
  latency_ms = parsed_json["latency_ms"]
312
301
  latitude = parsed_json["latitude"]
313
- link_id = parsed_json["link_id"]
314
302
  longitude = parsed_json["longitude"]
315
303
  metadata = parsed_json["metadata"]
316
304
  method_ = parsed_json["method"]
@@ -356,13 +344,11 @@ module Pinnacle
356
344
  final_url: final_url,
357
345
  fingerprint_id: fingerprint_id,
358
346
  gclid: gclid,
359
- id: id,
360
347
  ip_address: ip_address,
361
348
  ip_chain: ip_chain,
362
349
  is_bot: is_bot,
363
350
  latency_ms: latency_ms,
364
351
  latitude: latitude,
365
- link_id: link_id,
366
352
  longitude: longitude,
367
353
  metadata: metadata,
368
354
  method_: method_,
@@ -425,13 +411,11 @@ module Pinnacle
425
411
  obj.final_url&.is_a?(String) != false || raise("Passed value for field obj.final_url is not the expected type, validation failed.")
426
412
  obj.fingerprint_id&.is_a?(String) != false || raise("Passed value for field obj.fingerprint_id is not the expected type, validation failed.")
427
413
  obj.gclid&.is_a?(String) != false || raise("Passed value for field obj.gclid is not the expected type, validation failed.")
428
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
429
414
  obj.ip_address&.is_a?(String) != false || raise("Passed value for field obj.ip_address is not the expected type, validation failed.")
430
415
  obj.ip_chain&.is_a?(Array) != false || raise("Passed value for field obj.ip_chain is not the expected type, validation failed.")
431
416
  obj.is_bot&.is_a?(Boolean) != false || raise("Passed value for field obj.is_bot is not the expected type, validation failed.")
432
417
  obj.latency_ms&.is_a?(Integer) != false || raise("Passed value for field obj.latency_ms is not the expected type, validation failed.")
433
418
  obj.latitude&.is_a?(Float) != false || raise("Passed value for field obj.latitude is not the expected type, validation failed.")
434
- obj.link_id.is_a?(Integer) != false || raise("Passed value for field obj.link_id is not the expected type, validation failed.")
435
419
  obj.longitude&.is_a?(Float) != false || raise("Passed value for field obj.longitude is not the expected type, validation failed.")
436
420
  obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
437
421
  obj.method_&.is_a?(String) != false || raise("Passed value for field obj.method_ is not the expected type, validation failed.")
@@ -23,7 +23,8 @@ module Pinnacle
23
23
  # <br>
24
24
  # Null indicates no errors.
25
25
  attr_reader :error
26
- # @return [Integer] Unique identifier of the message.
26
+ # @return [String] Unique identifier of the message. This identifier is a string that always begins
27
+ # with the prefix `msg_`, for example: `msg_1234567890`.
27
28
  attr_reader :id
28
29
  # @return [Pinnacle::Types::MessageMethodEnum]
29
30
  attr_reader :method_
@@ -57,7 +58,8 @@ module Pinnacle
57
58
  # @param error [String] Detailed explanation of any errors that occurred while delivering the message.
58
59
  # <br>
59
60
  # Null indicates no errors.
60
- # @param id [Integer] Unique identifier of the message.
61
+ # @param id [String] Unique identifier of the message. This identifier is a string that always begins
62
+ # with the prefix `msg_`, for example: `msg_1234567890`.
61
63
  # @param method_ [Pinnacle::Types::MessageMethodEnum]
62
64
  # @param num_segments [Integer] Number of segments the message was split into for delivery.
63
65
  # @param receiver [String] Phone number that received the message in E.164 format.
@@ -160,7 +162,7 @@ module Pinnacle
160
162
  obj.cost&.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.")
161
163
  obj.delivered_at&.is_a?(String) != false || raise("Passed value for field obj.delivered_at is not the expected type, validation failed.")
162
164
  obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
163
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
165
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
164
166
  obj.method_.is_a?(Pinnacle::Types::MessageMethodEnum) != false || raise("Passed value for field obj.method_ is not the expected type, validation failed.")
165
167
  obj.num_segments.is_a?(Integer) != false || raise("Passed value for field obj.num_segments is not the expected type, validation failed.")
166
168
  obj.receiver.is_a?(String) != false || raise("Passed value for field obj.receiver is not the expected type, validation failed.")
@@ -4,7 +4,7 @@ require "json"
4
4
  require_relative "sms_content"
5
5
  require_relative "mms_content"
6
6
  require_relative "rcs_content"
7
- require_relative "inbound_button"
7
+ require_relative "button_clicked"
8
8
 
9
9
  module Pinnacle
10
10
  module Types
@@ -41,8 +41,8 @@ module Pinnacle
41
41
  # noop
42
42
  end
43
43
  begin
44
- Pinnacle::Types::InboundButton.validate_raw(obj: struct)
45
- return Pinnacle::Types::InboundButton.from_json(json_object: struct) unless struct.nil?
44
+ Pinnacle::Types::ButtonClicked.validate_raw(obj: struct)
45
+ return Pinnacle::Types::ButtonClicked.from_json(json_object: struct) unless struct.nil?
46
46
 
47
47
  return nil
48
48
  rescue StandardError
@@ -74,7 +74,7 @@ module Pinnacle
74
74
  # noop
75
75
  end
76
76
  begin
77
- return Pinnacle::Types::InboundButton.validate_raw(obj: obj)
77
+ return Pinnacle::Types::ButtonClicked.validate_raw(obj: obj)
78
78
  rescue StandardError
79
79
  # noop
80
80
  end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "webhook_event_enum"
4
+ require_relative "message_event_conversation"
5
+ require_relative "message_status_enum"
6
+ require_relative "message_event_direction"
7
+ require_relative "message_event_content"
8
+ require "ostruct"
9
+ require "json"
10
+
11
+ module Pinnacle
12
+ module Types
13
+ # Represents an incoming message or message status update received via webhook.
14
+ class MessageEvent
15
+ # @return [Pinnacle::Types::WebhookEventEnum] Type of webhook event. MESSAGE.STATUS for message status updates or
16
+ # MESSAGE.RECEIVED for inbound messages.
17
+ attr_reader :type
18
+ # @return [Pinnacle::Types::MessageEventConversation] Conversation metadata containing the conversation ID, sender, and recipient
19
+ # information.
20
+ attr_reader :conversation
21
+ # @return [Pinnacle::Types::MessageStatusEnum]
22
+ attr_reader :status
23
+ # @return [Pinnacle::Types::MessageEventDirection] Direction of the message flow.
24
+ attr_reader :direction
25
+ # @return [Integer] Number of segments for this message.
26
+ attr_reader :segments
27
+ # @return [String] Timestamp when the message was sent in ISO 8601 format.
28
+ attr_reader :sent_at
29
+ # @return [String] Timestamp when the message was delivered in ISO 8601 format.
30
+ # Null if not yet delivered or for inbound messages.
31
+ attr_reader :delivered_at
32
+ # @return [Pinnacle::Types::MessageEventContent]
33
+ attr_reader :message
34
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
35
+ attr_reader :additional_properties
36
+ # @return [Object]
37
+ attr_reader :_field_set
38
+ protected :_field_set
39
+
40
+ OMIT = Object.new
41
+
42
+ # @param type [Pinnacle::Types::WebhookEventEnum] Type of webhook event. MESSAGE.STATUS for message status updates or
43
+ # MESSAGE.RECEIVED for inbound messages.
44
+ # @param conversation [Pinnacle::Types::MessageEventConversation] Conversation metadata containing the conversation ID, sender, and recipient
45
+ # information.
46
+ # @param status [Pinnacle::Types::MessageStatusEnum]
47
+ # @param direction [Pinnacle::Types::MessageEventDirection] Direction of the message flow.
48
+ # @param segments [Integer] Number of segments for this message.
49
+ # @param sent_at [String] Timestamp when the message was sent in ISO 8601 format.
50
+ # @param delivered_at [String] Timestamp when the message was delivered in ISO 8601 format.
51
+ # Null if not yet delivered or for inbound messages.
52
+ # @param message [Pinnacle::Types::MessageEventContent]
53
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
54
+ # @return [Pinnacle::Types::MessageEvent]
55
+ def initialize(type:, conversation:, status:, direction:, segments:, sent_at:, message:, delivered_at: OMIT,
56
+ additional_properties: nil)
57
+ @type = type
58
+ @conversation = conversation
59
+ @status = status
60
+ @direction = direction
61
+ @segments = segments
62
+ @sent_at = sent_at
63
+ @delivered_at = delivered_at if delivered_at != OMIT
64
+ @message = message
65
+ @additional_properties = additional_properties
66
+ @_field_set = {
67
+ "type": type,
68
+ "conversation": conversation,
69
+ "status": status,
70
+ "direction": direction,
71
+ "segments": segments,
72
+ "sentAt": sent_at,
73
+ "deliveredAt": delivered_at,
74
+ "message": message
75
+ }.reject do |_k, v|
76
+ v == OMIT
77
+ end
78
+ end
79
+
80
+ # Deserialize a JSON object to an instance of MessageEvent
81
+ #
82
+ # @param json_object [String]
83
+ # @return [Pinnacle::Types::MessageEvent]
84
+ def self.from_json(json_object:)
85
+ struct = JSON.parse(json_object, object_class: OpenStruct)
86
+ parsed_json = JSON.parse(json_object)
87
+ type = parsed_json["type"]
88
+ if parsed_json["conversation"].nil?
89
+ conversation = nil
90
+ else
91
+ conversation = parsed_json["conversation"].to_json
92
+ conversation = Pinnacle::Types::MessageEventConversation.from_json(json_object: conversation)
93
+ end
94
+ status = parsed_json["status"]
95
+ direction = parsed_json["direction"]
96
+ segments = parsed_json["segments"]
97
+ sent_at = parsed_json["sentAt"]
98
+ delivered_at = parsed_json["deliveredAt"]
99
+ if parsed_json["message"].nil?
100
+ message = nil
101
+ else
102
+ message = parsed_json["message"].to_json
103
+ message = Pinnacle::Types::MessageEventContent.from_json(json_object: message)
104
+ end
105
+ new(
106
+ type: type,
107
+ conversation: conversation,
108
+ status: status,
109
+ direction: direction,
110
+ segments: segments,
111
+ sent_at: sent_at,
112
+ delivered_at: delivered_at,
113
+ message: message,
114
+ additional_properties: struct
115
+ )
116
+ end
117
+
118
+ # Serialize an instance of MessageEvent to a JSON object
119
+ #
120
+ # @return [String]
121
+ def to_json(*_args)
122
+ @_field_set&.to_json
123
+ end
124
+
125
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
126
+ # hash and check each fields type against the current object's property
127
+ # definitions.
128
+ #
129
+ # @param obj [Object]
130
+ # @return [Void]
131
+ def self.validate_raw(obj:)
132
+ obj.type.is_a?(Pinnacle::Types::WebhookEventEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
133
+ Pinnacle::Types::MessageEventConversation.validate_raw(obj: obj.conversation)
134
+ obj.status.is_a?(Pinnacle::Types::MessageStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
135
+ obj.direction.is_a?(Pinnacle::Types::MessageEventDirection) != false || raise("Passed value for field obj.direction is not the expected type, validation failed.")
136
+ obj.segments.is_a?(Integer) != false || raise("Passed value for field obj.segments is not the expected type, validation failed.")
137
+ obj.sent_at.is_a?(String) != false || raise("Passed value for field obj.sent_at is not the expected type, validation failed.")
138
+ obj.delivered_at&.is_a?(String) != false || raise("Passed value for field obj.delivered_at is not the expected type, validation failed.")
139
+ Pinnacle::Types::MessageEventContent.validate_raw(obj: obj.message)
140
+ end
141
+ end
142
+ end
143
+ end
@@ -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,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Types
5
+ # Direction of the message flow.
6
+ class MessageEventDirection
7
+ INBOUND = "INBOUND"
8
+ OUTBOUND = "OUTBOUND"
9
+ end
10
+ end
11
+ 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