rcs 2.0.0 → 2.0.2

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.
@@ -3,6 +3,8 @@
3
3
  require_relative "../../../requests"
4
4
  require_relative "../../types/rich_message"
5
5
  require_relative "types/rcs_send_response"
6
+ require_relative "types/send_typing_indicator_schema_options"
7
+ require_relative "../../types/send_typing_indicator_response"
6
8
  require_relative "../../types/rcs_validate_content"
7
9
  require_relative "../../types/rcs_validation_result"
8
10
  require "async"
@@ -51,6 +53,66 @@ module Pinnacle
51
53
  Pinnacle::Messages::Rcs::Types::RcsSendResponse.from_json(json_object: response.body)
52
54
  end
53
55
 
56
+ # Send a typing indicator from an RCS agent to a recipient.
57
+ # This endpoint allows RCS agents to display a typing indicator to recipients. The
58
+ # indicator is a message bubble with animated typing dots like this: <img
59
+ # le.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png"
60
+ # alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align:
61
+ # middle; margin: 0 4px;" />
62
+ # **Use Case:** Typing indicators are especially useful for providing feedback to
63
+ # users while the agent is thinking or generating a response that may take some
64
+ # time, creating a more engaging conversational experience.
65
+ # **Expiration:** Typing indicators automatically expire after around 20 seconds
66
+ # or when the agent sends a message, whichever comes first.
67
+ # **Frequency:** You can send typing indicators as many times as needed, though
68
+ # only one will be displayed at a time. Sending multiple typing indicators will
69
+ # extend the duration of the current indicator.
70
+ # > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed
71
+ # state. The platform is allowed to coalesce or drop them, and the client UI
72
+ # decides when to show/hide.
73
+ #
74
+ # @param agent_id [String] The unique identifier of the RCS agent sending the typing indicator. <br>
75
+ # Format: `agent_` followed by alphanumeric characters (e.g., `agent_pinnacle`).
76
+ # @param to [String] The recipient's phone number in E.164 format. <br>
77
+ # Must include country code with a leading plus sign (e.g., `+14155551234`).
78
+ # @param options [Hash] Configure how your typing indicator is sent.Request of type Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions, as a Hash
79
+ # * :test_mode (Boolean)
80
+ # @param request_options [Pinnacle::RequestOptions]
81
+ # @return [Pinnacle::Types::SendTypingIndicatorResponse]
82
+ # @example
83
+ # api = Pinnacle::Client.new(
84
+ # base_url: "https://api.example.com",
85
+ # environment: Pinnacle::Environment::DEFAULT,
86
+ # api_key: "YOUR_API_KEY"
87
+ # )
88
+ # api.messages.rcs.send_typing(
89
+ # agent_id: "agent_pinnacle",
90
+ # to: "+14154746461",
91
+ # options: { test_mode: false }
92
+ # )
93
+ def send_typing(agent_id:, to:, options: nil, request_options: nil)
94
+ response = @request_client.conn.post do |req|
95
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
96
+ req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
97
+ req.headers = {
98
+ **(req.headers || {}),
99
+ **@request_client.get_headers,
100
+ **(request_options&.additional_headers || {})
101
+ }.compact
102
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
103
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
104
+ end
105
+ req.body = {
106
+ **(request_options&.additional_body_parameters || {}),
107
+ agentId: agent_id,
108
+ to: to,
109
+ options: options
110
+ }.compact
111
+ req.url "#{@request_client.get_url(request_options: request_options)}/messages/typing"
112
+ end
113
+ Pinnacle::Types::SendTypingIndicatorResponse.from_json(json_object: response.body)
114
+ end
115
+
54
116
  # Validate RCS message content without sending it.
55
117
  #
56
118
  # @param request [Pinnacle::Types::RcsTextContent, Pinnacle::Types::RcsValidateContentMedia, Pinnacle::Types::RcsCards]
@@ -126,6 +188,68 @@ module Pinnacle
126
188
  end
