runapi-happyhorse 0.2.7 → 0.2.8
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7d66e7f6bb1e4993244ffac318f0ea95a9a20d5b395588ed6f18d5a8a6dc7d3
|
|
4
|
+
data.tar.gz: 8559c1d3ee40b323fdc03a84b72cef7c076729089f8e00e3ff2e4e3e33c86442
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 909f40ba4f68a5eb5f8fe5ceb6bf3ce42f2a30f05b1db001aa68b2da8f1e70f9aee8f79a427ec9db6adf3a24963b6ce5b92b142c2fda4c5f856f2a338132d166
|
|
7
|
+
data.tar.gz: 3633c1b80aecfff1c4f75dc930db62705415f6febcb35b37ddb156bb5f29c97444c8bd1268d87b33f089381ffc5a9a2716e447a66f042ccf34dbca29f6aa75b8
|
data/README.md
CHANGED
|
@@ -13,6 +13,9 @@ module RunApi
|
|
|
13
13
|
"output_resolution" => {
|
|
14
14
|
"enum" => ["720p", "1080p"]
|
|
15
15
|
},
|
|
16
|
+
"reference_image_urls" => {
|
|
17
|
+
"max_items" => 5
|
|
18
|
+
},
|
|
16
19
|
"seed" => {
|
|
17
20
|
"type" => "integer"
|
|
18
21
|
},
|
|
@@ -55,7 +58,9 @@ module RunApi
|
|
|
55
58
|
"enum" => ["720p", "1080p"]
|
|
56
59
|
},
|
|
57
60
|
"reference_image_urls" => {
|
|
58
|
-
"required" => true
|
|
61
|
+
"required" => true,
|
|
62
|
+
"min_items" => 1,
|
|
63
|
+
"max_items" => 9
|
|
59
64
|
},
|
|
60
65
|
"seed" => {
|
|
61
66
|
"type" => "integer"
|
|
@@ -12,7 +12,6 @@ module RunApi
|
|
|
12
12
|
|
|
13
13
|
RESPONSE_CLASS = Types::EditVideoResponse
|
|
14
14
|
COMPLETED_RESPONSE_CLASS = Types::CompletedEditVideoResponse
|
|
15
|
-
REFERENCE_IMAGE_RANGE = (0..5)
|
|
16
15
|
|
|
17
16
|
def initialize(http)
|
|
18
17
|
@http = http
|
|
@@ -22,27 +21,27 @@ module RunApi
|
|
|
22
21
|
#
|
|
23
22
|
# @param params [Hash] edit-video parameters
|
|
24
23
|
# @return [RunApi::HappyHorse::Types::CompletedEditVideoResponse] completed task with videos
|
|
25
|
-
def run(**params)
|
|
26
|
-
task = create(**params)
|
|
27
|
-
poll_until_complete { get(task.id) }
|
|
24
|
+
def run(options: nil, **params)
|
|
25
|
+
task = create(options: options, **params)
|
|
26
|
+
poll_until_complete { get(task.id, options: options) }
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
# Create an edit-video task.
|
|
31
30
|
#
|
|
32
31
|
# @param params [Hash] edit-video parameters
|
|
33
32
|
# @return [RunApi::HappyHorse::Types::EditVideoResponse] task creation result with id
|
|
34
|
-
def create(**params)
|
|
33
|
+
def create(options: nil, **params)
|
|
35
34
|
params = compact_params(params)
|
|
36
35
|
validate_params!(params)
|
|
37
|
-
request(:post, ENDPOINT, body: params)
|
|
36
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
# Get edit-video task status by task ID.
|
|
41
40
|
#
|
|
42
41
|
# @param id [String] task ID
|
|
43
42
|
# @return [RunApi::HappyHorse::Types::EditVideoResponse] current task status
|
|
44
|
-
def get(id)
|
|
45
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
43
|
+
def get(id, options: nil)
|
|
44
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
private
|
|
@@ -52,11 +51,6 @@ module RunApi
|
|
|
52
51
|
|
|
53
52
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
54
53
|
|
|
55
|
-
reference_image_urls = param(params, :reference_image_urls)
|
|
56
|
-
if reference_image_urls && (!reference_image_urls.is_a?(Array) || !REFERENCE_IMAGE_RANGE.cover?(reference_image_urls.size))
|
|
57
|
-
raise Core::ValidationError, "reference_image_urls must include at most #{REFERENCE_IMAGE_RANGE.max} entries"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
54
|
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
61
55
|
end
|
|
62
56
|
|
|
@@ -21,27 +21,27 @@ module RunApi
|
|
|
21
21
|
#
|
|
22
22
|
# @param params [Hash] image-to-video parameters
|
|
23
23
|
# @return [RunApi::HappyHorse::Types::CompletedImageToVideoResponse] completed task with videos
|
|
24
|
-
def run(**params)
|
|
25
|
-
task = create(**params)
|
|
26
|
-
poll_until_complete { get(task.id) }
|
|
24
|
+
def run(options: nil, **params)
|
|
25
|
+
task = create(options: options, **params)
|
|
26
|
+
poll_until_complete { get(task.id, options: options) }
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Create an image-to-video task.
|
|
30
30
|
#
|
|
31
31
|
# @param params [Hash] image-to-video parameters
|
|
32
32
|
# @return [RunApi::HappyHorse::Types::ImageToVideoResponse] task creation result with id
|
|
33
|
-
def create(**params)
|
|
33
|
+
def create(options: nil, **params)
|
|
34
34
|
params = compact_params(params)
|
|
35
35
|
validate_params!(params)
|
|
36
|
-
request(:post, ENDPOINT, body: params)
|
|
36
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Get image-to-video task status by task ID.
|
|
40
40
|
#
|
|
41
41
|
# @param id [String] task ID
|
|
42
42
|
# @return [RunApi::HappyHorse::Types::ImageToVideoResponse] current task status
|
|
43
|
-
def get(id)
|
|
44
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
43
|
+
def get(id, options: nil)
|
|
44
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
private
|
|
@@ -12,7 +12,6 @@ module RunApi
|
|
|
12
12
|
|
|
13
13
|
RESPONSE_CLASS = Types::TextToVideoResponse
|
|
14
14
|
COMPLETED_RESPONSE_CLASS = Types::CompletedTextToVideoResponse
|
|
15
|
-
REFERENCE_IMAGE_URLS_RANGE = (1..9)
|
|
16
15
|
|
|
17
16
|
def initialize(http)
|
|
18
17
|
@http = http
|
|
@@ -22,27 +21,27 @@ module RunApi
|
|
|
22
21
|
#
|
|
23
22
|
# @param params [Hash] text-to-video parameters
|
|
24
23
|
# @return [RunApi::HappyHorse::Types::CompletedTextToVideoResponse] completed task with videos
|
|
25
|
-
def run(**params)
|
|
26
|
-
task = create(**params)
|
|
27
|
-
poll_until_complete { get(task.id) }
|
|
24
|
+
def run(options: nil, **params)
|
|
25
|
+
task = create(options: options, **params)
|
|
26
|
+
poll_until_complete { get(task.id, options: options) }
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
# Create a text-to-video task.
|
|
31
30
|
#
|
|
32
31
|
# @param params [Hash] text-to-video parameters
|
|
33
32
|
# @return [RunApi::HappyHorse::Types::TextToVideoResponse] task creation result with id
|
|
34
|
-
def create(**params)
|
|
33
|
+
def create(options: nil, **params)
|
|
35
34
|
params = compact_params(params)
|
|
36
35
|
validate_params!(params)
|
|
37
|
-
request(:post, ENDPOINT, body: params)
|
|
36
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
# Get text-to-video task status by task ID.
|
|
41
40
|
#
|
|
42
41
|
# @param id [String] task ID
|
|
43
42
|
# @return [RunApi::HappyHorse::Types::TextToVideoResponse] current task status
|
|
44
|
-
def get(id)
|
|
45
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
43
|
+
def get(id, options: nil)
|
|
44
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
private
|
|
@@ -53,11 +52,7 @@ module RunApi
|
|
|
53
52
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
54
53
|
|
|
55
54
|
reference_image_urls = param(params, :reference_image_urls)
|
|
56
|
-
if param(params, :model)
|
|
57
|
-
if reference_image_urls && !(reference_image_urls.is_a?(Array) && REFERENCE_IMAGE_URLS_RANGE.cover?(reference_image_urls.size))
|
|
58
|
-
raise Core::ValidationError, "reference_image_urls must include between #{REFERENCE_IMAGE_URLS_RANGE.min} and #{REFERENCE_IMAGE_URLS_RANGE.max} entries"
|
|
59
|
-
end
|
|
60
|
-
elsif reference_image_urls
|
|
55
|
+
if param(params, :model) != Types::CHARACTER_MODEL && reference_image_urls
|
|
61
56
|
raise Core::ValidationError, "reference_image_urls is only supported for #{Types::CHARACTER_MODEL}"
|
|
62
57
|
end
|
|
63
58
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-happyhorse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.14
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
25
|
+
version: 0.2.14
|
|
26
26
|
description: The HappyHorse Ruby SDK is the language-specific package for HappyHorse
|
|
27
27
|
on RunAPI. Use this package for video generation, animation, and video editing workflows
|
|
28
28
|
when your application needs request bodies, task status lookup, and consistent RunAPI
|