rcs 2.0.0.pre.rc.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) 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 +1 -1
  16. data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
  17. data/lib/rcs/phone_numbers/client.rb +0 -14
  18. data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
  19. data/lib/rcs/rcs/client.rb +32 -18
  20. data/lib/rcs/status/get/client.rb +32 -16
  21. data/lib/rcs/tools/contact_card/client.rb +18 -8
  22. data/lib/rcs/tools/file/client.rb +92 -2
  23. data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
  24. data/lib/rcs/tools/url/client.rb +4 -2
  25. data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
  26. data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
  27. data/lib/rcs/types/autofill_campaign_params.rb +15 -3
  28. data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
  29. data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
  30. data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
  31. data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
  32. data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
  33. data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
  34. data/lib/rcs/types/brand_status.rb +5 -3
  35. data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
  36. data/lib/rcs/types/button_clicked_data.rb +80 -0
  37. data/lib/rcs/types/button_clicked_data_button.rb +118 -0
  38. data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
  39. data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
  40. data/lib/rcs/types/campaign_query.rb +10 -2
  41. data/lib/rcs/types/contact.rb +5 -3
  42. data/lib/rcs/types/contact_id.rb +5 -3
  43. data/lib/rcs/types/conversation.rb +16 -8
  44. data/lib/rcs/types/conversation_by_id_params.rb +7 -3
  45. data/lib/rcs/types/conversation_contact.rb +5 -3
  46. data/lib/rcs/types/conversation_list.rb +50 -28
  47. data/lib/rcs/types/create_url_options.rb +4 -2
  48. data/lib/rcs/types/detached_webhook_info.rb +5 -3
  49. data/lib/rcs/types/dlc_campaign_status.rb +5 -3
  50. data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
  51. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
  52. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
  53. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
  54. data/lib/rcs/types/extended_brand.rb +25 -13
  55. data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
  56. data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
  57. data/lib/rcs/types/link_click_event.rb +1 -17
  58. data/lib/rcs/types/message.rb +5 -3
  59. data/lib/rcs/types/message_content.rb +4 -4
  60. data/lib/rcs/types/message_event.rb +143 -0
  61. data/lib/rcs/types/message_event_content.rb +127 -0
  62. data/lib/rcs/types/message_event_conversation.rb +82 -0
  63. data/lib/rcs/types/message_event_direction.rb +11 -0
  64. data/lib/rcs/types/message_event_mms_content.rb +94 -0
  65. data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
  66. data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
  67. data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
  68. data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
  69. data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
  70. data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
  71. data/lib/rcs/types/message_event_sms_content.rb +81 -0
  72. data/lib/rcs/types/{retrieved_conversations.rb → message_list.rb} +26 -25
  73. data/lib/rcs/types/message_with_reaction.rb +197 -0
  74. data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
  75. data/lib/rcs/types/{error_response.rb → not_found_error_body.rb} +7 -7
  76. data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
  77. data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
  78. data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
  79. data/lib/rcs/types/profile_status_enum.rb +4 -4
  80. data/lib/rcs/types/rcs_base_options.rb +12 -1
  81. data/lib/rcs/types/rcs_button_call.rb +11 -2
  82. data/lib/rcs/types/rcs_button_open_url.rb +11 -2
  83. data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
  84. data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
  85. data/lib/rcs/types/rcs_button_send_location.rb +11 -2
  86. data/lib/rcs/types/rcs_button_trigger.rb +8 -6
  87. data/lib/rcs/types/rcs_campaign.rb +3 -3
  88. data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +8 -8
  89. data/lib/rcs/types/rcs_campaign_status.rb +5 -3
  90. data/lib/rcs/types/reaction_result.rb +10 -6
  91. data/lib/rcs/types/refreshed_file.rb +67 -0
  92. data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
  93. data/lib/rcs/types/scheduled_messaage.rb +5 -3
  94. data/lib/rcs/types/sent_mms_details.rb +4 -2
  95. data/lib/rcs/types/sent_rcs_details.rb +12 -13
  96. data/lib/rcs/types/sent_sms_details.rb +5 -3
  97. data/lib/rcs/types/toll_free_campaign.rb +3 -3
  98. data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
  99. data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
  100. data/lib/rcs/types/updated_contact_id.rb +5 -3
  101. data/lib/rcs/types/user_event.rb +83 -0
  102. data/lib/rcs/types/user_event_conversation.rb +78 -0
  103. data/lib/rcs/types/v_card_data.rb +5 -3
  104. data/lib/rcs/types/validate_campaign_params.rb +15 -3
  105. data/lib/rcs/types/vcard.rb +5 -3
  106. data/lib/rcs/types/vcard_content.rb +5 -3
  107. data/lib/rcs/types/vcard_resource.rb +5 -3
  108. data/lib/rcs/types/webhook_event_enum.rb +1 -0
  109. data/lib/rcs/types/webhooks.rb +5 -3
  110. data/lib/requests.rb +2 -2
  111. data/lib/types_export.rb +29 -7
  112. metadata +33 -11
  113. data/lib/rcs/types/click_action.rb +0 -73
  114. data/lib/rcs/types/click_action_data_metadata.rb +0 -69