127
189
  end
128
190
 
191
+ # Send a typing indicator from an RCS agent to a recipient.
192
+ # This endpoint allows RCS agents to display a typing indicator to recipients. The
193
+ # indicator is a message bubble with animated typing dots like this: <img
194
+ # le.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png"
195
+ # alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align:
196
+ # middle; margin: 0 4px;" />
197
+ # **Use Case:** Typing indicators are especially useful for providing feedback to
198
+ # users while the agent is thinking or generating a response that may take some
199
+ # time, creating a more engaging conversational experience.
200
+ # **Expiration:** Typing indicators automatically expire after around 20 seconds
201
+ # or when the agent sends a message, whichever comes first.
202
+ # **Frequency:** You can send typing indicators as many times as needed, though
203
+ # only one will be displayed at a time. Sending multiple typing indicators will
204
+ # extend the duration of the current indicator.
205
+ # > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed
206
+ # state. The platform is allowed to coalesce or drop them, and the client UI
207
+ # decides when to show/hide.
208
+ #
209
+ # @param agent_id [String] The unique identifier of the RCS agent sending the typing indicator. <br>
210
+ # Format: `agent_` followed by alphanumeric characters (e.g., `agent_pinnacle`).
211
+ # @param to [String] The recipient's phone number in E.164 format. <br>
212
+ # Must include country code with a leading plus sign (e.g., `+14155551234`).
213
+ # @param options [Hash] Configure how your typing indicator is sent.Request of type Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions, as a Hash
214
+ # * :test_mode (Boolean)
215
+ # @param request_options [Pinnacle::RequestOptions]
216
+ # @return [Pinnacle::Types::SendTypingIndicatorResponse]
217
+ # @example
218
+ # api = Pinnacle::Client.new(
219
+ # base_url: "https://api.example.com",
220
+ # environment: Pinnacle::Environment::DEFAULT,
221
+ # api_key: "YOUR_API_KEY"
222
+ # )
223
+ # api.messages.rcs.send_typing(
224
+ # agent_id: "agent_pinnacle",
225
+ # to: "+14154746461",
226
+ # options: { test_mode: false }
227
+ # )
228
+ def send_typing(agent_id:, to:, options: nil, request_options: nil)
229
+ Async do
230
+ response = @request_client.conn.post do |req|
231
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
232
+ req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
233
+ req.headers = {
234
+ **(req.headers || {}),
235
+ **@request_client.get_headers,
236
+ **(request_options&.additional_headers || {})
237
+ }.compact
238
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
239
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
240
+ end
241
+ req.body = {
242
+ **(request_options&.additional_body_parameters || {}),
243
+ agentId: agent_id,
244
+ to: to,
245
+ options: options
246
+ }.compact
247
+ req.url "#{@request_client.get_url(request_options: request_options)}/messages/typing"
248
+ end
249
+ Pinnacle::Types::SendTypingIndicatorResponse.from_json(json_object: response.body)
250
+ end
251
+ end
252
+
129
253
  # Validate RCS message content without sending it.
130
254
  #
