twilio-ruby 7.10.0 → 7.10.3

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,382 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Flex
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 FlexApi < FlexApiBase
19
+ class V1 < Version
20
+ class CreateFlexInstanceList < ListResource
21
+
22
+ class CreateInstanceRequestBody
23
+ # @param [conversation]: [CreateFlexInstanceList.CreateInstanceRequestBodyConversation]
24
+ attr_accessor :conversation
25
+ def initialize(payload)
26
+ @conversation = payload["conversation"]
27
+ end
28
+ def to_json(options = {})
29
+ {
30
+ "Conversation": @conversation,
31
+ }.to_json(options)
32
+ end
33
+ end
34
+
35
+ class CreateInstanceRequestBodyConversation
36
+ # @param [default]: [Boolean] Set newly created conversation service as the default conversation service
37
+ attr_accessor :default
38
+ def initialize(payload)
39
+ @default = payload["default"]
40
+ end
41
+ def to_json(options = {})
42
+ {
43
+ "Default": @default,
44
+ }.to_json(options)
45
+ end
46
+ end
47
+
48
+
49
+ ##
50
+ # Initialize the CreateFlexInstanceList
51
+ # @param [Version] version Version that contains the resource
52
+ # @return [CreateFlexInstanceList] CreateFlexInstanceList
53
+ def initialize(version)
54
+ super(version)
55
+
56
+ # Path Solution
57
+ @solution = { }
58
+
59
+
60
+ end
61
+
62
+
63
+
64
+ # Provide a user friendly representation
65
+ def to_s
66
+ '#<Twilio.FlexApi.V1.CreateFlexInstanceList>'
67
+ end
68
+ end
69
+
70
+
71
+ class CreateFlexInstanceContext < InstanceContext
72
+ ##
73
+ # Initialize the CreateFlexInstanceContext
74
+ # @param [Version] version Version that contains the resource
75
+ # @return [CreateFlexInstanceContext] CreateFlexInstanceContext
76
+ def initialize(version)
77
+ super(version)
78
+
79
+
80
+ # Path Solution
81
+ @solution = { }
82
+ @uri = "/Instances"
83
+
84
+
85
+ end
86
+ ##
87
+ # Create the CreateFlexInstanceInstance
88
+ # @param [CreateInstanceRequestBody] create_instance_request_body
89
+ # @return [CreateFlexInstanceInstance] Created CreateFlexInstanceInstance
90
+ def create(create_instance_request_body: :unset
91
+ )
92
+
93
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
94
+ headers['Content-Type'] = 'application/json'
95
+
96
+
97
+
98
+
99
+ payload = @version.create('POST', @uri, headers: headers, data: create_instance_request_body.to_json)
100
+ CreateFlexInstanceInstance.new(
101
+ @version,
102
+ payload,
103
+ )
104
+ end
105
+
106
+ ##
107
+ # Create the CreateFlexInstanceInstanceMetadata
108
+ # @param [CreateInstanceRequestBody] create_instance_request_body
109
+ # @return [CreateFlexInstanceInstance] Created CreateFlexInstanceInstance
110
+ def create_with_metadata(create_instance_request_body: :unset
111
+ )
112
+
113
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
114
+ headers['Content-Type'] = 'application/json'
115
+
116
+
117
+
118
+
119
+ response = @version.create_with_metadata('POST', @uri, headers: headers, data: create_instance_request_body.to_json)
120
+ create_flex_instance_instance = CreateFlexInstanceInstance.new(
121
+ @version,
122
+ response.body,
123
+ )
124
+ CreateFlexInstanceInstanceMetadata.new(
125
+ @version,
126
+ create_flex_instance_instance,
127
+ response.headers,
128
+ response.status_code
129
+ )
130
+ end
131
+
132
+
133
+ ##
134
+ # Provide a user friendly representation
135
+ def to_s
136
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
137
+ "#<Twilio.FlexApi.V1.CreateFlexInstanceContext #{context}>"
138
+ end
139
+
140
+ ##
141
+ # Provide a detailed, user friendly representation
142
+ def inspect
143
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
144
+ "#<Twilio.FlexApi.V1.CreateFlexInstanceContext #{context}>"
145
+ end
146
+ end
147
+
148
+ class CreateFlexInstanceInstanceMetadata < InstanceResourceMetadata
149
+ ##
150
+ # Initializes a new CreateFlexInstanceInstanceMetadata.
151
+ # @param [Version] version Version that contains the resource
152
+ # @param [}CreateFlexInstanceInstance] create_flex_instance_instance The instance associated with the metadata.
153
+ # @param [Hash] headers Header object with response headers.
154
+ # @param [Integer] status_code The HTTP status code of the response.
155
+ # @return [CreateFlexInstanceInstanceMetadata] The initialized instance with metadata.
156
+ def initialize(version, create_flex_instance_instance, headers, status_code)
157
+ super(version, headers, status_code)
158
+ @create_flex_instance_instance = create_flex_instance_instance
159
+ end
160
+
161
+ def create_flex_instance
162
+ @create_flex_instance_instance
163
+ end
164
+
165
+ def headers
166
+ @headers
167
+ end
168
+
169
+ def status_code
170
+ @status_code
171
+ end
172
+
173
+ def to_s
174
+ "<Twilio.Api.V2010.CreateFlexInstanceInstanceMetadata status=#{@status_code}>"
175
+ end
176
+ end
177
+
178
+ class CreateFlexInstanceListResponse < InstanceListResource
179
+ # @param [Array<CreateFlexInstanceInstance>] instance
180
+ # @param [Hash{String => Object}] headers
181
+ # @param [Integer] status_code
182
+ def initialize(version, payload, key)
183
+ @create_flex_instance_instance = payload.body[key].map do |data|
184
+ CreateFlexInstanceInstance.new(version, data)
185
+ end
186
+ @headers = payload.headers
187
+ @status_code = payload.status_code
188
+ end
189
+
190
+ def create_flex_instance_instance
191
+ @instance
192
+ end
193
+ end
194
+
195
+ class CreateFlexInstancePage < Page
196
+ ##
197
+ # Initialize the CreateFlexInstancePage
198
+ # @param [Version] version Version that contains the resource
199
+ # @param [Response] response Response from the API
200
+ # @param [Hash] solution Path solution for the resource
201
+ # @return [CreateFlexInstancePage] CreateFlexInstancePage
202
+ def initialize(version, response, solution)
203
+ super(version, response)
204
+
205
+
206
+ # Path Solution
207
+ @solution = solution
208
+ end
209
+
210
+ ##
211
+ # Build an instance of CreateFlexInstanceInstance
212
+ # @param [Hash] payload Payload response from the API
213
+ # @return [CreateFlexInstanceInstance] CreateFlexInstanceInstance
214
+ def get_instance(payload)
215
+ CreateFlexInstanceInstance.new(@version, payload)
216
+ end
217
+
218
+ ##
219
+ # Provide a user friendly representation
220
+ def to_s
221
+ '<Twilio.FlexApi.V1.CreateFlexInstancePage>'
222
+ end
223
+ end
224
+
225
+ class CreateFlexInstancePageMetadata < PageMetadata
226
+ attr_reader :create_flex_instance_page
227
+
228
+ def initialize(version, response, solution, limit)
229
+ super(version, response)
230
+ @create_flex_instance_page = []
231
+ @limit = limit
232
+ key = get_key(response.body)
233
+ records = 0
234
+ while( limit != :unset && records < limit )
235
+ @create_flex_instance_page << CreateFlexInstanceListResponse.new(version, @payload, key, limit - records)
236
+ @payload = self.next_page
237
+ break unless @payload
238
+ records += @payload.body[key].size
239
+ end
240
+ # Path Solution
241
+ @solution = solution
242
+ end
243
+
244
+ def each
245
+ @create_flex_instance_page.each do |record|
246
+ yield record
247
+ end
248
+ end
249
+
250
+ def to_s
251
+ '<Twilio::REST::FlexApi::V1PageMetadata>';
252
+ end
253
+ end
254
+ class CreateFlexInstanceListResponse < InstanceListResource
255
+
256
+ # @param [Array<CreateFlexInstanceInstance>] instance
257
+ # @param [Hash{String => Object}] headers
258
+ # @param [Integer] status_code
259
+ def initialize(version, payload, key, limit = :unset)
260
+ data_list = payload.body[key]
261
+ if limit != :unset
262
+ data_list = data_list[0, limit]
263
+ end
264
+ @create_flex_instance = data_list.map do |data|
265
+ CreateFlexInstanceInstance.new(version, data)
266
+ end
267
+ @headers = payload.headers
268
+ @status_code = payload.status_code
269
+ end
270
+
271
+ def create_flex_instance
272
+ @create_flex_instance
273
+ end
274
+
275
+ def headers
276
+ @headers
277
+ end
278
+
279
+ def status_code
280
+ @status_code
281
+ end
282
+ end
283
+
284
+ class CreateFlexInstanceInstance < InstanceResource
285
+ ##
286
+ # Initialize the CreateFlexInstanceInstance
287
+ # @param [Version] version Version that contains the resource
288
+ # @param [Hash] payload payload that contains response from Twilio
289
+ # @param [String] account_sid The SID of the
290
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this CreateFlexInstance
291
+ # resource.
292
+ # @param [String] sid The SID of the Call resource to fetch.
293
+ # @return [CreateFlexInstanceInstance] CreateFlexInstanceInstance
294
+ def initialize(version, payload )
295
+ super(version)
296
+
297
+
298
+ # Marshaled Properties
299
+ @properties = {
300
+ 'flex_instance_sid' => payload['flex_instance_sid'],
301
+ 'account_sid' => payload['account_sid'],
302
+ 'status' => payload['status'],
303
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
304
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
305
+ }
306
+
307
+ # Context
308
+ @instance_context = nil
309
+ @params = { }
310
+ end
311
+
312
+ ##
313
+ # Generate an instance context for the instance, the context is capable of
314
+ # performing various actions. All instance actions are proxied to the context
315
+ # @return [CreateFlexInstanceContext] CallContext for this CallInstance
316
+ def context
317
+ unless @instance_context
318
+ @instance_context = CreateFlexInstanceContext.new(@version )
319
+ end
320
+ @instance_context
321
+ end
322
+
323
+ ##
324
+ # @return [String]
325
+ def flex_instance_sid
326
+ @properties['flex_instance_sid']
327
+ end
328
+
329
+ ##
330
+ # @return [String]
331
+ def account_sid
332
+ @properties['account_sid']
333
+ end
334
+
335
+ ##
336
+ # @return [String]
337
+ def status
338
+ @properties['status']
339
+ end
340
+
341
+ ##
342
+ # @return [Time]
343
+ def date_created
344
+ @properties['date_created']
345
+ end
346
+
347
+ ##
348
+ # @return [Time]
349
+ def date_updated
350
+ @properties['date_updated']
351
+ end
352
+
353
+ ##
354
+ # Create the CreateFlexInstanceInstance
355
+ # @param [CreateInstanceRequestBody] create_instance_request_body
356
+ # @return [CreateFlexInstanceInstance] Created CreateFlexInstanceInstance
357
+ def create(create_instance_request_body: :unset
358
+ )
359
+
360
+ context.create(
361
+ )
362
+ end
363
+
364
+ ##
365
+ # Provide a user friendly representation
366
+ def to_s
367
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
368
+ "<Twilio.FlexApi.V1.CreateFlexInstanceInstance #{values}>"
369
+ end
370
+
371
+ ##
372
+ # Provide a detailed, user friendly representation
373
+ def inspect
374
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
375
+ "<Twilio.FlexApi.V1.CreateFlexInstanceInstance #{values}>"
376
+ end
377
+ end
378
+
379
+ end
380
+ end
381
+ end
382
+ end
@@ -24,6 +24,7 @@ module Twilio
24
24
  @assessments = nil