@@ -0,0 +1,80 @@
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
+ # Unified data structure for button click events.
10
+ class ButtonClickedData
11
+ # @return [Pinnacle::Types::ButtonClickedDataButton] Information about the button that was clicked.
12
+ attr_reader :button
13
+ # @return [String] ID of the message this button was sent in, or null if not available. To get the
14
+ # message details, use the [GET /messages/{id}](/api-reference/messages/get)
15
+ # endpoint.
16
+ attr_reader :message_id
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 button [Pinnacle::Types::ButtonClickedDataButton] Information about the button that was clicked.
26
+ # @param message_id [String] ID of the message this button was sent in, or null if not available. To get the
27
+ # message details, use the [GET /messages/{id}](/api-reference/messages/get)
28
+ # endpoint.
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Pinnacle::Types::ButtonClickedData]
31
+ def initialize(button:, message_id: OMIT, additional_properties: nil)
32
+ @button = button
33
+ @message_id = message_id if message_id != OMIT
34
+ @additional_properties = additional_properties
35
+ @_field_set = { "button": button, "messageId": message_id }.reject do |_k, v|
36
+ v == OMIT
37
+ end
38
+ end
39
+
40
+ # Deserialize a JSON object to an instance of ButtonClickedData
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Pinnacle::Types::ButtonClickedData]
44
+ def self.from_json(json_object:)
45
+ struct = JSON.parse(json_object, object_class: OpenStruct)
46
+ parsed_json = JSON.parse(json_object)
47
+ if parsed_json["button"].nil?
48
+ button = nil
49
+ else
50
+ button = parsed_json["button"].to_json
51
+ button = Pinnacle::Types::ButtonClickedDataButton.from_json(json_object: button)
52
+ end
53
+ message_id = parsed_json["messageId"]
54
+ new(
55
+ button: button,
56
+ message_id: message_id,
57
+ additional_properties: struct
58
+ )
59
+ end
60
+
61
+ # Serialize an instance of ButtonClickedData 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
+ Pinnacle::Types::ButtonClickedDataButton.validate_raw(obj: obj.button)
76
+ obj.message_id&.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.")
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "button_clicked_data_button_type"
4
+ require_relative "button_clicked_data_button_raw"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Pinnacle
9
+ module Types
10
+ # Information about the button that was clicked.
11
+ class ButtonClickedDataButton
12
+ # @return [Pinnacle::Types::ButtonClickedDataButtonType] Type of button clicked.
13
+ # - `CARD` for card buttons,
14
+ # - `QUICK_REPLY` for quick replies.
15
+ # - `null` if we cannot determine the button type. This is a rare edge case and is
16
+ # mainly here for backward compatibility.
17
+ attr_reader :type
18
+ # @return [Pinnacle::Types::ButtonClickedDataButtonRaw] Raw button data. Contains the entire button that was clicked by the user. In
19
+ # rare cases where we cannot determine the exact button, this will return only the
20
+ # button title.
21
+ attr_reader :raw
22
+ # @return [String] Extracted payload from the button's `payload` field, if provided. Provides quick
23
+ # access to any payload that was attached to the button.
24
+ attr_reader :payload
25
+ # @return [String] Additional metadata attached to the button's `metadata` field, if provided.
26
+ attr_reader :metadata
27
+ # @return [Integer] Number of times the button has been clicked.
28
+ attr_reader :clicks
29
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
30
+ attr_reader :additional_properties
31
+ # @return [Object]
32
+ attr_reader :_field_set
33
+ protected :_field_set
34
+
35
+ OMIT = Object.new
36
+
37
+ # @param type [Pinnacle::Types::ButtonClickedDataButtonType] Type of button clicked.
38
+ # - `CARD` for card buttons,
39
+ # - `QUICK_REPLY` for quick replies.
40
+ # - `null` if we cannot determine the button type. This is a rare edge case and is
41
+ # mainly here for backward compatibility.
42
+ # @param raw [Pinnacle::Types::ButtonClickedDataButtonRaw] Raw button data. Contains the entire button that was clicked by the user. In
43
+ # rare cases where we cannot determine the exact button, this will return only the
44
+ # button title.
45
+ # @param payload [String] Extracted payload from the button's `payload` field, if provided. Provides quick
46
+ # access to any payload that was attached to the button.
47
+ # @param metadata [String] Additional metadata attached to the button's `metadata` field, if provided.
48
+ # @param clicks [Integer] Number of times the button has been clicked.
49
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
50
+ # @return [Pinnacle::Types::ButtonClickedDataButton]
51
+ def initialize(raw:, clicks:, type: OMIT, payload: OMIT, metadata: OMIT, additional_properties: nil)
52
+ @type = type if type != OMIT
53
+ @raw = raw
54
+ @payload = payload if payload != OMIT
55
+ @metadata = metadata if metadata != OMIT
56
+ @clicks = clicks
57
+ @additional_properties = additional_properties
58
+ @_field_set = {
59
+ "type": type,
60
+ "raw": raw,
61
+ "payload": payload,
62
+ "metadata": metadata,
63
+ "clicks": clicks
64
+ }.reject do |_k, v|
65
+ v == OMIT
66
+ end
67
+ end
68
+
69
+ # Deserialize a JSON object to an instance of ButtonClickedDataButton
70
+ #
71
+ # @param json_object [String]
72
+ # @return [Pinnacle::Types::ButtonClickedDataButton]
73
+ def self.from_json(json_object:)
74
+ struct = JSON.parse(json_object, object_class: OpenStruct)
75
+ parsed_json = JSON.parse(json_object)
76
+ type = parsed_json["type"]
77
+ if parsed_json["raw"].nil?
78
+ raw = nil
79
+ else
80
+ raw = parsed_json["raw"].to_json
81
+ raw = Pinnacle::Types::ButtonClickedDataButtonRaw.from_json(json_object: raw)
82
+ end
83
+ payload = parsed_json["payload"]
84
+ metadata = parsed_json["metadata"]
85
+ clicks = parsed_json["clicks"]
86
+ new(
87
+ type: type,
88
+ raw: raw,
89
+ payload: payload,
90
+ metadata: metadata,
91
+ clicks: clicks,
92
+ additional_properties: struct
93
+ )
94
+ end
95
+
96
+ # Serialize an instance of ButtonClickedDataButton to a JSON object
97
+ #
98
+ # @return [String]
99
+ def to_json(*_args)
100
+ @_field_set&.to_json
101
+ end
102
+
103
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
104
+ # hash and check each fields type against the current object's property
105
+ # definitions.
106
+ #
107
+ # @param obj [Object]
108
+ # @return [Void]
109
+ def self.validate_raw(obj:)
110
+ obj.type&.is_a?(Pinnacle::Types::ButtonClickedDataButtonType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
111
+ Pinnacle::Types::ButtonClickedDataButtonRaw.validate_raw(obj: obj.raw)
112
+ obj.payload&.is_a?(String) != false || raise("Passed value for field obj.payload is not the expected type, validation failed.")
113
+ obj.metadata&.is_a?(String) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
114
+ obj.clicks.is_a?(Integer) != false || raise("Passed value for field obj.clicks is not the expected type, validation failed.")
115
+ end
116
+ end
117
+ end
118
+ end
@@ -1,21 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "json"
4
- require_relative "click_action_data_metadata"
4
+ require_relative "rich_button"
5
5
 
6
6
  module Pinnacle
7
7
  module Types
8
- # Payload received from the button interaction.
9
- class ClickActionData
10
- # Deserialize a JSON object to an instance of ClickActionData
8
+ # Raw button data. Contains the entire button that was clicked by the user. In
9
+ # rare cases where we cannot determine the exact button, this will return only the
10
+ # button title.
11
+ class ButtonClickedDataButtonRaw
12
+ # Deserialize a JSON object to an instance of ButtonClickedDataButtonRaw
11
13
  #
12
14
  # @param json_object [String]
13
- # @return [Pinnacle::Types::ClickActionData]
15
+ # @return [Pinnacle::Types::ButtonClickedDataButtonRaw]
14
16
  def self.from_json(json_object:)
15
17
  struct = JSON.parse(json_object, object_class: OpenStruct)
16
18
  begin
17
- Pinnacle::Types::ClickActionDataMetadata.validate_raw(obj: struct)
18
- return Pinnacle::Types::ClickActionDataMetadata.from_json(json_object: struct) unless struct.nil?
19
+ Pinnacle::Types::RichButton.validate_raw(obj: struct)
20
+ return Pinnacle::Types::RichButton.from_json(json_object: struct) unless struct.nil?
19
21
 
20
22
  return nil
21
23
  rescue StandardError
@@ -40,7 +42,7 @@ module Pinnacle
40
42
  # @return [Void]
41
43
  def self.validate_raw(obj:)
42
44
  begin
43
- return Pinnacle::Types::ClickActionDataMetadata.validate_raw(obj: obj)
45
+ return Pinnacle::Types::RichButton.validate_raw(obj: obj)
44
46
  rescue StandardError
45
47
  # noop
46
48
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Types
5
+ # Type of button clicked.
6
+ # - `CARD` for card buttons,
7
+ # - `QUICK_REPLY` for quick replies.
8
+ # - `null` if we cannot determine the button type. This is a rare edge case and is
9
+ # mainly here for backward compatibility.
10
+ class ButtonClickedDataButtonType
11
+ CARD = "CARD"
12
+ QUICK_REPLY = "QUICK_REPLY"
13
+ end
14
+ end
15
+ end
@@ -8,7 +8,11 @@ module Pinnacle
8
8
  module Types
9
9
  # Information about the campaign associated with a conversation
10
10
  class CampaignQuery
11
- # @return [String] Unique identifier for the campaign
11
+ # @return [String] Unique identifier for the campaign. This identifier is a string that begins with
12
+ # the prefix:
13
+ # - TOLL_FREE: `tf_` (e.g., `tf_1234567890`)
14
+ # - 10DLC: `dlc_` (e.g., `dlc_1234567890`)
15
+ # - RCS: `rcs_` (e.g., `rcs_1234567890`)
12
16
  attr_reader :id
13
17
  # @return [Pinnacle::Types::CampaignEnum]
14
18
  attr_reader :type
@@ -20,7 +24,11 @@ module Pinnacle
20
24
 
21
25
  OMIT = Object.new
22
26
 
23
- # @param id [String] Unique identifier for the campaign
27
+ # @param id [String] Unique identifier for the campaign. This identifier is a string that begins with
28
+ # the prefix:
29
+ # - TOLL_FREE: `tf_` (e.g., `tf_1234567890`)
30
+ # - 10DLC: `dlc_` (e.g., `dlc_1234567890`)
31
+ # - RCS: `rcs_` (e.g., `rcs_1234567890`)
24
32
  # @param type [Pinnacle::Types::CampaignEnum]
25
33
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
34
  # @return [Pinnacle::Types::CampaignQuery]
@@ -10,7 +10,8 @@ module Pinnacle
10
10
  attr_reader :description
11
11
  # @return [String] Contact's email address, if available.
12
12
  attr_reader :email
13
- # @return [Integer] Unique ID of the contact.
13
+ # @return [String] Unique ID of the contact. This identifier is a string that always begins with
14
+ # the prefix `co_`, for example: `co_1234567890`.
14
15
  attr_reader :id
15
16
  # @return [String] Full name of the contact, if available.
16
17
  attr_reader :name
@@ -28,7 +29,8 @@ module Pinnacle
28
29
 
29
30
  # @param description [String] Additional information about the contact.
30
31
  # @param email [String] Contact's email address, if available.
31
- # @param id [Integer] Unique ID of the contact.
32
+ # @param id [String] Unique ID of the contact. This identifier is a string that always begins with
33
+ # the prefix `co_`, for example: `co_1234567890`.
32
34
  # @param name [String] Full name of the contact, if available.
33
35
  # @param phone_number [String] Contact's phone number in E.164 format.
34
36
  # @param tags [Array<String>] List of tags associated with the contact.
@@ -95,7 +97,7 @@ module Pinnacle
95
97
  def self.validate_raw(obj:)
96
98
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
97
99
  obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
98
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
100
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
99
101
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
100
102
  obj.phone_number.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
101
103
  obj.tags&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.")
@@ -6,7 +6,8 @@ require "json"
6
6
  module Pinnacle
7
7
  module Types
8
8
  class ContactId
9
- # @return [Integer] Unique ID of the created contact.
9
+ # @return [String] Unique ID of the created contact. This identifier is a string that always begins
10
+ # with the prefix `co_`, for example: `co_1234567890`.
10
11
  attr_reader :id
11
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
12
13
  attr_reader :additional_properties
@@ -16,7 +17,8 @@ module Pinnacle
16
17
 
17
18
  OMIT = Object.new
18
19
 
19
- # @param id [Integer] Unique ID of the created contact.
20
+ # @param id [String] Unique ID of the created contact. This identifier is a string that always begins
21
+ # with the prefix `co_`, for example: `co_1234567890`.
20
22
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
23
  # @return [Pinnacle::Types::ContactId]
22
24
  def initialize(id:, additional_properties: nil)
@@ -50,7 +52,7 @@ module Pinnacle
50
52
  # @param obj [Object]
51
53
  # @return [Void]
52
54
  def self.validate_raw(obj:)
53
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
54
56
  end
55
57
  end
56
58
  end
@@ -10,15 +10,19 @@ module Pinnacle
10
10
  module Types
11
11
  # Conversation that was found.
12
12
  class Conversation
13
- # @return [Integer] Identifier for the brand associated with this conversation.
13
+ # @return [String] The unique identifier of the brand associated with this conversation. This
14
+ # identifier is a string that always begins with the prefix `b_`, for example:
15
+ # `b_1234567890`.
14
16
  attr_reader :brand_id
15
- # @return [Pinnacle::Types::CampaignQuery] Campaign information if this conversation is part of a marketing campaign.
17
+ # @return [Pinnacle::Types::CampaignQuery] Campaign information if this conversation is part of a marketing campaign. This
18
+ # is an object that contains the campaign ID and type.
16
19
  attr_reader :campaign
17
20
  # @return [Pinnacle::Types::ConversationContact] Contact information for the recipient in a conversation.
18
21
  attr_reader :contact
19
22
  # @return [String] ISO 8601 timestamp when the conversation was created.
20
23
  attr_reader :created_at
21
- # @return [Integer] Unique identifier for the conversation.
24
+ # @return [String] Unique identifier for the conversation. This identifier is a string that always
25
+ # begins with the prefix `conv_`, for example: `conv_1234567890`.
22
26
  attr_reader :id
23
27
  # @return [String] Free-form notes or comments about the conversation.
24
28
  attr_reader :notes
@@ -37,11 +41,15 @@ module Pinnacle
37
41
 
38
42
  OMIT = Object.new
39
43
 
40
- # @param brand_id [Integer] Identifier for the brand associated with this conversation.
41
- # @param campaign [Pinnacle::Types::CampaignQuery] Campaign information if this conversation is part of a marketing campaign.
44
+ # @param brand_id [String] The unique identifier of the brand associated with this conversation. This
45
+ # identifier is a string that always begins with the prefix `b_`, for example:
46
+ # `b_1234567890`.
47
+ # @param campaign [Pinnacle::Types::CampaignQuery] Campaign information if this conversation is part of a marketing campaign. This
48
+ # is an object that contains the campaign ID and type.
42
49
  # @param contact [Pinnacle::Types::ConversationContact] Contact information for the recipient in a conversation.
43
50
  # @param created_at [String] ISO 8601 timestamp when the conversation was created.
44
- # @param id [Integer] Unique identifier for the conversation.
51
+ # @param id [String] Unique identifier for the conversation. This identifier is a string that always
52
+ # begins with the prefix `conv_`, for example: `conv_1234567890`.
45
53
  # @param notes [String] Free-form notes or comments about the conversation.
46
54
  # @param sender [Pinnacle::Types::ConversationSender] The sender of messages in this conversation. Can be:
47
55
  # - A phone number with its capabilities and metadata
@@ -132,11 +140,11 @@ module Pinnacle
132
140
  # @param obj [Object]
133
141
  # @return [Void]
134
142
  def self.validate_raw(obj:)
135
- obj.brand_id&.is_a?(Integer) != false || raise("Passed value for field obj.brand_id is not the expected type, validation failed.")
143
+ obj.brand_id&.is_a?(String) != false || raise("Passed value for field obj.brand_id is not the expected type, validation failed.")
136
144
  obj.campaign.nil? || Pinnacle::Types::CampaignQuery.validate_raw(obj: obj.campaign)
137
145
  Pinnacle::Types::ConversationContact.validate_raw(obj: obj.contact)
138
146
  obj.created_at.is_a?(String) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
139
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
147
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
140
148
  obj.notes.is_a?(String) != false || raise("Passed value for field obj.notes is not the expected type, validation failed.")
141
149
  obj.sender.nil? || Pinnacle::Types::ConversationSender.validate_raw(obj: obj.sender)
142
150
  obj.updated_at.is_a?(String) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
@@ -7,7 +7,9 @@ module Pinnacle
7
7
  module Types
8
8
  # Retrieve conversation information by ID.
9
9
  class ConversationByIdParams
10
- # @return [Integer] Unique identifier of the conversation you want to retrieve.
10
+ # @return [String] Unique identifier of the conversation you want to retrieve. This identifier is a
11
+ # string that always begins with the prefix `conv_`, for example:
12
+ # `conv_1234567890`.
11
13
  attr_reader :id
12
14
  # @return [OpenStruct] Additional properties unmapped to the current class definition
13
15
  attr_reader :additional_properties
@@ -17,7 +19,9 @@ module Pinnacle
17
19
 
18
20
  OMIT = Object.new
19
21
 
20
- # @param id [Integer] Unique identifier of the conversation you want to retrieve.
22
+ # @param id [String] Unique identifier of the conversation you want to retrieve. This identifier is a
23
+ # string that always begins with the prefix `conv_`, for example:
24
+ # `conv_1234567890`.
21
25
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
26
  # @return [Pinnacle::Types::ConversationByIdParams]
23
27
  def initialize(id:, additional_properties: nil)
@@ -51,7 +55,7 @@ module Pinnacle
51
55
  # @param obj [Object]
52
56
  # @return [Void]
53
57
  def self.validate_raw(obj:)
54
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
58
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
59
  end
56
60
  end
57
61
  end
@@ -7,7 +7,8 @@ module Pinnacle
7
7
  module Types
8
8
  # Contact information for the recipient in a conversation.
9
9
  class ConversationContact
10
- # @return [Integer] Unique identifier for the contact.
10
+ # @return [String] Unique ID of the contact. This identifier is a string that always begins with
11
+ # the prefix `co_`, for example: `co_1234567890`.
11
12
  attr_reader :id
12
13
  # @return [String] The contact's phone number in E.164 format.
13
14
  attr_reader :phone_number
@@ -19,7 +20,8 @@ module Pinnacle
19
20
 
20
21
  OMIT = Object.new
21
22
 
22
- # @param id [Integer] Unique identifier for the contact.
23
+ # @param id [String] Unique ID of the contact. This identifier is a string that always begins with
24
+ # the prefix `co_`, for example: `co_1234567890`.
23
25
  # @param phone_number [String] The contact's phone number in E.164 format.
24
26
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
27
  # @return [Pinnacle::Types::ConversationContact]
@@ -60,7 +62,7 @@ module Pinnacle
60
62
  # @param obj [Object]
61
63
  # @return [Void]
62
64
  def self.validate_raw(obj:)
63
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
65
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
64
66
  obj.phone_number.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
65
67
  end
66
68
  end
@@ -1,36 +1,66 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "conversation"
4
+ require "ostruct"
3
5
  require "json"
4
- require_relative "error_response"
5
- require_relative "retrieved_conversations"
6
6
 
7
7
  module Pinnacle
8
8
  module Types
9
9
  # Response for list conversation.
10
10
  class ConversationList
11
+ # @return [Integer] Total number of conversations matching the filter.
12
+ attr_reader :count
13
+ # @return [Array<Pinnacle::Types::Conversation>]
14
+ attr_reader :conversations
15
+ # @return [Boolean] Indicates if more conversations are available beyond the current page.
16
+ attr_reader :has_more
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 count [Integer] Total number of conversations matching the filter.
26
+ # @param conversations [Array<Pinnacle::Types::Conversation>]
27
+ # @param has_more [Boolean] Indicates if more conversations are available beyond the current page.
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Pinnacle::Types::ConversationList]
30
+ def initialize(count:, conversations:, has_more:, additional_properties: nil)
31
+ @count = count
32
+ @conversations = conversations
33
+ @has_more = has_more
34
+ @additional_properties = additional_properties
35
+ @_field_set = { "count": count, "conversations": conversations, "hasMore": has_more }
36
+ end
37
+
11
38
  # Deserialize a JSON object to an instance of ConversationList
