twilio-ruby 5.39.2 → 5.40.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +107 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/PULL_REQUEST_TEMPLATE.md +1 -1
  7. data/README.md +4 -3
  8. data/lib/twilio-ruby/framework/version.rb +4 -8
  9. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +12 -3
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +12 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +12 -3
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +12 -3
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +12 -3
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +12 -3
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +12 -3
  17. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -1
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +85 -60
  19. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
  20. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  22. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  23. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +8 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +3 -1
  25. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +2 -1
  26. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +8 -4
  27. data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +11 -4
  28. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +13 -6
  29. data/lib/twilio-ruby/rest/client.rb +7 -0
  30. data/lib/twilio-ruby/rest/conversations.rb +39 -3
  31. data/lib/twilio-ruby/rest/conversations/v1.rb +68 -5
  32. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +268 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +21 -10
  35. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
  36. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +34 -19
  37. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +48 -32
  38. data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
  39. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  40. data/lib/twilio-ruby/rest/conversations/v1/role.rb +374 -0
  41. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  42. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +388 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +271 -0
  44. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +549 -0
  47. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +394 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +519 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +457 -0
  50. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +395 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  53. data/lib/twilio-ruby/rest/events.rb +72 -0
  54. data/lib/twilio-ruby/rest/events/v1.rb +90 -0
  55. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  56. data/lib/twilio-ruby/rest/events/v1/schema.rb +226 -0
  57. data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +290 -0
  58. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  59. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  60. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  61. data/lib/twilio-ruby/rest/events/v1/subscription.rb +383 -0
  62. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +216 -0
  63. data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
  64. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  65. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  66. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  67. data/lib/twilio-ruby/rest/messaging/v1/service.rb +6 -3
  68. data/lib/twilio-ruby/rest/notify/v1/credential.rb +12 -6
  69. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +10 -2
  70. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  71. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  72. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  73. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +10 -5
  74. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +6 -3
  75. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +1 -4
  76. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +3 -1
  77. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  78. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  79. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  80. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  81. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  82. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  83. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  84. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  85. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  86. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  87. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  88. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  89. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  90. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
  91. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  92. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  93. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +6 -2
  94. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +1 -4
  95. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +6 -2
  96. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +38 -23
  97. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -1
  98. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -1
  99. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +201 -0
  100. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  101. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  102. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -2
  103. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -3
  104. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +18 -9
  105. data/lib/twilio-ruby/rest/video/v1/room.rb +2 -1
  106. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  107. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +1 -4
  108. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -1
  109. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  110. data/lib/twilio-ruby/version.rb +1 -1
  111. data/spec/framework/version_spec.rb +53 -0
  112. data/spec/holodeck/holodeck.rb +3 -3
  113. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  114. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  115. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  116. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  117. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  118. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  119. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  120. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  121. data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
  122. data/spec/integration/conversations/v1/configuration_spec.rb +87 -0
  123. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  124. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  125. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  126. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  127. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  128. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  129. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  130. data/spec/integration/conversations/v1/service/configuration/notification_spec.rb +115 -0
  131. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  132. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  133. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  134. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  135. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  136. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  137. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  138. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  139. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  140. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  141. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  142. data/spec/integration/events/v1/schema/schema_version_spec.rb +126 -0
  143. data/spec/integration/events/v1/schema_spec.rb +46 -0
  144. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  145. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  146. data/spec/integration/events/v1/sink_spec.rb +217 -0
  147. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +91 -0
  148. data/spec/integration/events/v1/subscription_spec.rb +243 -0
  149. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  150. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  151. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  152. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  153. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  154. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  155. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  156. data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
  157. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  158. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  159. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  160. data/spec/integration/video/v1/room_spec.rb +37 -0
  161. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  162. data/spec/spec_helper.rb +1 -1
  163. metadata +82 -5
  164. data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -0,0 +1,315 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Conversations < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ class ConfigurationContext < InstanceContext
