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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rcs/brands/client.rb +36 -24
  3. data/lib/rcs/campaigns/dlc/client.rb +44 -34
  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/rcs/types/upsert_rcs_agent.rb +4 -4
  7. data/lib/rcs/campaigns/toll_free/client.rb +32 -26
  8. data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +6 -6
  9. data/lib/rcs/contacts/client.rb +10 -8
  10. data/lib/rcs/conversations/client.rb +142 -14
  11. data/lib/rcs/conversations/types/conversations_list_messages_request_direction.rb +12 -0
  12. data/lib/rcs/conversations/types/conversations_list_messages_request_sort_order.rb +12 -0
  13. data/lib/rcs/conversations/types/conversations_list_messages_request_status.rb +17 -0
  14. data/lib/rcs/conversations/types/conversations_list_messages_request_type.rb +13 -0
  15. data/lib/rcs/messages/client.rb +12 -29
  16. data/lib/rcs/messages/mms/client.rb +2 -2
  17. data/lib/rcs/messages/rcs/client.rb +1 -1
  18. data/lib/rcs/messages/sms/client.rb +2 -2
  19. data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
  20. data/lib/rcs/phone_numbers/client.rb +0 -14
  21. data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
  22. data/lib/rcs/rcs/client.rb +330 -0
  23. data/lib/rcs/status/get/client.rb +34 -18
  24. data/lib/rcs/tools/contact_card/client.rb +18 -8
  25. data/lib/rcs/tools/file/client.rb +92 -2
  26. data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
  27. data/lib/rcs/tools/url/client.rb +4 -2
  28. data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
  29. data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
  30. data/lib/rcs/types/autofill_campaign_params.rb +15 -3
  31. data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
  32. data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
  33. data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
  34. data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
  35. data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
  36. data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
  37. data/lib/rcs/types/brand_status.rb +5 -3
  38. data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
  39. data/lib/rcs/types/button_clicked_data.rb +80 -0
  40. data/lib/rcs/types/button_clicked_data_button.rb +118 -0
  41. data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
  42. data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
  43. data/lib/rcs/types/campaign_query.rb +10 -2
  44. data/lib/rcs/types/contact.rb +5 -3
  45. data/lib/rcs/types/contact_id.rb +5 -3
  46. data/lib/rcs/types/conversation.rb +16 -8
  47. data/lib/rcs/types/conversation_by_id_params.rb +7 -3
  48. data/lib/rcs/types/conversation_contact.rb +5 -3
  49. data/lib/rcs/types/create_url_options.rb +4 -2
  50. data/lib/rcs/types/detached_webhook_info.rb +5 -3
  51. data/lib/rcs/types/dlc_campaign_status.rb +7 -5
  52. data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
  53. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
  54. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
  55. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
  56. data/lib/rcs/types/extended_brand.rb +25 -13
  57. data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
  58. data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
  59. data/lib/rcs/types/get_dlc_campaign_status_response_updates.rb +1 -1
  60. data/lib/rcs/types/link_click_event.rb +1 -17
  61. data/lib/rcs/types/message.rb +5 -3
  62. data/lib/rcs/types/message_content.rb +4 -4
  63. data/lib/rcs/types/message_event.rb +143 -0
  64. data/lib/rcs/types/message_event_content.rb +127 -0
  65. data/lib/rcs/types/message_event_conversation.rb +82 -0
  66. data/lib/rcs/types/message_event_direction.rb +11 -0
  67. data/lib/rcs/types/message_event_mms_content.rb +94 -0
  68. data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
  69. data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
  70. data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
  71. data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
  72. data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
  73. data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
  74. data/lib/rcs/types/message_event_sms_content.rb +81 -0
  75. data/lib/rcs/types/message_list.rb +79 -0
  76. data/lib/rcs/types/message_schedule.rb +4 -5
  77. data/lib/rcs/types/message_with_reaction.rb +197 -0
  78. data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
  79. data/lib/rcs/types/not_found_error_body.rb +59 -0
  80. data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
  81. data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
  82. data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
  83. data/lib/rcs/types/profile_status_enum.rb +4 -4
  84. data/lib/rcs/types/rcs_base_options.rb +12 -1
  85. data/lib/rcs/types/rcs_button_call.rb +11 -2
  86. data/lib/rcs/types/rcs_button_open_url.rb +11 -2
  87. data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
  88. data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
  89. data/lib/rcs/types/rcs_button_send_location.rb +11 -2
  90. data/lib/rcs/types/rcs_button_trigger.rb +8 -6
  91. data/lib/rcs/types/rcs_campaign.rb +3 -3
  92. data/lib/rcs/types/rcs_campaign_schema_agent.rb +4 -4
  93. data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +12 -12
  94. data/lib/rcs/types/rcs_campaign_status.rb +5 -3
  95. data/lib/rcs/types/rcs_capabilities_result.rb +7 -0
  96. data/lib/rcs/types/rcs_capability.rb +82 -0
  97. data/lib/rcs/types/rcs_capability_actions.rb +105 -0
  98. data/lib/rcs/types/rcs_capability_cards.rb +67 -0
  99. data/lib/rcs/types/rcs_link_result.rb +75 -0
  100. data/lib/rcs/types/rcs_validate_content_media.rb +17 -3
  101. data/lib/rcs/types/rcs_whitelist_response.rb +58 -0
  102. data/lib/rcs/types/reaction_result.rb +10 -6
  103. data/lib/rcs/types/refreshed_file.rb +67 -0
  104. data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
  105. data/lib/rcs/types/scheduled_messaage.rb +5 -3
  106. data/lib/rcs/types/sent_mms_details.rb +4 -2
  107. data/lib/rcs/types/sent_rcs_details.rb +12 -13
  108. data/lib/rcs/types/sent_sms_details.rb +5 -3
  109. data/lib/rcs/types/toll_free_campaign.rb +3 -3
  110. data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
  111. data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
  112. data/lib/rcs/types/updated_contact_id.rb +5 -3
  113. data/lib/rcs/types/user_event.rb +83 -0
  114. data/lib/rcs/types/user_event_conversation.rb +78 -0
  115. data/lib/rcs/types/v_card_data.rb +5 -3
  116. data/lib/rcs/types/validate_campaign_params.rb +15 -3
  117. data/lib/rcs/types/vcard.rb +5 -3
  118. data/lib/rcs/types/vcard_content.rb +5 -3
  119. data/lib/rcs/types/vcard_resource.rb +5 -3
  120. data/lib/rcs/types/webhook_event_enum.rb +1 -0
  121. data/lib/rcs/types/webhooks.rb +5 -3
  122. data/lib/rcs.rb +7 -0
  123. data/lib/requests.rb +2 -2
  124. data/lib/types_export.rb +35 -5
  125. metadata +40 -9
  126. data/lib/rcs/types/click_action.rb +0 -73
  127. data/lib/rcs/types/click_action_data_metadata.rb +0 -69
