diff --git a/.oas-version b/.oas-version
index 18b3114..84cc529 100644
--- a/.oas-version
+++ b/.oas-version
@@ -1 +1 @@
-1.10.4
+1.18.0
diff --git a/lib/shotstack/api/edit_api.rb b/lib/shotstack/api/edit_api.rb
index 3ff55f2..0b7f1b8 100644
--- a/lib/shotstack/api/edit_api.rb
+++ b/lib/shotstack/api/edit_api.rb
@@ -85,6 +85,196 @@ def delete_template_with_http_info(id, opts = {})
return data, status_code, headers
end
+ # Get Generation Status
+ # Get the status of an on-demand asset generation job created with the generate endpoint. Jobs are owner-scoped. **Base URL:** https://api.shotstack.io/edit/{version}
+ # @param id [String] The generation job id returned by the generate endpoint.
+ # @param [Hash] opts the optional parameters
+ # @return [Object]
+ def get_generate(id, opts = {})
+ data, _status_code, _headers = get_generate_with_http_info(id, opts)
+ data
+ end
+
+ # Get Generation Status
+ # Get the status of an on-demand asset generation job created with the generate endpoint. Jobs are owner-scoped. **Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
+ # @param id [String] The generation job id returned by the generate endpoint.
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def get_generate_with_http_info(id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EditApi.get_generate ...'
+ 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 EditApi.get_generate"
+ end
+ # resource path
+ local_var_path = '/generate/{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'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['DeveloperKey']
+
+ new_options = opts.merge(
+ :operation => :"EditApi.get_generate",
+ :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: EditApi#get_generate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Get Generation Model
+ # Get one generation model, including the JSON Schema for the options it accepts and what it costs in credits. **Base URL:** https://api.shotstack.io/edit/{version}
+ # @param id [String] The model identifier, as returned by the list endpoint.
+ # @param [Hash] opts the optional parameters
+ # @return [GetModel200Response]
+ def get_model(id, opts = {})
+ data, _status_code, _headers = get_model_with_http_info(id, opts)
+ data
+ end
+
+ # Get Generation Model
+ # Get one generation model, including the JSON Schema for the options it accepts and what it costs in credits. **Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
+ # @param id [String] The model identifier, as returned by the list endpoint.
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(GetModel200Response, Integer, Hash)>] GetModel200Response data, response status code and response headers
+ def get_model_with_http_info(id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EditApi.get_model ...'
+ 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 EditApi.get_model"
+ end
+ # resource path
+ local_var_path = '/models/{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'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'GetModel200Response'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['DeveloperKey']
+
+ new_options = opts.merge(
+ :operation => :"EditApi.get_model",
+ :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: EditApi#get_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # List Generation Models
+ # List the generation models available for `prompt`-bearing image, video and audio assets, with the options each accepts and what it costs in credits. Use this to populate a model picker and render its option fields, rather than hard coding a model list. A newly launched model appears here without any change on your side. Each entry carries the asset type it generates, so filter the list client side when a picker only needs one kind. Option schemas are omitted by default. Request them with `expand=options`. **Base URL:** https://api.shotstack.io/edit/{version}
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :expand Set to `options` to include each model's option schema in the list. Omitted by default to keep the response small.
+ # @return [GetModels200Response]
+ def get_models(opts = {})
+ data, _status_code, _headers = get_models_with_http_info(opts)
+ data
+ end
+
+ # List Generation Models
+ # List the generation models available for `prompt`-bearing image, video and audio assets, with the options each accepts and what it costs in credits. Use this to populate a model picker and render its option fields, rather than hard coding a model list. A newly launched model appears here without any change on your side. Each entry carries the asset type it generates, so filter the list client side when a picker only needs one kind. Option schemas are omitted by default. Request them with `expand=options`. **Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :expand Set to `options` to include each model's option schema in the list. Omitted by default to keep the response small.
+ # @return [Array<(GetModels200Response, Integer, Hash)>] GetModels200Response data, response status code and response headers
+ def get_models_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EditApi.get_models ...'
+ end
+ allowable_values = ["options"]
+ if @api_client.config.client_side_validation && opts[:'expand'] && !allowable_values.include?(opts[:'expand'])
+ fail ArgumentError, "invalid value for \"expand\", must be one of #{allowable_values}"
+ end
+ # resource path
+ local_var_path = '/models'
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'GetModels200Response'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['DeveloperKey']
+
+ new_options = opts.merge(
+ :operation => :"EditApi.get_models",
+ :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: EditApi#get_models\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Get Render Status
# Get the rendering status, temporary asset url and details of a render by ID. **Base URL:** https://api.shotstack.io/edit/{version}
# @param id [String] The id of the timeline render task in UUID format
@@ -284,6 +474,70 @@ def get_templates_with_http_info(opts = {})
return data, status_code, headers
end
+ # Generate Asset
+ # Generate a single image, video or audio asset from a text prompt without rendering a full edit. Submit a prompt-bearing asset; the response is immediate when an identical asset has been generated before (results are cached by prompt, model and options), otherwise the job is queued and can be polled via the status endpoint. Generation is billed in credits per asset. Identical repeat requests resolve from the cache at no charge. **Base URL:** https://api.shotstack.io/edit/{version}
+ # @param [Hash] opts the optional parameters
+ # @option opts [PostGenerateRequest] :post_generate_request A prompt-bearing image, video or audio asset to generate.
+ # @return [PostGenerate200Response]
+ def post_generate(opts = {})
+ data, _status_code, _headers = post_generate_with_http_info(opts)
+ data
+ end
+
+ # Generate Asset
+ # Generate a single image, video or audio asset from a text prompt without rendering a full edit. Submit a prompt-bearing asset; the response is immediate when an identical asset has been generated before (results are cached by prompt, model and options), otherwise the job is queued and can be polled via the status endpoint. Generation is billed in credits per asset. Identical repeat requests resolve from the cache at no charge. **Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
+ # @param [Hash] opts the optional parameters
+ # @option opts [PostGenerateRequest] :post_generate_request A prompt-bearing image, video or audio asset to generate.
+ # @return [Array<(PostGenerate200Response, Integer, Hash)>] PostGenerate200Response data, response status code and response headers
+ def post_generate_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EditApi.post_generate ...'
+ end
+ # resource path
+ local_var_path = '/generate'
+
+ # 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'])
+ # 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(opts[:'post_generate_request'])
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'PostGenerate200Response'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['DeveloperKey']
+
+ new_options = opts.merge(
+ :operation => :"EditApi.post_generate",
+ :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: EditApi#post_generate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Render Asset
# Queue and render the contents of an [Edit](#tocs_edit) as a video, image or audio file. **Rendering Process:** 1. **Validation**: The edit JSON is validated 2. **Download**: All assets are downloaded and cached 3. **Preprocessing**: Video assets are automatically processed to fix compatibility issues 4. **Rendering**: The timeline is rendered using the processed assets 5. **Output**: The final media file is generated and stored **Video Preprocessing:** Video assets undergo automatic preprocessing to ensure compatibility. You can force preprocessing by setting `\"transcode\": true` on video assets. See [Preprocessing](#preprocessing) for more details. **Base URL:** https://api.shotstack.io/edit/{version}
# @param edit [Edit] The video, image or audio edit specified using JSON.
diff --git a/lib/shotstack/models/asset.rb b/lib/shotstack/models/asset.rb
index 59182bb..550a5da 100644
--- a/lib/shotstack/models/asset.rb
+++ b/lib/shotstack/models/asset.rb
@@ -22,6 +22,7 @@ def openapi_one_of
[
:'AudioAsset',
:'CaptionAsset',
+ :'Html5Asset',
:'HtmlAsset',
:'ImageAsset',
:'ImageToVideoAsset',
@@ -49,6 +50,7 @@ def openapi_discriminator_mapping
:'audio' => :'AudioAsset',
:'caption' => :'CaptionAsset',
:'html' => :'HtmlAsset',
+ :'html5' => :'Html5Asset',
:'image' => :'ImageAsset',
:'image-to-video' => :'ImageToVideoAsset',
:'luma' => :'LumaAsset',
diff --git a/lib/shotstack/models/audio_asset.rb b/lib/shotstack/models/audio_asset.rb
index 0c805f5..4d62d12 100644
--- a/lib/shotstack/models/audio_asset.rb
+++ b/lib/shotstack/models/audio_asset.rb
@@ -14,20 +14,29 @@
require 'time'
module Shotstack
- # The AudioAsset is used to add sound effects and audio at specific intervals on the timeline. The src must be a publicly accessible URL to an audio resource such as an mp3 file.
+ # The AudioAsset adds audio to a Clip. The audio can be sourced from a URL (`src`), generated from a text prompt (`prompt`), or both. At least one of `src` or `prompt` must be provided. - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3). - **Generated speech:** set `prompt` to the spoken text and choose a text-to-speech `model`; set the voice via `options`. - **Generated music or SFX:** set `prompt` describing the sound and choose a music generation `model`. - **Both:** `src` acts as a preview placeholder while `prompt` drives generation — the audio is regenerated from the prompt at render time. Unchanged prompts and options resolve from the generation cache. - Use `model` to choose the generator and `options` to configure it. The generated `src` is filled in automatically.
class AudioAsset
# The type of asset - set to `audio` for audio assets.
attr_accessor :type
- # The audio source URL. The URL must be publicly accessible or include credentials.
+ # The audio source URL. The URL must be publicly accessible or include credentials. When `prompt` is also set, `src` serves as a preview placeholder and the audio is regenerated from the prompt at render time.
attr_accessor :src
+ # A text prompt. For text-to-speech models the prompt is the spoken text; for music models it describes the sound to generate. The generated `src` is filled in automatically; an existing `src` is treated as a preview placeholder and replaced.
+ attr_accessor :prompt
+
+ # The generation model to use when `prompt` is set (e.g. `polly-neural`, `elevenlabs-tts`, `elevenlabs-music`). Defaults to `elevenlabs-tts` (with a default voice) if omitted. Each model's available options are defined by the model registry.
+ attr_accessor :model
+
+ # Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected.
+ attr_accessor :options
+
# The start trim point of the audio clip, in seconds (defaults to 0). Audio will start from the in trim point. The audio will play until the file ends or the Clip length is reached.
attr_accessor :trim
attr_accessor :volume
- # Adjust the playback speed of the audio clip between 0 (paused) and 10 (10x normal speed), where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire audio (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire audio (i.e. original length / 2).
+ # Adjust the playback speed of the audio clip between 0 (paused) and 10 (10x normal speed), where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire audio (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire audio (i.e. original length / 2).
attr_accessor :speed
# The effect to apply to the audio asset
`fadeIn` - fade volume in only
`fadeOut` - fade volume out only
`fadeInFadeOut` - fade volume in and out
@@ -60,6 +69,9 @@ def self.attribute_map
{
:'type' => :'type',
:'src' => :'src',
+ :'prompt' => :'prompt',
+ :'model' => :'model',
+ :'options' => :'options',
:'trim' => :'trim',
:'volume' => :'volume',
:'speed' => :'speed',
@@ -77,6 +89,9 @@ def self.openapi_types
{
:'type' => :'String',
:'src' => :'String',
+ :'prompt' => :'String',
+ :'model' => :'String',
+ :'options' => :'Hash',
:'trim' => :'Float',
:'volume' => :'AudioAssetVolume',
:'speed' => :'Float',
@@ -113,8 +128,20 @@ def initialize(attributes = {})
if attributes.key?(:'src')
self.src = attributes[:'src']
- else
- self.src = nil
+ end
+
+ if attributes.key?(:'prompt')
+ self.prompt = attributes[:'prompt']
+ end
+
+ if attributes.key?(:'model')
+ self.model = attributes[:'model']
+ end
+
+ if attributes.key?(:'options')
+ if (value = attributes[:'options']).is_a?(Hash)
+ self.options = value
+ end
end
if attributes.key?(:'trim')
@@ -143,19 +170,19 @@ def list_invalid_properties
invalid_properties.push('invalid value for "type", type cannot be nil.')
end
- if @src.nil?
- invalid_properties.push('invalid value for "src", src cannot be nil.')
- end
-
- if @src.to_s.length < 1
+ if !@src.nil? && @src.to_s.length < 1
invalid_properties.push('invalid value for "src", the character length must be great than or equal to 1.')
end
pattern = Regexp.new(/\S/)
- if @src !~ pattern
+ if !@src.nil? && @src !~ pattern
invalid_properties.push("invalid value for \"src\", must conform to the pattern #{pattern}.")
end
+ if !@prompt.nil? && @prompt.to_s.length > 4000
+ invalid_properties.push('invalid value for "prompt", the character length must be smaller than or equal to 4000.')
+ end
+
if !@speed.nil? && @speed > 10
invalid_properties.push('invalid value for "speed", must be smaller than or equal to 10.')
end
@@ -174,9 +201,9 @@ def valid?
return false if @type.nil?
type_validator = EnumAttributeValidator.new('String', ["audio"])
return false unless type_validator.valid?(@type)
- return false if @src.nil?
- return false if @src.to_s.length < 1
- return false if @src !~ Regexp.new(/\S/)
+ return false if !@src.nil? && @src.to_s.length < 1
+ return false if !@src.nil? && @src !~ Regexp.new(/\S/)
+ return false if !@prompt.nil? && @prompt.to_s.length > 4000
return false if !@speed.nil? && @speed > 10
return false if !@speed.nil? && @speed < 0
effect_validator = EnumAttributeValidator.new('String', ["none", "fadeIn", "fadeOut", "fadeInFadeOut"])
@@ -213,6 +240,20 @@ def src=(src)
@src = src
end
+ # Custom attribute writer method with validation
+ # @param [Object] prompt Value to be assigned
+ def prompt=(prompt)
+ if prompt.nil?
+ fail ArgumentError, 'prompt cannot be nil'
+ end
+
+ if prompt.to_s.length > 4000
+ fail ArgumentError, 'invalid value for "prompt", the character length must be smaller than or equal to 4000.'
+ end
+
+ @prompt = prompt
+ end
+
# Custom attribute writer method with validation
# @param [Object] speed Value to be assigned
def speed=(speed)
@@ -248,6 +289,9 @@ def ==(o)
self.class == o.class &&
type == o.type &&
src == o.src &&
+ prompt == o.prompt &&
+ model == o.model &&
+ options == o.options &&
trim == o.trim &&
volume == o.volume &&
speed == o.speed &&
@@ -263,7 +307,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [type, src, trim, volume, speed, effect].hash
+ [type, src, prompt, model, options, trim, volume, speed, effect].hash
end
# Builds the object from hash
diff --git a/lib/shotstack/models/clip.rb b/lib/shotstack/models/clip.rb
index c38a91d..d6c61b6 100644
--- a/lib/shotstack/models/clip.rb
+++ b/lib/shotstack/models/clip.rb
@@ -16,6 +16,9 @@
module Shotstack
# A clip is a container for a specific type of asset, i.e. a title, image, video, audio or html. You use a Clip to define when an asset will display on the timeline, how long it will play for and transitions, filters and effects to apply to it.
class Clip
+ # Optional client-generated identifier. Used by client SDKs (e.g. the Shotstack Studio SDK) to reference a clip across edits without relying on its position in the timeline. The render API does not use this field and it does not appear in render output.
+ attr_accessor :id
+
attr_accessor :asset
attr_accessor :start
@@ -78,6 +81,7 @@ def valid?(value)
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
+ :'id' => :'id',
:'asset' => :'asset',
:'start' => :'start',
:'length' => :'length',
@@ -104,6 +108,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
+ :'id' => :'String',
:'asset' => :'Asset',
:'start' => :'ClipStart',
:'length' => :'ClipLength',
@@ -143,6 +148,10 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
+ if attributes.key?(:'id')
+ self.id = attributes[:'id']
+ end
+
if attributes.key?(:'asset')
self.asset = attributes[:'asset']
else
@@ -370,6 +379,7 @@ def _alias=(_alias)
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
+ id == o.id &&
asset == o.asset &&
start == o.start &&
length == o.length &&
@@ -396,7 +406,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [asset, start, length, fit, scale, width, height, position, offset, transition, effect, filter, opacity, transform, _alias].hash
+ [id, asset, start, length, fit, scale, width, height, position, offset, transition, effect, filter, opacity, transform, _alias].hash
end
# Builds the object from hash
diff --git a/lib/shotstack/models/get_model200_response.rb b/lib/shotstack/models/get_model200_response.rb
new file mode 100644
index 0000000..e405a3f
--- /dev/null
+++ b/lib/shotstack/models/get_model200_response.rb
@@ -0,0 +1,295 @@
+=begin
+#Shotstack
+
+# Official Ruby SDK for the Shotstack Cloud Video Editing API
+
+The version of the OpenAPI document: v1
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.4.0
+
+=end
+
+require 'date'
+require 'time'
+
+module Shotstack
+ # A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts and what it costs. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
+ class GetModel200Response
+ # The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.
+ attr_accessor :model
+
+ # The asset type this model generates.
+ attr_accessor :type
+
+ attr_accessor :pricing
+
+ # JSON Schema for the model's `options` object. Only returned for a single model, or for a list requested with `expand=options`. Values outside this schema are rejected.
+ attr_accessor :options
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'model' => :'model',
+ :'type' => :'type',
+ :'pricing' => :'pricing',
+ :'options' => :'options'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'model' => :'String',
+ :'type' => :'String',
+ :'pricing' => :'GetModel200ResponsePricing',
+ :'options' => :'Hash'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::GetModel200Response` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::GetModel200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'model')
+ self.model = attributes[:'model']
+ else
+ self.model = nil
+ end
+
+ if attributes.key?(:'type')
+ self.type = attributes[:'type']
+ else
+ self.type = nil
+ end
+
+ if attributes.key?(:'pricing')
+ self.pricing = attributes[:'pricing']
+ end
+
+ if attributes.key?(:'options')
+ if (value = attributes[:'options']).is_a?(Hash)
+ self.options = value
+ end
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
+ invalid_properties = Array.new
+ if @model.nil?
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
+ end
+
+ if @type.nil?
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
+ end
+
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if @model.nil?
+ return false if @type.nil?
+ type_validator = EnumAttributeValidator.new('String', ["image", "video", "audio"])
+ return false unless type_validator.valid?(@type)
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] type Object to be assigned
+ def type=(type)
+ validator = EnumAttributeValidator.new('String', ["image", "video", "audio"])
+ unless validator.valid?(type)
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
+ end
+ @type = type
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ model == o.model &&
+ type == o.type &&
+ pricing == o.pricing &&
+ options == o.options
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [model, type, pricing, options].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ transformed_hash = {}
+ openapi_types.each_pair do |key, type|
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = nil
+ elsif type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[attribute_map[key]].is_a?(Array)
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
+ end
+ elsif !attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
+ end
+ end
+ new(transformed_hash)
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def self._deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = Shotstack.const_get(type)
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/lib/shotstack/models/get_model200_response_pricing.rb b/lib/shotstack/models/get_model200_response_pricing.rb
new file mode 100644
index 0000000..c45ca73
--- /dev/null
+++ b/lib/shotstack/models/get_model200_response_pricing.rb
@@ -0,0 +1,312 @@
+=begin
+#Shotstack
+
+# Official Ruby SDK for the Shotstack Cloud Video Editing API
+
+The version of the OpenAPI document: v1
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.4.0
+
+=end
+
+require 'date'
+require 'time'
+
+module Shotstack
+ # What one generation with this model costs.
+ class GetModel200ResponsePricing
+ # What one unit is. `render` means the whole generation counts as one unit, whatever its size.
+ attr_accessor :unit
+
+ attr_accessor :credits
+
+ # The options whose values select the rate, outermost first. Absent when `credits` is a single number.
+ attr_accessor :tiered_by
+
+ # The fewest units a generation is charged for, when a model has a minimum charge.
+ attr_accessor :min_units
+
+ # The date this rate took effect, or `legacy` for a rate that predates dated pricing.
+ attr_accessor :effective_from
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'unit' => :'unit',
+ :'credits' => :'credits',
+ :'tiered_by' => :'tieredBy',
+ :'min_units' => :'minUnits',
+ :'effective_from' => :'effectiveFrom'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'unit' => :'String',
+ :'credits' => :'GetModel200ResponsePricingCredits',
+ :'tiered_by' => :'Array',
+ :'min_units' => :'Float',
+ :'effective_from' => :'String'
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([
+ ])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ if (!attributes.is_a?(Hash))
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::GetModel200ResponsePricing` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::GetModel200ResponsePricing`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+ h[k.to_sym] = v
+ }
+
+ if attributes.key?(:'unit')
+ self.unit = attributes[:'unit']
+ else
+ self.unit = nil
+ end
+
+ if attributes.key?(:'credits')
+ self.credits = attributes[:'credits']
+ else
+ self.credits = nil
+ end
+
+ if attributes.key?(:'tiered_by')
+ if (value = attributes[:'tiered_by']).is_a?(Array)
+ self.tiered_by = value
+ end
+ end
+
+ if attributes.key?(:'min_units')
+ self.min_units = attributes[:'min_units']
+ end
+
+ if attributes.key?(:'effective_from')
+ self.effective_from = attributes[:'effective_from']
+ else
+ self.effective_from = nil
+ end
+ end
+
+ # Show invalid properties with the reasons. Usually used together with valid?
+ # @return Array for valid properties with the reasons
+ def list_invalid_properties
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
+ invalid_properties = Array.new
+ if @unit.nil?
+ invalid_properties.push('invalid value for "unit", unit cannot be nil.')
+ end
+
+ if @credits.nil?
+ invalid_properties.push('invalid value for "credits", credits cannot be nil.')
+ end
+
+ if @effective_from.nil?
+ invalid_properties.push('invalid value for "effective_from", effective_from cannot be nil.')
+ end
+
+ invalid_properties
+ end
+
+ # Check to see if the all the properties in the model are valid
+ # @return true if the model is valid
+ def valid?
+ warn '[DEPRECATED] the `valid?` method is obsolete'
+ return false if @unit.nil?
+ unit_validator = EnumAttributeValidator.new('String', ["render", "second", "minute", "thousandCharacters"])
+ return false unless unit_validator.valid?(@unit)
+ return false if @credits.nil?
+ return false if @effective_from.nil?
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] unit Object to be assigned
+ def unit=(unit)
+ validator = EnumAttributeValidator.new('String', ["render", "second", "minute", "thousandCharacters"])
+ unless validator.valid?(unit)
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}."
+ end
+ @unit = unit
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(o)
+ return true if self.equal?(o)
+ self.class == o.class &&
+ unit == o.unit &&
+ credits == o.credits &&
+ tiered_by == o.tiered_by &&
+ min_units == o.min_units &&
+ effective_from == o.effective_from
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(o)
+ self == o
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [unit, credits, tiered_by, min_units, effective_from].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ transformed_hash = {}
+ openapi_types.each_pair do |key, type|
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = nil
+ elsif type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[attribute_map[key]].is_a?(Array)
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
+ end
+ elsif !attributes[attribute_map[key]].nil?
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
+ end
+ end
+ new(transformed_hash)
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def self._deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = Shotstack.const_get(type)
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = self.send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/lib/shotstack/models/get_model200_response_pricing_credits.rb b/lib/shotstack/models/get_model200_response_pricing_credits.rb
new file mode 100644
index 0000000..7bafbfe
--- /dev/null
+++ b/lib/shotstack/models/get_model200_response_pricing_credits.rb
@@ -0,0 +1,106 @@
+=begin
+#Shotstack
+
+# Official Ruby SDK for the Shotstack Cloud Video Editing API
+
+The version of the OpenAPI document: v1
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.4.0
+
+=end
+
+require 'date'
+require 'time'
+
+module Shotstack
+ # Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.
+ module GetModel200ResponsePricingCredits
+ class << self
+ # List of class defined in oneOf (OpenAPI v3)
+ def openapi_one_of
+ [
+ :'Float',
+ :'Hash'
+ ]
+ end
+
+ # Builds the object
+ # @param [Mixed] Data to be matched against the list of oneOf items
+ # @return [Object] Returns the model or the data itself
+ def build(data)
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
+ # Note:
+ # - We do not attempt to check whether exactly one item matches.
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
+ # - TODO: scalar values are de facto behaving as if they were nullable.
+ # - TODO: logging when debugging is set.
+ openapi_one_of.each do |klass|
+ begin
+ next if klass == :AnyType # "nullable: true"
+ typed_data = find_and_cast_into_type(klass, data)
+ return typed_data if typed_data
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
+ end
+ end
+
+ openapi_one_of.include?(:AnyType) ? data : nil
+ end
+
+ private
+
+ SchemaMismatchError = Class.new(StandardError)
+
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
+ def find_and_cast_into_type(klass, data)
+ return if data.nil?
+
+ case klass.to_s
+ when 'Boolean'
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
+ when 'Float'
+ return data if data.instance_of?(Float)
+ when 'Integer'
+ return data if data.instance_of?(Integer)
+ when 'Time'
+ return Time.parse(data)
+ when 'Date'
+ return Date.parse(data)
+ when 'String'
+ return data if data.instance_of?(String)
+ when 'Object' # "type: object"
+ return data if data.instance_of?(Hash)
+ when /\AArray<(?.+)>\z/ # "type: array"
+ if data.instance_of?(Array)
+ sub_type = Regexp.last_match[:sub_type]
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
+ end
+ when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }"
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
+ sub_type = Regexp.last_match[:sub_type]
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
+ end
+ else # model
+ const = Shotstack.const_get(klass)
+ if const
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
+ model = const.build(data)
+ return model if model
+ else
+ # raise if data contains keys that are not known to the model
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
+ model = const.build_from_hash(data)
+ return model if model
+ end
+ end
+ end
+
+ raise # if no match by now, raise
+ rescue
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
+ end
+ end
+ end
+
+end
diff --git a/lib/shotstack/models/get_models200_response.rb b/lib/shotstack/models/get_models200_response.rb
new file mode 100644
index 0000000..7c87445
--- /dev/null
+++ b/lib/shotstack/models/get_models200_response.rb
@@ -0,0 +1,225 @@
+=begin
+#Shotstack
+
+# Official Ruby SDK for the Shotstack Cloud Video Editing API
+
+The version of the OpenAPI document: v1
+
+Generated by: https://openapi-generator.tech
+Generator version: 7.4.0
+
+=end
+
+require 'date'
+require 'time'
+
+module Shotstack
+ # The generation models available to this account.
+ class GetModels200Response
+ # The available models.
+ attr_accessor :models
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'models' => :'models'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'models' => :'Array