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