shotstack 0.2.1 → 0.2.6
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.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/README.md +387 -23
- data/Rakefile +10 -0
- data/lib/shotstack/api/create_api.rb +158 -0
- data/lib/shotstack/api/edit_api.rb +20 -20
- data/lib/shotstack/api/ingest_api.rb +338 -0
- data/lib/shotstack/api/serve_api.rb +76 -8
- data/lib/shotstack/api_client.rb +28 -24
- data/lib/shotstack/api_error.rb +3 -2
- data/lib/shotstack/configuration.rb +55 -9
- data/lib/shotstack/models/asset.rb +4 -4
- data/lib/shotstack/models/asset_render_response.rb +23 -20
- data/lib/shotstack/models/asset_response.rb +23 -20
- data/lib/shotstack/models/asset_response_attributes.rb +38 -21
- data/lib/shotstack/models/asset_response_data.rb +30 -20
- data/lib/shotstack/models/audio_asset.rb +57 -23
- data/lib/shotstack/models/audio_enhancement.rb +43 -0
- data/lib/shotstack/models/clip.rb +29 -33
- data/lib/shotstack/models/crop.rb +40 -28
- data/lib/shotstack/models/destinations.rb +78 -244
- data/lib/shotstack/models/did_generated_asset.rb +273 -0
- data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
- data/lib/shotstack/models/dolby_enhancement.rb +239 -0
- data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
- data/lib/shotstack/models/edit.rb +22 -24
- data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
- data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
- data/lib/shotstack/models/enhancements.rb +215 -0
- data/lib/shotstack/models/flip_transformation.rb +16 -24
- data/lib/shotstack/models/font.rb +18 -20
- data/lib/shotstack/models/generated_asset.rb +48 -0
- data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
- data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
- data/lib/shotstack/models/generated_asset_response.rb +222 -0
- data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
- data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
- data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
- data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
- data/lib/shotstack/models/google_drive_destination.rb +239 -0
- data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
- data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
- data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
- data/lib/shotstack/models/html_asset.rb +20 -26
- data/lib/shotstack/models/image_asset.rb +18 -20
- data/lib/shotstack/models/ingest_error_response.rb +225 -0
- data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
- data/lib/shotstack/models/luma_asset.rb +18 -20
- data/lib/shotstack/models/merge_field.rb +20 -20
- data/lib/shotstack/models/mux_destination.rb +18 -22
- data/lib/shotstack/models/mux_destination_options.rb +50 -25
- data/lib/shotstack/models/offset.rb +46 -46
- data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
- data/lib/shotstack/models/output.rb +40 -35
- data/lib/shotstack/models/outputs.rb +227 -0
- data/lib/shotstack/models/outputs_response.rb +218 -0
- data/lib/shotstack/models/poster.rb +18 -20
- data/lib/shotstack/models/probe_response.rb +22 -20
- data/lib/shotstack/models/queued_response.rb +22 -20
- data/lib/shotstack/models/queued_response_data.rb +20 -20
- data/lib/shotstack/models/queued_source_response.rb +222 -0
- data/lib/shotstack/models/queued_source_response_data.rb +240 -0
- data/lib/shotstack/models/range.rb +26 -22
- data/lib/shotstack/models/render_response.rb +22 -20
- data/lib/shotstack/models/render_response_data.rb +24 -35
- data/lib/shotstack/models/rendition.rb +429 -0
- data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
- data/lib/shotstack/models/rotate_transformation.rb +16 -22
- data/lib/shotstack/models/s3_destination.rb +232 -0
- data/lib/shotstack/models/s3_destination_options.rb +270 -0
- data/lib/shotstack/models/shotstack_destination.rb +19 -25
- data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
- data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
- data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
- data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
- data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
- data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
- data/lib/shotstack/models/size.rb +39 -35
- data/lib/shotstack/models/skew_transformation.rb +16 -24
- data/lib/shotstack/models/soundtrack.rb +18 -22
- data/lib/shotstack/models/source.rb +244 -0
- data/lib/shotstack/models/source_list_response.rb +225 -0
- data/lib/shotstack/models/source_response.rb +222 -0
- data/lib/shotstack/models/source_response_attributes.rb +373 -0
- data/lib/shotstack/models/source_response_data.rb +256 -0
- data/lib/shotstack/models/speed.rb +254 -0
- data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
- data/lib/shotstack/models/template.rb +18 -20
- data/lib/shotstack/models/template_data_response.rb +24 -22
- data/lib/shotstack/models/template_data_response_data.rb +25 -22
- data/lib/shotstack/models/template_list_response.rb +24 -22
- data/lib/shotstack/models/template_list_response_data.rb +20 -20
- data/lib/shotstack/models/template_list_response_item.rb +20 -30
- data/lib/shotstack/models/template_render.rb +19 -21
- data/lib/shotstack/models/template_response.rb +23 -21
- data/lib/shotstack/models/template_response_data.rb +20 -20
- data/lib/shotstack/models/thumbnail.rb +20 -20
- data/lib/shotstack/models/timeline.rb +19 -25
- data/lib/shotstack/models/title_asset.rb +19 -27
- data/lib/shotstack/models/track.rb +18 -20
- data/lib/shotstack/models/transcription.rb +250 -0
- data/lib/shotstack/models/transfer.rb +259 -0
- data/lib/shotstack/models/transfer_response.rb +222 -0
- data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
- data/lib/shotstack/models/transfer_response_data.rb +225 -0
- data/lib/shotstack/models/transformation.rb +16 -20
- data/lib/shotstack/models/transition.rb +16 -20
- data/lib/shotstack/models/upload_response.rb +222 -0
- data/lib/shotstack/models/upload_response_attributes.rb +257 -0
- data/lib/shotstack/models/upload_response_data.rb +256 -0
- data/lib/shotstack/models/video_asset.rb +102 -22
- data/lib/shotstack/version.rb +3 -3
- data/lib/shotstack.rb +63 -2
- data/shotstack.gemspec +8 -8
- metadata +80 -24
@@ -0,0 +1,338 @@
|
|
1
|
+
=begin
|
2
|
+
#Shotstack
|
3
|
+
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Shotstack
|
16
|
+
class IngestApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Delete Source
|
23
|
+
# Delete an ingested source file by its id. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
24
|
+
# @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [nil]
|
27
|
+
def delete_source(id, opts = {})
|
28
|
+
delete_source_with_http_info(id, opts)
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# Delete Source
|
33
|
+
# Delete an ingested source file by its id. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
34
|
+
# @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
37
|
+
def delete_source_with_http_info(id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: IngestApi.delete_source ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'id' is set
|
42
|
+
if @api_client.config.client_side_validation && id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling IngestApi.delete_source"
|
44
|
+
end
|
45
|
+
pattern = Regexp.new(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/)
|
46
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
47
|
+
fail ArgumentError, "invalid value for 'id' when calling IngestApi.delete_source, must conform to the pattern #{pattern}."
|
48
|
+
end
|
49
|
+
|
50
|
+
# resource path
|
51
|
+
local_var_path = '/sources/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
52
|
+
|
53
|
+
# query parameters
|
54
|
+
query_params = opts[:query_params] || {}
|
55
|
+
|
56
|
+
# header parameters
|
57
|
+
header_params = opts[:header_params] || {}
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = opts[:form_params] || {}
|
61
|
+
|
62
|
+
# http body (model)
|
63
|
+
post_body = opts[:debug_body]
|
64
|
+
|
65
|
+
# return_type
|
66
|
+
return_type = opts[:debug_return_type]
|
67
|
+
|
68
|
+
# auth_names
|
69
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
70
|
+
|
71
|
+
new_options = opts.merge(
|
72
|
+
:operation => :"IngestApi.delete_source",
|
73
|
+
:header_params => header_params,
|
74
|
+
:query_params => query_params,
|
75
|
+
:form_params => form_params,
|
76
|
+
:body => post_body,
|
77
|
+
:auth_names => auth_names,
|
78
|
+
:return_type => return_type
|
79
|
+
)
|
80
|
+
|
81
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
82
|
+
if @api_client.config.debugging
|
83
|
+
@api_client.config.logger.debug "API called: IngestApi#delete_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
84
|
+
end
|
85
|
+
return data, status_code, headers
|
86
|
+
end
|
87
|
+
|
88
|
+
# Get Source
|
89
|
+
# Fetch a source file details and status by its id. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
90
|
+
# @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format.
|
91
|
+
# @param [Hash] opts the optional parameters
|
92
|
+
# @return [SourceResponse]
|
93
|
+
def get_source(id, opts = {})
|
94
|
+
data, _status_code, _headers = get_source_with_http_info(id, opts)
|
95
|
+
data
|
96
|
+
end
|
97
|
+
|
98
|
+
# Get Source
|
99
|
+
# Fetch a source file details and status by its id. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
100
|
+
# @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format.
|
101
|
+
# @param [Hash] opts the optional parameters
|
102
|
+
# @return [Array<(SourceResponse, Integer, Hash)>] SourceResponse data, response status code and response headers
|
103
|
+
def get_source_with_http_info(id, opts = {})
|
104
|
+
if @api_client.config.debugging
|
105
|
+
@api_client.config.logger.debug 'Calling API: IngestApi.get_source ...'
|
106
|
+
end
|
107
|
+
# verify the required parameter 'id' is set
|
108
|
+
if @api_client.config.client_side_validation && id.nil?
|
109
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling IngestApi.get_source"
|
110
|
+
end
|
111
|
+
pattern = Regexp.new(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/)
|
112
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
113
|
+
fail ArgumentError, "invalid value for 'id' when calling IngestApi.get_source, must conform to the pattern #{pattern}."
|
114
|
+
end
|
115
|
+
|
116
|
+
# resource path
|
117
|
+
local_var_path = '/sources/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
118
|
+
|
119
|
+
# query parameters
|
120
|
+
query_params = opts[:query_params] || {}
|
121
|
+
|
122
|
+
# header parameters
|
123
|
+
header_params = opts[:header_params] || {}
|
124
|
+
# HTTP header 'Accept' (if needed)
|
125
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
126
|
+
|
127
|
+
# form parameters
|
128
|
+
form_params = opts[:form_params] || {}
|
129
|
+
|
130
|
+
# http body (model)
|
131
|
+
post_body = opts[:debug_body]
|
132
|
+
|
133
|
+
# return_type
|
134
|
+
return_type = opts[:debug_return_type] || 'SourceResponse'
|
135
|
+
|
136
|
+
# auth_names
|
137
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
138
|
+
|
139
|
+
new_options = opts.merge(
|
140
|
+
:operation => :"IngestApi.get_source",
|
141
|
+
:header_params => header_params,
|
142
|
+
:query_params => query_params,
|
143
|
+
:form_params => form_params,
|
144
|
+
:body => post_body,
|
145
|
+
:auth_names => auth_names,
|
146
|
+
:return_type => return_type
|
147
|
+
)
|
148
|
+
|
149
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
150
|
+
if @api_client.config.debugging
|
151
|
+
@api_client.config.logger.debug "API called: IngestApi#get_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
152
|
+
end
|
153
|
+
return data, status_code, headers
|
154
|
+
end
|
155
|
+
|
156
|
+
# List Sources
|
157
|
+
# Retrieve a list of ingested source files stored against a users account and stage. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @return [SourceListResponse]
|
160
|
+
def get_sources(opts = {})
|
161
|
+
data, _status_code, _headers = get_sources_with_http_info(opts)
|
162
|
+
data
|
163
|
+
end
|
164
|
+
|
165
|
+
# List Sources
|
166
|
+
# Retrieve a list of ingested source files stored against a users account and stage. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
167
|
+
# @param [Hash] opts the optional parameters
|
168
|
+
# @return [Array<(SourceListResponse, Integer, Hash)>] SourceListResponse data, response status code and response headers
|
169
|
+
def get_sources_with_http_info(opts = {})
|
170
|
+
if @api_client.config.debugging
|
171
|
+
@api_client.config.logger.debug 'Calling API: IngestApi.get_sources ...'
|
172
|
+
end
|
173
|
+
# resource path
|
174
|
+
local_var_path = '/sources'
|
175
|
+
|
176
|
+
# query parameters
|
177
|
+
query_params = opts[:query_params] || {}
|
178
|
+
|
179
|
+
# header parameters
|
180
|
+
header_params = opts[:header_params] || {}
|
181
|
+
# HTTP header 'Accept' (if needed)
|
182
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
183
|
+
|
184
|
+
# form parameters
|
185
|
+
form_params = opts[:form_params] || {}
|
186
|
+
|
187
|
+
# http body (model)
|
188
|
+
post_body = opts[:debug_body]
|
189
|
+
|
190
|
+
# return_type
|
191
|
+
return_type = opts[:debug_return_type] || 'SourceListResponse'
|
192
|
+
|
193
|
+
# auth_names
|
194
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
195
|
+
|
196
|
+
new_options = opts.merge(
|
197
|
+
:operation => :"IngestApi.get_sources",
|
198
|
+
:header_params => header_params,
|
199
|
+
:query_params => query_params,
|
200
|
+
:form_params => form_params,
|
201
|
+
:body => post_body,
|
202
|
+
:auth_names => auth_names,
|
203
|
+
:return_type => return_type
|
204
|
+
)
|
205
|
+
|
206
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
207
|
+
if @api_client.config.debugging
|
208
|
+
@api_client.config.logger.debug "API called: IngestApi#get_sources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
209
|
+
end
|
210
|
+
return data, status_code, headers
|
211
|
+
end
|
212
|
+
|
213
|
+
# Direct Upload
|
214
|
+
# Request a signed URL to upload a file to. The response returns a signed URL that you use to upload the file to. The signed URL looks similar to: https://shotstack-ingest-api-stage-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzytey4v-32km-kq1z-aftr-3kcuqi0brad2/source?AWSAccessKeyId=ASIAWJV7UWDMGTZLHTXP&Expires=1677209777&Signature=PKR4dGDDdOuMTAQmDASzLGmLOeo%3D&x-amz-acl=public-read&x-amz-security-token=IQoJb3JpZ2luX2VjEGMaDmFwLX......56osBGByztm7WZdbmXzO09KR In a separate API call, use this signed URL to send a PUT request with the binary file. Using cURL you can use a command like: `curl -X PUT -T video.mp4 {data.attributes.url}` Where **video.mp4** is the file you want to upload and **{data.attributes.url}** is the signed URL returned in the response. The request must be a PUT type. The SDK does not currently support the PUT request. You can use the SDK to make the request for the signed URL and then use cURL to make the PUT request. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
215
|
+
# @param [Hash] opts the optional parameters
|
216
|
+
# @return [UploadResponse]
|
217
|
+
def get_upload_signed_url(opts = {})
|
218
|
+
data, _status_code, _headers = get_upload_signed_url_with_http_info(opts)
|
219
|
+
data
|
220
|
+
end
|
221
|
+
|
222
|
+
# Direct Upload
|
223
|
+
# Request a signed URL to upload a file to. The response returns a signed URL that you use to upload the file to. The signed URL looks similar to: https://shotstack-ingest-api-stage-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzytey4v-32km-kq1z-aftr-3kcuqi0brad2/source?AWSAccessKeyId=ASIAWJV7UWDMGTZLHTXP&Expires=1677209777&Signature=PKR4dGDDdOuMTAQmDASzLGmLOeo%3D&x-amz-acl=public-read&x-amz-security-token=IQoJb3JpZ2luX2VjEGMaDmFwLX......56osBGByztm7WZdbmXzO09KR In a separate API call, use this signed URL to send a PUT request with the binary file. Using cURL you can use a command like: `curl -X PUT -T video.mp4 {data.attributes.url}` Where **video.mp4** is the file you want to upload and **{data.attributes.url}** is the signed URL returned in the response. The request must be a PUT type. The SDK does not currently support the PUT request. You can use the SDK to make the request for the signed URL and then use cURL to make the PUT request. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
224
|
+
# @param [Hash] opts the optional parameters
|
225
|
+
# @return [Array<(UploadResponse, Integer, Hash)>] UploadResponse data, response status code and response headers
|
226
|
+
def get_upload_signed_url_with_http_info(opts = {})
|
227
|
+
if @api_client.config.debugging
|
228
|
+
@api_client.config.logger.debug 'Calling API: IngestApi.get_upload_signed_url ...'
|
229
|
+
end
|
230
|
+
# resource path
|
231
|
+
local_var_path = '/upload'
|
232
|
+
|
233
|
+
# query parameters
|
234
|
+
query_params = opts[:query_params] || {}
|
235
|
+
|
236
|
+
# header parameters
|
237
|
+
header_params = opts[:header_params] || {}
|
238
|
+
# HTTP header 'Accept' (if needed)
|
239
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
240
|
+
|
241
|
+
# form parameters
|
242
|
+
form_params = opts[:form_params] || {}
|
243
|
+
|
244
|
+
# http body (model)
|
245
|
+
post_body = opts[:debug_body]
|
246
|
+
|
247
|
+
# return_type
|
248
|
+
return_type = opts[:debug_return_type] || 'UploadResponse'
|
249
|
+
|
250
|
+
# auth_names
|
251
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
252
|
+
|
253
|
+
new_options = opts.merge(
|
254
|
+
:operation => :"IngestApi.get_upload_signed_url",
|
255
|
+
:header_params => header_params,
|
256
|
+
:query_params => query_params,
|
257
|
+
:form_params => form_params,
|
258
|
+
:body => post_body,
|
259
|
+
:auth_names => auth_names,
|
260
|
+
:return_type => return_type
|
261
|
+
)
|
262
|
+
|
263
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
264
|
+
if @api_client.config.debugging
|
265
|
+
@api_client.config.logger.debug "API called: IngestApi#get_upload_signed_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
266
|
+
end
|
267
|
+
return data, status_code, headers
|
268
|
+
end
|
269
|
+
|
270
|
+
# Fetch Source
|
271
|
+
# Queue a source file to be fetched from a URL and stored by Shotstack. Source files can be videos, images, audio files and fonts. Once ingested, new [output renditions](#tocs_outputs) can be created from the source file. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
272
|
+
# @param source [Source] Ingest a video, image, audio or font file from the provided URL. Optionally provide a list of output renditions.
|
273
|
+
# @param [Hash] opts the optional parameters
|
274
|
+
# @return [QueuedSourceResponse]
|
275
|
+
def post_source(source, opts = {})
|
276
|
+
data, _status_code, _headers = post_source_with_http_info(source, opts)
|
277
|
+
data
|
278
|
+
end
|
279
|
+
|
280
|
+
# Fetch Source
|
281
|
+
# Queue a source file to be fetched from a URL and stored by Shotstack. Source files can be videos, images, audio files and fonts. Once ingested, new [output renditions](#tocs_outputs) can be created from the source file. **Base URL:** <a href=\"#\">https://api.shotstack.io/ingest/{version}</a>
|
282
|
+
# @param source [Source] Ingest a video, image, audio or font file from the provided URL. Optionally provide a list of output renditions.
|
283
|
+
# @param [Hash] opts the optional parameters
|
284
|
+
# @return [Array<(QueuedSourceResponse, Integer, Hash)>] QueuedSourceResponse data, response status code and response headers
|
285
|
+
def post_source_with_http_info(source, opts = {})
|
286
|
+
if @api_client.config.debugging
|
287
|
+
@api_client.config.logger.debug 'Calling API: IngestApi.post_source ...'
|
288
|
+
end
|
289
|
+
# verify the required parameter 'source' is set
|
290
|
+
if @api_client.config.client_side_validation && source.nil?
|
291
|
+
fail ArgumentError, "Missing the required parameter 'source' when calling IngestApi.post_source"
|
292
|
+
end
|
293
|
+
# resource path
|
294
|
+
local_var_path = '/sources'
|
295
|
+
|
296
|
+
# query parameters
|
297
|
+
query_params = opts[:query_params] || {}
|
298
|
+
|
299
|
+
# header parameters
|
300
|
+
header_params = opts[:header_params] || {}
|
301
|
+
# HTTP header 'Accept' (if needed)
|
302
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
303
|
+
# HTTP header 'Content-Type'
|
304
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
305
|
+
if !content_type.nil?
|
306
|
+
header_params['Content-Type'] = content_type
|
307
|
+
end
|
308
|
+
|
309
|
+
# form parameters
|
310
|
+
form_params = opts[:form_params] || {}
|
311
|
+
|
312
|
+
# http body (model)
|
313
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(source)
|
314
|
+
|
315
|
+
# return_type
|
316
|
+
return_type = opts[:debug_return_type] || 'QueuedSourceResponse'
|
317
|
+
|
318
|
+
# auth_names
|
319
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
320
|
+
|
321
|
+
new_options = opts.merge(
|
322
|
+
:operation => :"IngestApi.post_source",
|
323
|
+
:header_params => header_params,
|
324
|
+
:query_params => query_params,
|
325
|
+
:form_params => form_params,
|
326
|
+
:body => post_body,
|
327
|
+
:auth_names => auth_names,
|
328
|
+
:return_type => return_type
|
329
|
+
)
|
330
|
+
|
331
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
332
|
+
if @api_client.config.debugging
|
333
|
+
@api_client.config.logger.debug "API called: IngestApi#post_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
334
|
+
end
|
335
|
+
return data, status_code, headers
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -20,7 +20,7 @@ module Shotstack
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
# Delete Asset
|
23
|
-
# Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **Base URL:** https://api.shotstack.io/serve/{version}
|
23
|
+
# Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
24
24
|
# @param id [String] The id of the asset in UUID format
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
26
|
# @return [nil]
|
@@ -30,7 +30,7 @@ module Shotstack
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Delete Asset
|
33
|
-
# Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **Base URL:** https://api.shotstack.io/serve/{version}
|
33
|
+
# Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
34
34
|
# @param id [String] The id of the asset in UUID format
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
36
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
@@ -86,7 +86,7 @@ module Shotstack
|
|
86
86
|
end
|
87
87
|
|
88
88
|
# Get Asset
|
89
|
-
# The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **Base URL:** https://api.shotstack.io/serve/{version}
|
89
|
+
# The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
90
90
|
# @param id [String] The id of the asset in UUID format
|
91
91
|
# @param [Hash] opts the optional parameters
|
92
92
|
# @return [AssetResponse]
|
@@ -96,7 +96,7 @@ module Shotstack
|
|
96
96
|
end
|
97
97
|
|
98
98
|
# Get Asset
|
99
|
-
# The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **Base URL:** https://api.shotstack.io/serve/{version}
|
99
|
+
# The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
100
100
|
# @param id [String] The id of the asset in UUID format
|
101
101
|
# @param [Hash] opts the optional parameters
|
102
102
|
# @return [Array<(AssetResponse, Integer, Hash)>] AssetResponse data, response status code and response headers
|
@@ -154,7 +154,7 @@ module Shotstack
|
|
154
154
|
end
|
155
155
|
|
156
156
|
# Get Asset by Render ID
|
157
|
-
# A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **Base URL:** https://api.shotstack.io/serve/{version}
|
157
|
+
# A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
158
158
|
# @param id [String] The render id associated with the asset in UUID format
|
159
159
|
# @param [Hash] opts the optional parameters
|
160
160
|
# @return [AssetRenderResponse]
|
@@ -164,7 +164,7 @@ module Shotstack
|
|
164
164
|
end
|
165
165
|
|
166
166
|
# Get Asset by Render ID
|
167
|
-
# A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **Base URL:** https://api.shotstack.io/serve/{version}
|
167
|
+
# A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
168
168
|
# @param id [String] The render id associated with the asset in UUID format
|
169
169
|
# @param [Hash] opts the optional parameters
|
170
170
|
# @return [Array<(AssetRenderResponse, Integer, Hash)>] AssetRenderResponse data, response status code and response headers
|
@@ -220,5 +220,73 @@ module Shotstack
|
|
220
220
|
end
|
221
221
|
return data, status_code, headers
|
222
222
|
end
|
223
|
+
|
224
|
+
# Transfer Asset
|
225
|
+
# Transfer a file from any publicly available URL to one or more Serve API [destinations](#tocs_destinations). **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
226
|
+
# @param transfer [Transfer] Fetch an asset from a URL and send it to one or more destinations.
|
227
|
+
# @param [Hash] opts the optional parameters
|
228
|
+
# @return [TransferResponse]
|
229
|
+
def post_serve_asset(transfer, opts = {})
|
230
|
+
data, _status_code, _headers = post_serve_asset_with_http_info(transfer, opts)
|
231
|
+
data
|
232
|
+
end
|
233
|
+
|
234
|
+
# Transfer Asset
|
235
|
+
# Transfer a file from any publicly available URL to one or more Serve API [destinations](#tocs_destinations). **Base URL:** <a href=\"#\">https://api.shotstack.io/serve/{version}</a>
|
236
|
+
# @param transfer [Transfer] Fetch an asset from a URL and send it to one or more destinations.
|
237
|
+
# @param [Hash] opts the optional parameters
|
238
|
+
# @return [Array<(TransferResponse, Integer, Hash)>] TransferResponse data, response status code and response headers
|
239
|
+
def post_serve_asset_with_http_info(transfer, opts = {})
|
240
|
+
if @api_client.config.debugging
|
241
|
+
@api_client.config.logger.debug 'Calling API: ServeApi.post_serve_asset ...'
|
242
|
+
end
|
243
|
+
# verify the required parameter 'transfer' is set
|
244
|
+
if @api_client.config.client_side_validation && transfer.nil?
|
245
|
+
fail ArgumentError, "Missing the required parameter 'transfer' when calling ServeApi.post_serve_asset"
|
246
|
+
end
|
247
|
+
# resource path
|
248
|
+
local_var_path = '/assets'
|
249
|
+
|
250
|
+
# query parameters
|
251
|
+
query_params = opts[:query_params] || {}
|
252
|
+
|
253
|
+
# header parameters
|
254
|
+
header_params = opts[:header_params] || {}
|
255
|
+
# HTTP header 'Accept' (if needed)
|
256
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
257
|
+
# HTTP header 'Content-Type'
|
258
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
259
|
+
if !content_type.nil?
|
260
|
+
header_params['Content-Type'] = content_type
|
261
|
+
end
|
262
|
+
|
263
|
+
# form parameters
|
264
|
+
form_params = opts[:form_params] || {}
|
265
|
+
|
266
|
+
# http body (model)
|
267
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(transfer)
|
268
|
+
|
269
|
+
# return_type
|
270
|
+
return_type = opts[:debug_return_type] || 'TransferResponse'
|
271
|
+
|
272
|
+
# auth_names
|
273
|
+
auth_names = opts[:debug_auth_names] || ['DeveloperKey']
|
274
|
+
|
275
|
+
new_options = opts.merge(
|
276
|
+
:operation => :"ServeApi.post_serve_asset",
|
277
|
+
:header_params => header_params,
|
278
|
+
:query_params => query_params,
|
279
|
+
:form_params => form_params,
|
280
|
+
:body => post_body,
|
281
|
+
:auth_names => auth_names,
|
282
|
+
:return_type => return_type
|
283
|
+
)
|
284
|
+
|
285
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
286
|
+
if @api_client.config.debugging
|
287
|
+
@api_client.config.logger.debug "API called: ServeApi#post_serve_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
288
|
+
end
|
289
|
+
return data, status_code, headers
|
290
|
+
end
|
223
291
|
end
|
224
292
|
end
|
data/lib/shotstack/api_client.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module Shotstack
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -45,9 +46,10 @@ module Shotstack
|
|
45
46
|
# Call an API with given options.
|
46
47
|
#
|
47
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
48
|
-
# the data deserialized from response body (
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
49
50
|
def call_api(http_method, path, opts = {})
|
50
51
|
request = build_request(http_method, path, opts)
|
52
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
51
53
|
response = request.run
|
52
54
|
|
53
55
|
if @config.debugging
|
@@ -69,7 +71,9 @@ module Shotstack
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
|
-
if opts[:return_type]
|
74
|
+
if opts[:return_type] == 'File'
|
75
|
+
data = tempfile
|
76
|
+
elsif opts[:return_type]
|
73
77
|
data = deserialize(response, opts[:return_type])
|
74
78
|
else
|
75
79
|
data = nil
|
@@ -93,6 +97,7 @@ module Shotstack
|
|
93
97
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
94
98
|
query_params = opts[:query_params] || {}
|
95
99
|
form_params = opts[:form_params] || {}
|
100
|
+
follow_location = opts[:follow_location] || true
|
96
101
|
|
97
102
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
98
103
|
|
@@ -109,7 +114,8 @@ module Shotstack
|
|
109
114
|
:ssl_verifyhost => _verify_ssl_host,
|
110
115
|
:sslcert => @config.cert_file,
|
111
116
|
:sslkey => @config.key_file,
|
112
|
-
:verbose => @config.debugging
|
117
|
+
:verbose => @config.debugging,
|
118
|
+
:followlocation => follow_location
|
113
119
|
}
|
114
120
|
|
115
121
|
# set custom cert, if provided
|
@@ -123,9 +129,7 @@ module Shotstack
|
|
123
129
|
end
|
124
130
|
end
|
125
131
|
|
126
|
-
|
127
|
-
download_file(request) if opts[:return_type] == 'File'
|
128
|
-
request
|
132
|
+
Typhoeus::Request.new(url, req_opts)
|
129
133
|
end
|
130
134
|
|
131
135
|
# Builds the HTTP request body
|
@@ -163,6 +167,8 @@ module Shotstack
|
|
163
167
|
# process can use.
|
164
168
|
#
|
165
169
|
# @see Configuration#temp_folder_path
|
170
|
+
#
|
171
|
+
# @return [Tempfile] the tempfile generated
|
166
172
|
def download_file(request)
|
167
173
|
tempfile = nil
|
168
174
|
encoding = nil
|
@@ -177,21 +183,24 @@ module Shotstack
|
|
177
183
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
178
184
|
encoding = response.body.encoding
|
179
185
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
180
|
-
@tempfile = tempfile
|
181
186
|
end
|
182
187
|
request.on_body do |chunk|
|
183
188
|
chunk.force_encoding(encoding)
|
184
189
|
tempfile.write(chunk)
|
185
190
|
end
|
186
|
-
request
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
191
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
192
|
+
request.run
|
193
|
+
if tempfile
|
194
|
+
tempfile.close
|
195
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
196
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
197
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
198
|
+
"explicitly with `tempfile.delete`"
|
199
|
+
else
|
200
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
194
201
|
end
|
202
|
+
|
203
|
+
tempfile
|
195
204
|
end
|
196
205
|
|
197
206
|
# Check if the given MIME is a JSON MIME.
|
@@ -212,15 +221,10 @@ module Shotstack
|
|
212
221
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
213
222
|
def deserialize(response, return_type)
|
214
223
|
body = response.body
|
215
|
-
|
216
|
-
# handle file downloading - return the File instance processed in request callbacks
|
217
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
218
|
-
return @tempfile if return_type == 'File'
|
219
|
-
|
220
224
|
return nil if body.nil? || body.empty?
|
221
225
|
|
222
226
|
# return response body directly for String return type
|
223
|
-
return body if return_type == 'String'
|
227
|
+
return body.to_s if return_type == 'String'
|
224
228
|
|
225
229
|
# ensuring a default content type
|
226
230
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -335,7 +339,7 @@ module Shotstack
|
|
335
339
|
# @param [Array] content_types array for Content-Type
|
336
340
|
# @return [String] the Content-Type header (e.g. application/json)
|
337
341
|
def select_header_content_type(content_types)
|
338
|
-
#
|
342
|
+
# return nil by default
|
339
343
|
return 'application/json' if content_types.nil? || content_types.empty?
|
340
344
|
# use JSON when present, otherwise use the first one
|
341
345
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
data/lib/shotstack/api_error.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module Shotstack
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|