hermoso 0.1.4
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +53 -0
- data/lib/hermoso/api/account_api.rb +156 -0
- data/lib/hermoso/api/analytics_api.rb +400 -0
- data/lib/hermoso/api/brands_api.rb +82 -0
- data/lib/hermoso/api/campaign_profit_api.rb +103 -0
- data/lib/hermoso/api/campaign_results_api.rb +289 -0
- data/lib/hermoso/api/channels_api.rb +82 -0
- data/lib/hermoso/api/clones_api.rb +93 -0
- data/lib/hermoso/api/connect_links_api.rb +228 -0
- data/lib/hermoso/api/connect_redirects_api.rb +153 -0
- data/lib/hermoso/api/connections_api.rb +151 -0
- data/lib/hermoso/api/credits_api.rb +85 -0
- data/lib/hermoso/api/edits_api.rb +102 -0
- data/lib/hermoso/api/events_api.rb +932 -0
- data/lib/hermoso/api/generations_api.rb +173 -0
- data/lib/hermoso/api/jobs_api.rb +226 -0
- data/lib/hermoso/api/library_api.rb +88 -0
- data/lib/hermoso/api/media_api.rb +158 -0
- data/lib/hermoso/api/models_api.rb +88 -0
- data/lib/hermoso/api/posts_api.rb +377 -0
- data/lib/hermoso/api/recasts_api.rb +102 -0
- data/lib/hermoso/api/signup_api.rb +164 -0
- data/lib/hermoso/api/tag_api.rb +570 -0
- data/lib/hermoso/api/tools_api.rb +252 -0
- data/lib/hermoso/api_client.rb +441 -0
- data/lib/hermoso/api_error.rb +58 -0
- data/lib/hermoso/api_model_base.rb +92 -0
- data/lib/hermoso/configuration.rb +400 -0
- data/lib/hermoso/helpers.rb +116 -0
- data/lib/hermoso/models/asset.rb +241 -0
- data/lib/hermoso/models/asset_list.rb +203 -0
- data/lib/hermoso/models/best_time.rb +250 -0
- data/lib/hermoso/models/best_time_slots_inner.rb +205 -0
- data/lib/hermoso/models/brand.rb +273 -0
- data/lib/hermoso/models/brand_list.rb +203 -0
- data/lib/hermoso/models/campaign_profit.rb +261 -0
- data/lib/hermoso/models/campaign_results.rb +250 -0
- data/lib/hermoso/models/campaign_results_upload.rb +171 -0
- data/lib/hermoso/models/campaign_results_upload_rows_inner.rb +259 -0
- data/lib/hermoso/models/channel.rb +326 -0
- data/lib/hermoso/models/channel_carousel.rb +188 -0
- data/lib/hermoso/models/channel_list.rb +203 -0
- data/lib/hermoso/models/clone_quote.rb +243 -0
- data/lib/hermoso/models/clone_quote_request.rb +227 -0
- data/lib/hermoso/models/clone_quote_step.rb +201 -0
- data/lib/hermoso/models/connect_link.rb +321 -0
- data/lib/hermoso/models/connect_link_account.rb +178 -0
- data/lib/hermoso/models/connect_link_create.rb +236 -0
- data/lib/hermoso/models/connect_link_error.rb +169 -0
- data/lib/hermoso/models/connect_redirects.rb +203 -0
- data/lib/hermoso/models/connect_redirects_set.rb +180 -0
- data/lib/hermoso/models/connection.rb +250 -0
- data/lib/hermoso/models/connection_accounts_inner.rb +178 -0
- data/lib/hermoso/models/connection_deleted.rb +228 -0
- data/lib/hermoso/models/connection_list.rb +203 -0
- data/lib/hermoso/models/contact_email.rb +189 -0
- data/lib/hermoso/models/contact_email_resend.rb +161 -0
- data/lib/hermoso/models/content_decay.rb +223 -0
- data/lib/hermoso/models/content_decay_buckets_inner.rb +187 -0
- data/lib/hermoso/models/conversion_destination_create.rb +317 -0
- data/lib/hermoso/models/conversion_destination_list.rb +223 -0
- data/lib/hermoso/models/conversion_destination_result.rb +221 -0
- data/lib/hermoso/models/conversion_event_list.rb +230 -0
- data/lib/hermoso/models/conversion_event_update.rb +195 -0
- data/lib/hermoso/models/conversion_events_send.rb +236 -0
- data/lib/hermoso/models/conversion_events_send_events_inner.rb +314 -0
- data/lib/hermoso/models/conversion_insights.rb +265 -0
- data/lib/hermoso/models/conversion_send_result.rb +257 -0
- data/lib/hermoso/models/conversion_send_result_destinations_inner.rb +286 -0
- data/lib/hermoso/models/credits.rb +240 -0
- data/lib/hermoso/models/credits_limits.rb +234 -0
- data/lib/hermoso/models/credits_limits_brands_inner.rb +218 -0
- data/lib/hermoso/models/credits_limits_brands_inner_members_inner.rb +196 -0
- data/lib/hermoso/models/deleted.rb +210 -0
- data/lib/hermoso/models/edit.rb +278 -0
- data/lib/hermoso/models/edit_create.rb +317 -0
- data/lib/hermoso/models/edit_preview.rb +199 -0
- data/lib/hermoso/models/edit_quote.rb +231 -0
- data/lib/hermoso/models/error.rb +198 -0
- data/lib/hermoso/models/error_error.rb +335 -0
- data/lib/hermoso/models/error_error_unknown_arguments_inner.rb +171 -0
- data/lib/hermoso/models/follower_history.rb +239 -0
- data/lib/hermoso/models/follower_history_accounts_inner.rb +207 -0
- data/lib/hermoso/models/follower_history_accounts_inner_points_inner.rb +178 -0
- data/lib/hermoso/models/follower_history_date_range.rb +169 -0
- data/lib/hermoso/models/generation_create.rb +435 -0
- data/lib/hermoso/models/generation_quote.rb +263 -0
- data/lib/hermoso/models/hermoso_tag.rb +230 -0
- data/lib/hermoso/models/hermoso_tag_audience_action.rb +325 -0
- data/lib/hermoso/models/hermoso_tag_audiences.rb +241 -0
- data/lib/hermoso/models/hermoso_tag_events.rb +223 -0
- data/lib/hermoso/models/hermoso_tag_events_send.rb +179 -0
- data/lib/hermoso/models/hermoso_tag_events_sent.rb +221 -0
- data/lib/hermoso/models/hermoso_tag_install.rb +246 -0
- data/lib/hermoso/models/hermoso_tag_install_result.rb +255 -0
- data/lib/hermoso/models/hermoso_tag_report.rb +261 -0
- data/lib/hermoso/models/hermoso_tag_tag.rb +211 -0
- data/lib/hermoso/models/hermoso_tag_update.rb +356 -0
- data/lib/hermoso/models/inbox_stats.rb +315 -0
- data/lib/hermoso/models/job.rb +359 -0
- data/lib/hermoso/models/job_cancel.rb +221 -0
- data/lib/hermoso/models/job_list.rb +232 -0
- data/lib/hermoso/models/media.rb +230 -0
- data/lib/hermoso/models/model.rb +327 -0
- data/lib/hermoso/models/model_list.rb +203 -0
- data/lib/hermoso/models/post.rb +382 -0
- data/lib/hermoso/models/post_create.rb +318 -0
- data/lib/hermoso/models/post_create_media_inner.rb +104 -0
- data/lib/hermoso/models/post_create_media_inner_one_of.rb +201 -0
- data/lib/hermoso/models/post_list.rb +221 -0
- data/lib/hermoso/models/post_media_inner.rb +169 -0
- data/lib/hermoso/models/post_results_inner.rb +205 -0
- data/lib/hermoso/models/post_results_inner_first_comment.rb +188 -0
- data/lib/hermoso/models/posting_frequency.rb +241 -0
- data/lib/hermoso/models/posting_frequency_frequency_inner.rb +205 -0
- data/lib/hermoso/models/profit_settings.rb +230 -0
- data/lib/hermoso/models/recast.rb +308 -0
- data/lib/hermoso/models/recast_create.rb +274 -0
- data/lib/hermoso/models/recast_person.rb +182 -0
- data/lib/hermoso/models/recast_quote.rb +232 -0
- data/lib/hermoso/models/recast_step.rb +201 -0
- data/lib/hermoso/models/recast_subject.rb +170 -0
- data/lib/hermoso/models/recast_voice.rb +178 -0
- data/lib/hermoso/models/recast_window.rb +179 -0
- data/lib/hermoso/models/signup.rb +329 -0
- data/lib/hermoso/models/signup_claim.rb +178 -0
- data/lib/hermoso/models/signup_create.rb +247 -0
- data/lib/hermoso/models/tool.rb +360 -0
- data/lib/hermoso/models/tool_invoke.rb +169 -0
- data/lib/hermoso/models/tool_job.rb +262 -0
- data/lib/hermoso/models/tool_list.rb +273 -0
- data/lib/hermoso/models/tool_list_areas_inner.rb +219 -0
- data/lib/hermoso/models/tool_list_search.rb +181 -0
- data/lib/hermoso/models/tool_result.rb +245 -0
- data/lib/hermoso/models/tool_result_images_inner.rb +170 -0
- data/lib/hermoso/models/warning.rb +244 -0
- data/lib/hermoso/spec.rb +8 -0
- data/lib/hermoso/version.rb +15 -0
- data/lib/hermoso.rb +174 -0
- metadata +237 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Hermoso API
|
|
3
|
+
|
|
4
|
+
#The Hermoso public API. Guide: https://hermoso.ai/docs/api/ · OpenAPI: https://app.hermoso.ai/openapi.json
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026-08-26
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.27.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Hermoso
|
|
16
|
+
class GenerationsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Generate an image or video
|
|
23
|
+
# Queue one image or one video render for this profile and answer 202 with the job. Poll `GET /v1/jobs/{id}` until `status` is `done` (its `url` is the file) or `error`. Billed exactly as the same render is anywhere in Hermoso: the credits are reserved when it starts and settle to the measured cost. A refusal (not enough credits, a prompt the model will not render) is an error in the standard envelope, with the server’s own sentence in `message`. Send an `Idempotency-Key` and a retry never starts a second render.
|
|
24
|
+
# @param generation_create [GenerationCreate]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :callback_url The same as the `X-Hermoso-Callback-Url` header, for a client that cannot set headers. Prefer the header: a callback URL is a secret, and query strings are logged.
|
|
27
|
+
# @option opts [String] :x_hermoso_callback_url An https:// URL to POST the outcome to, for a platform that cannot poll (for example Zapier `z.generateCallbackUrl()`). When the call queued a job, Hermoso POSTs the job resource — exactly what `GET /v1/jobs/{id}` answers — once the job is `done` or `error`, with headers `Hermoso-Event: job.done | job.error` and `Hermoso-Delivery` (also sent as `Idempotency-Key`; drop a repeat). A 2xx ends delivery; a 4xx other than 408, 425 and 429 is final; anything else is retried for about 16 hours. When the call finished inside the request, its response body is POSTed too (`Hermoso-Event: tool.result`). The response header `Hermoso-Callback` says what happened: `registered`, `sent`, `limit-reached` or `not-registered`. Nothing about what runs or what it costs changes: the URL is attached after the job is queued. A refusal is the HTTP error and nothing is POSTed. Must be https on a public host name; a replay with the same `Idempotency-Key` and a new URL adds that URL to the same job.
|
|
28
|
+
# @option opts [String] :idempotency_key Send a unique value to make this call safe to retry. A replay returns the original response with `Idempotency-Replayed: true`, for 24 hours — except a call that queued a job, whose replay is that job as it is now (what `GET /v1/jobs/{id}` answers), so a finished render replays as done with its file.
|
|
29
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
30
|
+
# @return [Job]
|
|
31
|
+
def create_generation(generation_create, opts = {})
|
|
32
|
+
data, _status_code, _headers = create_generation_with_http_info(generation_create, opts)
|
|
33
|
+
data
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Generate an image or video
|
|
37
|
+
# Queue one image or one video render for this profile and answer 202 with the job. Poll `GET /v1/jobs/{id}` until `status` is `done` (its `url` is the file) or `error`. Billed exactly as the same render is anywhere in Hermoso: the credits are reserved when it starts and settle to the measured cost. A refusal (not enough credits, a prompt the model will not render) is an error in the standard envelope, with the server’s own sentence in `message`. Send an `Idempotency-Key` and a retry never starts a second render.
|
|
38
|
+
# @param generation_create [GenerationCreate]
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @option opts [String] :callback_url The same as the `X-Hermoso-Callback-Url` header, for a client that cannot set headers. Prefer the header: a callback URL is a secret, and query strings are logged.
|
|
41
|
+
# @option opts [String] :x_hermoso_callback_url An https:// URL to POST the outcome to, for a platform that cannot poll (for example Zapier `z.generateCallbackUrl()`). When the call queued a job, Hermoso POSTs the job resource — exactly what `GET /v1/jobs/{id}` answers — once the job is `done` or `error`, with headers `Hermoso-Event: job.done | job.error` and `Hermoso-Delivery` (also sent as `Idempotency-Key`; drop a repeat). A 2xx ends delivery; a 4xx other than 408, 425 and 429 is final; anything else is retried for about 16 hours. When the call finished inside the request, its response body is POSTed too (`Hermoso-Event: tool.result`). The response header `Hermoso-Callback` says what happened: `registered`, `sent`, `limit-reached` or `not-registered`. Nothing about what runs or what it costs changes: the URL is attached after the job is queued. A refusal is the HTTP error and nothing is POSTed. Must be https on a public host name; a replay with the same `Idempotency-Key` and a new URL adds that URL to the same job.
|
|
42
|
+
# @option opts [String] :idempotency_key Send a unique value to make this call safe to retry. A replay returns the original response with `Idempotency-Replayed: true`, for 24 hours — except a call that queued a job, whose replay is that job as it is now (what `GET /v1/jobs/{id}` answers), so a finished render replays as done with its file.
|
|
43
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
44
|
+
# @return [Array<(Job, Integer, Hash)>] Job data, response status code and response headers
|
|
45
|
+
def create_generation_with_http_info(generation_create, opts = {})
|
|
46
|
+
if @api_client.config.debugging
|
|
47
|
+
@api_client.config.logger.debug 'Calling API: GenerationsApi.create_generation ...'
|
|
48
|
+
end
|
|
49
|
+
# verify the required parameter 'generation_create' is set
|
|
50
|
+
if @api_client.config.client_side_validation && generation_create.nil?
|
|
51
|
+
fail ArgumentError, "Missing the required parameter 'generation_create' when calling GenerationsApi.create_generation"
|
|
52
|
+
end
|
|
53
|
+
# resource path
|
|
54
|
+
local_var_path = '/v1/generations'
|
|
55
|
+
|
|
56
|
+
# query parameters
|
|
57
|
+
query_params = opts[:query_params] || {}
|
|
58
|
+
query_params[:'callback_url'] = opts[:'callback_url'] if !opts[:'callback_url'].nil?
|
|
59
|
+
|
|
60
|
+
# header parameters
|
|
61
|
+
header_params = opts[:header_params] || {}
|
|
62
|
+
# HTTP header 'Accept' (if needed)
|
|
63
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
64
|
+
# HTTP header 'Content-Type'
|
|
65
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
66
|
+
if !content_type.nil?
|
|
67
|
+
header_params['Content-Type'] = content_type
|
|
68
|
+
end
|
|
69
|
+
header_params[:'X-Hermoso-Callback-Url'] = opts[:'x_hermoso_callback_url'] if !opts[:'x_hermoso_callback_url'].nil?
|
|
70
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
71
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
72
|
+
|
|
73
|
+
# form parameters
|
|
74
|
+
form_params = opts[:form_params] || {}
|
|
75
|
+
|
|
76
|
+
# http body (model)
|
|
77
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(generation_create)
|
|
78
|
+
|
|
79
|
+
# return_type
|
|
80
|
+
return_type = opts[:debug_return_type] || 'Job'
|
|
81
|
+
|
|
82
|
+
# auth_names
|
|
83
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
84
|
+
|
|
85
|
+
new_options = opts.merge(
|
|
86
|
+
:operation => :"GenerationsApi.create_generation",
|
|
87
|
+
:header_params => header_params,
|
|
88
|
+
:query_params => query_params,
|
|
89
|
+
:form_params => form_params,
|
|
90
|
+
:body => post_body,
|
|
91
|
+
:auth_names => auth_names,
|
|
92
|
+
:return_type => return_type
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
96
|
+
if @api_client.config.debugging
|
|
97
|
+
@api_client.config.logger.debug "API called: GenerationsApi#create_generation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
98
|
+
end
|
|
99
|
+
return data, status_code, headers
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Price a generation before running it
|
|
103
|
+
# The estimated credits a generation with this body would reserve, from the render’s own pricing, with the brand’s product photos attached exactly as the real run attaches them. Free: nothing is queued, reserved or charged. It is an estimate: the render is charged its actual cost when it finishes, usually within a few percent of this figure. `credits: null` with `refused` means the render would not start, and says why.
|
|
104
|
+
# @param generation_create [GenerationCreate]
|
|
105
|
+
# @param [Hash] opts the optional parameters
|
|
106
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
107
|
+
# @return [GenerationQuote]
|
|
108
|
+
def quote_generation(generation_create, opts = {})
|
|
109
|
+
data, _status_code, _headers = quote_generation_with_http_info(generation_create, opts)
|
|
110
|
+
data
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Price a generation before running it
|
|
114
|
+
# The estimated credits a generation with this body would reserve, from the render’s own pricing, with the brand’s product photos attached exactly as the real run attaches them. Free: nothing is queued, reserved or charged. It is an estimate: the render is charged its actual cost when it finishes, usually within a few percent of this figure. `credits: null` with `refused` means the render would not start, and says why.
|
|
115
|
+
# @param generation_create [GenerationCreate]
|
|
116
|
+
# @param [Hash] opts the optional parameters
|
|
117
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
118
|
+
# @return [Array<(GenerationQuote, Integer, Hash)>] GenerationQuote data, response status code and response headers
|
|
119
|
+
def quote_generation_with_http_info(generation_create, opts = {})
|
|
120
|
+
if @api_client.config.debugging
|
|
121
|
+
@api_client.config.logger.debug 'Calling API: GenerationsApi.quote_generation ...'
|
|
122
|
+
end
|
|
123
|
+
# verify the required parameter 'generation_create' is set
|
|
124
|
+
if @api_client.config.client_side_validation && generation_create.nil?
|
|
125
|
+
fail ArgumentError, "Missing the required parameter 'generation_create' when calling GenerationsApi.quote_generation"
|
|
126
|
+
end
|
|
127
|
+
# resource path
|
|
128
|
+
local_var_path = '/v1/generations/quote'
|
|
129
|
+
|
|
130
|
+
# query parameters
|
|
131
|
+
query_params = opts[:query_params] || {}
|
|
132
|
+
|
|
133
|
+
# header parameters
|
|
134
|
+
header_params = opts[:header_params] || {}
|
|
135
|
+
# HTTP header 'Accept' (if needed)
|
|
136
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
137
|
+
# HTTP header 'Content-Type'
|
|
138
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
139
|
+
if !content_type.nil?
|
|
140
|
+
header_params['Content-Type'] = content_type
|
|
141
|
+
end
|
|
142
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
143
|
+
|
|
144
|
+
# form parameters
|
|
145
|
+
form_params = opts[:form_params] || {}
|
|
146
|
+
|
|
147
|
+
# http body (model)
|
|
148
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(generation_create)
|
|
149
|
+
|
|
150
|
+
# return_type
|
|
151
|
+
return_type = opts[:debug_return_type] || 'GenerationQuote'
|
|
152
|
+
|
|
153
|
+
# auth_names
|
|
154
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
155
|
+
|
|
156
|
+
new_options = opts.merge(
|
|
157
|
+
:operation => :"GenerationsApi.quote_generation",
|
|
158
|
+
:header_params => header_params,
|
|
159
|
+
:query_params => query_params,
|
|
160
|
+
:form_params => form_params,
|
|
161
|
+
:body => post_body,
|
|
162
|
+
:auth_names => auth_names,
|
|
163
|
+
:return_type => return_type
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
167
|
+
if @api_client.config.debugging
|
|
168
|
+
@api_client.config.logger.debug "API called: GenerationsApi#quote_generation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
169
|
+
end
|
|
170
|
+
return data, status_code, headers
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Hermoso API
|
|
3
|
+
|
|
4
|
+
#The Hermoso public API. Guide: https://hermoso.ai/docs/api/ · OpenAPI: https://app.hermoso.ai/openapi.json
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026-08-26
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.27.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Hermoso
|
|
16
|
+
class JobsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Cancel an image or video job
|
|
23
|
+
# Stop an image or video generation. A job that has not started is stopped and charged nothing. A job that is starting stops before it reaches a model when it still can, and is charged nothing if it does. Once a model is rendering it, the render cannot be called back: it finishes, its credits are used and it lands in the Library, and `outcome` says so. Keep polling `GET /v1/jobs/{id}` for the final state; a stopped job ends `error` with `cancelled: true`. Safe to repeat.
|
|
24
|
+
# @param id [String]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
27
|
+
# @return [JobCancel]
|
|
28
|
+
def cancel_job(id, opts = {})
|
|
29
|
+
data, _status_code, _headers = cancel_job_with_http_info(id, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Cancel an image or video job
|
|
34
|
+
# Stop an image or video generation. A job that has not started is stopped and charged nothing. A job that is starting stops before it reaches a model when it still can, and is charged nothing if it does. Once a model is rendering it, the render cannot be called back: it finishes, its credits are used and it lands in the Library, and `outcome` says so. Keep polling `GET /v1/jobs/{id}` for the final state; a stopped job ends `error` with `cancelled: true`. Safe to repeat.
|
|
35
|
+
# @param id [String]
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
38
|
+
# @return [Array<(JobCancel, Integer, Hash)>] JobCancel data, response status code and response headers
|
|
39
|
+
def cancel_job_with_http_info(id, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: JobsApi.cancel_job ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'id' is set
|
|
44
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling JobsApi.cancel_job"
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/v1/jobs/{id}/cancel'.sub('{id}', CGI.escape(id.to_s))
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = opts[:query_params] || {}
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = opts[:header_params] || {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
57
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
58
|
+
|
|
59
|
+
# form parameters
|
|
60
|
+
form_params = opts[:form_params] || {}
|
|
61
|
+
|
|
62
|
+
# http body (model)
|
|
63
|
+
post_body = opts[:debug_body]
|
|
64
|
+
|
|
65
|
+
# return_type
|
|
66
|
+
return_type = opts[:debug_return_type] || 'JobCancel'
|
|
67
|
+
|
|
68
|
+
# auth_names
|
|
69
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
70
|
+
|
|
71
|
+
new_options = opts.merge(
|
|
72
|
+
:operation => :"JobsApi.cancel_job",
|
|
73
|
+
:header_params => header_params,
|
|
74
|
+
:query_params => query_params,
|
|
75
|
+
:form_params => form_params,
|
|
76
|
+
:body => post_body,
|
|
77
|
+
:auth_names => auth_names,
|
|
78
|
+
:return_type => return_type
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
82
|
+
if @api_client.config.debugging
|
|
83
|
+
@api_client.config.logger.debug "API called: JobsApi#cancel_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
84
|
+
end
|
|
85
|
+
return data, status_code, headers
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Retrieve a job
|
|
89
|
+
# One job. Poll this until `status` is `done` or `error`; a few seconds between reads is plenty, and reads spend the read budget, not the write one. `url` is the finished file once there is one. An id that is not on your account is a 404, whether or not it exists somewhere else, and that answer is final: stop polling it and do not re-run the render on the strength of it.
|
|
90
|
+
# @param id [String]
|
|
91
|
+
# @param [Hash] opts the optional parameters
|
|
92
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
93
|
+
# @return [Job]
|
|
94
|
+
def get_job(id, opts = {})
|
|
95
|
+
data, _status_code, _headers = get_job_with_http_info(id, opts)
|
|
96
|
+
data
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Retrieve a job
|
|
100
|
+
# One job. Poll this until `status` is `done` or `error`; a few seconds between reads is plenty, and reads spend the read budget, not the write one. `url` is the finished file once there is one. An id that is not on your account is a 404, whether or not it exists somewhere else, and that answer is final: stop polling it and do not re-run the render on the strength of it.
|
|
101
|
+
# @param id [String]
|
|
102
|
+
# @param [Hash] opts the optional parameters
|
|
103
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
104
|
+
# @return [Array<(Job, Integer, Hash)>] Job data, response status code and response headers
|
|
105
|
+
def get_job_with_http_info(id, opts = {})
|
|
106
|
+
if @api_client.config.debugging
|
|
107
|
+
@api_client.config.logger.debug 'Calling API: JobsApi.get_job ...'
|
|
108
|
+
end
|
|
109
|
+
# verify the required parameter 'id' is set
|
|
110
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
111
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling JobsApi.get_job"
|
|
112
|
+
end
|
|
113
|
+
# resource path
|
|
114
|
+
local_var_path = '/v1/jobs/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
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']) unless header_params['Accept']
|
|
123
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
124
|
+
|
|
125
|
+
# form parameters
|
|
126
|
+
form_params = opts[:form_params] || {}
|
|
127
|
+
|
|
128
|
+
# http body (model)
|
|
129
|
+
post_body = opts[:debug_body]
|
|
130
|
+
|
|
131
|
+
# return_type
|
|
132
|
+
return_type = opts[:debug_return_type] || 'Job'
|
|
133
|
+
|
|
134
|
+
# auth_names
|
|
135
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
136
|
+
|
|
137
|
+
new_options = opts.merge(
|
|
138
|
+
:operation => :"JobsApi.get_job",
|
|
139
|
+
:header_params => header_params,
|
|
140
|
+
:query_params => query_params,
|
|
141
|
+
:form_params => form_params,
|
|
142
|
+
:body => post_body,
|
|
143
|
+
:auth_names => auth_names,
|
|
144
|
+
:return_type => return_type
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
148
|
+
if @api_client.config.debugging
|
|
149
|
+
@api_client.config.logger.debug "API called: JobsApi#get_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
150
|
+
end
|
|
151
|
+
return data, status_code, headers
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# List jobs
|
|
155
|
+
# Renders and other long-running work for this profile, newest first. Cursor-paginated. A job belongs to the profile that started it (`brand_id`); send `X-Hermoso-User` to list another profile’s. Jobs are kept while they are useful to poll, not forever: a finished job ages out of this list, and its output lives on in the Library.
|
|
156
|
+
# @param [Hash] opts the optional parameters
|
|
157
|
+
# @option opts [Integer] :limit 1-100, default 25.
|
|
158
|
+
# @option opts [String] :starting_after A job id from a previous page; returns the page after it. An unknown cursor is an error, never a silent restart.
|
|
159
|
+
# @option opts [String] :status Filter: queued, running, done, error.
|
|
160
|
+
# @option opts [String] :type Filter to one job type, e.g. video, stitch, avatar, templatead.
|
|
161
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
162
|
+
# @return [JobList]
|
|
163
|
+
def list_jobs(opts = {})
|
|
164
|
+
data, _status_code, _headers = list_jobs_with_http_info(opts)
|
|
165
|
+
data
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# List jobs
|
|
169
|
+
# Renders and other long-running work for this profile, newest first. Cursor-paginated. A job belongs to the profile that started it (`brand_id`); send `X-Hermoso-User` to list another profile’s. Jobs are kept while they are useful to poll, not forever: a finished job ages out of this list, and its output lives on in the Library.
|
|
170
|
+
# @param [Hash] opts the optional parameters
|
|
171
|
+
# @option opts [Integer] :limit 1-100, default 25.
|
|
172
|
+
# @option opts [String] :starting_after A job id from a previous page; returns the page after it. An unknown cursor is an error, never a silent restart.
|
|
173
|
+
# @option opts [String] :status Filter: queued, running, done, error.
|
|
174
|
+
# @option opts [String] :type Filter to one job type, e.g. video, stitch, avatar, templatead.
|
|
175
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
176
|
+
# @return [Array<(JobList, Integer, Hash)>] JobList data, response status code and response headers
|
|
177
|
+
def list_jobs_with_http_info(opts = {})
|
|
178
|
+
if @api_client.config.debugging
|
|
179
|
+
@api_client.config.logger.debug 'Calling API: JobsApi.list_jobs ...'
|
|
180
|
+
end
|
|
181
|
+
# resource path
|
|
182
|
+
local_var_path = '/v1/jobs'
|
|
183
|
+
|
|
184
|
+
# query parameters
|
|
185
|
+
query_params = opts[:query_params] || {}
|
|
186
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
187
|
+
query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?
|
|
188
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
189
|
+
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
|
190
|
+
|
|
191
|
+
# header parameters
|
|
192
|
+
header_params = opts[:header_params] || {}
|
|
193
|
+
# HTTP header 'Accept' (if needed)
|
|
194
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
195
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
196
|
+
|
|
197
|
+
# form parameters
|
|
198
|
+
form_params = opts[:form_params] || {}
|
|
199
|
+
|
|
200
|
+
# http body (model)
|
|
201
|
+
post_body = opts[:debug_body]
|
|
202
|
+
|
|
203
|
+
# return_type
|
|
204
|
+
return_type = opts[:debug_return_type] || 'JobList'
|
|
205
|
+
|
|
206
|
+
# auth_names
|
|
207
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
208
|
+
|
|
209
|
+
new_options = opts.merge(
|
|
210
|
+
:operation => :"JobsApi.list_jobs",
|
|
211
|
+
:header_params => header_params,
|
|
212
|
+
:query_params => query_params,
|
|
213
|
+
:form_params => form_params,
|
|
214
|
+
:body => post_body,
|
|
215
|
+
:auth_names => auth_names,
|
|
216
|
+
:return_type => return_type
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
220
|
+
if @api_client.config.debugging
|
|
221
|
+
@api_client.config.logger.debug "API called: JobsApi#list_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
222
|
+
end
|
|
223
|
+
return data, status_code, headers
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Hermoso API
|
|
3
|
+
|
|
4
|
+
#The Hermoso public API. Guide: https://hermoso.ai/docs/api/ · OpenAPI: https://app.hermoso.ai/openapi.json
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026-08-26
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.27.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Hermoso
|
|
16
|
+
class LibraryApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# List the profile’s Library
|
|
23
|
+
# Every image and video this profile has made in Hermoso, newest first: the same Library the app shows. Each `url` is a durable public file; a video carries a `poster_url` still.
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [String] :type image, video or all (default all).
|
|
26
|
+
# @option opts [Integer] :limit 1-60, default 30.
|
|
27
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
28
|
+
# @return [AssetList]
|
|
29
|
+
def list_library(opts = {})
|
|
30
|
+
data, _status_code, _headers = list_library_with_http_info(opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# List the profile’s Library
|
|
35
|
+
# Every image and video this profile has made in Hermoso, newest first: the same Library the app shows. Each `url` is a durable public file; a video carries a `poster_url` still.
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :type image, video or all (default all).
|
|
38
|
+
# @option opts [Integer] :limit 1-60, default 30.
|
|
39
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
40
|
+
# @return [Array<(AssetList, Integer, Hash)>] AssetList data, response status code and response headers
|
|
41
|
+
def list_library_with_http_info(opts = {})
|
|
42
|
+
if @api_client.config.debugging
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: LibraryApi.list_library ...'
|
|
44
|
+
end
|
|
45
|
+
# resource path
|
|
46
|
+
local_var_path = '/v1/library'
|
|
47
|
+
|
|
48
|
+
# query parameters
|
|
49
|
+
query_params = opts[:query_params] || {}
|
|
50
|
+
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
|
51
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
52
|
+
|
|
53
|
+
# header parameters
|
|
54
|
+
header_params = opts[:header_params] || {}
|
|
55
|
+
# HTTP header 'Accept' (if needed)
|
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
57
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
58
|
+
|
|
59
|
+
# form parameters
|
|
60
|
+
form_params = opts[:form_params] || {}
|
|
61
|
+
|
|
62
|
+
# http body (model)
|
|
63
|
+
post_body = opts[:debug_body]
|
|
64
|
+
|
|
65
|
+
# return_type
|
|
66
|
+
return_type = opts[:debug_return_type] || 'AssetList'
|
|
67
|
+
|
|
68
|
+
# auth_names
|
|
69
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
70
|
+
|
|
71
|
+
new_options = opts.merge(
|
|
72
|
+
:operation => :"LibraryApi.list_library",
|
|
73
|
+
:header_params => header_params,
|
|
74
|
+
:query_params => query_params,
|
|
75
|
+
:form_params => form_params,
|
|
76
|
+
:body => post_body,
|
|
77
|
+
:auth_names => auth_names,
|
|
78
|
+
:return_type => return_type
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
82
|
+
if @api_client.config.debugging
|
|
83
|
+
@api_client.config.logger.debug "API called: LibraryApi#list_library\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
84
|
+
end
|
|
85
|
+
return data, status_code, headers
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Hermoso API
|
|
3
|
+
|
|
4
|
+
#The Hermoso public API. Guide: https://hermoso.ai/docs/api/ · OpenAPI: https://app.hermoso.ai/openapi.json
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026-08-26
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.27.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Hermoso
|
|
16
|
+
class MediaApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Upload media
|
|
23
|
+
# Turn a file into a Hermoso-hosted URL that `POST /v1/posts` accepts. Two ways in, and exactly ONE per call: send the file’s raw bytes as the request body with its own `Content-Type` (name it with `X-File-Name`), or send `?url=` (or a JSON body `{\"url\": \"…\"}`) and we fetch it. Sending both is an error rather than a silent precedence — a caller who sent both has two different files in mind. A form-encoded or multipart body is refused with `400 unsupported_media_body`: send the bytes themselves, not a form around them.
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [String] :url A public https URL to fetch instead of sending bytes. The same as a JSON body `{\"url\": \"…\"}`.
|
|
26
|
+
# @option opts [String] :idempotency_key Send a unique value to make this call safe to retry. A replay returns the original response with `Idempotency-Replayed: true`, for 24 hours — except a call that queued a job, whose replay is that job as it is now (what `GET /v1/jobs/{id}` answers), so a finished render replays as done with its file.
|
|
27
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
28
|
+
# @option opts [File] :body
|
|
29
|
+
# @return [Media]
|
|
30
|
+
def create_media(opts = {})
|
|
31
|
+
data, _status_code, _headers = create_media_with_http_info(opts)
|
|
32
|
+
data
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Upload media
|
|
36
|
+
# Turn a file into a Hermoso-hosted URL that `POST /v1/posts` accepts. Two ways in, and exactly ONE per call: send the file’s raw bytes as the request body with its own `Content-Type` (name it with `X-File-Name`), or send `?url=` (or a JSON body `{\"url\": \"…\"}`) and we fetch it. Sending both is an error rather than a silent precedence — a caller who sent both has two different files in mind. A form-encoded or multipart body is refused with `400 unsupported_media_body`: send the bytes themselves, not a form around them.
|
|
37
|
+
# @param [Hash] opts the optional parameters
|
|
38
|
+
# @option opts [String] :url A public https URL to fetch instead of sending bytes. The same as a JSON body `{\"url\": \"…\"}`.
|
|
39
|
+
# @option opts [String] :idempotency_key Send a unique value to make this call safe to retry. A replay returns the original response with `Idempotency-Replayed: true`, for 24 hours — except a call that queued a job, whose replay is that job as it is now (what `GET /v1/jobs/{id}` answers), so a finished render replays as done with its file.
|
|
40
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
41
|
+
# @option opts [File] :body
|
|
42
|
+
# @return [Array<(Media, Integer, Hash)>] Media data, response status code and response headers
|
|
43
|
+
def create_media_with_http_info(opts = {})
|
|
44
|
+
if @api_client.config.debugging
|
|
45
|
+
@api_client.config.logger.debug 'Calling API: MediaApi.create_media ...'
|
|
46
|
+
end
|
|
47
|
+
# resource path
|
|
48
|
+
local_var_path = '/v1/media'
|
|
49
|
+
|
|
50
|
+
# query parameters
|
|
51
|
+
query_params = opts[:query_params] || {}
|
|
52
|
+
query_params[:'url'] = opts[:'url'] if !opts[:'url'].nil?
|
|
53
|
+
|
|
54
|
+
# header parameters
|
|
55
|
+
header_params = opts[:header_params] || {}
|
|
56
|
+
# HTTP header 'Accept' (if needed)
|
|
57
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
58
|
+
# HTTP header 'Content-Type'
|
|
59
|
+
content_type = @api_client.select_header_content_type(['application/octet-stream'])
|
|
60
|
+
if !content_type.nil?
|
|
61
|
+
header_params['Content-Type'] = content_type
|
|
62
|
+
end
|
|
63
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
64
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
65
|
+
|
|
66
|
+
# form parameters
|
|
67
|
+
form_params = opts[:form_params] || {}
|
|
68
|
+
|
|
69
|
+
# http body (model)
|
|
70
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
|
|
71
|
+
|
|
72
|
+
# return_type
|
|
73
|
+
return_type = opts[:debug_return_type] || 'Media'
|
|
74
|
+
|
|
75
|
+
# auth_names
|
|
76
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
77
|
+
|
|
78
|
+
new_options = opts.merge(
|
|
79
|
+
:operation => :"MediaApi.create_media",
|
|
80
|
+
:header_params => header_params,
|
|
81
|
+
:query_params => query_params,
|
|
82
|
+
:form_params => form_params,
|
|
83
|
+
:body => post_body,
|
|
84
|
+
:auth_names => auth_names,
|
|
85
|
+
:return_type => return_type
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
89
|
+
if @api_client.config.debugging
|
|
90
|
+
@api_client.config.logger.debug "API called: MediaApi#create_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
91
|
+
end
|
|
92
|
+
return data, status_code, headers
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Download a Hermoso file
|
|
96
|
+
# The bytes of a file Hermoso made or hosts (a Library `url`, a job `url`), streamed with its own `Content-Type`. Only Hermoso-hosted files are served; any other address is refused. For an app that has to hand raw bytes to its host (a design editor inserting the file) and cannot read our file host directly.
|
|
97
|
+
# @param [Hash] opts the optional parameters
|
|
98
|
+
# @option opts [String] :url A Hermoso-hosted file URL.
|
|
99
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
100
|
+
# @return [File]
|
|
101
|
+
def get_media_content(opts = {})
|
|
102
|
+
data, _status_code, _headers = get_media_content_with_http_info(opts)
|
|
103
|
+
data
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Download a Hermoso file
|
|
107
|
+
# The bytes of a file Hermoso made or hosts (a Library `url`, a job `url`), streamed with its own `Content-Type`. Only Hermoso-hosted files are served; any other address is refused. For an app that has to hand raw bytes to its host (a design editor inserting the file) and cannot read our file host directly.
|
|
108
|
+
# @param [Hash] opts the optional parameters
|
|
109
|
+
# @option opts [String] :url A Hermoso-hosted file URL.
|
|
110
|
+
# @option opts [String] :x_hermoso_user Which profile to act on, when the account holds more than one: an `id` from `GET /v1/brands`. Defaults to the workspace the key is pinned to. Membership is re-authorised on every request, and an id this key cannot act on is a 404 `brand_not_found`, never an empty result.
|
|
111
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
112
|
+
def get_media_content_with_http_info(opts = {})
|
|
113
|
+
if @api_client.config.debugging
|
|
114
|
+
@api_client.config.logger.debug 'Calling API: MediaApi.get_media_content ...'
|
|
115
|
+
end
|
|
116
|
+
# resource path
|
|
117
|
+
local_var_path = '/v1/media/content'
|
|
118
|
+
|
|
119
|
+
# query parameters
|
|
120
|
+
query_params = opts[:query_params] || {}
|
|
121
|
+
query_params[:'url'] = opts[:'url'] if !opts[:'url'].nil?
|
|
122
|
+
|
|
123
|
+
# header parameters
|
|
124
|
+
header_params = opts[:header_params] || {}
|
|
125
|
+
# HTTP header 'Accept' (if needed)
|
|
126
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
127
|
+
header_params[:'X-Hermoso-User'] = opts[:'x_hermoso_user'] if !opts[:'x_hermoso_user'].nil?
|
|
128
|
+
|
|
129
|
+
# form parameters
|
|
130
|
+
form_params = opts[:form_params] || {}
|
|
131
|
+
|
|
132
|
+
# http body (model)
|
|
133
|
+
post_body = opts[:debug_body]
|
|
134
|
+
|
|
135
|
+
# return_type
|
|
136
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
137
|
+
|
|
138
|
+
# auth_names
|
|
139
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
140
|
+
|
|
141
|
+
new_options = opts.merge(
|
|
142
|
+
:operation => :"MediaApi.get_media_content",
|
|
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(:GET, local_var_path, new_options)
|
|
152
|
+
if @api_client.config.debugging
|
|
153
|
+
@api_client.config.logger.debug "API called: MediaApi#get_media_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
154
|
+
end
|
|
155
|
+
return data, status_code, headers
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|