@@ -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
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "message_with_reaction"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Pinnacle
8
+ module Types
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.
14
+ attr_reader :has_more
15
+ # @return [Integer] Total number of messages in the conversation.
16
+ attr_reader :count
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
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.
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Pinnacle::Types::MessageList]
30
+ def initialize(messages:, has_more:, count:, additional_properties: nil)
31
+ @messages = messages
32
+ @has_more = has_more
33
+ @count = count
34
+ @additional_properties = additional_properties
35
+ @_field_set = { "messages": messages, "hasMore": has_more, "count": count }
36
+ end
37
+
38
+ # Deserialize a JSON object to an instance of MessageList
39
+ #
40
+ # @param json_object [String]
41
+ # @return [Pinnacle::Types::MessageList]
42
+ def self.from_json(json_object:)
43
+ struct = JSON.parse(json_object, object_class: OpenStruct)
44
+ parsed_json = JSON.parse(json_object)
45
+ messages = parsed_json["messages"]&.map do |item|
46
+ item = item.to_json
47
+ Pinnacle::Types::MessageWithReaction.from_json(json_object: item)
48
+ end
49
+ has_more = parsed_json["hasMore"]
50
+ count = parsed_json["count"]
51
+ new(
52
+ messages: messages,
53
+ has_more: has_more,
54
+ count: count,
55
+ additional_properties: struct
56
+ )
57
+ end
58
+
59
+ # Serialize an instance of MessageList to a JSON object
60
+ #
61
+ # @return [String]
62
+ def to_json(*_args)
63
+ @_field_set&.to_json
64
+ end
65
+
66
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
67
+ # hash and check each fields type against the current object's property
68
+ # definitions.
69
+ #
70
+ # @param obj [Object]
71
+ # @return [Void]
72
+ def self.validate_raw(obj:)
73
+ obj.messages.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
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.")
76
+ end
77
+ end
78
+ end
79
+ end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "date"
4
3
  require "ostruct"
