twilio-ruby 7.3.3 → 7.3.5

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.
@@ -0,0 +1,265 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Conversations
8
+ # This is the public Twilio REST API.
9
+ #
10
+ # NOTE: This class is auto generated by OpenAPI Generator.
11
+ # https://openapi-generator.tech
12
+ # Do not edit the class manually.
13
+ #
14
+
15
+
16
+ module Twilio
17
+ module REST
18
+ class Conversations < ConversationsBase
19
+ class V1 < Version
20
+ class ServiceContext < InstanceContext
21
+
22
+ class ConversationWithParticipantsList < ListResource
23
+
24
+ ##
25
+ # Initialize the ConversationWithParticipantsList
26
+ # @param [Version] version Version that contains the resource
27
+ # @return [ConversationWithParticipantsList] ConversationWithParticipantsList
28
+ def initialize(version, chat_service_sid: nil)
29
+ super(version)
30
+ # Path Solution
31
+ @solution = { chat_service_sid: chat_service_sid }
32
+ @uri = "/Services/#{@solution[:chat_service_sid]}/ConversationWithParticipants"
33
+
34
+ end
35
+ ##
36
+ # Create the ConversationWithParticipantsInstance
37
+ # @param [String] friendly_name The human-readable name of this conversation, limited to 256 characters. Optional.
38
+ # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
39
+ # @param [Time] date_created The date that this resource was created.
40
+ # @param [Time] date_updated The date that this resource was last updated.
41
+ # @param [String] messaging_service_sid The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
42
+ # @param [String] attributes An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned.
43
+ # @param [State] state
44
+ # @param [String] timers_inactive ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute.
45
+ # @param [String] timers_closed ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes.
46
+ # @param [String] bindings_email_address The default email address that will be used when sending outbound emails in this conversation.
47
+ # @param [String] bindings_email_name The default name that will be used when sending outbound emails in this conversation.
48
+ # @param [Array[String]] participant The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10.
49
+ # @param [ServiceConversationWithParticipantsEnumWebhookEnabledType] x_twilio_webhook_enabled The X-Twilio-Webhook-Enabled HTTP request header
50
+ # @return [ConversationWithParticipantsInstance] Created ConversationWithParticipantsInstance
51
+ def create(
52
+ friendly_name: :unset,
53
+ unique_name: :unset,
54
+ date_created: :unset,
55
+ date_updated: :unset,
56
+ messaging_service_sid: :unset,
57
+ attributes: :unset,
58
+ state: :unset,
59
+ timers_inactive: :unset,
60
+ timers_closed: :unset,
61
+ bindings_email_address: :unset,
62
+ bindings_email_name: :unset,
63
+ participant: :unset,
64
+ x_twilio_webhook_enabled: :unset
65
+ )
66
+
67
+ data = Twilio::Values.of({
68
+ 'FriendlyName' => friendly_name,
69
+ 'UniqueName' => unique_name,
70
+ 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
71
+ 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
72
+ 'MessagingServiceSid' => messaging_service_sid,
73
+ 'Attributes' => attributes,
74
+ 'State' => state,
75
+ 'Timers.Inactive' => timers_inactive,
76
+ 'Timers.Closed' => timers_closed,
77
+ 'Bindings.Email.Address' => bindings_email_address,
78
+ 'Bindings.Email.Name' => bindings_email_name,
79
+ 'Participant' => Twilio.serialize_list(participant) { |e| e },
80
+ })
81
+
82
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
83
+
84
+ payload = @version.create('POST', @uri, data: data, headers: headers)
85
+ ConversationWithParticipantsInstance.new(
86
+ @version,
87
+ payload,
88
+ chat_service_sid: @solution[:chat_service_sid],
89
+ )
90
+ end
91
+
92
+
93
+
94
+
95
+ # Provide a user friendly representation
96
+ def to_s
97
+ '#<Twilio.Conversations.V1.ConversationWithParticipantsList>'
98
+ end
99
+ end
100
+
101
+ class ConversationWithParticipantsPage < Page
102
+ ##
103
+ # Initialize the ConversationWithParticipantsPage
104
+ # @param [Version] version Version that contains the resource
105
+ # @param [Response] response Response from the API
106
+ # @param [Hash] solution Path solution for the resource
107
+ # @return [ConversationWithParticipantsPage] ConversationWithParticipantsPage
108
+ def initialize(version, response, solution)
109
+ super(version, response)
110
+
111
+ # Path Solution
112
+ @solution = solution
113
+ end
114
+
115
+ ##
116
+ # Build an instance of ConversationWithParticipantsInstance
117
+ # @param [Hash] payload Payload response from the API
118
+ # @return [ConversationWithParticipantsInstance] ConversationWithParticipantsInstance
119
+ def get_instance(payload)
120
+ ConversationWithParticipantsInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid])
121
+ end
122
+
123
+ ##
124
+ # Provide a user friendly representation
125
+ def to_s
126
+ '<Twilio.Conversations.V1.ConversationWithParticipantsPage>'
127
+ end
128
+ end
129
+ class ConversationWithParticipantsInstance < InstanceResource
130
+ ##
131
+ # Initialize the ConversationWithParticipantsInstance
132
+ # @param [Version] version Version that contains the resource
133
+ # @param [Hash] payload payload that contains response from Twilio
134
+ # @param [String] account_sid The SID of the
135
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this ConversationWithParticipants
136
+ # resource.
137
+ # @param [String] sid The SID of the Call resource to fetch.
138
+ # @return [ConversationWithParticipantsInstance] ConversationWithParticipantsInstance
139
+ def initialize(version, payload , chat_service_sid: nil)
140
+ super(version)
141
+
142
+ # Marshaled Properties
143
+ @properties = {
144
+ 'account_sid' => payload['account_sid'],
145
+ 'chat_service_sid' => payload['chat_service_sid'],
146
+ 'messaging_service_sid' => payload['messaging_service_sid'],
147
+ 'sid' => payload['sid'],
148
+ 'friendly_name' => payload['friendly_name'],
149
+ 'unique_name' => payload['unique_name'],
150
+ 'attributes' => payload['attributes'],
151
+ 'state' => payload['state'],
152
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
153
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
154
+ 'timers' => payload['timers'],
155
+ 'links' => payload['links'],
156
+ 'bindings' => payload['bindings'],
157
+ 'url' => payload['url'],
158
+ }
159
+ end
160
+
161
+
162
+ ##
163
+ # @return [String] The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation.
164
+ def account_sid
165
+ @properties['account_sid']
166
+ end
167
+
168
+ ##
169
+ # @return [String] The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
170
+ def chat_service_sid
171
+ @properties['chat_service_sid']
172
+ end
173
+
174
+ ##
175
+ # @return [String] The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
176
+ def messaging_service_sid
177
+ @properties['messaging_service_sid']
178
+ end
179
+
180
+ ##
181
+ # @return [String] A 34 character string that uniquely identifies this resource.
182
+ def sid
183
+ @properties['sid']
184
+ end
185
+
186
+ ##
187
+ # @return [String] The human-readable name of this conversation, limited to 256 characters. Optional.
188
+ def friendly_name
189
+ @properties['friendly_name']
190
+ end
191
+
192
+ ##
193
+ # @return [String] An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
194
+ def unique_name
195
+ @properties['unique_name']
196
+ end
197
+
198
+ ##
199
+ # @return [String] An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned.
200
+ def attributes
201
+ @properties['attributes']
202
+ end
203
+
204
+ ##
205
+ # @return [State]
206
+ def state
207
+ @properties['state']
208
+ end
209
+
210
+ ##
211
+ # @return [Time] The date that this resource was created.
212
+ def date_created
213
+ @properties['date_created']
214
+ end
215
+
216
+ ##
217
+ # @return [Time] The date that this resource was last updated.
218
+ def date_updated
219
+ @properties['date_updated']
220
+ end
221
+
222
+ ##
223
+ # @return [Hash] Timer date values representing state update for this conversation.
224
+ def timers
225
+ @properties['timers']
226
+ end
227
+
228
+ ##
229
+ # @return [Hash] Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation.
230
+ def links
231
+ @properties['links']
232
+ end
233
+
234
+ ##
235
+ # @return [Hash]
236
+ def bindings
237
+ @properties['bindings']
238
+ end
239
+
240
+ ##
241
+ # @return [String] An absolute API resource URL for this conversation.
242
+ def url
243
+ @properties['url']
244
+ end
245
+
246
+ ##
247
+ # Provide a user friendly representation
248
+ def to_s
249
+ "<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
250
+ end
251
+
252
+ ##
253
+ # Provide a detailed, user friendly representation
254
+ def inspect
255
+ "<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
256
+ end
257
+ end
258
+
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end
264
+
265
+
@@ -160,9 +160,10 @@ module Twilio
160
160
 
