Class: ILoveVideoEditor::AssetsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/generated/ilovevideoeditor-sdk/api/assets_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AssetsApi

Returns a new instance of AssetsApi.



19
20
21
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#batch_delete_assets(batch_delete_projects_request, opts = {}) ⇒ BatchDeleteResult

Bulk delete assets

Parameters:

Returns:



26
27
28
29
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 26

def batch_delete_assets(batch_delete_projects_request, opts = {})
  data, _status_code, _headers = batch_delete_assets_with_http_info(batch_delete_projects_request, opts)
  data
end

#batch_delete_assets_with_http_info(batch_delete_projects_request, opts = {}) ⇒ Array<(BatchDeleteResult, Integer, Hash)>

Bulk delete assets

Parameters:

Returns:

  • (Array<(BatchDeleteResult, Integer, Hash)>)

    BatchDeleteResult data, response status code and response headers



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 35

def batch_delete_assets_with_http_info(batch_delete_projects_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.batch_delete_assets ...'
  end
  # verify the required parameter 'batch_delete_projects_request' is set
  if @api_client.config.client_side_validation && batch_delete_projects_request.nil?
    fail ArgumentError, "Missing the required parameter 'batch_delete_projects_request' when calling AssetsApi.batch_delete_assets"
  end
  # resource path
  local_var_path = '/v1/assets/batch-delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_delete_projects_request)

  # return_type
  return_type = opts[:debug_return_type] || 'BatchDeleteResult'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.batch_delete_assets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#batch_delete_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_asset(asset_create, opts = {}) ⇒ CreateAsset201Response

Register an uploaded asset Register an asset after it has been uploaded to Bunny Storage. Use POST /v1/assets/upload-url first.

Parameters:

  • asset_create (AssetCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



93
94
95
96
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 93

def create_asset(asset_create, opts = {})
  data, _status_code, _headers = create_asset_with_http_info(asset_create, opts)
  data
end

#create_asset_with_http_info(asset_create, opts = {}) ⇒ Array<(CreateAsset201Response, Integer, Hash)>

Register an uploaded asset Register an asset after it has been uploaded to Bunny Storage. Use `POST /v1/assets/upload-url` first.

Parameters:

  • asset_create (AssetCreate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateAsset201Response, Integer, Hash)>)

    CreateAsset201Response data, response status code and response headers



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 103

def create_asset_with_http_info(asset_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.create_asset ...'
  end
  # verify the required parameter 'asset_create' is set
  if @api_client.config.client_side_validation && asset_create.nil?
    fail ArgumentError, "Missing the required parameter 'asset_create' when calling AssetsApi.create_asset"
  end
  # resource path
  local_var_path = '/v1/assets'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(asset_create)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateAsset201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.create_asset",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#create_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_asset(id, opts = {}) ⇒ DeleteProject200Response

Delete an asset

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



160
161
162
163
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 160

def delete_asset(id, opts = {})
  data, _status_code, _headers = delete_asset_with_http_info(id, opts)
  data
end

#delete_asset_with_http_info(id, opts = {}) ⇒ Array<(DeleteProject200Response, Integer, Hash)>

Delete an asset

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteProject200Response, Integer, Hash)>)

    DeleteProject200Response data, response status code and response headers



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 169

def delete_asset_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.delete_asset ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.delete_asset"
  end
  # resource path
  local_var_path = '/v1/assets/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteProject200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.delete_asset",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#delete_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_asset(id, opts = {}) ⇒ CreateAsset201Response

Get a single asset

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



221
222
223
224
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 221

def get_asset(id, opts = {})
  data, _status_code, _headers = get_asset_with_http_info(id, opts)
  data
end

#get_asset_signed_url(id, opts = {}) ⇒ GetAssetSignedUrl200Response

Get a public asset URL Returns the public Bunny CDN URL for the asset.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



283
284
285
286
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 283

def get_asset_signed_url(id, opts = {})
  data, _status_code, _headers = get_asset_signed_url_with_http_info(id, opts)
  data
end

#get_asset_signed_url_with_http_info(id, opts = {}) ⇒ Array<(GetAssetSignedUrl200Response, Integer, Hash)>

Get a public asset URL Returns the public Bunny CDN URL for the asset.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 293

def get_asset_signed_url_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.get_asset_signed_url ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.get_asset_signed_url"
  end
  # resource path
  local_var_path = '/v1/assets/{id}/signed-url'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAssetSignedUrl200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.get_asset_signed_url",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#get_asset_signed_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_asset_upload_url(get_asset_upload_url_request, opts = {}) ⇒ AssetUploadUrlResponse

Get asset upload URL Returns the upload endpoint and Bunny Storage path for a new asset.

Parameters:

Returns:



346
347
348
349
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 346