25
25
  @channel = nil
26
26
  @configuration = nil
27
+ @create_flex_instance = nil
27
28
  @flex_flow = nil
28
29
  @insights_assessments_comment = nil
29
30
  @insights_conversations = nil
@@ -80,6 +81,11 @@ module Twilio
80
81
  @configuration ||= ConfigurationContext.new self
81
82
  end
82
83
  ##
84
+ # @return [Twilio::REST::FlexApi::V1::createFlexInstanceContext]
85
+ def create_flex_instance
86
+ @create_flex_instance ||= CreateFlexInstanceContext.new self
87
+ end
88
+ ##
83
89
  # @param [String] sid The SID of the Flex Flow resource to fetch.
84
90
  # @return [Twilio::REST::FlexApi::V1::FlexFlowContext] if sid was passed.
85
91
  # @return [Twilio::REST::FlexApi::V1::FlexFlowList]
@@ -36,6 +36,7 @@ module Twilio
36
36
  # Lists OperatorTypeInstance records from the API as a list.
37
37
  # Unlike stream(), this operation is eager and will load `limit` records into
38
38
  # memory before returning.
39
+ # @param [String] language_code Returns Operator Types that support the provided language code.
39
40
  # @param [Integer] limit Upper limit for the number of records to return. stream()
40
41
  # guarantees to never return more than limit. Default is no limit
