twilio-ruby 7.0.0.pre.rc.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,405 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # Twilio - Media
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 Media < MediaBase
19
- class V1 < Version
20
- class MediaRecordingList < ListResource
21
-
22
- ##
23
- # Initialize the MediaRecordingList
24
- # @param [Version] version Version that contains the resource
25
- # @return [MediaRecordingList] MediaRecordingList
26
- def initialize(version)
27
- super(version)
28
- # Path Solution
29
- @solution = { }
30
- @uri = "/MediaRecordings"
31
-
32
- end
33
-
34
- ##
35
- # Lists MediaRecordingInstance records from the API as a list.
36
- # Unlike stream(), this operation is eager and will load `limit` records into
37
- # memory before returning.
38
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
39
- # @param [Status] status Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`.
40
- # @param [String] processor_sid SID of a MediaProcessor to filter by.
41
- # @param [String] source_sid SID of a MediaRecording source to filter by.
42
- # @param [Integer] limit Upper limit for the number of records to return. stream()
43
- # guarantees to never return more than limit. Default is no limit
44
- # @param [Integer] page_size Number of records to fetch per request, when
45
- # not set will use the default value of 50 records. If no page_size is defined
46
- # but a limit is defined, stream() will attempt to read the limit with the most
47
- # efficient page size, i.e. min(limit, 1000)
48
- # @return [Array] Array of up to limit results
49
- def list(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, limit: nil, page_size: nil)
50
- self.stream(
51
- order: order,
52
- status: status,
53
- processor_sid: processor_sid,
54
- source_sid: source_sid,
55
- limit: limit,
56
- page_size: page_size
57
- ).entries
58
- end
59
-
60
- ##
61
- # Streams Instance records from the API as an Enumerable.
62
- # This operation lazily loads records as efficiently as possible until the limit
63
- # is reached.
64
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
65
- # @param [Status] status Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`.
66
- # @param [String] processor_sid SID of a MediaProcessor to filter by.
67
- # @param [String] source_sid SID of a MediaRecording source to filter by.
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 [Enumerable] Enumerable that will yield up to limit results
75
- def stream(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, limit: nil, page_size: nil)
76
- limits = @version.read_limits(limit, page_size)
77
-
78
- page = self.page(
79
- order: order,
80
- status: status,
81
- processor_sid: processor_sid,
82
- source_sid: source_sid,
83
- page_size: limits[:page_size], )
84
-
85
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
86
- end
87
-
88
- ##
89
- # When passed a block, yields MediaRecordingInstance records from the API.
90
- # This operation lazily loads records as efficiently as possible until the limit
91
- # is reached.
92
- def each
93
- limits = @version.read_limits
94
-
95
- page = self.page(page_size: limits[:page_size], )
96
-
97
- @version.stream(page,
98
- limit: limits[:limit],
99
- page_limit: limits[:page_limit]).each {|x| yield x}
100
- end
101
-
102
- ##
103
- # Retrieve a single page of MediaRecordingInstance records from the API.
104
- # Request is executed immediately.
105
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
106
- # @param [Status] status Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`.
107
- # @param [String] processor_sid SID of a MediaProcessor to filter by.
108
- # @param [String] source_sid SID of a MediaRecording source to filter by.
109
- # @param [String] page_token PageToken provided by the API
110
- # @param [Integer] page_number Page Number, this value is simply for client state
111
- # @param [Integer] page_size Number of records to return, defaults to 50
112
- # @return [Page] Page of MediaRecordingInstance
113
- def page(order: :unset, status: :unset, processor_sid: :unset, source_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114
- params = Twilio::Values.of({
115
- 'Order' => order,
116
- 'Status' => status,
117
- 'ProcessorSid' => processor_sid,
118
- 'SourceSid' => source_sid,
119
- 'PageToken' => page_token,
120
- 'Page' => page_number,
121
- 'PageSize' => page_size,
122
- })
123
-
124
- response = @version.page('GET', @uri, params: params)
125
-
126
- MediaRecordingPage.new(@version, response, @solution)
127
- end
128
-
129
- ##
130
- # Retrieve a single page of MediaRecordingInstance records from the API.
131
- # Request is executed immediately.
132
- # @param [String] target_url API-generated URL for the requested results page
133
- # @return [Page] Page of MediaRecordingInstance
134
- def get_page(target_url)
135
- response = @version.domain.request(
136
- 'GET',
137
- target_url
138
- )
139
- MediaRecordingPage.new(@version, response, @solution)
140
- end
141
-
142
-
143
-
144
- # Provide a user friendly representation
145
- def to_s
146
- '#<Twilio.Media.V1.MediaRecordingList>'
147
- end
148
- end
149
-
150
-
151
- class MediaRecordingContext < InstanceContext
152
- ##
153
- # Initialize the MediaRecordingContext
154
- # @param [Version] version Version that contains the resource
155
- # @param [String] sid The SID of the MediaRecording resource to fetch.
156
- # @return [MediaRecordingContext] MediaRecordingContext
157
- def initialize(version, sid)
158
- super(version)
159
-
160
- # Path Solution
161
- @solution = { sid: sid, }
162
- @uri = "/MediaRecordings/#{@solution[:sid]}"
163
-
164
-
165
- end
166
- ##
167
- # Delete the MediaRecordingInstance
168
- # @return [Boolean] True if delete succeeds, false otherwise
169
- def delete
170
-
171
-
172
- @version.delete('DELETE', @uri)
173
- end
174
-
175
- ##
176
- # Fetch the MediaRecordingInstance
177
- # @return [MediaRecordingInstance] Fetched MediaRecordingInstance
178
- def fetch
179
-
180
-
181
- payload = @version.fetch('GET', @uri)
182
- MediaRecordingInstance.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.Media.V1.MediaRecordingContext #{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.Media.V1.MediaRecordingContext #{context}>"
202
- end
203
- end
204
-
205
- class MediaRecordingPage < Page
206
- ##
207
- # Initialize the MediaRecordingPage
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 [MediaRecordingPage] MediaRecordingPage
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 MediaRecordingInstance
221
- # @param [Hash] payload Payload response from the API
222
- # @return [MediaRecordingInstance] MediaRecordingInstance
223
- def get_instance(payload)
224
- MediaRecordingInstance.new(@version, payload)
225
- end
226
-
227
- ##
228
- # Provide a user friendly representation
229
- def to_s
230
- '<Twilio.Media.V1.MediaRecordingPage>'
231
- end
232
- end
233
- class MediaRecordingInstance < InstanceResource
234
- ##
235
- # Initialize the MediaRecordingInstance
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 MediaRecording
240
- # resource.
241
- # @param [String] sid The SID of the Call resource to fetch.
242
- # @return [MediaRecordingInstance] MediaRecordingInstance
243
- def initialize(version, payload , sid: nil)
244
- super(version)
245
-
246
- # Marshaled Properties
247
- @properties = {
248
- 'account_sid' => payload['account_sid'],
249
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
250
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
251
- 'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
252
- 'format' => payload['format'],
253
- 'links' => payload['links'],
254
- 'processor_sid' => payload['processor_sid'],
255
- 'resolution' => payload['resolution'],
256
- 'source_sid' => payload['source_sid'],
257
- 'sid' => payload['sid'],
258
- 'media_size' => payload['media_size'],
259
- 'status' => payload['status'],
260
- 'status_callback' => payload['status_callback'],
261
- 'status_callback_method' => payload['status_callback_method'],
262
- 'url' => payload['url'],
263
- }
264
-
265
- # Context
266
- @instance_context = nil
267
- @params = { 'sid' => sid || @properties['sid'] , }
268
- end
269
-
270
- ##
271
- # Generate an instance context for the instance, the context is capable of
272
- # performing various actions. All instance actions are proxied to the context
273
- # @return [MediaRecordingContext] CallContext for this CallInstance
274
- def context
275
- unless @instance_context
276
- @instance_context = MediaRecordingContext.new(@version , @params['sid'])
277
- end
278
- @instance_context
279
- end
280
-
281
- ##
282
- # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource.
283
- def account_sid
284
- @properties['account_sid']
285
- end
286
-
287
- ##
288
- # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
289
- def date_created
290
- @properties['date_created']
291
- end
292
-
293
- ##
294
- # @return [Time] The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
295
- def date_updated
296
- @properties['date_updated']
297
- end
298
-
299
- ##
300
- # @return [String] The duration of the MediaRecording in seconds.
301
- def duration
302
- @properties['duration']
303
- end
304
-
305
- ##
306
- # @return [Format]
307
- def format
308
- @properties['format']
309
- end
310
-
311
- ##
312
- # @return [Hash] The URLs of related resources.
313
- def links
314
- @properties['links']
315
- end
316
-
317
- ##
318
- # @return [String] The SID of the MediaProcessor resource which produced the MediaRecording.
319
- def processor_sid
320
- @properties['processor_sid']
321
- end
322
-
323
- ##
324
- # @return [String] The dimensions of the video image in pixels expressed as columns (width) and rows (height).
325
- def resolution
326
- @properties['resolution']
327
- end
328
-
329
- ##
330
- # @return [String] The SID of the resource that generated the original media track(s) of the MediaRecording.
331
- def source_sid
332
- @properties['source_sid']
333
- end
334
-
335
- ##
336
- # @return [String] The unique string generated to identify the MediaRecording resource.
337
- def sid
338
- @properties['sid']
339
- end
340
-
341
- ##
342
- # @return [String] The size of the recording media in bytes.
343
- def media_size
344
- @properties['media_size']
345
- end
346
-
347
- ##
348
- # @return [Status]
349
- def status
350
- @properties['status']
351
- end
352
-
353
- ##
354
- # @return [String] The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details.
355
- def status_callback
356
- @properties['status_callback']
357
- end
358
-
359
- ##
360
- # @return [String] The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
361
- def status_callback_method
362
- @properties['status_callback_method']
363
- end
364
-
365
- ##
366
- # @return [String] The absolute URL of the resource.
367
- def url
368
- @properties['url']
369
- end
370
-
371
- ##
372
- # Delete the MediaRecordingInstance
373
- # @return [Boolean] True if delete succeeds, false otherwise
374
- def delete
375
-
376
- context.delete
377
- end
378
-
379
- ##
380
- # Fetch the MediaRecordingInstance
381
- # @return [MediaRecordingInstance] Fetched MediaRecordingInstance
382
- def fetch
383
-
384
- context.fetch
385
- end
386
-
387
- ##
388
- # Provide a user friendly representation
389
- def to_s
390
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
391
- "<Twilio.Media.V1.MediaRecordingInstance #{values}>"
392
- end
393
-
394
- ##
395
- # Provide a detailed, user friendly representation
396
- def inspect
397
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
398
- "<Twilio.Media.V1.MediaRecordingInstance #{values}>"
399
- end
400
- end
401
-
402
- end
403
- end
404
- end
405
- end
@@ -1,255 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # Twilio - Media
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 Media < MediaBase
19
- class V1 < Version
20
- class PlayerStreamerContext < InstanceContext
21
-
22
- class PlaybackGrantList < ListResource
23
-
24
- ##
25
- # Initialize the PlaybackGrantList
26
- # @param [Version] version Version that contains the resource
27
- # @return [PlaybackGrantList] PlaybackGrantList
28
- def initialize(version, sid: nil)
29
- super(version)
30
- # Path Solution
31
- @solution = { sid: sid }
32
-
33
-
34
- end
35
-
36
-
37
-
38
- # Provide a user friendly representation
39
- def to_s
40
- '#<Twilio.Media.V1.PlaybackGrantList>'
41
- end
42
- end
43
-
44
-
45
- class PlaybackGrantContext < InstanceContext
46
- ##
47
- # Initialize the PlaybackGrantContext
48
- # @param [Version] version Version that contains the resource
49
- # @param [String] sid The SID of the PlayerStreamer resource to fetch.
50
- # @return [PlaybackGrantContext] PlaybackGrantContext
51
- def initialize(version, sid)
52
- super(version)
53
-
54
- # Path Solution
55
- @solution = { sid: sid, }
56
- @uri = "/PlayerStreamers/#{@solution[:sid]}/PlaybackGrant"
57
-
58
-
59
- end
60
- ##
61
- # Create the PlaybackGrantInstance
62
- # @param [String] ttl The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds.
63
- # @param [String] access_control_allow_origin The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain.
64
- # @return [PlaybackGrantInstance] Created PlaybackGrantInstance
65
- def create(
66
- ttl: :unset,
67
- access_control_allow_origin: :unset
68
- )
69
-
70
- data = Twilio::Values.of({
71
- 'Ttl' => ttl,
72
- 'AccessControlAllowOrigin' => access_control_allow_origin,
73
- })
74
-
75
-
76
- payload = @version.create('POST', @uri, data: data)
77
- PlaybackGrantInstance.new(
78
- @version,
79
- payload,
80
- sid: @solution[:sid],
81
- )
82
- end
83
-
84
- ##
85
- # Fetch the PlaybackGrantInstance
86
- # @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
87
- def fetch
88
-
89
-
90
- payload = @version.fetch('GET', @uri)
91
- PlaybackGrantInstance.new(
92
- @version,
93
- payload,
94
- sid: @solution[:sid],
95
- )
96
- end
97
-
98
-
99
- ##
100
- # Provide a user friendly representation
101
- def to_s
102
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
103
- "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
104
- end
105
-
106
- ##
107
- # Provide a detailed, user friendly representation
108
- def inspect
109
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
110
- "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
111
- end
112
- end
113
-
114
- class PlaybackGrantPage < Page
115
- ##
116
- # Initialize the PlaybackGrantPage
117
- # @param [Version] version Version that contains the resource
118
- # @param [Response] response Response from the API
119
- # @param [Hash] solution Path solution for the resource
120
- # @return [PlaybackGrantPage] PlaybackGrantPage
121
- def initialize(version, response, solution)
122
- super(version, response)
123
-
124
- # Path Solution
125
- @solution = solution
126
- end
127
-
128
- ##
129
- # Build an instance of PlaybackGrantInstance
130
- # @param [Hash] payload Payload response from the API
131
- # @return [PlaybackGrantInstance] PlaybackGrantInstance
132
- def get_instance(payload)
133
- PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid])
134
- end
135
-
136
- ##
137
- # Provide a user friendly representation
138
- def to_s
139
- '<Twilio.Media.V1.PlaybackGrantPage>'
140
- end
141
- end
142
- class PlaybackGrantInstance < InstanceResource
143
- ##
144
- # Initialize the PlaybackGrantInstance
145
- # @param [Version] version Version that contains the resource
146
- # @param [Hash] payload payload that contains response from Twilio
147
- # @param [String] account_sid The SID of the
148
- # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PlaybackGrant
149
- # resource.
150
- # @param [String] sid The SID of the Call resource to fetch.
151
- # @return [PlaybackGrantInstance] PlaybackGrantInstance
152
- def initialize(version, payload , sid: nil)
153
- super(version)
154
-
155
- # Marshaled Properties
156
- @properties = {
157
- 'sid' => payload['sid'],
158
- 'url' => payload['url'],
159
- 'account_sid' => payload['account_sid'],
160
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
161
- 'grant' => payload['grant'],
162
- }
163
-
164
- # Context
165
- @instance_context = nil
166
- @params = { 'sid' => sid || @properties['sid'] , }
167
- end
168
-
169
- ##
170
- # Generate an instance context for the instance, the context is capable of
171
- # performing various actions. All instance actions are proxied to the context
172
- # @return [PlaybackGrantContext] CallContext for this CallInstance
173
- def context
174
- unless @instance_context
175
- @instance_context = PlaybackGrantContext.new(@version , @params['sid'])
176
- end
177
- @instance_context
178
- end
179
-
180
- ##
181
- # @return [String] The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for.
182
- def sid
183
- @properties['sid']
184
- end
185
-
186
- ##
187
- # @return [String] The absolute URL of the resource.
188
- def url
189
- @properties['url']
190
- end
191
-
192
- ##
193
- # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource.
194
- def account_sid
195
- @properties['account_sid']
196
- end
197
-
198
- ##
199
- # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
200
- def date_created
201
- @properties['date_created']
202
- end
203
-
204
- ##
205
- # @return [Hash] The grant that authorizes the player sdk to connect to the livestream
206
- def grant
207
- @properties['grant']
208
- end
209
-
210
- ##
211
- # Create the PlaybackGrantInstance
212
- # @param [String] ttl The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds.
213
- # @param [String] access_control_allow_origin The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain.
214
- # @return [PlaybackGrantInstance] Created PlaybackGrantInstance
215
- def create(
216
- ttl: :unset,
217
- access_control_allow_origin: :unset
218
- )
219
-
220
- context.create(
221
- ttl: ttl,
222
- access_control_allow_origin: access_control_allow_origin,
223
- )
224
- end
225
-
226
- ##
227
- # Fetch the PlaybackGrantInstance
228
- # @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
229
- def fetch
230
-
231
- context.fetch
232
- end
233
-
234
- ##
235
- # Provide a user friendly representation
236
- def to_s
237
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
238
- "<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
239
- end
240
-
241
- ##
242
- # Provide a detailed, user friendly representation
243
- def inspect
244
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
245
- "<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
246
- end
247
- end
248
-
249
- end
250
- end
251
- end
252
- end
253
- end
254
-
255
-