5
4
  require "json"
6
5
 
@@ -8,7 +7,7 @@ module Pinnacle
8
7
  module Types
9
8
  # Define when and how your message should be sent.
10
9
  class MessageSchedule
11
- # @return [DateTime] Date and time when you want recurring messages to stop in ISO 8601 format.
10
+ # @return [String] Date and time when you want recurring messages to stop in ISO 8601 format.
12
11
  attr_reader :end_date
13
12
  # @return [String] Provide an AWS cron expression to control the when messages are sent. <br>
14
13
  # [Learn more about cron
@@ -26,7 +25,7 @@ module Pinnacle
26
25
 
27
26
  OMIT = Object.new
28
27
 
29
- # @param end_date [DateTime] Date and time when you want recurring messages to stop in ISO 8601 format.
28
+ # @param end_date [String] Date and time when you want recurring messages to stop in ISO 8601 format.
30
29
  # @param recurrence [String] Provide an AWS cron expression to control the when messages are sent. <br>
31
30
  # [Learn more about cron
32
31
  # ocs.aws.amazon.com/eventbridge/latest/userguide/eb-scheduled-rule-pattern.html).
@@ -57,7 +56,7 @@ module Pinnacle
57
56
  def self.from_json(json_object:)
58
57
  struct = JSON.parse(json_object, object_class: OpenStruct)
59
58
  parsed_json = JSON.parse(json_object)
60
- end_date = (DateTime.parse(parsed_json["endDate"]) unless parsed_json["endDate"].nil?)
59
+ end_date = parsed_json["endDate"]
61
60
  recurrence = parsed_json["recurrence"]
62
61
  send_at = parsed_json["sendAt"]
63
62
  timezone = parsed_json["timezone"]
@@ -84,7 +83,7 @@ module Pinnacle
84
83
  # @param obj [Object]
85
84
  # @return [Void]
86
85
  def self.validate_raw(obj:)
87
- obj.end_date&.is_a?(DateTime) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
86
+ obj.end_date&.is_a?(String) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
88
87
  obj.recurrence&.is_a?(String) != false || raise("Passed value for field obj.recurrence is not the expected type, validation failed.")
89
88
  obj.send_at.is_a?(String) != false || raise("Passed value for field obj.send_at is not the expected type, validation failed.")
90
89
  obj.timezone.is_a?(String) != false || raise("Passed value for field obj.timezone is not the expected type, validation failed.")
