|
| 1 | +=begin |
| 2 | +#Shotstack |
| 3 | +
|
| 4 | +# Official Ruby SDK for the Shotstack Cloud Video Editing API |
| 5 | +
|
| 6 | +The version of the OpenAPI document: v1 |
| 7 | +
|
| 8 | +Generated by: https://openapi-generator.tech |
| 9 | +Generator version: 7.4.0 |
| 10 | +
|
| 11 | +=end |
| 12 | + |
| 13 | +require 'cgi' |
| 14 | + |
| 15 | +module Shotstack |
| 16 | + class CreateApi |
| 17 | + attr_accessor :api_client |
| 18 | + |
| 19 | + def initialize(api_client = ApiClient.default) |
| 20 | + @api_client = api_client |
| 21 | + end |
| 22 | + # Get Generated Asset |
| 23 | + # Get the generated assets status, url and details by ID. **Base URL:** <a href=\"#\">https://api.shotstack.io/create/{version}</a> |
| 24 | + # @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format. |
| 25 | + # @param [Hash] opts the optional parameters |
| 26 | + # @return [GeneratedAssetResponse] |
| 27 | + def get_generated_asset(id, opts = {}) |
| 28 | + data, _status_code, _headers = get_generated_asset_with_http_info(id, opts) |
| 29 | + data |
| 30 | + end |
| 31 | + |
| 32 | + # Get Generated Asset |
| 33 | + # Get the generated assets status, url and details by ID. **Base URL:** <a href=\"#\">https://api.shotstack.io/create/{version}</a> |
| 34 | + # @param id [String] The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format. |
| 35 | + # @param [Hash] opts the optional parameters |
| 36 | + # @return [Array<(GeneratedAssetResponse, Integer, Hash)>] GeneratedAssetResponse data, response status code and response headers |
| 37 | + def get_generated_asset_with_http_info(id, opts = {}) |
| 38 | + if @api_client.config.debugging |
| 39 | + @api_client.config.logger.debug 'Calling API: CreateApi.get_generated_asset ...' |
| 40 | + end |
| 41 | + # verify the required parameter 'id' is set |
| 42 | + if @api_client.config.client_side_validation && id.nil? |
| 43 | + fail ArgumentError, "Missing the required parameter 'id' when calling CreateApi.get_generated_asset" |
| 44 | + end |
| 45 | + pattern = Regexp.new(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/) |
| 46 | + if @api_client.config.client_side_validation && id !~ pattern |
| 47 | + fail ArgumentError, "invalid value for 'id' when calling CreateApi.get_generated_asset, must conform to the pattern #{pattern}." |
| 48 | + end |
| 49 | + |
| 50 | + # resource path |
| 51 | + local_var_path = '/assets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) |
| 52 | + |
| 53 | + # query parameters |
| 54 | + query_params = opts[:query_params] || {} |
| 55 | + |
| 56 | + # header parameters |
| 57 | + header_params = opts[:header_params] || {} |
| 58 | + # HTTP header 'Accept' (if needed) |
| 59 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 60 | + |
| 61 | + # form parameters |
| 62 | + form_params = opts[:form_params] || {} |
| 63 | + |
| 64 | + # http body (model) |
| 65 | + post_body = opts[:debug_body] |
| 66 | + |
| 67 | + # return_type |
| 68 | + return_type = opts[:debug_return_type] || 'GeneratedAssetResponse' |
| 69 | + |
| 70 | + # auth_names |
| 71 | + auth_names = opts[:debug_auth_names] || ['DeveloperKey'] |
| 72 | + |
| 73 | + new_options = opts.merge( |
| 74 | + :operation => :"CreateApi.get_generated_asset", |
| 75 | + :header_params => header_params, |
| 76 | + :query_params => query_params, |
| 77 | + :form_params => form_params, |
| 78 | + :body => post_body, |
| 79 | + :auth_names => auth_names, |
| 80 | + :return_type => return_type |
| 81 | + ) |
| 82 | + |
| 83 | + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) |
| 84 | + if @api_client.config.debugging |
| 85 | + @api_client.config.logger.debug "API called: CreateApi#get_generated_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 86 | + end |
| 87 | + return data, status_code, headers |
| 88 | + end |
| 89 | + |
| 90 | + # Generate Asset |
| 91 | + # Generate an asset using a Shotstack or third party provider. Chose the provider, type of asset and provide prompts, inputs and options to generate the asset. Once generated the asset can be used with the [Edit](#tocs_edit) API or downloaded. **Base URL:** <a href=\"#\">https://api.shotstack.io/create/{version}</a> |
| 92 | + # @param generated_asset [GeneratedAsset] Generate an asset using the specified provider, type and options. |
| 93 | + # @param [Hash] opts the optional parameters |
| 94 | + # @return [GeneratedAssetResponse] |
| 95 | + def post_generate_asset(generated_asset, opts = {}) |
| 96 | + data, _status_code, _headers = post_generate_asset_with_http_info(generated_asset, opts) |
| 97 | + data |
| 98 | + end |
| 99 | + |
| 100 | + # Generate Asset |
| 101 | + # Generate an asset using a Shotstack or third party provider. Chose the provider, type of asset and provide prompts, inputs and options to generate the asset. Once generated the asset can be used with the [Edit](#tocs_edit) API or downloaded. **Base URL:** <a href=\"#\">https://api.shotstack.io/create/{version}</a> |
| 102 | + # @param generated_asset [GeneratedAsset] Generate an asset using the specified provider, type and options. |
| 103 | + # @param [Hash] opts the optional parameters |
| 104 | + # @return [Array<(GeneratedAssetResponse, Integer, Hash)>] GeneratedAssetResponse data, response status code and response headers |
| 105 | + def post_generate_asset_with_http_info(generated_asset, opts = {}) |
| 106 | + if @api_client.config.debugging |
| 107 | + @api_client.config.logger.debug 'Calling API: CreateApi.post_generate_asset ...' |
| 108 | + end |
| 109 | + # verify the required parameter 'generated_asset' is set |
| 110 | + if @api_client.config.client_side_validation && generated_asset.nil? |
| 111 | + fail ArgumentError, "Missing the required parameter 'generated_asset' when calling CreateApi.post_generate_asset" |
| 112 | + end |
| 113 | + # resource path |
| 114 | + local_var_path = '/assets' |
| 115 | + |
| 116 | + # query parameters |
| 117 | + query_params = opts[:query_params] || {} |
| 118 | + |
| 119 | + # header parameters |
| 120 | + header_params = opts[:header_params] || {} |
| 121 | + # HTTP header 'Accept' (if needed) |
| 122 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 123 | + # HTTP header 'Content-Type' |
| 124 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 125 | + if !content_type.nil? |
| 126 | + header_params['Content-Type'] = content_type |
| 127 | + end |
| 128 | + |
| 129 | + # form parameters |
| 130 | + form_params = opts[:form_params] || {} |
| 131 | + |
| 132 | + # http body (model) |
| 133 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(generated_asset) |
| 134 | + |
| 135 | + # return_type |
| 136 | + return_type = opts[:debug_return_type] || 'GeneratedAssetResponse' |
| 137 | + |
| 138 | + # auth_names |
| 139 | + auth_names = opts[:debug_auth_names] || ['DeveloperKey'] |
| 140 | + |
| 141 | + new_options = opts.merge( |
| 142 | + :operation => :"CreateApi.post_generate_asset", |
| 143 | + :header_params => header_params, |
| 144 | + :query_params => query_params, |
| 145 | + :form_params => form_params, |
| 146 | + :body => post_body, |
| 147 | + :auth_names => auth_names, |
| 148 | + :return_type => return_type |
| 149 | + ) |
| 150 | + |
| 151 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 152 | + if @api_client.config.debugging |
| 153 | + @api_client.config.logger.debug "API called: CreateApi#post_generate_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 154 | + end |
| 155 | + return data, status_code, headers |
| 156 | + end |
| 157 | + end |
| 158 | +end |
0 commit comments