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,308 @@
|
|
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 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Shotstack
|
17
|
+
# Options for the Shotstack text-to-image service. Set a text prompt to generate an image from. The output will be generated as a PNG file available at the URL returned in the response.
|
18
|
+
class ShotstackTextToImageOptions
|
19
|
+
# The type of asset to generate - set to `text-to-image` for text-to-image.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The text prompt to generate an image from.
|
23
|
+
attr_accessor :prompt
|
24
|
+
|
25
|
+
# The width of the image in pixels.
|
26
|
+
attr_accessor :width
|
27
|
+
|
28
|
+
# The height of the image in pixels.
|
29
|
+
attr_accessor :height
|
30
|
+
|
31
|
+
class EnumAttributeValidator
|
32
|
+
attr_reader :datatype
|
33
|
+
attr_reader :allowable_values
|
34
|
+
|
35
|
+
def initialize(datatype, allowable_values)
|
36
|
+
@allowable_values = allowable_values.map do |value|
|
37
|
+
case datatype.to_s
|
38
|
+
when /Integer/i
|
39
|
+
value.to_i
|
40
|
+
when /Float/i
|
41
|
+
value.to_f
|
42
|
+
else
|
43
|
+
value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def valid?(value)
|
49
|
+
!value || allowable_values.include?(value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:'type' => :'type',
|
57
|
+
:'prompt' => :'prompt',
|
58
|
+
:'width' => :'width',
|
59
|
+
:'height' => :'height'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns all the JSON keys this model knows about
|
64
|
+
def self.acceptable_attributes
|
65
|
+
attribute_map.values
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'type' => :'String',
|
72
|
+
:'prompt' => :'String',
|
73
|
+
:'width' => :'Integer',
|
74
|
+
:'height' => :'Integer'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# List of attributes with nullable: true
|
79
|
+
def self.openapi_nullable
|
80
|
+
Set.new([
|
81
|
+
])
|
82
|
+
end
|
83
|
+
|
84
|
+
# Initializes the object
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
def initialize(attributes = {})
|
87
|
+
if (!attributes.is_a?(Hash))
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::ShotstackTextToImageOptions` initialize method"
|
89
|
+
end
|
90
|
+
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
92
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
93
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
94
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::ShotstackTextToImageOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
95
|
+
end
|
96
|
+
h[k.to_sym] = v
|
97
|
+
}
|
98
|
+
|
99
|
+
if attributes.key?(:'type')
|
100
|
+
self.type = attributes[:'type']
|
101
|
+
else
|
102
|
+
self.type = 'text-to-image'
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'prompt')
|
106
|
+
self.prompt = attributes[:'prompt']
|
107
|
+
else
|
108
|
+
self.prompt = nil
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'width')
|
112
|
+
self.width = attributes[:'width']
|
113
|
+
else
|
114
|
+
self.width = nil
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'height')
|
118
|
+
self.height = attributes[:'height']
|
119
|
+
else
|
120
|
+
self.height = nil
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
128
|
+
invalid_properties = Array.new
|
129
|
+
if @type.nil?
|
130
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
131
|
+
end
|
132
|
+
|
133
|
+
if @prompt.nil?
|
134
|
+
invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
|
135
|
+
end
|
136
|
+
|
137
|
+
if @width.nil?
|
138
|
+
invalid_properties.push('invalid value for "width", width cannot be nil.')
|
139
|
+
end
|
140
|
+
|
141
|
+
if @height.nil?
|
142
|
+
invalid_properties.push('invalid value for "height", height cannot be nil.')
|
143
|
+
end
|
144
|
+
|
145
|
+
invalid_properties
|
146
|
+
end
|
147
|
+
|
148
|
+
# Check to see if the all the properties in the model are valid
|
149
|
+
# @return true if the model is valid
|
150
|
+
def valid?
|
151
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
152
|
+
return false if @type.nil?
|
153
|
+
type_validator = EnumAttributeValidator.new('String', ["text-to-image"])
|
154
|
+
return false unless type_validator.valid?(@type)
|
155
|
+
return false if @prompt.nil?
|
156
|
+
return false if @width.nil?
|
157
|
+
return false if @height.nil?
|
158
|
+
true
|
159
|
+
end
|
160
|
+
|
161
|
+
# Custom attribute writer method checking allowed values (enum).
|
162
|
+
# @param [Object] type Object to be assigned
|
163
|
+
def type=(type)
|
164
|
+
validator = EnumAttributeValidator.new('String', ["text-to-image"])
|
165
|
+
unless validator.valid?(type)
|
166
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
167
|
+
end
|
168
|
+
@type = type
|
169
|
+
end
|
170
|
+
|
171
|
+
# Checks equality by comparing each attribute.
|
172
|
+
# @param [Object] Object to be compared
|
173
|
+
def ==(o)
|
174
|
+
return true if self.equal?(o)
|
175
|
+
self.class == o.class &&
|
176
|
+
type == o.type &&
|
177
|
+
prompt == o.prompt &&
|
178
|
+
width == o.width &&
|
179
|
+
height == o.height
|
180
|
+
end
|
181
|
+
|
182
|
+
# @see the `==` method
|
183
|
+
# @param [Object] Object to be compared
|
184
|
+
def eql?(o)
|
185
|
+
self == o
|
186
|
+
end
|
187
|
+
|
188
|
+
# Calculates hash code according to all attributes.
|
189
|
+
# @return [Integer] Hash code
|
190
|
+
def hash
|
191
|
+
[type, prompt, width, height].hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Builds the object from hash
|
195
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
196
|
+
# @return [Object] Returns the model itself
|
197
|
+
def self.build_from_hash(attributes)
|
198
|
+
return nil unless attributes.is_a?(Hash)
|
199
|
+
attributes = attributes.transform_keys(&:to_sym)
|
200
|
+
transformed_hash = {}
|
201
|
+
openapi_types.each_pair do |key, type|
|
202
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
203
|
+
transformed_hash["#{key}"] = nil
|
204
|
+
elsif type =~ /\AArray<(.*)>/i
|
205
|
+
# check to ensure the input is an array given that the attribute
|
206
|
+
# is documented as an array but the input is not
|
207
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
208
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
209
|
+
end
|
210
|
+
elsif !attributes[attribute_map[key]].nil?
|
211
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
212
|
+
end
|
213
|
+
end
|
214
|
+
new(transformed_hash)
|
215
|
+
end
|
216
|
+
|
217
|
+
# Deserializes the data based on type
|
218
|
+
# @param string type Data type
|
219
|
+
# @param string value Value to be deserialized
|
220
|
+
# @return [Object] Deserialized data
|
221
|
+
def self._deserialize(type, value)
|
222
|
+
case type.to_sym
|
223
|
+
when :Time
|
224
|
+
Time.parse(value)
|
225
|
+
when :Date
|
226
|
+
Date.parse(value)
|
227
|
+
when :String
|
228
|
+
value.to_s
|
229
|
+
when :Integer
|
230
|
+
value.to_i
|
231
|
+
when :Float
|
232
|
+
value.to_f
|
233
|
+
when :Boolean
|
234
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
235
|
+
true
|
236
|
+
else
|
237
|
+
false
|
238
|
+
end
|
239
|
+
when :Object
|
240
|
+
# generic object (usually a Hash), return directly
|
241
|
+
value
|
242
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
243
|
+
inner_type = Regexp.last_match[:inner_type]
|
244
|
+
value.map { |v| _deserialize(inner_type, v) }
|
245
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
246
|
+
k_type = Regexp.last_match[:k_type]
|
247
|
+
v_type = Regexp.last_match[:v_type]
|
248
|
+
{}.tap do |hash|
|
249
|
+
value.each do |k, v|
|
250
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
else # model
|
254
|
+
# models (e.g. Pet) or oneOf
|
255
|
+
klass = Shotstack.const_get(type)
|
256
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns the string representation of the object
|
261
|
+
# @return [String] String presentation of the object
|
262
|
+
def to_s
|
263
|
+
to_hash.to_s
|
264
|
+
end
|
265
|
+
|
266
|
+
# to_body is an alias to to_hash (backward compatibility)
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_body
|
269
|
+
to_hash
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns the object in the form of hash
|
273
|
+
# @return [Hash] Returns the object in the form of hash
|
274
|
+
def to_hash
|
275
|
+
hash = {}
|
276
|
+
self.class.attribute_map.each_pair do |attr, param|
|
277
|
+
value = self.send(attr)
|
278
|
+
if value.nil?
|
279
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
280
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
281
|
+
end
|
282
|
+
|
283
|
+
hash[param] = _to_hash(value)
|
284
|
+
end
|
285
|
+
hash
|
286
|
+
end
|
287
|
+
|
288
|
+
# Outputs non-array value in the form of hash
|
289
|
+
# For object, use to_hash. Otherwise, just return the value
|
290
|
+
# @param [Object] value Any valid value
|
291
|
+
# @return [Hash] Returns the value in the form of hash
|
292
|
+
def _to_hash(value)
|
293
|
+
if value.is_a?(Array)
|
294
|
+
value.compact.map { |v| _to_hash(v) }
|
295
|
+
elsif value.is_a?(Hash)
|
296
|
+
{}.tap do |hash|
|
297
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
298
|
+
end
|
299
|
+
elsif value.respond_to? :to_hash
|
300
|
+
value.to_hash
|
301
|
+
else
|
302
|
+
value
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
@@ -0,0 +1,339 @@
|
|
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 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Shotstack
|
17
|
+
# Options for the Shotstack text-to-speech service. Set the text to be converted to speech and choose a voice to set the speaking style. The output will be generated as an MP3 audio file available at the URL returned in the response.
|
18
|
+
class ShotstackTextToSpeechOptions
|
19
|
+
# The type of asset to generate - set to `text-to-speech` for text-to-speech.
|
20
|
+
attr_accessor :type
|
21
|
+
|
22
|
+
# The text to convert to speech.
|
23
|
+
attr_accessor :text
|
24
|
+
|
25
|
+
# The voice to use for the text-to-speech conversion. You must pair the correct voice with the correct language. For each language there is a language code that must be set in the `language` property. The voice must be available for the language code or the conversion will fail. i.e. To use the voice `Zeina` for Arabic you must set the `language` to `arb`. Select a voice from the list of available voices, the language code is in brackets: <ul> <li>Arabic - Gulf (ar-AE)</li> <ul> <li>`Hala`</li> </ul> <li>Dutch - Belgian (nl-BE)</li> <ul> <li>`Lisa`</li> </ul> <li>Catalan (ca-ES)</li> <ul> <li>`Arlet`</li> </ul> <li>Chinese - Cantonese (yue-CN)</li> <ul> <li>`Hiujin`</li> </ul> <li>Chinese - Mandarin (cmn-CN)</li> <ul> <li>`Zhiyu`</li> </ul> <li>Danish (da-DK)</li> <ul> <li>`Sofie`</li> </ul> <li>Dutch (nl-NL)</li> <ul> <li>`Laura`</li> </ul> <li>English - Australian (en-AU)</li> <ul> <li>`Olivia`</li> </ul> <li>English - British (en-GB)</li> <ul> <li>`Amy`</li> <li>`Emma`</li> <li>`Brian`</li> <li>`Arthur`</li> </ul> <li>English - Indian (en-IN)</li> <ul> <li>`Kajal`</li> </ul> <li>English - Ireland (en-IE)</li> <ul> <li>`Niamh`</li> </ul> <li>English - New Zealand (en-NZ)</li> <ul> <li>`Aria`</li> </ul> <li>English - South African (en-ZA)</li> <ul> <li>`Ayanda`</li> </ul> <li>English - US (en-US)</li> <ul> <li>`Ivy`</li> <li>`Joanna`</li> <li>`Kendra`</li> <li>`Kimberly`</li> <li>`Salli`</li> <li>`Joey`</li> <li>`Justin`</li> <li>`Kevin`</li> <li>`Matthew`</li> <li>`Ruth`</li> <li>`Stephen`</li> </ul> <li>Finnish (fi-FI)</li> <ul> <li>`Suvi`</li> </ul> <li>French (fr-FR)</li> <ul> <li>`Léa`</li> <li>`Rémi`</li> </ul> <li>French - Canadian (fr-CA)</li> <ul> <li>`Gabrielle`</li> <li>`Liam`</li> </ul> <li>German (de-DE)</li> <ul> <li>`Vicki`</li> <li>`Daniel`</li> </ul> <li>German - Austrian (de-AT)</li> <ul> <li>`Hannah`</li> </ul> <li>Hindi (hi-IN)</li> <ul> <li>`Kajal`</li> </ul> <li>Italian (it-IT)</li> <ul> <li>`Bianca`</li> <li>`Adriano`</li> </ul> <li>Japanese (ja-JP)</li> <ul> <li>`Takumi`</li> <li>`Kazuha`</li> <li>`Tomoko`</li> </ul> <li>Korean (ko-KR)</li> <ul> <li>`Seoyeon`</li> </ul> <li>Norwegian (nb-NO)</li> <ul> <li>`Ida`</li> </ul> <li>Polish (pl-PL)</li> <ul> <li>`Ola`</li> </ul> <li>Portuguese - Brazilian (pt-BR)</li> <ul> <li>`Camila`</li> <li>`Vitória` or `Vitoria`</li> <li>`Thiago`</li> </ul> <li>Portuguese - European (pt-PT)</li> <ul> <li>`Inês` or `Ines`</li> </ul> <li>Spanish (es-ES)</li> <ul> <li>`Lucia`</li> <li>`Sergio`</li> </ul> <li>Spanish - Mexican (es-MX)</li> <ul> <li>`Mia`</li> <li>`Andrés`</li> </ul> <li>Spanish - US (es-US)</li> <ul> <li>`Lupe`</li> <li>`Pedro`</li> </ul> <li>Swedish (sv-SE)</li> <ul> <li>`Elin`</li> </ul> </ul>
|
26
|
+
attr_accessor :voice
|
27
|
+
|
28
|
+
# The language code for the text-to-speech conversion. You must pair the correct language with the correct voice (see voice parameter above). Select a language from the list of available languages: <ul> <li>`cmn-CN`</li> <li>`da-DK`</li> <li>`de-DE`</li> <li>`en-AU`</li> <li>`en-GB`</li> <li>`en-IN`</li> <li>`en-US`</li> <li>`es-ES`</li> <li>`es-MX`</li> <li>`es-US`</li> <li>`fr-CA`</li> <li>`fr-FR`</li> <li>`it-IT`</li> <li>`ja-JP`</li> <li>`hi-IN`</li> <li>`ko-KR`</li> <li>`nb-NO`</li> <li>`nl-NL`</li> <li>`pl-PL`</li> <li>`pt-BR`</li> <li>`pt-PT`</li> <li>`sv-SE`</li> <li>`en-NZ`</li> <li>`en-ZA`</li> <li>`ca-ES`</li> <li>`de-AT`</li> <li>`yue-CN`</li> <li>`ar-AE`</li> <li>`fi-FI`</li> </ul>
|
29
|
+
attr_accessor :language
|
30
|
+
|
31
|
+
# Set the voice to newscaster mode.<br /><br /> *Only Matthew and Joanna for US English (en-US), Lupe for US Spanish (es-US), and Amy for British English (en-GB) are available in the newscaster voice.
|
32
|
+
attr_accessor :newscaster
|
33
|
+
|
34
|
+
class EnumAttributeValidator
|
35
|
+
attr_reader :datatype
|
36
|
+
attr_reader :allowable_values
|
37
|
+
|
38
|
+
def initialize(datatype, allowable_values)
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
40
|
+
case datatype.to_s
|
41
|
+
when /Integer/i
|
42
|
+
value.to_i
|
43
|
+
when /Float/i
|
44
|
+
value.to_f
|
45
|
+
else
|
46
|
+
value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def valid?(value)
|
52
|
+
!value || allowable_values.include?(value)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'type' => :'type',
|
60
|
+
:'text' => :'text',
|
61
|
+
:'voice' => :'voice',
|
62
|
+
:'language' => :'language',
|
63
|
+
:'newscaster' => :'newscaster'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Returns all the JSON keys this model knows about
|
68
|
+
def self.acceptable_attributes
|
69
|
+
attribute_map.values
|
70
|
+
end
|
71
|
+
|
72
|
+
# Attribute type mapping.
|
73
|
+
def self.openapi_types
|
74
|
+
{
|
75
|
+
:'type' => :'String',
|
76
|
+
:'text' => :'String',
|
77
|
+
:'voice' => :'String',
|
78
|
+
:'language' => :'String',
|
79
|
+
:'newscaster' => :'Boolean'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# List of attributes with nullable: true
|
84
|
+
def self.openapi_nullable
|
85
|
+
Set.new([
|
86
|
+
])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
if (!attributes.is_a?(Hash))
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::ShotstackTextToSpeechOptions` initialize method"
|
94
|
+
end
|
95
|
+
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
98
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::ShotstackTextToSpeechOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
+
end
|
101
|
+
h[k.to_sym] = v
|
102
|
+
}
|
103
|
+
|
104
|
+
if attributes.key?(:'type')
|
105
|
+
self.type = attributes[:'type']
|
106
|
+
else
|
107
|
+
self.type = 'text-to-speech'
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'text')
|
111
|
+
self.text = attributes[:'text']
|
112
|
+
else
|
113
|
+
self.text = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'voice')
|
117
|
+
self.voice = attributes[:'voice']
|
118
|
+
else
|
119
|
+
self.voice = nil
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'language')
|
123
|
+
self.language = attributes[:'language']
|
124
|
+
else
|
125
|
+
self.language = 'en-US'
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'newscaster')
|
129
|
+
self.newscaster = attributes[:'newscaster']
|
130
|
+
else
|
131
|
+
self.newscaster = false
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
136
|
+
# @return Array for valid properties with the reasons
|
137
|
+
def list_invalid_properties
|
138
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
139
|
+
invalid_properties = Array.new
|
140
|
+
if @type.nil?
|
141
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @text.nil?
|
145
|
+
invalid_properties.push('invalid value for "text", text cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @voice.nil?
|
149
|
+
invalid_properties.push('invalid value for "voice", voice cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
invalid_properties
|
153
|
+
end
|
154
|
+
|
155
|
+
# Check to see if the all the properties in the model are valid
|
156
|
+
# @return true if the model is valid
|
157
|
+
def valid?
|
158
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
159
|
+
return false if @type.nil?
|
160
|
+
type_validator = EnumAttributeValidator.new('String', ["text-to-speech"])
|
161
|
+
return false unless type_validator.valid?(@type)
|
162
|
+
return false if @text.nil?
|
163
|
+
return false if @voice.nil?
|
164
|
+
voice_validator = EnumAttributeValidator.new('String', ["Hala", "Lisa", "Arlet", "Hiujin", "Zhiyu", "Sofie", "Laura", "Olivia", "Amy", "Emma", "Brian", "Arthur", "Kajal", "Niamh", "Aria", "Ayanda", "Ivy", "Joanna", "Kendra", "Kimberly", "Salli", "Joey", "Justin", "Kevin", "Matthew", "Ruth", "Stephen", "Suvi", "Léa", "Rémi", "Gabrielle", "Liam", "Vicki", "Daniel", "Hannah", "Kajal", "Bianca", "Adriano", "Takumi", "Kazuha", "Tomoko", "Seoyeon", "Ida", "Ola", "Camila", "Vitória", "Vitoria", "Thiago", "Inês", "Ines", "Lucia", "Sergio", "Mia", "Andrés", "Lupe", "Pedro", "Elin"])
|
165
|
+
return false unless voice_validator.valid?(@voice)
|
166
|
+
language_validator = EnumAttributeValidator.new('String', ["cmn-CN", "da-DK", "de-DE", "en-AU", "en-GB", "en-IN", "en-US", "es-ES", "es-MX", "es-US", "fr-CA", "fr-FR", "it-IT", "ja-JP", "hi-IN", "ko-KR", "nb-NO", "nl-NL", "pl-PL", "pt-BR", "pt-PT", "sv-SE", "en-NZ", "en-ZA", "ca-ES", "de-AT", "yue-CN", "ar-AE", "fi-FI"])
|
167
|
+
return false unless language_validator.valid?(@language)
|
168
|
+
true
|
169
|
+
end
|
170
|
+
|
171
|
+
# Custom attribute writer method checking allowed values (enum).
|
172
|
+
# @param [Object] type Object to be assigned
|
173
|
+
def type=(type)
|
174
|
+
validator = EnumAttributeValidator.new('String', ["text-to-speech"])
|
175
|
+
unless validator.valid?(type)
|
176
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
177
|
+
end
|
178
|
+
@type = type
|
179
|
+
end
|
180
|
+
|
181
|
+
# Custom attribute writer method checking allowed values (enum).
|
182
|
+
# @param [Object] voice Object to be assigned
|
183
|
+
def voice=(voice)
|
184
|
+
validator = EnumAttributeValidator.new('String', ["Hala", "Lisa", "Arlet", "Hiujin", "Zhiyu", "Sofie", "Laura", "Olivia", "Amy", "Emma", "Brian", "Arthur", "Kajal", "Niamh", "Aria", "Ayanda", "Ivy", "Joanna", "Kendra", "Kimberly", "Salli", "Joey", "Justin", "Kevin", "Matthew", "Ruth", "Stephen", "Suvi", "Léa", "Rémi", "Gabrielle", "Liam", "Vicki", "Daniel", "Hannah", "Kajal", "Bianca", "Adriano", "Takumi", "Kazuha", "Tomoko", "Seoyeon", "Ida", "Ola", "Camila", "Vitória", "Vitoria", "Thiago", "Inês", "Ines", "Lucia", "Sergio", "Mia", "Andrés", "Lupe", "Pedro", "Elin"])
|
185
|
+
unless validator.valid?(voice)
|
186
|
+
fail ArgumentError, "invalid value for \"voice\", must be one of #{validator.allowable_values}."
|
187
|
+
end
|
188
|
+
@voice = voice
|
189
|
+
end
|
190
|
+
|
191
|
+
# Custom attribute writer method checking allowed values (enum).
|
192
|
+
# @param [Object] language Object to be assigned
|
193
|
+
def language=(language)
|
194
|
+
validator = EnumAttributeValidator.new('String', ["cmn-CN", "da-DK", "de-DE", "en-AU", "en-GB", "en-IN", "en-US", "es-ES", "es-MX", "es-US", "fr-CA", "fr-FR", "it-IT", "ja-JP", "hi-IN", "ko-KR", "nb-NO", "nl-NL", "pl-PL", "pt-BR", "pt-PT", "sv-SE", "en-NZ", "en-ZA", "ca-ES", "de-AT", "yue-CN", "ar-AE", "fi-FI"])
|
195
|
+
unless validator.valid?(language)
|
196
|
+
fail ArgumentError, "invalid value for \"language\", must be one of #{validator.allowable_values}."
|
197
|
+
end
|
198
|
+
@language = language
|
199
|
+
end
|
200
|
+
|
201
|
+
# Checks equality by comparing each attribute.
|
202
|
+
# @param [Object] Object to be compared
|
203
|
+
def ==(o)
|
204
|
+
return true if self.equal?(o)
|
205
|
+
self.class == o.class &&
|
206
|
+
type == o.type &&
|
207
|
+
text == o.text &&
|
208
|
+
voice == o.voice &&
|
209
|
+
language == o.language &&
|
210
|
+
newscaster == o.newscaster
|
211
|
+
end
|
212
|
+
|
213
|
+
# @see the `==` method
|
214
|
+
# @param [Object] Object to be compared
|
215
|
+
def eql?(o)
|
216
|
+
self == o
|
217
|
+
end
|
218
|
+
|
219
|
+
# Calculates hash code according to all attributes.
|
220
|
+
# @return [Integer] Hash code
|
221
|
+
def hash
|
222
|
+
[type, text, voice, language, newscaster].hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Builds the object from hash
|
226
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
227
|
+
# @return [Object] Returns the model itself
|
228
|
+
def self.build_from_hash(attributes)
|
229
|
+
return nil unless attributes.is_a?(Hash)
|
230
|
+
attributes = attributes.transform_keys(&:to_sym)
|
231
|
+
transformed_hash = {}
|
232
|
+
openapi_types.each_pair do |key, type|
|
233
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
234
|
+
transformed_hash["#{key}"] = nil
|
235
|
+
elsif type =~ /\AArray<(.*)>/i
|
236
|
+
# check to ensure the input is an array given that the attribute
|
237
|
+
# is documented as an array but the input is not
|
238
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
239
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
240
|
+
end
|
241
|
+
elsif !attributes[attribute_map[key]].nil?
|
242
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
243
|
+
end
|
244
|
+
end
|
245
|
+
new(transformed_hash)
|
246
|
+
end
|
247
|
+
|
248
|
+
# Deserializes the data based on type
|
249
|
+
# @param string type Data type
|
250
|
+
# @param string value Value to be deserialized
|
251
|
+
# @return [Object] Deserialized data
|
252
|
+
def self._deserialize(type, value)
|
253
|
+
case type.to_sym
|
254
|
+
when :Time
|
255
|
+
Time.parse(value)
|
256
|
+
when :Date
|
257
|
+
Date.parse(value)
|
258
|
+
when :String
|
259
|
+
value.to_s
|
260
|
+
when :Integer
|
261
|
+
value.to_i
|
262
|
+
when :Float
|
263
|
+
value.to_f
|
264
|
+
when :Boolean
|
265
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
266
|
+
true
|
267
|
+
else
|
268
|
+
false
|
269
|
+
end
|
270
|
+
when :Object
|
271
|
+
# generic object (usually a Hash), return directly
|
272
|
+
value
|
273
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
274
|
+
inner_type = Regexp.last_match[:inner_type]
|
275
|
+
value.map { |v| _deserialize(inner_type, v) }
|
276
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
277
|
+
k_type = Regexp.last_match[:k_type]
|
278
|
+
v_type = Regexp.last_match[:v_type]
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each do |k, v|
|
281
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
else # model
|
285
|
+
# models (e.g. Pet) or oneOf
|
286
|
+
klass = Shotstack.const_get(type)
|
287
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the string representation of the object
|
292
|
+
# @return [String] String presentation of the object
|
293
|
+
def to_s
|
294
|
+
to_hash.to_s
|
295
|
+
end
|
296
|
+
|
297
|
+
# to_body is an alias to to_hash (backward compatibility)
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
299
|
+
def to_body
|
300
|
+
to_hash
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the object in the form of hash
|
304
|
+
# @return [Hash] Returns the object in the form of hash
|
305
|
+
def to_hash
|
306
|
+
hash = {}
|
307
|
+
self.class.attribute_map.each_pair do |attr, param|
|
308
|
+
value = self.send(attr)
|
309
|
+
if value.nil?
|
310
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
311
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
312
|
+
end
|
313
|
+
|
314
|
+
hash[param] = _to_hash(value)
|
315
|
+
end
|
316
|
+
hash
|
317
|
+
end
|
318
|
+
|
319
|
+
# Outputs non-array value in the form of hash
|
320
|
+
# For object, use to_hash. Otherwise, just return the value
|
321
|
+
# @param [Object] value Any valid value
|
322
|
+
# @return [Hash] Returns the value in the form of hash
|
323
|
+
def _to_hash(value)
|
324
|
+
if value.is_a?(Array)
|
325
|
+
value.compact.map { |v| _to_hash(v) }
|
326
|
+
elsif value.is_a?(Hash)
|
327
|
+
{}.tap do |hash|
|
328
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
329
|
+
end
|
330
|
+
elsif value.respond_to? :to_hash
|
331
|
+
value.to_hash
|
332
|
+
else
|
333
|
+
value
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
|
339
|
+
end
|