161
161
  # Dependents
162
162
  @participant_conversations = nil
163
+ @conversation_with_participants = nil
164
+ @configuration = nil
163
165
  @users = nil
164
166
  @roles = nil
165
- @configuration = nil
166
167
  @bindings = nil
167
168
  @conversations = nil
168
169
  end
@@ -203,6 +204,27 @@ module Twilio
203
204
  @participant_conversations
204
205
  end
205
206
  ##
207
+ # Access the conversation_with_participants
208
+ # @return [ConversationWithParticipantsList]
209
+ # @return [ConversationWithParticipantsContext]
210
+ def conversation_with_participants
211
+ unless @conversation_with_participants
212
+ @conversation_with_participants = ConversationWithParticipantsList.new(
213
+ @version, chat_service_sid: @solution[:sid], )
214
+ end
215
+ @conversation_with_participants
216
+ end
217
+ ##
218
+ # Access the configuration
219
+ # @return [ConfigurationList]
220
+ # @return [ConfigurationContext]
221
+ def configuration
222
+ ConfigurationContext.new(
223
+ @version,
224
+ @solution[:sid]
225
+ )
226
+ end
227
+ ##
206
228
  # Access the users
207
229
  # @return [UserList]
208
230
  # @return [UserContext] if sid was passed.
