twilio-ruby 6.12.0 → 6.12.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,386 @@
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 PluginConfigurationList < ListResource
21
+
22
+ ##
23
+ # Initialize the PluginConfigurationList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [PluginConfigurationList] PluginConfigurationList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/PluginService/Configurations"
31
+
32
+ end
33
+ ##
34
+ # Create the PluginConfigurationInstance
35
+ # @param [String] name The Flex Plugin Configuration's name.
36
+ # @param [Array[Hash]] plugins A list of objects that describe the plugin versions included in the configuration. Each object contains the sid of the plugin version.
37
+ # @param [String] description The Flex Plugin Configuration's description.
38
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
39
+ # @return [PluginConfigurationInstance] Created PluginConfigurationInstance
40
+ def create(
41
+ name: nil,
42
+ plugins: :unset,
43
+ description: :unset,
44
+ flex_metadata: :unset
45
+ )
46
+
47
+ data = Twilio::Values.of({
48
+ 'Name' => name,
49
+ 'Plugins' => Twilio.serialize_list(plugins) { |e| Twilio.serialize_object(e) },
50
+ 'Description' => description,
51
+ })
52
+
53
+
54
+ headers = Twilio::Values.of({ 'Flex-Metadata' => flex_metadata, })
55
+ payload = @version.create('POST', @uri, data: data, headers: headers)
56
+ PluginConfigurationInstance.new(
57
+ @version,
58
+ payload,
59
+ )
60
+ end
61
+
62
+
63
+ ##
64
+ # Lists PluginConfigurationInstance records from the API as a list.
65
+ # Unlike stream(), this operation is eager and will load `limit` records into
66
+ # memory before returning.
67
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
68
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
69
+ # guarantees to never return more than limit. Default is no limit
70
+ # @param [Integer] page_size Number of records to fetch per request, when
71
+ # not set will use the default value of 50 records. If no page_size is defined
72
+ # but a limit is defined, stream() will attempt to read the limit with the most
73
+ # efficient page size, i.e. min(limit, 1000)
74
+ # @return [Array] Array of up to limit results
75
+ def list(flex_metadata: :unset, limit: nil, page_size: nil)
76
+ self.stream(
77
+ flex_metadata: flex_metadata,
78
+ limit: limit,
79
+ page_size: page_size
80
+ ).entries
81
+ end
82
+
83
+ ##
84
+ # Streams Instance records from the API as an Enumerable.
85
+ # This operation lazily loads records as efficiently as possible until the limit
86
+ # is reached.
87
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
88
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
89
+ # guarantees to never return more than limit. Default is no limit
90
+ # @param [Integer] page_size Number of records to fetch per request, when
91
+ # not set will use the default value of 50 records. If no page_size is defined
92
+ # but a limit is defined, stream() will attempt to read the limit with the most
93
+ # efficient page size, i.e. min(limit, 1000)
94
+ # @return [Enumerable] Enumerable that will yield up to limit results
95
+ def stream(flex_metadata: :unset, limit: nil, page_size: nil)
96
+ limits = @version.read_limits(limit, page_size)
97
+
98
+ page = self.page(
99
+ flex_metadata: flex_metadata,
100
+ page_size: limits[:page_size], )
101
+
102
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
103
+ end
104
+
105
+ ##
106
+ # When passed a block, yields PluginConfigurationInstance records from the API.
107
+ # This operation lazily loads records as efficiently as possible until the limit
108
+ # is reached.
109
+ def each
110
+ limits = @version.read_limits
111
+
112
+ page = self.page(page_size: limits[:page_size], )
113
+
114
+ @version.stream(page,
115
+ limit: limits[:limit],
116
+ page_limit: limits[:page_limit]).each {|x| yield x}
117
+ end
118
+
119
+ ##
120
+ # Retrieve a single page of PluginConfigurationInstance records from the API.
121
+ # Request is executed immediately.
122
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
123
+ # @param [String] page_token PageToken provided by the API
124
+ # @param [Integer] page_number Page Number, this value is simply for client state
125
+ # @param [Integer] page_size Number of records to return, defaults to 50
126
+ # @return [Page] Page of PluginConfigurationInstance
127
+ def page(flex_metadata: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
128
+ params = Twilio::Values.of({
129
+ 'Flex-Metadata' => flex_metadata,
130
+ 'PageToken' => page_token,
131
+ 'Page' => page_number,
132
+ 'PageSize' => page_size,
133
+ })
134
+
135
+ response = @version.page('GET', @uri, params: params)
136
+
137
+ PluginConfigurationPage.new(@version, response, @solution)
138
+ end
139
+
140
+ ##
141
+ # Retrieve a single page of PluginConfigurationInstance records from the API.
142
+ # Request is executed immediately.
143
+ # @param [String] target_url API-generated URL for the requested results page
144
+ # @return [Page] Page of PluginConfigurationInstance
145
+ def get_page(target_url)
146
+ response = @version.domain.request(
147
+ 'GET',
148
+ target_url
149
+ )
150
+ PluginConfigurationPage.new(@version, response, @solution)
151
+ end
152
+
153
+
154
+
155
+ # Provide a user friendly representation
156
+ def to_s
157
+ '#<Twilio.FlexApi.V1.PluginConfigurationList>'
158
+ end
159
+ end
160
+
161
+
162
+ class PluginConfigurationContext < InstanceContext
163
+ ##
164
+ # Initialize the PluginConfigurationContext
165
+ # @param [Version] version Version that contains the resource
166
+ # @param [String] sid The SID of the Flex Plugin Configuration resource to fetch.
167
+ # @return [PluginConfigurationContext] PluginConfigurationContext
168
+ def initialize(version, sid)
169
+ super(version)
170
+
171
+ # Path Solution
172
+ @solution = { sid: sid, }
173
+ @uri = "/PluginService/Configurations/#{@solution[:sid]}"
174
+
175
+ # Dependents
176
+ @plugins = nil
177
+ end
178
+ ##
179
+ # Fetch the PluginConfigurationInstance
180
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
181
+ # @return [PluginConfigurationInstance] Fetched PluginConfigurationInstance
182
+ def fetch(
183
+ flex_metadata: :unset
184
+ )
185
+
186
+
187
+ headers = Twilio::Values.of({ 'Flex-Metadata' => flex_metadata, })
188
+ payload = @version.fetch('GET', @uri, headers: headers)
189
+ PluginConfigurationInstance.new(
190
+ @version,
191
+ payload,
192
+ sid: @solution[:sid],
193
+ )
194
+ end
195
+
196
+ ##
197
+ # Access the plugins
198
+ # @return [ConfiguredPluginList]
199
+ # @return [ConfiguredPluginContext] if sid was passed.
200
+ def plugins(plugin_sid=:unset)
201
+
202
+ raise ArgumentError, 'plugin_sid cannot be nil' if plugin_sid.nil?
203
+
204
+ if plugin_sid != :unset
205
+ return ConfiguredPluginContext.new(@version, @solution[:sid],plugin_sid )
206
+ end
207
+
208
+ unless @plugins
209
+ @plugins = ConfiguredPluginList.new(
210
+ @version, configuration_sid: @solution[:sid], )
211
+ end
212
+
213
+ @plugins
214
+ end
215
+
216
+ ##
217
+ # Provide a user friendly representation
218
+ def to_s
219
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
220
+ "#<Twilio.FlexApi.V1.PluginConfigurationContext #{context}>"
221
+ end
222
+
223
+ ##
224
+ # Provide a detailed, user friendly representation
225
+ def inspect
226
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
227
+ "#<Twilio.FlexApi.V1.PluginConfigurationContext #{context}>"
228
+ end
229
+ end
230
+
231
+ class PluginConfigurationPage < Page
232
+ ##
233
+ # Initialize the PluginConfigurationPage
234
+ # @param [Version] version Version that contains the resource
235
+ # @param [Response] response Response from the API
236
+ # @param [Hash] solution Path solution for the resource
237
+ # @return [PluginConfigurationPage] PluginConfigurationPage
238
+ def initialize(version, response, solution)
239
+ super(version, response)
240
+
241
+ # Path Solution
242
+ @solution = solution
243
+ end
244
+
245
+ ##
246
+ # Build an instance of PluginConfigurationInstance
247
+ # @param [Hash] payload Payload response from the API
248
+ # @return [PluginConfigurationInstance] PluginConfigurationInstance
249
+ def get_instance(payload)
250
+ PluginConfigurationInstance.new(@version, payload)
251
+ end
252
+
253
+ ##
254
+ # Provide a user friendly representation
255
+ def to_s
256
+ '<Twilio.FlexApi.V1.PluginConfigurationPage>'
257
+ end
258
+ end
259
+ class PluginConfigurationInstance < InstanceResource
260
+ ##
261
+ # Initialize the PluginConfigurationInstance
262
+ # @param [Version] version Version that contains the resource
263
+ # @param [Hash] payload payload that contains response from Twilio
264
+ # @param [String] account_sid The SID of the
265
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PluginConfiguration
266
+ # resource.
267
+ # @param [String] sid The SID of the Call resource to fetch.
268
+ # @return [PluginConfigurationInstance] PluginConfigurationInstance
269
+ def initialize(version, payload , sid: nil)
270
+ super(version)
271
+
272
+ # Marshaled Properties
273
+ @properties = {
274
+ 'sid' => payload['sid'],
275
+ 'account_sid' => payload['account_sid'],
276
+ 'name' => payload['name'],
277
+ 'description' => payload['description'],
278
+ 'archived' => payload['archived'],
279
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
280
+ 'url' => payload['url'],
281
+ 'links' => payload['links'],
282
+ }
283
+
284
+ # Context
285
+ @instance_context = nil
286
+ @params = { 'sid' => sid || @properties['sid'] , }
287
+ end
288
+
289
+ ##
290
+ # Generate an instance context for the instance, the context is capable of
291
+ # performing various actions. All instance actions are proxied to the context
292
+ # @return [PluginConfigurationContext] CallContext for this CallInstance
293
+ def context
294
+ unless @instance_context
295
+ @instance_context = PluginConfigurationContext.new(@version , @params['sid'])
296
+ end
297
+ @instance_context
298
+ end
299
+
300
+ ##
301
+ # @return [String] The unique string that we created to identify the Flex Plugin Configuration resource.
302
+ def sid
303
+ @properties['sid']
304
+ end
305
+
306
+ ##
307
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource.
308
+ def account_sid
309
+ @properties['account_sid']
310
+ end
311
+
312
+ ##
313
+ # @return [String] The name of this Flex Plugin Configuration.
314
+ def name
315
+ @properties['name']
316
+ end
317
+
318
+ ##
319
+ # @return [String] The description of the Flex Plugin Configuration resource.
320
+ def description
321
+ @properties['description']
322
+ end
323
+
324
+ ##
325
+ # @return [Boolean] Whether the Flex Plugin Configuration is archived. The default value is false.
326
+ def archived
327
+ @properties['archived']
328
+ end
329
+
330
+ ##
331
+ # @return [Time] The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
332
+ def date_created
333
+ @properties['date_created']
334
+ end
335
+
336
+ ##
337
+ # @return [String] The absolute URL of the Flex Plugin Configuration resource.
338
+ def url
339
+ @properties['url']
340
+ end
341
+
342
+ ##
343
+ # @return [Hash]
344
+ def links
345
+ @properties['links']
346
+ end
347
+
348
+ ##
349
+ # Fetch the PluginConfigurationInstance
350
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
351
+ # @return [PluginConfigurationInstance] Fetched PluginConfigurationInstance
352
+ def fetch(
353
+ flex_metadata: :unset
354
+ )
355
+
356
+ context.fetch(
357
+ flex_metadata: flex_metadata,
358
+ )
359
+ end
360
+
361
+ ##
362
+ # Access the plugins
363
+ # @return [plugins] plugins
364
+ def plugins
365
+ context.plugins
366
+ end
367
+
368
+ ##
369
+ # Provide a user friendly representation
370
+ def to_s
371
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
372
+ "<Twilio.FlexApi.V1.PluginConfigurationInstance #{values}>"
373
+ end
374
+
375
+ ##
376
+ # Provide a detailed, user friendly representation
377
+ def inspect
378
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
379
+ "<Twilio.FlexApi.V1.PluginConfigurationInstance #{values}>"
380
+ end
381
+ end
382
+
383
+ end
384
+ end
385
+ end
386
+ end
@@ -0,0 +1,233 @@
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 PluginConfigurationArchiveList < ListResource
21
+
22
+ ##
23
+ # Initialize the PluginConfigurationArchiveList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [PluginConfigurationArchiveList] PluginConfigurationArchiveList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+
31
+
32
+ end
33
+
34
+
35
+
36
+ # Provide a user friendly representation
37
+ def to_s
38
+ '#<Twilio.FlexApi.V1.PluginConfigurationArchiveList>'
39
+ end
40
+ end
41
+
42
+
43
+ class PluginConfigurationArchiveContext < InstanceContext
44
+ ##
45
+ # Initialize the PluginConfigurationArchiveContext
46
+ # @param [Version] version Version that contains the resource
47
+ # @param [String] sid The SID of the Flex Plugin Configuration resource to archive.
48
+ # @return [PluginConfigurationArchiveContext] PluginConfigurationArchiveContext
49
+ def initialize(version, sid)
50
+ super(version)
51
+
52
+ # Path Solution
53
+ @solution = { sid: sid, }
54
+ @uri = "/PluginService/Configurations/#{@solution[:sid]}/Archive"
55
+
56
+
57
+ end
58
+ ##
59
+ # Update the PluginConfigurationArchiveInstance
60
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
61
+ # @return [PluginConfigurationArchiveInstance] Updated PluginConfigurationArchiveInstance
62
+ def update(
63
+ flex_metadata: :unset
64
+ )
65
+
66
+
67
+ headers = Twilio::Values.of({ 'Flex-Metadata' => flex_metadata, })
68
+ payload = @version.update('POST', @uri, headers: headers)
69
+ PluginConfigurationArchiveInstance.new(
70
+ @version,
71
+ payload,
72
+ sid: @solution[:sid],
73
+ )
74
+ end
75
+
76
+
77
+ ##
78
+ # Provide a user friendly representation
79
+ def to_s
80
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
81
+ "#<Twilio.FlexApi.V1.PluginConfigurationArchiveContext #{context}>"
82
+ end
83
+
84
+ ##
85
+ # Provide a detailed, user friendly representation
86
+ def inspect
87
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
88
+ "#<Twilio.FlexApi.V1.PluginConfigurationArchiveContext #{context}>"
89
+ end
90
+ end
91
+
92
+ class PluginConfigurationArchivePage < Page
93
+ ##
94
+ # Initialize the PluginConfigurationArchivePage
95
+ # @param [Version] version Version that contains the resource
96
+ # @param [Response] response Response from the API
97
+ # @param [Hash] solution Path solution for the resource
98
+ # @return [PluginConfigurationArchivePage] PluginConfigurationArchivePage
99
+ def initialize(version, response, solution)
100
+ super(version, response)
101
+
102
+ # Path Solution
103
+ @solution = solution
104
+ end
105
+
106
+ ##
107
+ # Build an instance of PluginConfigurationArchiveInstance
108
+ # @param [Hash] payload Payload response from the API
109
+ # @return [PluginConfigurationArchiveInstance] PluginConfigurationArchiveInstance
110
+ def get_instance(payload)
111
+ PluginConfigurationArchiveInstance.new(@version, payload)
112
+ end
113
+
114
+ ##
115
+ # Provide a user friendly representation
116
+ def to_s
117
+ '<Twilio.FlexApi.V1.PluginConfigurationArchivePage>'
118
+ end
119
+ end
120
+ class PluginConfigurationArchiveInstance < InstanceResource
121
+ ##
122
+ # Initialize the PluginConfigurationArchiveInstance
123
+ # @param [Version] version Version that contains the resource
124
+ # @param [Hash] payload payload that contains response from Twilio
125
+ # @param [String] account_sid The SID of the
126
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PluginConfigurationArchive
127
+ # resource.
128
+ # @param [String] sid The SID of the Call resource to fetch.
129
+ # @return [PluginConfigurationArchiveInstance] PluginConfigurationArchiveInstance
130
+ def initialize(version, payload , sid: nil)
131
+ super(version)
132
+
133
+ # Marshaled Properties
134
+ @properties = {
135
+ 'sid' => payload['sid'],
136
+ 'account_sid' => payload['account_sid'],
137
+ 'name' => payload['name'],
138
+ 'description' => payload['description'],
139
+ 'archived' => payload['archived'],
140
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
141
+ 'url' => payload['url'],
142
+ }
143
+
144
+ # Context
145
+ @instance_context = nil
146
+ @params = { 'sid' => sid || @properties['sid'] , }
147
+ end
148
+
149
+ ##
150
+ # Generate an instance context for the instance, the context is capable of
151
+ # performing various actions. All instance actions are proxied to the context
152
+ # @return [PluginConfigurationArchiveContext] CallContext for this CallInstance
153
+ def context
154
+ unless @instance_context
155
+ @instance_context = PluginConfigurationArchiveContext.new(@version , @params['sid'])
156
+ end
157
+ @instance_context
158
+ end
159
+
160
+ ##
161
+ # @return [String] The unique string that we created to identify the Flex Plugin Configuration resource.
162
+ def sid
163
+ @properties['sid']
164
+ end
165
+
166
+ ##
167
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource.
168
+ def account_sid
169
+ @properties['account_sid']
170
+ end
171
+
172
+ ##
173
+ # @return [String] The name of this Flex Plugin Configuration.
174
+ def name
175
+ @properties['name']
176
+ end
177
+
178
+ ##
179
+ # @return [String] The description of the Flex Plugin Configuration resource.
180
+ def description
181
+ @properties['description']
182
+ end
183
+
184
+ ##
185
+ # @return [Boolean] Whether the Flex Plugin Configuration is archived. The default value is false.
186
+ def archived
187
+ @properties['archived']
188
+ end
189
+
190
+ ##
191
+ # @return [Time] The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
192
+ def date_created
193
+ @properties['date_created']
194
+ end
195
+
196
+ ##
197
+ # @return [String] The absolute URL of the Flex Plugin Configuration resource.
198
+ def url
199
+ @properties['url']
200
+ end
201
+
202
+ ##
203
+ # Update the PluginConfigurationArchiveInstance
204
+ # @param [String] flex_metadata The Flex-Metadata HTTP request header
205
+ # @return [PluginConfigurationArchiveInstance] Updated PluginConfigurationArchiveInstance
206
+ def update(
207
+ flex_metadata: :unset
208
+ )
209
+
210
+ context.update(
211
+ flex_metadata: flex_metadata,
212
+ )
213
+ end
214
+
215
+ ##
216
+ # Provide a user friendly representation
217
+ def to_s
218
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
219
+ "<Twilio.FlexApi.V1.PluginConfigurationArchiveInstance #{values}>"
220
+ end
221
+
222
+ ##
223
+ # Provide a detailed, user friendly representation
224
+ def inspect
225
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
226
+ "<Twilio.FlexApi.V1.PluginConfigurationArchiveInstance #{values}>"
227
+ end
228
+ end
229
+
230
+ end
231
+ end
232
+ end
233
+ end