12
39
  #
13
40
  # @param json_object [String]
14
41
  # @return [Pinnacle::Types::ConversationList]
15
42
  def self.from_json(json_object:)
16
43
  struct = JSON.parse(json_object, object_class: OpenStruct)
17
- begin
18
- Pinnacle::Types::ErrorResponse.validate_raw(obj: struct)
19
- return Pinnacle::Types::ErrorResponse.from_json(json_object: struct) unless struct.nil?
20
-
21
- return nil
22
- rescue StandardError
23
- # noop
44
+ parsed_json = JSON.parse(json_object)
45
+ count = parsed_json["count"]
46
+ conversations = parsed_json["conversations"]&.map do |item|
47
+ item = item.to_json
48
+ Pinnacle::Types::Conversation.from_json(json_object: item)
24
49
  end
25
- begin
26
- Pinnacle::Types::RetrievedConversations.validate_raw(obj: struct)
27
- return Pinnacle::Types::RetrievedConversations.from_json(json_object: struct) unless struct.nil?
50
+ has_more = parsed_json["hasMore"]
51
+ new(
52
+ count: count,
53
+ conversations: conversations,
54
+ has_more: has_more,
55
+ additional_properties: struct
56
+ )
57
+ end
28
58
 
29
- return nil
30
- rescue StandardError
31
- # noop
32
- end
33
- struct
59
+ # Serialize an instance of ConversationList to a JSON object
60
+ #
61
+ # @return [String]
62
+ def to_json(*_args)
63
+ @_field_set&.to_json
34
64
  end