@@ -241,16 +263,6 @@ module Twilio
241
263
  @roles
242
264
  end
243
265
  ##
244
- # Access the configuration
245
- # @return [ConfigurationList]
246
- # @return [ConfigurationContext]
247
- def configuration
248
- ConfigurationContext.new(
249
- @version,
250
- @solution[:sid]
251
- )
252
- end
253
- ##
254
266
  # Access the bindings
255
267
  # @return [BindingList]
256
268
  # @return [BindingContext] if sid was passed.
@@ -437,6 +449,20 @@ module Twilio
437
449
  context.participant_conversations
438
450
  end
439
451
 
452
+ ##
453
+ # Access the conversation_with_participants
454
+ # @return [conversation_with_participants] conversation_with_participants
455
+ def conversation_with_participants
456
+ context.conversation_with_participants
457
+ end
458
+
459
+ ##
460
+ # Access the configuration
461
+ # @return [configuration] configuration
462
+ def configuration
463
+ context.configuration
464
+ end
465
+
440
466
  ##
441
467
  # Access the users
442
468
  # @return [users] users
@@ -451,13 +477,6 @@ module Twilio
451
477
  context.roles
452
478
  end
453
479
 
454
- ##
455
- # Access the configuration
456
- # @return [configuration] configuration
457
- def configuration
458
- context.configuration
459
- end
460
-
461
480
  ##
462
481
  # Access the bindings
463
482
  # @return [bindings] bindings
@@ -24,6 +24,7 @@ module Twilio
24
24
  @address_configurations = nil
25
25
  @configuration = nil
26
26
  @conversations = nil
27
+ @conversation_with_participants = nil
27
28
  @credentials = nil
28
29
  @participant_conversations = nil
29
30
  @roles = nil
@@ -65,6 +66,11 @@ module Twilio
65
66
  end
66
67
  end
67
68
  ##
69
+ # @return [Twilio::REST::Conversations::V1::ConversationWithParticipantsList]
70
+ def conversation_with_participants
71
+ @conversation_with_participants ||= ConversationWithParticipantsList.new self
72
+ end
73
+ ##
68
74
  # @param [String] sid A 34 character string that uniquely identifies this resource.