@@ -0,0 +1,197 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "message_with_reaction_direction"
4
+ require_relative "message_content"
5
+ require_relative "message_method_enum"
6
+ require_relative "message_status_enum"
7
+ require_relative "message_protocol_enum"
8
+ require "ostruct"
9
+ require "json"
10
+
11
+ module Pinnacle
12
+ module Types
13
+ # Message with additional conversation-specific fields including direction and
14
+ # reaction.
15
+ class MessageWithReaction
16
+ # @return [Pinnacle::Types::MessageWithReactionDirection] Direction of the message flow.
17
+ attr_reader :direction
18
+ # @return [String] Unicode emoji reaction attached to this message. <br>
19
+ # Null indicates no reaction has been added.
20
+ attr_reader :reaction
21
+ # @return [Pinnacle::Types::MessageContent]
22
+ attr_reader :content
23
+ # @return [Float] Total cost charged for sending the message. <br>
24
+ # Null means the message incurred no cost or has not been charged yet.
25
+ attr_reader :cost
26
+ # @return [String] Timestamp indicating when the message was successfully delivered to the
27
+ # recipient. <br>
28
+ # Null indicates the message has not yet been delivered.
29
+ attr_reader :delivered_at
30
+ # @return [String] Detailed explanation of any errors that occurred while delivering the message.
31
+ # <br>
32
+ # Null indicates no errors.
33
+ attr_reader :error
34
+ # @return [String] Unique identifier of the message. This identifier is a string that always begins
35
+ # with the prefix `msg_`, for example: `msg_1234567890`.
36
+ attr_reader :id
37
+ # @return [Pinnacle::Types::MessageMethodEnum]
38
+ attr_reader :method_
39
+ # @return [Integer] Number of segments the message was split into for delivery.
40
+ attr_reader :num_segments
41
+ # @return [String] Phone number that received the message in E.164 format.
42
+ attr_reader :receiver
43
+ # @return [String] Phone number or agent that sent the message.
44
+ attr_reader :sender
45
+ # @return [String] Timestamp indicating when the message was submitted for delivery. <br>
46
+ # Null indicates the message is still in the queue.
47
+ attr_reader :sent_at
48
+ # @return [Pinnacle::Types::MessageStatusEnum]
49
+ attr_reader :status
50
+ # @return [Pinnacle::Types::MessageProtocolEnum]
51
+ attr_reader :type
52
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
53
+ attr_reader :additional_properties
54
+ # @return [Object]
55
+ attr_reader :_field_set
56
+ protected :_field_set
57
+
58
+ OMIT = Object.new
59
+
60
+ # @param direction [Pinnacle::Types::MessageWithReactionDirection] Direction of the message flow.
61
+ # @param reaction [String] Unicode emoji reaction attached to this message. <br>
62
+ # Null indicates no reaction has been added.
63
+ # @param content [Pinnacle::Types::MessageContent]
64
+ # @param cost [Float] Total cost charged for sending the message. <br>
65
+ # Null means the message incurred no cost or has not been charged yet.
66
+ # @param delivered_at [String] Timestamp indicating when the message was successfully delivered to the
67
+ # recipient. <br>
68
+ # Null indicates the message has not yet been delivered.
69
+ # @param error [String] Detailed explanation of any errors that occurred while delivering the message.
70
+ # <br>
71
+ # Null indicates no errors.
72
+ # @param id [String] Unique identifier of the message. This identifier is a string that always begins
73
+ # with the prefix `msg_`, for example: `msg_1234567890`.
74
+ # @param method_ [Pinnacle::Types::MessageMethodEnum]
75
+ # @param num_segments [Integer] Number of segments the message was split into for delivery.
76
+ # @param receiver [String] Phone number that received the message in E.164 format.
77
+ # @param sender [String] Phone number or agent that sent the message.
78
+ # @param sent_at [String] Timestamp indicating when the message was submitted for delivery. <br>
79
+ # Null indicates the message is still in the queue.
80
+ # @param status [Pinnacle::Types::MessageStatusEnum]
81
+ # @param type [Pinnacle::Types::MessageProtocolEnum]
82
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
83
+ # @return [Pinnacle::Types::MessageWithReaction]
84
+ def initialize(direction:, content:, id:, method_:, num_segments:, receiver:, sender:, status:, type:,
85
+ reaction: OMIT, cost: OMIT, delivered_at: OMIT, error: OMIT, sent_at: OMIT, additional_properties: nil)
86
+ @direction = direction
87
+ @reaction = reaction if reaction != OMIT
88
+ @content = content
89
+ @cost = cost if cost != OMIT
90
+ @delivered_at = delivered_at if delivered_at != OMIT
91
+ @error = error if error != OMIT
92
+ @id = id
93
+ @method_ = method_
94
+ @num_segments = num_segments
95
+ @receiver = receiver
96
+ @sender = sender
97
+ @sent_at = sent_at if sent_at != OMIT
98
+ @status = status
99
+ @type = type
100
+ @additional_properties = additional_properties
101
+ @_field_set = {
102
+ "direction": direction,
103
+ "reaction": reaction,
104
+ "content": content,
105
+ "cost": cost,
106
+ "deliveredAt": delivered_at,
107
+ "error": error,
108
+ "id": id,
109
+ "method": method_,
110
+ "numSegments": num_segments,
111
+ "receiver": receiver,
112
+ "sender": sender,
113
+ "sentAt": sent_at,
114
+ "status": status,
115
+ "type": type
116
+ }.reject do |_k, v|
117
+ v == OMIT
118
+ end
119
+ end
120
+
121
+ # Deserialize a JSON object to an instance of MessageWithReaction
122
+ #
123
+ # @param json_object [String]
124
+ # @return [Pinnacle::Types::MessageWithReaction]
125
+ def self.from_json(json_object:)
126
+ struct = JSON.parse(json_object, object_class: OpenStruct)
127
+ parsed_json = JSON.parse(json_object)
128
+ direction = parsed_json["direction"]
129
+ reaction = parsed_json["reaction"]
130
+ if parsed_json["content"].nil?
131
+ content = nil
132
+ else
133
+ content = parsed_json["content"].to_json
134
+ content = Pinnacle::Types::MessageContent.from_json(json_object: content)
135
+ end
136
+ cost = parsed_json["cost"]
137
+ delivered_at = parsed_json["deliveredAt"]
138
+ error = parsed_json["error"]
139
+ id = parsed_json["id"]
140
+ method_ = parsed_json["method"]
141
+ num_segments = parsed_json["numSegments"]
142
+ receiver = parsed_json["receiver"]
143
+ sender = parsed_json["sender"]
144
+ sent_at = parsed_json["sentAt"]
145
+ status = parsed_json["status"]
146
+ type = parsed_json["type"]
147
+ new(
148
+ direction: direction,
149
+ reaction: reaction,
150
+ content: content,
151
+ cost: cost,
152
+ delivered_at: delivered_at,
153
+ error: error,
154
+ id: id,
155
+ method_: method_,
156
+ num_segments: num_segments,
157
+ receiver: receiver,
158
+ sender: sender,
159
+ sent_at: sent_at,
160
+ status: status,
161
+ type: type,
162
+ additional_properties: struct
163
+ )
164
+ end
165
+
166
+ # Serialize an instance of MessageWithReaction to a JSON object
167
+ #
168
+ # @return [String]
169
+ def to_json(*_args)
170
+ @_field_set&.to_json
171
+ end
172
+
173
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
174
+ # hash and check each fields type against the current object's property
175
+ # definitions.
176
+ #
177
+ # @param obj [Object]
178
+ # @return [Void]
179
+ def self.validate_raw(obj:)
180
+ obj.direction.is_a?(Pinnacle::Types::MessageWithReactionDirection) != false || raise("Passed value for field obj.direction is not the expected type, validation failed.")
181
+ obj.reaction&.is_a?(String) != false || raise("Passed value for field obj.reaction is not the expected type, validation failed.")
182
+ Pinnacle::Types::MessageContent.validate_raw(obj: obj.content)
183
+ obj.cost&.is_a?(Float) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.")
184
+ obj.delivered_at&.is_a?(String) != false || raise("Passed value for field obj.delivered_at is not the expected type, validation failed.")
185
+ obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
186
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
187
+ obj.method_.is_a?(Pinnacle::Types::MessageMethodEnum) != false || raise("Passed value for field obj.method_ is not the expected type, validation failed.")
188
+ obj.num_segments.is_a?(Integer) != false || raise("Passed value for field obj.num_segments is not the expected type, validation failed.")
189
+ obj.receiver.is_a?(String) != false || raise("Passed value for field obj.receiver is not the expected type, validation failed.")
190
+ obj.sender.is_a?(String) != false || raise("Passed value for field obj.sender is not the expected type, validation failed.")
191
+ obj.sent_at&.is_a?(String) != false || raise("Passed value for field obj.sent_at is not the expected type, validation failed.")
192
+ obj.status.is_a?(Pinnacle::Types::MessageStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
193
+ obj.type.is_a?(Pinnacle::Types::MessageProtocolEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
194
+ end
195
+ end
196
+ end
197
+ end