15
+ ##
16
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
17
+ class NotificationList < ListResource
18
+ ##
19
+ # Initialize the NotificationList
20
+ # @param [Version] version Version that contains the resource
21
+ # @param [String] chat_service_sid The unique string that we created to identify
22
+ # the Service configuration resource.
23
+ # @return [NotificationList] NotificationList
24
+ def initialize(version, chat_service_sid: nil)
25
+ super(version)
26
+
27
+ # Path Solution
28
+ @solution = {chat_service_sid: chat_service_sid}
29
+ end
30
+
31
+ ##
32
+ # Provide a user friendly representation
33
+ def to_s
34
+ '#<Twilio.Conversations.V1.NotificationList>'
35
+ end
36
+ end
37
+
38
+ ##
39
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
40
+ class NotificationPage < Page
41
+ ##
42
+ # Initialize the NotificationPage
43
+ # @param [Version] version Version that contains the resource
44
+ # @param [Response] response Response from the API
45
+ # @param [Hash] solution Path solution for the resource
46
+ # @return [NotificationPage] NotificationPage
47
+ def initialize(version, response, solution)
48
+ super(version, response)
49
+
50
+ # Path Solution
51
+ @solution = solution
52
+ end
53
+
54
+ ##
55
+ # Build an instance of NotificationInstance
56
+ # @param [Hash] payload Payload response from the API
57
+ # @return [NotificationInstance] NotificationInstance
58
+ def get_instance(payload)
59
+ NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
60
+ end
61
+
62
+ ##
63
+ # Provide a user friendly representation
64
+ def to_s
65
+ '<Twilio.Conversations.V1.NotificationPage>'
66
+ end
67
+ end
68
+
69
+ ##
70
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
71
+ class NotificationContext < InstanceContext
72
+ ##
73
+ # Initialize the NotificationContext
74
+ # @param [Version] version Version that contains the resource
75
+ # @param [String] chat_service_sid The SID of the [Conversation
76
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
77
+ # Configuration applies to.
78
+ # @return [NotificationContext] NotificationContext
79
+ def initialize(version, chat_service_sid)
80
+ super(version)
81
+
82
+ # Path Solution
83
+ @solution = {chat_service_sid: chat_service_sid, }
84
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Notifications"
85
+ end
86
+
87
+ ##
88
+ # Update the NotificationInstance
89
+ # @param [Boolean] log_enabled Weather the notification logging is enabled.
90
+ # @param [Boolean] new_message_enabled Whether to send a notification when a new
91
+ # message is added to a conversation. The default is `false`.
92
+ # @param [String] new_message_template The template to use to create the
93
+ # notification text displayed when a new message is added to a conversation and
94
+ # `new_message.enabled` is `true`.
95
+ # @param [String] new_message_sound The name of the sound to play when a new
96
+ # message is added to a conversation and `new_message.enabled` is `true`.
97
+ # @param [Boolean] new_message_badge_count_enabled Whether the new message badge
98
+ # is enabled. The default is `false`.
99
+ # @param [Boolean] added_to_conversation_enabled Whether to send a notification
100
+ # when a participant is added to a conversation. The default is `false`.
101
+ # @param [String] added_to_conversation_template The template to use to create the
102
+ # notification text displayed when a participant is added to a conversation and
103
+ # `added_to_conversation.enabled` is `true`.
104
+ # @param [String] added_to_conversation_sound The name of the sound to play when a
105
+ # participant is added to a conversation and `added_to_conversation.enabled` is
106
+ # `true`.
107
+ # @param [Boolean] removed_from_conversation_enabled Whether to send a
108
+ # notification to a user when they are removed from a conversation. The default is
109
+ # `false`.
110
+ # @param [String] removed_from_conversation_template The template to use to create
111
+ # the notification text displayed to a user when they are removed from a
112
+ # conversation and `removed_from_conversation.enabled` is `true`.
113
+ # @param [String] removed_from_conversation_sound The name of the sound to play to
114
+ # a user when they are removed from a conversation and
115
+ # `removed_from_conversation.enabled` is `true`.
116
+ # @return [NotificationInstance] Updated NotificationInstance
117
+ def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
118
+ data = Twilio::Values.of({
119
+ 'LogEnabled' => log_enabled,
120
+ 'NewMessage.Enabled' => new_message_enabled,
121
+ 'NewMessage.Template' => new_message_template,
122
+ 'NewMessage.Sound' => new_message_sound,
123
+ 'NewMessage.BadgeCountEnabled' => new_message_badge_count_enabled,
124
+ 'AddedToConversation.Enabled' => added_to_conversation_enabled,
125
+ 'AddedToConversation.Template' => added_to_conversation_template,
126
+ 'AddedToConversation.Sound' => added_to_conversation_sound,
127
+ 'RemovedFromConversation.Enabled' => removed_from_conversation_enabled,
128
+ 'RemovedFromConversation.Template' => removed_from_conversation_template,
129
+ 'RemovedFromConversation.Sound' => removed_from_conversation_sound,
130
+ })
131
+
132
+ payload = @version.update('POST', @uri, data: data)
133
+
134
+ NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
135
+ end
136
+
137
+ ##
138
+ # Fetch the NotificationInstance
139
+ # @return [NotificationInstance] Fetched NotificationInstance
140
+ def fetch
141
+ payload = @version.fetch('GET', @uri)
142
+
143
+ NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
144
+ end
145
+
146
+ ##
147
+ # Provide a user friendly representation
148
+ def to_s
149
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
150
+ "#<Twilio.Conversations.V1.NotificationContext #{context}>"
151
+ end
152
+
153
+ ##
154
+ # Provide a detailed, user friendly representation
155
+ def inspect
156
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
157
+ "#<Twilio.Conversations.V1.NotificationContext #{context}>"
158
+ end
159
+ end
160
+
161
+ ##
162
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
163
+ class NotificationInstance < InstanceResource
164
+ ##
165
+ # Initialize the NotificationInstance
166
+ # @param [Version] version Version that contains the resource
167
+ # @param [Hash] payload payload that contains response from Twilio
168
+ # @param [String] chat_service_sid The unique string that we created to identify
169
+ # the Service configuration resource.
170
+ # @return [NotificationInstance] NotificationInstance
171
+ def initialize(version, payload, chat_service_sid: nil)
172
+ super(version)
173
+
174
+ # Marshaled Properties
175
+ @properties = {
176
+ 'account_sid' => payload['account_sid'],
177
+ 'chat_service_sid' => payload['chat_service_sid'],
178
+ 'new_message' => payload['new_message'],
179
+ 'added_to_conversation' => payload['added_to_conversation'],
180
+ 'removed_from_conversation' => payload['removed_from_conversation'],
181
+ 'log_enabled' => payload['log_enabled'],
182
+ 'url' => payload['url'],
183
+ }
184
+
185
+ # Context
186
+ @instance_context = nil
187
+ @params = {'chat_service_sid' => chat_service_sid, }
188
+ end
189
+
190
+ ##
191
+ # Generate an instance context for the instance, the context is capable of
192
+ # performing various actions. All instance actions are proxied to the context
193
+ # @return [NotificationContext] NotificationContext for this NotificationInstance
194
+ def context
195
+ unless @instance_context
196
+ @instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )
197
+ end
198
+ @instance_context
199
+ end
200
+
201
+ ##
202
+ # @return [String] The unique ID of the Account responsible for this configuration.
203
+ def account_sid
204
+ @properties['account_sid']
205
+ end
206
+
207
+ ##
208
+ # @return [String] The SID of the Conversation Service that the Configuration applies to.
209
+ def chat_service_sid
210
+ @properties['chat_service_sid']
211
+ end
212
+
213
+ ##
214
+ # @return [Hash] The Push Notification configuration for New Messages.
215
+ def new_message
216
+ @properties['new_message']
217
+ end
218
+
219
+ ##
220
+ # @return [Hash] The Push Notification configuration for being added to a Conversation.
221
+ def added_to_conversation
222
+ @properties['added_to_conversation']
223
+ end
224
+
225
+ ##
226
+ # @return [Hash] The Push Notification configuration for being removed from a Conversation.
227
+ def removed_from_conversation
228
+ @properties['removed_from_conversation']
229
+ end
230
+
231
+ ##
232
+ # @return [Boolean] Weather the notification logging is enabled.
233
+ def log_enabled
234
+ @properties['log_enabled']
235
+ end
236
+
237
+ ##
238
+ # @return [String] An absolute URL for this configuration.
239
+ def url
240
+ @properties['url']
241
+ end
242
+
243
+ ##
244
+ # Update the NotificationInstance
245
+ # @param [Boolean] log_enabled Weather the notification logging is enabled.
246
+ # @param [Boolean] new_message_enabled Whether to send a notification when a new
247
+ # message is added to a conversation. The default is `false`.
248
+ # @param [String] new_message_template The template to use to create the
249
+ # notification text displayed when a new message is added to a conversation and
250
+ # `new_message.enabled` is `true`.
251
+ # @param [String] new_message_sound The name of the sound to play when a new
252
+ # message is added to a conversation and `new_message.enabled` is `true`.
253
+ # @param [Boolean] new_message_badge_count_enabled Whether the new message badge
254
+ # is enabled. The default is `false`.
255
+ # @param [Boolean] added_to_conversation_enabled Whether to send a notification
256
+ # when a participant is added to a conversation. The default is `false`.
257
+ # @param [String] added_to_conversation_template The template to use to create the
258
+ # notification text displayed when a participant is added to a conversation and
259
+ # `added_to_conversation.enabled` is `true`.
260
+ # @param [String] added_to_conversation_sound The name of the sound to play when a
261
+ # participant is added to a conversation and `added_to_conversation.enabled` is
262
+ # `true`.
263
+ # @param [Boolean] removed_from_conversation_enabled Whether to send a
264
+ # notification to a user when they are removed from a conversation. The default is
265
+ # `false`.
266
+ # @param [String] removed_from_conversation_template The template to use to create
267
+ # the notification text displayed to a user when they are removed from a
268
+ # conversation and `removed_from_conversation.enabled` is `true`.
269
+ # @param [String] removed_from_conversation_sound The name of the sound to play to
270
+ # a user when they are removed from a conversation and
271
+ # `removed_from_conversation.enabled` is `true`.
272
+ # @return [NotificationInstance] Updated NotificationInstance
273
+ def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
274
+ context.update(
275
+ log_enabled: log_enabled,
276
+ new_message_enabled: new_message_enabled,
277
+ new_message_template: new_message_template,
278
+ new_message_sound: new_message_sound,
279
+ new_message_badge_count_enabled: new_message_badge_count_enabled,
280
+ added_to_conversation_enabled: added_to_conversation_enabled,
281
+ added_to_conversation_template: added_to_conversation_template,
282
+ added_to_conversation_sound: added_to_conversation_sound,
283
+ removed_from_conversation_enabled: removed_from_conversation_enabled,
284
+ removed_from_conversation_template: removed_from_conversation_template,
285
+ removed_from_conversation_sound: removed_from_conversation_sound,
286
+ )
287
+ end
288
+
289
+ ##
290
+ # Fetch the NotificationInstance
291
+ # @return [NotificationInstance] Fetched NotificationInstance
292
+ def fetch
293
+ context.fetch
294
+ end
295
+
296
+ ##
297
+ # Provide a user friendly representation
298
+ def to_s
299
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
300
+ "<Twilio.Conversations.V1.NotificationInstance #{values}>"
301
+ end
302
+
303
+ ##
304
+ # Provide a detailed, user friendly representation
305
+ def inspect
306
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
307
+ "<Twilio.Conversations.V1.NotificationInstance #{values}>"
308
+ end
309
+ end
310
+ end
311
+ end
312
+ end
313
+ end
314
+ end
315
+ end
@@ -0,0 +1,586 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Conversations < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class ConversationList < ListResource
17
+ ##
18
+ # Initialize the ConversationList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] chat_service_sid The unique ID of the [Conversation
21
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) this
22
+ # conversation belongs to.
23
+ # @return [ConversationList] ConversationList
24
+ def initialize(version, chat_service_sid: nil)
25
+ super(version)
26
+
27
+ # Path Solution
28
+ @solution = {chat_service_sid: chat_service_sid}
29
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations"
30
+ end
31
+
32
+ ##
33
+ # Create the ConversationInstance
34
+ # @param [String] friendly_name The human-readable name of this conversation,
35
+ # limited to 256 characters. Optional.
36
+ # @param [String] unique_name An application-defined string that uniquely
37
+ # identifies the resource. It can be used to address the resource in place of the
38
+ # resource's `sid` in the URL.
39
+ # @param [String] attributes An optional string metadata field you can use to
40
+ # store any data you wish. The string value must contain structurally valid JSON
41
+ # if specified. **Note** that if the attributes are not set "{}" will be
42
+ # returned.
43
+ # @param [String] messaging_service_sid The unique ID of the [Messaging
44
+ # Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs
45
+ # to.
46
+ # @param [Time] date_created The date that this resource was created.
47
+ # @param [Time] date_updated The date that this resource was last updated.
48
+ # @param [conversation.State] state Current state of this conversation. Can be
49
+ # either `active`, `inactive` or `closed` and defaults to `active`
50
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
51
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
52
+ # @param [String] timers_closed ISO8601 duration when conversation will be
53
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
54
+ # @param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
55
+ # X-Twilio-Webhook-Enabled HTTP request header
56
+ # @return [ConversationInstance] Created ConversationInstance
57
+ def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, messaging_service_sid: :unset, date_created: :unset, date_updated: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, x_twilio_webhook_enabled: :unset)
58
+ data = Twilio::Values.of({
59
+ 'FriendlyName' => friendly_name,
60
+ 'UniqueName' => unique_name,
61
+ 'Attributes' => attributes,
62
+ 'MessagingServiceSid' => messaging_service_sid,
63
+ 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
64
+ 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
65
+ 'State' => state,
66
+ 'Timers.Inactive' => timers_inactive,
67
+ 'Timers.Closed' => timers_closed,
68
+ })
69
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
70
+
71
+ payload = @version.create('POST', @uri, data: data, headers: headers)
72
+
73
+ ConversationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
74
+ end
75
+
76
+ ##
77
+ # Lists ConversationInstance records from the API as a list.
78
+ # Unlike stream(), this operation is eager and will load `limit` records into
79
+ # memory before returning.
80
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
81
+ # guarantees to never return more than limit. Default is no limit
82
+ # @param [Integer] page_size Number of records to fetch per request, when
83
+ # not set will use the default value of 50 records. If no page_size is defined
84
+ # but a limit is defined, stream() will attempt to read the limit with the most
85
+ # efficient page size, i.e. min(limit, 1000)
86
+ # @return [Array] Array of up to limit results
87
+ def list(limit: nil, page_size: nil)
88
+ self.stream(limit: limit, page_size: page_size).entries
89
+ end
90
+
91
+ ##
92
+ # Streams ConversationInstance records from the API as an Enumerable.
93
+ # This operation lazily loads records as efficiently as possible until the limit
94
+ # is reached.
95
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
96
+ # guarantees to never return more than limit. Default is no limit.
97
+ # @param [Integer] page_size Number of records to fetch per request, when
98
+ # not set will use the default value of 50 records. If no page_size is defined
99
+ # but a limit is defined, stream() will attempt to read the limit with the most
100
+ # efficient page size, i.e. min(limit, 1000)
101
+ # @return [Enumerable] Enumerable that will yield up to limit results
102
+ def stream(limit: nil, page_size: nil)
103
+ limits = @version.read_limits(limit, page_size)
104
+
105
+ page = self.page(page_size: limits[:page_size], )
106
+
107
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
108
+ end
109
+
110
+ ##
111
+ # When passed a block, yields ConversationInstance records from the API.
112
+ # This operation lazily loads records as efficiently as possible until the limit
113
+ # is reached.
114
+ def each
115
+ limits = @version.read_limits
116
+
117
+ page = self.page(page_size: limits[:page_size], )
118
+
119
+ @version.stream(page,
120
+ limit: limits[:limit],
121
+ page_limit: limits[:page_limit]).each {|x| yield x}
122
+ end
123
+
124
+ ##
125
+ # Retrieve a single page of ConversationInstance records from the API.
126
+ # Request is executed immediately.
127
+ # @param [String] page_token PageToken provided by the API
128
+ # @param [Integer] page_number Page Number, this value is simply for client state
129
+ # @param [Integer] page_size Number of records to return, defaults to 50
130
+ # @return [Page] Page of ConversationInstance
131
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
132
+ params = Twilio::Values.of({
133
+ 'PageToken' => page_token,
134
+ 'Page' => page_number,
135
+ 'PageSize' => page_size,
136
+ })
137
+
138
+ response = @version.page('GET', @uri, params: params)
139
+
140
+ ConversationPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Retrieve a single page of ConversationInstance records from the API.
145
+ # Request is executed immediately.
146
+ # @param [String] target_url API-generated URL for the requested results page
147
+ # @return [Page] Page of ConversationInstance
148
+ def get_page(target_url)
149
+ response = @version.domain.request(
150
+ 'GET',
151
+ target_url
152
+ )
153
+ ConversationPage.new(@version, response, @solution)
154
+ end
155
+
156
+ ##
157
+ # Provide a user friendly representation
158
+ def to_s
159
+ '#<Twilio.Conversations.V1.ConversationList>'
160
+ end
161
+ end
162
+
163
+ ##
164
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
165
+ class ConversationPage < Page
166
+ ##
167
+ # Initialize the ConversationPage
168
+ # @param [Version] version Version that contains the resource
169
+ # @param [Response] response Response from the API
170
+ # @param [Hash] solution Path solution for the resource
171
+ # @return [ConversationPage] ConversationPage
172
+ def initialize(version, response, solution)
173
+ super(version, response)
174
+
175
+ # Path Solution
176
+ @solution = solution
177
+ end
178
+
179
+ ##
180
+ # Build an instance of ConversationInstance
181
+ # @param [Hash] payload Payload response from the API
182
+ # @return [ConversationInstance] ConversationInstance
183
+ def get_instance(payload)
184
+ ConversationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
185
+ end
186
+
187
+ ##
188
+ # Provide a user friendly representation
189
+ def to_s
190
+ '<Twilio.Conversations.V1.ConversationPage>'
191
+ end
192
+ end
193
+
194
+ ##
195
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
196
+ class ConversationContext < InstanceContext
197
+ ##
198
+ # Initialize the ConversationContext
199
+ # @param [Version] version Version that contains the resource
200
+ # @param [String] chat_service_sid The chat_service_sid
201
+ # @param [String] sid A 34 character string that uniquely identifies this
202
+ # resource. Can also be the `unique_name` of the Conversation.
203
+ # @return [ConversationContext] ConversationContext
204
+ def initialize(version, chat_service_sid, sid)
205
+ super(version)
206
+
207
+ # Path Solution
208
+ @solution = {chat_service_sid: chat_service_sid, sid: sid, }
209
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:sid]}"
210
+
211
+ # Dependents
212
+ @participants = nil
213
+ @messages = nil
214
+ @webhooks = nil
215
+ end
216
+
217
+ ##
218
+ # Update the ConversationInstance
219
+ # @param [String] friendly_name The human-readable name of this conversation,
220
+ # limited to 256 characters. Optional.
221
+ # @param [Time] date_created The date that this resource was created.
222
+ # @param [Time] date_updated The date that this resource was last updated.
223
+ # @param [String] attributes An optional string metadata field you can use to
224
+ # store any data you wish. The string value must contain structurally valid JSON
225
+ # if specified. **Note** that if the attributes are not set "{}" will be
226
+ # returned.
227
+ # @param [String] messaging_service_sid The unique ID of the [Messaging
228
+ # Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs
229
+ # to.
230
+ # @param [conversation.State] state Current state of this conversation. Can be
231
+ # either `active`, `inactive` or `closed` and defaults to `active`
232
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
233
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
234
+ # @param [String] timers_closed ISO8601 duration when conversation will be
235
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
236
+ # @param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
237
+ # X-Twilio-Webhook-Enabled HTTP request header
238
+ # @return [ConversationInstance] Updated ConversationInstance
239
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, x_twilio_webhook_enabled: :unset)
240
+ data = Twilio::Values.of({
241
+ 'FriendlyName' => friendly_name,
242
+ 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
243
+ 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
244
+ 'Attributes' => attributes,
245
+ 'MessagingServiceSid' => messaging_service_sid,
246
+ 'State' => state,
247
+ 'Timers.Inactive' => timers_inactive,
248
+ 'Timers.Closed' => timers_closed,
249
+ })
250
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
251
+
252
+ payload = @version.update('POST', @uri, data: data, headers: headers)
253
+
254
+ ConversationInstance.new(
255
+ @version,
256
+ payload,
257
+ chat_service_sid: @solution[:chat_service_sid],
258
+ sid: @solution[:sid],
259
+ )
260
+ end
261
+
262
+ ##
263
+ # Delete the ConversationInstance
264
+ # @param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
265
+ # X-Twilio-Webhook-Enabled HTTP request header
266
+ # @return [Boolean] true if delete succeeds, false otherwise
267
+ def delete(x_twilio_webhook_enabled: :unset)
268
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
269
+
270
+ @version.delete('DELETE', @uri, headers: headers)
271
+ end
272
+
273
+ ##
274
+ # Fetch the ConversationInstance
275
+ # @return [ConversationInstance] Fetched ConversationInstance
276
+ def fetch
277
+ payload = @version.fetch('GET', @uri)
278
+
279
+ ConversationInstance.new(
280
+ @version,
281
+ payload,
282
+ chat_service_sid: @solution[:chat_service_sid],
283
+ sid: @solution[:sid],
284
+ )
285
+ end
286
+
287
+ ##
288
+ # Access the participants
289
+ # @return [ParticipantList]
290
+ # @return [ParticipantContext] if sid was passed.
291
+ def participants(sid=:unset)
292
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
293
+
294
+ if sid != :unset
295
+ return ParticipantContext.new(@version, @solution[:chat_service_sid], @solution[:sid], sid, )
296
+ end
297
+
298
+ unless @participants
299
+ @participants = ParticipantList.new(
300
+ @version,
301
+ chat_service_sid: @solution[:chat_service_sid],
302
+ conversation_sid: @solution[:sid],
303
+ )
304
+ end
305
+
306
+ @participants
307
+ end
308
+
309
+ ##
310
+ # Access the messages
311
+ # @return [MessageList]
312
+ # @return [MessageContext] if sid was passed.
313
+ def messages(sid=:unset)
314
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
315
+
316
+ if sid != :unset
317
+ return MessageContext.new(@version, @solution[:chat_service_sid], @solution[:sid], sid, )
318
+ end
319
+
320
+ unless @messages
321
+ @messages = MessageList.new(
322
+ @version,
323
+ chat_service_sid: @solution[:chat_service_sid],
324
+ conversation_sid: @solution[:sid],
325
+ )
326
+ end
327
+
328
+ @messages
329
+ end
330
+
331
+ ##
332
+ # Access the webhooks
333
+ # @return [WebhookList]
334
+ # @return [WebhookContext] if sid was passed.
335
+ def webhooks(sid=:unset)
336
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
337
+
338
+ if sid != :unset
339
+ return WebhookContext.new(@version, @solution[:chat_service_sid], @solution[:sid], sid, )
340
+ end
341
+
342
+ unless @webhooks
343
+ @webhooks = WebhookList.new(
344
+ @version,
345
+ chat_service_sid: @solution[:chat_service_sid],
346
+ conversation_sid: @solution[:sid],
347
+ )
348
+ end
349
+
350
+ @webhooks
351
+ end
352
+
353
+ ##
354
+ # Provide a user friendly representation
355
+ def to_s
356
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
357
+ "#<Twilio.Conversations.V1.ConversationContext #{context}>"
358
+ end
359
+
360
+ ##
361
+ # Provide a detailed, user friendly representation
362
+ def inspect
363
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
364
+ "#<Twilio.Conversations.V1.ConversationContext #{context}>"
365
+ end
366
+ end
367
+
368
+ ##
369
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
370
+ class ConversationInstance < InstanceResource
371
+ ##
372
+ # Initialize the ConversationInstance
373
+ # @param [Version] version Version that contains the resource
374
+ # @param [Hash] payload payload that contains response from Twilio
375
+ # @param [String] chat_service_sid The unique ID of the [Conversation
376
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) this
377
+ # conversation belongs to.
378
+ # @param [String] sid A 34 character string that uniquely identifies this
379
+ # resource. Can also be the `unique_name` of the Conversation.
380
+ # @return [ConversationInstance] ConversationInstance
381
+ def initialize(version, payload, chat_service_sid: nil, sid: nil)
382
+ super(version)
383
+
384
+ # Marshaled Properties
385
+ @properties = {
386
+ 'account_sid' => payload['account_sid'],
387
+ 'chat_service_sid' => payload['chat_service_sid'],
388
+ 'messaging_service_sid' => payload['messaging_service_sid'],
389
+ 'sid' => payload['sid'],
390
+ 'friendly_name' => payload['friendly_name'],
391
+ 'unique_name' => payload['unique_name'],
392
+ 'attributes' => payload['attributes'],
393
+ 'state' => payload['state'],
394
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
395
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
396
+ 'timers' => payload['timers'],
397
+ 'url' => payload['url'],
398
+ 'links' => payload['links'],
399
+ }
400
+
401
+ # Context
402
+ @instance_context = nil
403
+ @params = {'chat_service_sid' => chat_service_sid, 'sid' => sid || @properties['sid'], }
404
+ end
405
+
406
+ ##
407
+ # Generate an instance context for the instance, the context is capable of
408
+ # performing various actions. All instance actions are proxied to the context
409
+ # @return [ConversationContext] ConversationContext for this ConversationInstance
410
+ def context
411
+ unless @instance_context
412
+ @instance_context = ConversationContext.new(@version, @params['chat_service_sid'], @params['sid'], )
413
+ end
414
+ @instance_context
415
+ end
416
+
417
+ ##
418
+ # @return [String] The unique ID of the Account responsible for this conversation.
419
+ def account_sid
420
+ @properties['account_sid']
421
+ end
422
+
423
+ ##
424
+ # @return [String] The unique ID of the Conversation Service this conversation belongs to.
425
+ def chat_service_sid
426
+ @properties['chat_service_sid']
427
+ end
428
+
429
+ ##
430
+ # @return [String] The unique ID of the Messaging Service this conversation belongs to.
431
+ def messaging_service_sid
432
+ @properties['messaging_service_sid']
433
+ end
434
+
435
+ ##
436
+ # @return [String] A 34 character string that uniquely identifies this resource.
437
+ def sid
438
+ @properties['sid']
439
+ end
440
+
441
+ ##
442
+ # @return [String] The human-readable name of this conversation.
443
+ def friendly_name
444
+ @properties['friendly_name']
445
+ end
446
+
447
+ ##
448
+ # @return [String] An application-defined string that uniquely identifies the resource
449
+ def unique_name
450
+ @properties['unique_name']
451
+ end
452
+
453
+ ##
454
+ # @return [String] An optional string metadata field you can use to store any data you wish.
455
+ def attributes
456
+ @properties['attributes']
457
+ end
458
+
459
+ ##
460
+ # @return [conversation.State] Current state of this conversation.
461
+ def state
462
+ @properties['state']
463
+ end
464
+
465
+ ##
466
+ # @return [Time] The date that this resource was created.
467
+ def date_created
468
+ @properties['date_created']
469
+ end
470
+
471
+ ##
472
+ # @return [Time] The date that this resource was last updated.
473
+ def date_updated
474
+ @properties['date_updated']
475
+ end
476
+
477
+ ##
478
+ # @return [Hash] Timer date values for this conversation.
479
+ def timers
480
+ @properties['timers']
481
+ end
482
+
483
+ ##
484
+ # @return [String] An absolute URL for this conversation.
485
+ def url
486
+ @properties['url']
487
+ end
488
+
489
+ ##
490
+ # @return [String] Absolute URLs to access the Participants, Messages and Webhooks of this Conversation.
491
+ def links
492
+ @properties['links']
493
+ end
494
+
495
+ ##
496
+ # Update the ConversationInstance
497
+ # @param [String] friendly_name The human-readable name of this conversation,
498
+ # limited to 256 characters. Optional.
499
+ # @param [Time] date_created The date that this resource was created.
500
+ # @param [Time] date_updated The date that this resource was last updated.
501
+ # @param [String] attributes An optional string metadata field you can use to
502
+ # store any data you wish. The string value must contain structurally valid JSON
503
+ # if specified. **Note** that if the attributes are not set "{}" will be
504
+ # returned.
505
+ # @param [String] messaging_service_sid The unique ID of the [Messaging
506
+ # Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs
507
+ # to.
508
+ # @param [conversation.State] state Current state of this conversation. Can be
509
+ # either `active`, `inactive` or `closed` and defaults to `active`
510
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
511
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
512
+ # @param [String] timers_closed ISO8601 duration when conversation will be
513
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
514
+ # @param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
515
+ # X-Twilio-Webhook-Enabled HTTP request header
516
+ # @return [ConversationInstance] Updated ConversationInstance
517
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, x_twilio_webhook_enabled: :unset)
518
+ context.update(
519
+ friendly_name: friendly_name,
520
+ date_created: date_created,
521
+ date_updated: date_updated,
522
+ attributes: attributes,
523
+ messaging_service_sid: messaging_service_sid,
524
+ state: state,
525
+ timers_inactive: timers_inactive,
526
+ timers_closed: timers_closed,
527
+ x_twilio_webhook_enabled: x_twilio_webhook_enabled,
528
+ )
529
+ end
530
+
531
+ ##
532
+ # Delete the ConversationInstance
533
+ # @param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
534
+ # X-Twilio-Webhook-Enabled HTTP request header
535
+ # @return [Boolean] true if delete succeeds, false otherwise
536
+ def delete(x_twilio_webhook_enabled: :unset)
537
+ context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
538
+ end
539
+
540
+ ##
541
+ # Fetch the ConversationInstance
542
+ # @return [ConversationInstance] Fetched ConversationInstance
543
+ def fetch
544
+ context.fetch
545
+ end
546
+
547
+ ##
548
+ # Access the participants
549
+ # @return [participants] participants
550
+ def participants
551
+ context.participants
552
+ end
553
+
554
+ ##
555
+ # Access the messages
556
+ # @return [messages] messages
557
+ def messages
558
+ context.messages
559
+ end
560
+
561
+ ##
562
+ # Access the webhooks
563
+ # @return [webhooks] webhooks
564
+ def webhooks
565
+ context.webhooks
566
+ end
567
+
568
+ ##
569
+ # Provide a user friendly representation
570
+ def to_s
571
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
572
+ "<Twilio.Conversations.V1.ConversationInstance #{values}>"
573
+ end
574
+
575
+ ##
576
+ # Provide a detailed, user friendly representation
577
+ def inspect
578
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
579
+ "<Twilio.Conversations.V1.ConversationInstance #{values}>"
580
+ end
581
+ end
582
+ end
583
+ end
584
+ end
585
+ end
586
+ end