35
65
 
36
66
  # Leveraged for Union-type generation, validate_raw attempts to parse the given
@@ -40,17 +70,9 @@ module Pinnacle
40
70
  # @param obj [Object]
41
71
  # @return [Void]
42
72
  def self.validate_raw(obj:)
43
- begin
44
- return Pinnacle::Types::ErrorResponse.validate_raw(obj: obj)
45
- rescue StandardError
46
- # noop
47
- end
48
- begin
49
- return Pinnacle::Types::RetrievedConversations.validate_raw(obj: obj)
50
- rescue StandardError
51
- # noop
52
- end
53
- raise("Passed value matched no type within the union, validation failed.")
73
+ obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
74
+ obj.conversations.is_a?(Array) != false || raise("Passed value for field obj.conversations is not the expected type, validation failed.")
75
+ obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.")
54
76
  end
55
77
  end
56
78
  end
@@ -7,7 +7,8 @@ module Pinnacle
7
7
  module Types
8
8
  class CreateUrlOptions
9
9
  # @return [String] Expiration date in ISO 8601 format for the shortened URL. <br>
10
- # If omitted, then a permalink is generated instead.
10
+ # If omitted, then a permalink is generated instead. Short permalinks contain a
11
+ # 30-digit link id. Short links with an expiration date contain a 8-digit link id.
11
12
  attr_reader :expires_at