41
42
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -43,8 +44,9 @@ module Twilio
43
44
  # but a limit is defined, stream() will attempt to read the limit with the most
44
45
  # efficient page size, i.e. min(limit, 1000)
45
46
  # @return [Array] Array of up to limit results
46
- def list(limit: nil, page_size: nil)
47
+ def list(language_code: :unset, limit: nil, page_size: nil)
47
48
  self.stream(
49
+ language_code: language_code,
48
50
  limit: limit,
49
51
  page_size: page_size
50
52
  ).entries
@@ -54,6 +56,7 @@ module Twilio
54
56
  # Streams Instance records from the API as an Enumerable.
55
57
  # This operation lazily loads records as efficiently as possible until the limit
56
58
  # is reached.
59
+ # @param [String] language_code Returns Operator Types that support the provided language code.
57
60
  # @param [Integer] limit Upper limit for the number of records to return. stream()
58
61
  # guarantees to never return more than limit. Default is no limit
59
62
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -61,10 +64,11 @@ module Twilio
61
64
  # but a limit is defined, stream() will attempt to read the limit with the most
62
65
  # efficient page size, i.e. min(limit, 1000)
63
66
  # @return [Enumerable] Enumerable that will yield up to limit results
64
- def stream(limit: nil, page_size: nil)
67
+ def stream(language_code: :unset, limit: nil, page_size: nil)
65
68
  limits = @version.read_limits(limit, page_size)
