Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .oas-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.4
1.16.0
127 changes: 127 additions & 0 deletions lib/shotstack/api/edit_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,69 @@ 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:** <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 [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:** &lt;a href&#x3D;\&quot;#\&quot;&gt;https://api.shotstack.io/edit/{version}&lt;/a&gt;
# @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 Render Status
# Get the rendering status, temporary asset url and details of a render by ID. **Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
# @param id [String] The id of the timeline render task in UUID format
Expand Down Expand Up @@ -284,6 +347,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:** <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 [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:** &lt;a href&#x3D;\&quot;#\&quot;&gt;https://api.shotstack.io/edit/{version}&lt;/a&gt;
# @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:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>
# @param edit [Edit] The video, image or audio edit specified using JSON.
Expand Down
2 changes: 2 additions & 0 deletions lib/shotstack/models/asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def openapi_one_of
[
:'AudioAsset',
:'CaptionAsset',
:'Html5Asset',
:'HtmlAsset',
:'ImageAsset',
:'ImageToVideoAsset',
Expand Down Expand Up @@ -49,6 +50,7 @@ def openapi_discriminator_mapping
:'audio' => :'AudioAsset',
:'caption' => :'CaptionAsset',
:'html' => :'HtmlAsset',
:'html5' => :'Html5Asset',
:'image' => :'ImageAsset',
:'image-to-video' => :'ImageToVideoAsset',
:'luma' => :'LumaAsset',
Expand Down
74 changes: 59 additions & 15 deletions lib/shotstack/models/audio_asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ul> <li>`fadeIn` - fade volume in only</li> <li>`fadeOut` - fade volume out only</li> <li>`fadeInFadeOut` - fade volume in and out</li> </ul>
Expand Down Expand Up @@ -60,6 +69,9 @@ def self.attribute_map
{
:'type' => :'type',
:'src' => :'src',
:'prompt' => :'prompt',
:'model' => :'model',
:'options' => :'options',
:'trim' => :'trim',
:'volume' => :'volume',
:'speed' => :'speed',
Expand All @@ -77,6 +89,9 @@ def self.openapi_types
{
:'type' => :'String',
:'src' => :'String',
:'prompt' => :'String',
:'model' => :'String',
:'options' => :'Hash<String, Object>',
:'trim' => :'Float',
:'volume' => :'AudioAssetVolume',
:'speed' => :'Float',
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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"])
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 &&
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion lib/shotstack/models/clip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -104,6 +108,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
:'id' => :'String',
:'asset' => :'Asset',
:'start' => :'ClipStart',
:'length' => :'ClipLength',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 &&
Expand All @@ -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
Expand Down
7 changes: 0 additions & 7 deletions lib/shotstack/models/google_drive_destination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ def initialize(attributes = {})

if attributes.key?(:'options')
self.options = attributes[:'options']
else
self.options = nil
end
end

Expand All @@ -85,10 +83,6 @@ def list_invalid_properties
invalid_properties.push('invalid value for "provider", provider cannot be nil.')
end

if @options.nil?
invalid_properties.push('invalid value for "options", options cannot be nil.')
end

invalid_properties
end

Expand All @@ -97,7 +91,6 @@ def list_invalid_properties
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
return false if @provider.nil?
return false if @options.nil?
true
end

Expand Down
Loading