12
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
13
14
  attr_reader :additional_properties
@@ -18,7 +19,8 @@ module Pinnacle
18
19
  OMIT = Object.new
19
20
 
20
21
  # @param expires_at [String] Expiration date in ISO 8601 format for the shortened URL. <br>
21
- # If omitted, then a permalink is generated instead.
22
+ # If omitted, then a permalink is generated instead. Short permalinks contain a
23
+ # 30-digit link id. Short links with an expiration date contain a 8-digit link id.
22
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
25
  # @return [Pinnacle::Types::CreateUrlOptions]
24
26
  def initialize(expires_at: OMIT, additional_properties: nil)
@@ -8,7 +8,8 @@ module Pinnacle
8
8
  class DetachedWebhookInfo
9
9
  # @return [String] Confirmation message.
10
10
  attr_reader :message
11
- # @return [Integer] ID of the detached webhook.
11
+ # @return [String] Unique identifier of the webhook within the account. This identifier is a string
12
+ # that always begins with the prefix `wh_`, for example: `wh_1234567890`.
12
13
  attr_reader :webhook_id
13
14
  # @return [String] Phone number the webhook was detached from in E.164 format.
14
15
  attr_reader :phone_number
@@ -21,7 +22,8 @@ module Pinnacle
21
22
  OMIT = Object.new