66
69
 
67
70
  page = self.page(
71
+ language_code: language_code,
68
72
  page_size: limits[:page_size], )
69
73
 
70
74
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
@@ -72,6 +76,7 @@ module Twilio
72
76
 
73
77
  ##
74
78
  # Lists OperatorTypePageMetadata records from the API as a list.
79
+ # @param [String] language_code Returns Operator Types that support the provided language code.
75
80
  # @param [Integer] limit Upper limit for the number of records to return. stream()
76
81
  # guarantees to never return more than limit. Default is no limit
77
82
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -79,9 +84,10 @@ module Twilio
79
84
  # but a limit is defined, stream() will attempt to read the limit with the most
80
85
  # efficient page size, i.e. min(limit, 1000)
81
86
  # @return [Array] Array of up to limit results
82
- def list_with_metadata(limit: nil, page_size: nil)
87
+ def list_with_metadata(language_code: :unset, limit: nil, page_size: nil)
83
88
  limits = @version.read_limits(limit, page_size)
84
89
  params = Twilio::Values.of({
90
+ 'LanguageCode' => language_code,
85
91
 
86
92
  'PageSize' => limits[:page_size],
87
93
  });
@@ -109,12 +115,14 @@ module Twilio
109
115
  ##
110
116
  # Retrieve a single page of OperatorTypeInstance records from the API.
111
117
  # Request is executed immediately.
118
+ # @param [String] language_code Returns Operator Types that support the provided language code.
112
119
  # @param [String] page_token PageToken provided by the API
113
120
  # @param [Integer] page_number Page Number, this value is simply for client state
114
121
  # @param [Integer] page_size Number of records to return, defaults to 50
115
122
  # @return [Page] Page of OperatorTypeInstance
116
- def page(page_token: :unset, page_number: :unset,page_size: :unset)
123
+ def page(language_code: :unset, page_token: :unset, page_number: :unset,page_size: :unset)
117
124
  params = Twilio::Values.of({
125
+ 'LanguageCode' => language_code,
118
126
  'PageToken' => page_token,
119
127
  'Page' => page_number,
120
128
  'PageSize' => page_size,