131
255
  # @param request [Pinnacle::Types::RcsTextContent, Pinnacle::Types::RcsValidateContentMedia, Pinnacle::Types::RcsCards]
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ module Messages
8
+ module Rcs
9
+ module Types
10
+ # Configure how your typing indicator is sent.
11
+ class SendTypingIndicatorSchemaOptions
12
+ # @return [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
13
+ # debugging.
14
+ attr_reader :test_mode
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param test_mode [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
24
+ # debugging.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions]
27
+ def initialize(test_mode: OMIT, additional_properties: nil)
28
+ @test_mode = test_mode if test_mode != OMIT
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "test_mode": test_mode }.reject do |_k, v|
31
+ v == OMIT
32
+ end
33
+ end
34
+
35
+ # Deserialize a JSON object to an instance of SendTypingIndicatorSchemaOptions
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ test_mode = parsed_json["test_mode"]
43
+ new(test_mode: test_mode, additional_properties: struct)
44
+ end
45
+
46
+ # Serialize an instance of SendTypingIndicatorSchemaOptions to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json(*_args)
50
+ @_field_set&.to_json
51
+ end
52
+
53
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
54
+ # hash and check each fields type against the current object's property
55
+ # definitions.
56
+ #
57
+ # @param obj [Object]
58
+ # @return [Void]
59
+ def self.validate_raw(obj:)
60
+ obj.test_mode&.is_a?(Boolean) != false || raise("Passed value for field obj.test_mode is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ module Types
8
+ class AudienceCountOnly
9
+ # @return [String] Audience public ID. This identifier is a string that always begins with the
10
+ # prefix `aud_`, for example: `aud_abc123`.
11
+ attr_reader :id
12
+ # @return [String] Audience name.
13
+ attr_reader :name
14
+ # @return [String] Audience description.
15
+ attr_reader :description
16
+ # @return [Integer] Total number of contacts in audience.
17
+ # Use the [Get Audience](/api-reference/audiences/get) endpoint with the
18
+ # pagination parameters to get the audience with its contacts.
19
+ attr_reader :contact_count
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] Audience public ID. This identifier is a string that always begins with the
29
+ # prefix `aud_`, for example: `aud_abc123`.
30
+ # @param name [String] Audience name.
31
+ # @param description [String] Audience description.
32
+ # @param contact_count [Integer] Total number of contacts in audience.
33
+ # Use the [Get Audience](/api-reference/audiences/get) endpoint with the
34
+ # pagination parameters to get the audience with its contacts.
35
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
36
+ # @return [Pinnacle::Types::AudienceCountOnly]
37
+ def initialize(id:, name:, description:, contact_count:, additional_properties: nil)
38
+ @id = id
39
+ @name = name
40
+ @description = description
41
+ @contact_count = contact_count
42
+ @additional_properties = additional_properties
43
+ @_field_set = { "id": id, "name": name, "description": description, "contactCount": contact_count }
44
+ end
45
+
46
+ # Deserialize a JSON object to an instance of AudienceCountOnly
47
+ #
48
+ # @param json_object [String]
49
+ # @return [Pinnacle::Types::AudienceCountOnly]
50
+ def self.from_json(json_object:)
51
+ struct = JSON.parse(json_object, object_class: OpenStruct)
52
+ parsed_json = JSON.parse(json_object)
53
+ id = parsed_json["id"]
54
+ name = parsed_json["name"]
55
+ description = parsed_json["description"]
56
+ contact_count = parsed_json["contactCount"]
57
+ new(
58
+ id: id,
59
+ name: name,
60
+ description: description,
61
+ contact_count: contact_count,
62
+ additional_properties: struct
63
+ )
64
+ end
65
+
66
+ # Serialize an instance of AudienceCountOnly to a JSON object
67
+ #
68
+ # @return [String]
69
+ def to_json(*_args)
70
+ @_field_set&.to_json
71
+ end
72
+
73
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
74
+ # hash and check each fields type against the current object's property
75
+ # definitions.
76
+ #
77
+ # @param obj [Object]
78
+ # @return [Void]
79
+ def self.validate_raw(obj:)
80
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
81
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
82
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
83
+ obj.contact_count.is_a?(Integer) != false || raise("Passed value for field obj.contact_count is not the expected type, validation failed.")
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "contact"
4
+ require_relative "pagination"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Pinnacle
9
+ module Types
10
+ class AudienceWithPagination
11
+ # @return [String] Audience public ID. This identifier is a string that always begins with the
12
+ # prefix `aud_`, for example: `aud_abc123`.
13
+ attr_reader :id
14
+ # @return [String] Audience name.
15
+ attr_reader :name
16
+ # @return [String] Audience description.
17
+ attr_reader :description
18
+ # @return [Array<Pinnacle::Types::Contact>] Array of contact objects (paginated).
19
+ attr_reader :contacts
20
+ # @return [Integer] Total number of contacts in audience.
21
+ attr_reader :contact_count
22
+ # @return [Pinnacle::Types::Pagination]
23
+ attr_reader :pagination
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 id [String] Audience public ID. This identifier is a string that always begins with the
33
+ # prefix `aud_`, for example: `aud_abc123`.
34
+ # @param name [String] Audience name.
35
+ # @param description [String] Audience description.
36
+ # @param contacts [Array<Pinnacle::Types::Contact>] Array of contact objects (paginated).
37
+ # @param contact_count [Integer] Total number of contacts in audience.
38
+ # @param pagination [Pinnacle::Types::Pagination]
39
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
40
+ # @return [Pinnacle::Types::AudienceWithPagination]
41
+ def initialize(id:, name:, description:, contacts:, contact_count:, pagination:, additional_properties: nil)
42
+ @id = id
43
+ @name = name
44
+ @description = description
45
+ @contacts = contacts
46
+ @contact_count = contact_count
47
+ @pagination = pagination
48
+ @additional_properties = additional_properties
49
+ @_field_set = {
50
+ "id": id,
51
+ "name": name,
52
+ "description": description,
53
+ "contacts": contacts,
54
+ "contactCount": contact_count,
55
+ "pagination": pagination
56
+ }
57
+ end
58
+
59
+ # Deserialize a JSON object to an instance of AudienceWithPagination
60
+ #
61
+ # @param json_object [String]
62
+ # @return [Pinnacle::Types::AudienceWithPagination]
63
+ def self.from_json(json_object:)
64
+ struct = JSON.parse(json_object, object_class: OpenStruct)
65
+ parsed_json = JSON.parse(json_object)
66
+ id = parsed_json["id"]
67
+ name = parsed_json["name"]
68
+ description = parsed_json["description"]
69
+ contacts = parsed_json["contacts"]&.map do |item|
70
+ item = item.to_json
71
+ Pinnacle::Types::Contact.from_json(json_object: item)
72
+ end
73
+ contact_count = parsed_json["contactCount"]
74
+ if parsed_json["pagination"].nil?
75
+ pagination = nil
76
+ else
77
+ pagination = parsed_json["pagination"].to_json
78
+ pagination = Pinnacle::Types::Pagination.from_json(json_object: pagination)
79
+ end
80
+ new(
81
+ id: id,
82
+ name: name,
83
+ description: description,
84
+ contacts: contacts,
85
+ contact_count: contact_count,
86
+ pagination: pagination,
87
+ additional_properties: struct
88
+ )
89
+ end
90
+
91
+ # Serialize an instance of AudienceWithPagination to a JSON object
92
+ #
93
+ # @return [String]
94
+ def to_json(*_args)
95
+ @_field_set&.to_json
96
+ end
97
+
98
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
99
+ # hash and check each fields type against the current object's property
100
+ # definitions.
101
+ #
102
+ # @param obj [Object]
103
+ # @return [Void]
104
+ def self.validate_raw(obj:)
105
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
106
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
107
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
108
+ obj.contacts.is_a?(Array) != false || raise("Passed value for field obj.contacts is not the expected type, validation failed.")
109
+ obj.contact_count.is_a?(Integer) != false || raise("Passed value for field obj.contact_count is not the expected type, validation failed.")
110
+ Pinnacle::Types::Pagination.validate_raw(obj: obj.pagination)
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ module Types
8
+ class DeleteAudienceResponse
9
+ # @return [Boolean] Indicates successful deletion.
10
+ attr_reader :success
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param success [Boolean] Indicates successful deletion.
20
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
+ # @return [Pinnacle::Types::DeleteAudienceResponse]
22
+ def initialize(success:, additional_properties: nil)
23
+ @success = success
24
+ @additional_properties = additional_properties
25
+ @_field_set = { "success": success }
26
+ end
27
+
28
+ # Deserialize a JSON object to an instance of DeleteAudienceResponse
29
+ #
30
+ # @param json_object [String]
31
+ # @return [Pinnacle::Types::DeleteAudienceResponse]
32
+ def self.from_json(json_object:)
33
+ struct = JSON.parse(json_object, object_class: OpenStruct)
34
+ parsed_json = JSON.parse(json_object)
35
+ success = parsed_json["success"]
36
+ new(success: success, additional_properties: struct)
37
+ end
38
+
39
+ # Serialize an instance of DeleteAudienceResponse to a JSON object
40
+ #
41
+ # @return [String]
42
+ def to_json(*_args)
43
+ @_field_set&.to_json
44
+ end
45
+
46
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
47
+ # hash and check each fields type against the current object's property
48
+ # definitions.
49
+ #
50
+ # @param obj [Object]
51
+ # @return [Void]
52
+ def self.validate_raw(obj:)
53
+ obj.success.is_a?(Boolean) != false || raise("Passed value for field obj.success is not the expected type, validation failed.")
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "message_schedule"
4
+ require_relative "tracking"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Pinnacle
9
+ module Types
10
+ # Configure how your RCS message is sent and tracked.
11
+ class Options
12
+ # @return [Pinnacle::Types::MessageSchedule]
13
+ attr_reader :schedule
14
+ # @return [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
15
+ # debugging.
16
+ attr_reader :test_mode
17
+ # @return [Pinnacle::Types::Tracking]
18
+ attr_reader :tracking
19
+ # @return [Boolean] Media files and card media will be transcoded to a supported RCS format. This
20
+ # adds a small delay to sending the message. Ignored for rich text messages.
21
+ attr_reader :transcode
22
+ # @return [Boolean] Validate your message for any unsupported files. <br>
23
+ # If failed, errors will be thrown and the message will not send.
24
+ attr_reader :validate
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param schedule [Pinnacle::Types::MessageSchedule]
34
+ # @param test_mode [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
35
+ # debugging.
36
+ # @param tracking [Pinnacle::Types::Tracking]
37
+ # @param transcode [Boolean] Media files and card media will be transcoded to a supported RCS format. This
38
+ # adds a small delay to sending the message. Ignored for rich text messages.
39
+ # @param validate [Boolean] Validate your message for any unsupported files. <br>
40
+ # If failed, errors will be thrown and the message will not send.
41
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
42
+ # @return [Pinnacle::Types::Options]
43
+ def initialize(schedule: OMIT, test_mode: OMIT, tracking: OMIT, transcode: OMIT, validate: OMIT,
44
+ additional_properties: nil)
45
+ @schedule = schedule if schedule != OMIT
46
+ @test_mode = test_mode if test_mode != OMIT
47
+ @tracking = tracking if tracking != OMIT
48
+ @transcode = transcode if transcode != OMIT
49
+ @validate = validate if validate != OMIT
50
+ @additional_properties = additional_properties
51
+ @_field_set = {
52
+ "schedule": schedule,
53
+ "test_mode": test_mode,
54
+ "tracking": tracking,
55
+ "transcode": transcode,
56
+ "validate": validate
57
+ }.reject do |_k, v|
58
+ v == OMIT
59
+ end
60
+ end
61
+
62
+ # Deserialize a JSON object to an instance of Options
63
+ #
64
+ # @param json_object [String]
65
+ # @return [Pinnacle::Types::Options]
66
+ def self.from_json(json_object:)
67
+ struct = JSON.parse(json_object, object_class: OpenStruct)
68
+ parsed_json = JSON.parse(json_object)
69
+ if parsed_json["schedule"].nil?
70
+ schedule = nil
71
+ else
72
+ schedule = parsed_json["schedule"].to_json
73
+ schedule = Pinnacle::Types::MessageSchedule.from_json(json_object: schedule)
74
+ end
75
+ test_mode = parsed_json["test_mode"]
76
+ tracking = parsed_json["tracking"]
77
+ transcode = parsed_json["transcode"]
78
+ validate = parsed_json["validate"]
79
+ new(
80
+ schedule: schedule,
81
+ test_mode: test_mode,
82
+ tracking: tracking,
83
+ transcode: transcode,
84
+ validate: validate,
85
+ additional_properties: struct
86
+ )
87
+ end
88
+
89
+ # Serialize an instance of Options to a JSON object
90
+ #
91
+ # @return [String]
92
+ def to_json(*_args)
93
+ @_field_set&.to_json
94
+ end
95
+
96
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
97
+ # hash and check each fields type against the current object's property
98
+ # definitions.
99
+ #
100
+ # @param obj [Object]
101
+ # @return [Void]
102
+ def self.validate_raw(obj:)
103
+ obj.schedule.nil? || Pinnacle::Types::MessageSchedule.validate_raw(obj: obj.schedule)
104
+ obj.test_mode&.is_a?(Boolean) != false || raise("Passed value for field obj.test_mode is not the expected type, validation failed.")
105
+ obj.tracking&.is_a?(Pinnacle::Types::Tracking) != false || raise("Passed value for field obj.tracking is not the expected type, validation failed.")
106
+ obj.transcode&.is_a?(Boolean) != false || raise("Passed value for field obj.transcode is not the expected type, validation failed.")
107
+ obj.validate&.is_a?(Boolean) != false || raise("Passed value for field obj.validate is not the expected type, validation failed.")
108
+ end
109
+ end
110
+ end
111
+ 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
+ class Pagination
9
+ # @return [Integer] Current page number (1-indexed).
10
+ attr_reader :page
11
+ # @return [Integer] Items per page (max 100, default 50).
12
+ attr_reader :limit
13
+ # @return [Integer] Total number of contacts in the audience.
14
+ attr_reader :total
15
+ # @return [Boolean] Whether more pages exist.
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 page [Integer] Current page number (1-indexed).
26
+ # @param limit [Integer] Items per page (max 100, default 50).
27
+ # @param total [Integer] Total number of contacts in the audience.
28
+ # @param has_more [Boolean] Whether more pages exist.
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Pinnacle::Types::Pagination]
31
+ def initialize(page:, limit:, total:, has_more:, additional_properties: nil)
32
+ @page = page
33
+ @limit = limit
34
+ @total = total
35
+ @has_more = has_more
36
+ @additional_properties = additional_properties
37
+ @_field_set = { "page": page, "limit": limit, "total": total, "hasMore": has_more }
38
+ end
39
+
40
+ # Deserialize a JSON object to an instance of Pagination
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Pinnacle::Types::Pagination]
44
+ def self.from_json(json_object:)
45
+ struct = JSON.parse(json_object, object_class: OpenStruct)
46
+ parsed_json = JSON.parse(json_object)
47
+ page = parsed_json["page"]
48
+ limit = parsed_json["limit"]
49
+ total = parsed_json["total"]
50
+ has_more = parsed_json["hasMore"]
51
+ new(
52
+ page: page,
53
+ limit: limit,
54
+ total: total,
55
+ has_more: has_more,
56
+ additional_properties: struct
57
+ )
58
+ end
59
+
60
+ # Serialize an instance of Pagination to a JSON object
61
+ #
62
+ # @return [String]
63
+ def to_json(*_args)
64
+ @_field_set&.to_json
65
+ end
66
+
67
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
68
+ # hash and check each fields type against the current object's property
69
+ # definitions.
70
+ #
71
+ # @param obj [Object]
72
+ # @return [Void]
73
+ def self.validate_raw(obj:)
74
+ obj.page.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
75
+ obj.limit.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.")
76
+ obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
77
+ obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.")
78
+ end
79
+ end
80
+ end
81
+ end