22
23
 
23
24
  # @param message [String] Confirmation message.
24
- # @param webhook_id [Integer] ID of the detached webhook.
25
+ # @param webhook_id [String] Unique identifier of the webhook within the account. This identifier is a string
26
+ # that always begins with the prefix `wh_`, for example: `wh_1234567890`.
25
27
  # @param phone_number [String] Phone number the webhook was detached from in E.164 format.
26
28
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
29
  # @return [Pinnacle::Types::DetachedWebhookInfo]
@@ -66,7 +68,7 @@ module Pinnacle
66
68
  # @return [Void]
67
69
  def self.validate_raw(obj:)
68
70
  obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
69
- obj.webhook_id.is_a?(Integer) != false || raise("Passed value for field obj.webhook_id is not the expected type, validation failed.")
71
+ obj.webhook_id.is_a?(String) != false || raise("Passed value for field obj.webhook_id is not the expected type, validation failed.")
70
72
  obj.phone_number.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
71
73
  end
72
74
  end
@@ -13,7 +13,8 @@ module Pinnacle
13
13
  # These errors may request additional information or point out erroneous and/or
14
14
  # missing fields.
15
15
  attr_reader :error
16
- # @return [Integer] Id of the DLC campaign.
16
+ # @return [String] The unique identifier of the 10DLC campaign. This identifier is a string that
17
+ # always begins with the prefix `dlc_`, for example: `dlc_1234567890`.
17
18
  attr_reader :id