def get_asset_upload_url(get_asset_upload_url_request, opts = {})
  data, _status_code, _headers = get_asset_upload_url_with_http_info(get_asset_upload_url_request, opts)
  data
end

#get_asset_upload_url_with_http_info(get_asset_upload_url_request, opts = {}) ⇒ Array<(AssetUploadUrlResponse, Integer, Hash)>

Get asset upload URL Returns the upload endpoint and Bunny Storage path for a new asset.

Parameters:

Returns:

  • (Array<(AssetUploadUrlResponse, Integer, Hash)>)

    AssetUploadUrlResponse data, response status code and response headers



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 356

def get_asset_upload_url_with_http_info(get_asset_upload_url_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.get_asset_upload_url ...'
  end
  # verify the required parameter 'get_asset_upload_url_request' is set
  if @api_client.config.client_side_validation && get_asset_upload_url_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_asset_upload_url_request' when calling AssetsApi.get_asset_upload_url"
  end
  # resource path
  local_var_path = '/v1/assets/upload-url'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(get_asset_upload_url_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AssetUploadUrlResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.get_asset_upload_url",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#get_asset_upload_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_asset_with_http_info(id, opts = {}) ⇒ Array<(CreateAsset201Response, Integer, Hash)>

Get a single asset

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateAsset201Response, Integer, Hash)>)

    CreateAsset201Response data, response status code and response headers



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 230

def get_asset_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.get_asset ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.get_asset"
  end
  # resource path
  local_var_path = '/v1/assets/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CreateAsset201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.get_asset",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#get_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_assets(opts = {}) ⇒ ListAssets200Response

List workspace assets

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)
  • :search (String)
  • :sort_by (String) — default: default to 'created_at'
  • :sort_order (String) — default: default to 'desc'
  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 25

Returns:



418
419
420
421
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 418

def list_assets(opts = {})
  data, _status_code, _headers = list_assets_with_http_info(opts)
  data
end

#list_assets_with_http_info(opts = {}) ⇒ Array<(ListAssets200Response, Integer, Hash)>

List workspace assets

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)
  • :search (String)
  • :sort_by (String) — default: default to 'created_at'
  • :sort_order (String) — default: default to 'desc'
  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 25

Returns:

  • (Array<(ListAssets200Response, Integer, Hash)>)

    ListAssets200Response data, response status code and response headers



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 432

def list_assets_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.list_assets ...'
  end
  allowable_values = ["video", "audio", "image", "font"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = ["created_at", "name", "type", "size_bytes", "duration"]
  if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
    fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
    fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/assets'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAssets200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.list_assets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#list_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#proxy_asset(id, opts = {}) ⇒ File

Proxy an asset through the API Streams the asset through the API so the browser can fetch it without relying on CDN CORS.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (File)


499
500
501
502
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 499

def proxy_asset(id, opts = {})
  data, _status_code, _headers = proxy_asset_with_http_info(id, opts)
  data
end

#proxy_asset_with_http_info(id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Proxy an asset through the API Streams the asset through the API so the browser can fetch it without relying on CDN CORS.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(File, Integer, Hash)>)

    File data, response status code and response headers



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 509

def proxy_asset_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.proxy_asset ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.proxy_asset"
  end
  # resource path
  local_var_path = '/v1/assets/{id}/proxy'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'File'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.proxy_asset",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#proxy_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_asset(asset_id, file, opts = {}) ⇒ UploadAsset200Response

Upload an asset file Receives a multipart/form-data file upload and forwards it to Bunny Storage.

Parameters:

  • asset_id (String)
  • file (File)

    Asset file (up to 2 GB).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



563
564
565
566
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 563

def upload_asset(asset_id, file, opts = {})
  data, _status_code, _headers = upload_asset_with_http_info(asset_id, file, opts)
  data
end

#upload_asset_with_http_info(asset_id, file, opts = {}) ⇒ Array<(UploadAsset200Response, Integer, Hash)>

Upload an asset file Receives a multipart/form-data file upload and forwards it to Bunny Storage.

Parameters:

  • asset_id (String)
  • file (File)

    Asset file (up to 2 GB).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UploadAsset200Response, Integer, Hash)>)

    UploadAsset200Response data, response status code and response headers



574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/generated/ilovevideoeditor-sdk/api/assets_api.rb', line 574

def upload_asset_with_http_info(asset_id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AssetsApi.upload_asset ...'
  end
  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.upload_asset"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling AssetsApi.upload_asset"
  end
  # resource path
  local_var_path = '/v1/assets/{assetId}/upload'.sub('{assetId}', CGI.escape(asset_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UploadAsset200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['BearerAuth']

  new_options = opts.merge(
    :operation => :"AssetsApi.upload_asset",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AssetsApi#upload_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end