69
75
  # @return [Twilio::REST::Conversations::V1::CredentialContext] if sid was passed.
70
76
  # @return [Twilio::REST::Conversations::V1::CredentialList]
@@ -40,31 +40,7 @@ module Twilio
40
40
  super(version)
41
41
  # Path Solution
42
42
  @solution = { }
43
-
44
-
45
- end
46
-
47
-
48
-
49
- # Provide a user friendly representation
50
- def to_s
51
- '#<Twilio.Marketplace.V1.ReferralConversionList>'
52
- end
53
- end
54
-
55
-
56
- class ReferralConversionContext < InstanceContext
57
- ##
58
- # Initialize the ReferralConversionContext
59
- # @param [Version] version Version that contains the resource
60
- # @return [ReferralConversionContext] ReferralConversionContext
61
- def initialize(version)
62
- super(version)
63
-
64
- # Path Solution
65
- @solution = { }
66
43
  @uri = "/ReferralConversion"
67
-
68
44
 
69
45
  end
70
46
  ##
@@ -83,19 +59,12 @@ module Twilio
83
59
  )
84
60
  end
85
61
 
62
+
63
+
86
64
 
87
- ##
88
65
  # Provide a user friendly representation
89
66
  def to_s
90
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
91
- "#<Twilio.Marketplace.V1.ReferralConversionContext #{context}>"
92
- end
93
-
94
- ##
95
- # Provide a detailed, user friendly representation
96
- def inspect
97
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
98
- "#<Twilio.Marketplace.V1.ReferralConversionContext #{context}>"
67
+ '#<Twilio.Marketplace.V1.ReferralConversionList>'
99
68
  end
100
69
  end
101
70
 
@@ -144,22 +113,8 @@ module Twilio
144
113
  @properties = {
145
114
  'converted_account_sid' => payload['converted_account_sid'],
146
115
  }
147
-
148
- # Context
149
- @instance_context = nil
150
- @params = { }
151
116
  end
152
117
 
153
- ##
154
- # Generate an instance context for the instance, the context is capable of
155
- # performing various actions. All instance actions are proxied to the context
156
- # @return [ReferralConversionContext] CallContext for this CallInstance
157
- def context
158
- unless @instance_context
159
- @instance_context = ReferralConversionContext.new(@version )
160
- end
161
- @instance_context
162
- end
163
118
 
164
119
  ##
165
120
  # @return [String]
@@ -167,29 +122,16 @@ module Twilio
167
122
  @properties['converted_account_sid']
168
123
  end
169
124
 
170
- ##
171
- # Create the ReferralConversionInstance
172
- # @param [CreateReferralConversionRequest] create_referral_conversion_request
173
- # @return [ReferralConversionInstance] Created ReferralConversionInstance
174
- def create(create_referral_conversion_request: nil
175
- )
176
-
177
- context.create(
178
- )
179
- end
180
-
181
125
  ##
182
126
  # Provide a user friendly representation
183
127
  def to_s
184
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
185
- "<Twilio.Marketplace.V1.ReferralConversionInstance #{values}>"
128
+ "<Twilio.Marketplace.V1.ReferralConversionInstance>"
186
129
  end
187
130
 
188
131
  ##
189
132
  # Provide a detailed, user friendly representation
190
133
  def inspect
191
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
192
- "<Twilio.Marketplace.V1.ReferralConversionInstance #{values}>"
134
+ "<Twilio.Marketplace.V1.ReferralConversionInstance>"
193
135
  end
194
136
  end
195
137
 
@@ -70,9 +70,9 @@ module Twilio
70
70
  end
71
71
  end
72
72
  ##
73
- # @return [Twilio::REST::Marketplace::V1::referralConversionContext]
73
+ # @return [Twilio::REST::Marketplace::V1::ReferralConversionList]
74
74
  def referral_conversion
75
- @referral_conversion ||= ReferralConversionContext.new self
75
+ @referral_conversion ||= ReferralConversionList.new self
76
76
  end
77
77
  ##
78
78
  # Provide a user friendly representation