18
19
  # @return [Pinnacle::Types::ProfileStatusEnum] Current review status of the DLC campaign. <br>
19
20
  # `INCOMPLETE`: Not submitted.<br>
@@ -37,7 +38,8 @@ module Pinnacle
37
38
  # @param error [String] Summary of errors related to the verification process. <br>
38
39
  # These errors may request additional information or point out erroneous and/or
39
40
  # missing fields.
40
- # @param id [Integer] Id of the DLC campaign.
41
+ # @param id [String] The unique identifier of the 10DLC campaign. This identifier is a string that
42
+ # always begins with the prefix `dlc_`, for example: `dlc_1234567890`.
41
43
  # @param status [Pinnacle::Types::ProfileStatusEnum] Current review status of the DLC campaign. <br>
42
44
  # `INCOMPLETE`: Not submitted.<br>
43
45
  # `IN REVIEW`: Being reviewed by carriers.<br>
@@ -98,7 +100,7 @@ module Pinnacle
98
100
  # @return [Void]
99
101
  def self.validate_raw(obj:)
100
102
  obj.error.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
101
- obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
103
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
102
104
  obj.status.is_a?(Pinnacle::Types::ProfileStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
103
105
  Pinnacle::Types::GetDlcCampaignStatusResponseUpdates.validate_raw(obj: obj.updates)
104
106
  end