vectali 0.4.1
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 +202 -0
- data/NOTICE +3 -0
- data/README.md +60 -0
- data/lib/vectali/binary_response.rb +16 -0
- data/lib/vectali/client.rb +37 -0
- data/lib/vectali/codec.rb +280 -0
- data/lib/vectali/errors.rb +22 -0
- data/lib/vectali/file_upload.rb +78 -0
- data/lib/vectali/forge_client.rb +37 -0
- data/lib/vectali/models/billing_summary.rb +52 -0
- data/lib/vectali/models/billing_summary_api_credits.rb +24 -0
- data/lib/vectali/models/billing_summary_api_starter.rb +52 -0
- data/lib/vectali/models/billing_summary_api_starter_plan.rb +25 -0
- data/lib/vectali/models/billing_summary_available_plans_item.rb +27 -0
- data/lib/vectali/models/billing_summary_free_api_conversions.rb +28 -0
- data/lib/vectali/models/billing_summary_free_exports.rb +28 -0
- data/lib/vectali/models/billing_summary_mode.rb +17 -0
- data/lib/vectali/models/billing_summary_web_credits.rb +20 -0
- data/lib/vectali/models/billing_summary_web_pro.rb +32 -0
- data/lib/vectali/models/conversion.rb +49 -0
- data/lib/vectali/models/conversion_allowance_used_this_call.rb +17 -0
- data/lib/vectali/models/conversion_format.rb +16 -0
- data/lib/vectali/models/error.rb +24 -0
- data/lib/vectali/models/get_vector_format.rb +19 -0
- data/lib/vectali/models/health.rb +20 -0
- data/lib/vectali/requests/convert_image_request.rb +56 -0
- data/lib/vectali/requests/get_allowance_request.rb +23 -0
- data/lib/vectali/requests/get_vector_request.rb +43 -0
- data/lib/vectali/requests/health_request.rb +19 -0
- data/lib/vectali/transport.rb +296 -0
- data/lib/vectali/version.rb +3 -0
- data/lib/vectali.rb +29 -0
- data/provenance.json +71 -0
- metadata +78 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
require "securerandom"
|
|
5
|
+
require "stringio"
|
|
6
|
+
|
|
7
|
+
module Vectali
|
|
8
|
+
class FileUpload
|
|
9
|
+
attr_reader :data, :filename, :content_type
|
|
10
|
+
|
|
11
|
+
def initialize(data_or_io, filename:, content_type: "application/octet-stream")
|
|
12
|
+
@filename = Multipart.header_value(filename).dup.freeze
|
|
13
|
+
@content_type = Multipart.header_value(content_type).dup.freeze
|
|
14
|
+
data = if data_or_io.is_a?(String)
|
|
15
|
+
data_or_io
|
|
16
|
+
elsif data_or_io.respond_to?(:read)
|
|
17
|
+
data_or_io.binmode if data_or_io.respond_to?(:binmode)
|
|
18
|
+
data_or_io.read
|
|
19
|
+
end
|
|
20
|
+
raise ArgumentError, "Expected upload bytes or a readable IO" unless data.is_a?(String)
|
|
21
|
+
|
|
22
|
+
@data = data.b.freeze
|
|
23
|
+
freeze
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def inspect
|
|
27
|
+
"#<#{self.class.name} filename=#{filename.inspect} content_type=#{content_type.inspect}>"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module Multipart
|
|
32
|
+
module_function
|
|
33
|
+
|
|
34
|
+
def header_value(value)
|
|
35
|
+
unless value.is_a?(String) && !value.empty? && !value.b.match?(/[\x00-\x1f\x7f]/n)
|
|
36
|
+
raise ArgumentError, "Invalid multipart header value"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
value
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def quoted(value)
|
|
43
|
+
header_value(value).gsub(/["\\]/) { |char| "\\#{char}" }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def encode(fields)
|
|
47
|
+
raise ArgumentError, "Expected an object for a multipart request" unless fields.is_a?(Hash)
|
|
48
|
+
|
|
49
|
+
parts = fields.flat_map do |name, value|
|
|
50
|
+
values = value.is_a?(Array) ? value : [value]
|
|
51
|
+
values.map { |item| part(name.to_s, item) }
|
|
52
|
+
end
|
|
53
|
+
boundary = loop do
|
|
54
|
+
candidate = "forge-#{SecureRandom.hex(24)}"
|
|
55
|
+
break candidate unless parts.any? { |header, bytes| header.include?(candidate) || bytes.include?(candidate) }
|
|
56
|
+
end
|
|
57
|
+
output = StringIO.new(String.new(encoding: Encoding::BINARY))
|
|
58
|
+
parts.each do |header, bytes|
|
|
59
|
+
output << "--#{boundary}\r\n" << header << "\r\n\r\n" << bytes << "\r\n"
|
|
60
|
+
end
|
|
61
|
+
output << "--#{boundary}--\r\n"
|
|
62
|
+
[output.string, "multipart/form-data; boundary=#{boundary}"]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def part(name, value)
|
|
66
|
+
header = "Content-Disposition: form-data; name=\"#{quoted(name)}\""
|
|
67
|
+
case value
|
|
68
|
+
when FileUpload
|
|
69
|
+
header << "; filename=\"#{quoted(value.filename)}\"\r\nContent-Type: #{value.content_type}"
|
|
70
|
+
[header.b, value.data]
|
|
71
|
+
when Hash, Array
|
|
72
|
+
[header.b << "\r\nContent-Type: application/json", JSON.generate(value).b]
|
|
73
|
+
else
|
|
74
|
+
[header.b, value.to_s.b]
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class ForgeClient
|
|
6
|
+
def initialize(
|
|
7
|
+
base_url: "https://api.vectali.com", bearer_token: nil, api_key: nil, api_key_header: nil,
|
|
8
|
+
default_headers: {}, timeout: 30, allow_redirects: false
|
|
9
|
+
)
|
|
10
|
+
@__transport = ::Vectali::Transport.new(
|
|
11
|
+
base_url: base_url, bearer_token: bearer_token, api_key: api_key,
|
|
12
|
+
api_key_header: api_key_header, default_headers: default_headers,
|
|
13
|
+
timeout: timeout, allow_redirects: allow_redirects
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Use for user-requested vectorization. Maximum 10 MiB and 4000000 pixels (4096 per side). Requires remaining monthly API allowance or granted API credits. One successful request consumes one conversion. Reuse the same Idempotency-Key and image when retrying. Processing can take up to 240 seconds. Plan-based limits are shared across API keys, browser sessions, legacy routes and MCP. Starter permits 60 requests/minute, 6 conversion/export attempts/minute and one concurrent engine job; larger plans permit 120–300 requests/minute, 12–60 engine attempts/minute and two concurrent engine jobs. See x-vectali-plan-limits and https://vectali.com/docs/api-lifecycle/#rate-limits. PDF/EPS/DXF exports share the engine budget; saved SVG downloads do not. Attempts, including invalid requests and completed retries, count toward the minute budget. RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset and RateLimit-Scope identify the applicable window; Retry-After accompanies 429. Concurrency limits return concurrency_limited and X-Concurrency-Limit. Photos and tiny details may need manual cleanup.
|
|
18
|
+
def convert_image(request = nil, **kwargs)
|
|
19
|
+
@__transport.call(::Vectali::ConvertImageRequest, request, kwargs)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Read monthly API allowance (apiStarter.remaining), free lifetime API trial conversions (freeApiConversions.remaining), and total non-subscription API credits (apiCredits.available, which combines free trial conversions and apiCredits.granted). Total available conversions is apiStarter.remaining + apiCredits.available; free trials and granted credits work without a subscription. No purchases or changes. Account request limits depend on the active API plan and are shared with legacy routes and MCP; see x-vectali-plan-limits.
|
|
23
|
+
def get_allowance(request = nil, **kwargs)
|
|
24
|
+
@__transport.call(::Vectali::GetAllowanceRequest, request, kwargs)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Export the saved SVG after validating account ownership. Native PDF/EPS/DXF generation also shares the account engine-attempt and concurrency limits; saved SVG downloads need no engine slot. PDF preserves vector paint; EPS uses a white matte and simplifies mesh paint. DXF exports outlines in millimeters at 96 px/inch. Does not consume another conversion. Account request limits depend on the active API plan and are shared with legacy routes and MCP; see x-vectali-plan-limits.
|
|
28
|
+
def get_vector(request = nil, **kwargs)
|
|
29
|
+
@__transport.call(::Vectali::GetVectorRequest, request, kwargs)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Public service availability probe. Does not expose account information or run a conversion.
|
|
33
|
+
def health(request = nil, **kwargs)
|
|
34
|
+
@__transport.call(::Vectali::HealthRequest, request, kwargs)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummary < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
api_credits: ["apiCredits", -> { ::Vectali::BillingSummaryApiCredits }, true, false, false],
|
|
8
|
+
api_starter: ["apiStarter", -> { ::Vectali::BillingSummaryApiStarter }, true, false, false],
|
|
9
|
+
available_plans: ["availablePlans", [:array, -> { ::Vectali::BillingSummaryAvailablePlansItem }], false, false, false],
|
|
10
|
+
customer_portal_available: ["customerPortalAvailable", :boolean, true, false, false],
|
|
11
|
+
free_api_conversions: ["freeApiConversions", -> { ::Vectali::BillingSummaryFreeApiConversions }, true, false, false],
|
|
12
|
+
free_exports: ["freeExports", -> { ::Vectali::BillingSummaryFreeExports }, true, false, false],
|
|
13
|
+
mode: ["mode", -> { ::Vectali::BillingSummaryMode }, true, false, false],
|
|
14
|
+
web_credits: ["webCredits", -> { ::Vectali::BillingSummaryWebCredits }, true, false, false],
|
|
15
|
+
web_pro: ["webPro", -> { ::Vectali::BillingSummaryWebPro }, true, false, false],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
attr_reader :api_credits
|
|
19
|
+
attr_reader :api_starter
|
|
20
|
+
attr_reader :available_plans
|
|
21
|
+
attr_reader :customer_portal_available
|
|
22
|
+
attr_reader :free_api_conversions
|
|
23
|
+
attr_reader :free_exports
|
|
24
|
+
attr_reader :mode
|
|
25
|
+
attr_reader :web_credits
|
|
26
|
+
attr_reader :web_pro
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
api_credits: UNSET,
|
|
30
|
+
api_starter: UNSET,
|
|
31
|
+
available_plans: UNSET,
|
|
32
|
+
customer_portal_available: UNSET,
|
|
33
|
+
free_api_conversions: UNSET,
|
|
34
|
+
free_exports: UNSET,
|
|
35
|
+
mode: UNSET,
|
|
36
|
+
web_credits: UNSET,
|
|
37
|
+
web_pro: UNSET
|
|
38
|
+
)
|
|
39
|
+
super(
|
|
40
|
+
api_credits: api_credits,
|
|
41
|
+
api_starter: api_starter,
|
|
42
|
+
available_plans: available_plans,
|
|
43
|
+
customer_portal_available: customer_portal_available,
|
|
44
|
+
free_api_conversions: free_api_conversions,
|
|
45
|
+
free_exports: free_exports,
|
|
46
|
+
mode: mode,
|
|
47
|
+
web_credits: web_credits,
|
|
48
|
+
web_pro: web_pro
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryApiCredits < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
available: ["available", :integer, true, false, false],
|
|
8
|
+
granted: ["granted", :integer, false, false, false],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
attr_reader :available
|
|
12
|
+
attr_reader :granted
|
|
13
|
+
|
|
14
|
+
def initialize(
|
|
15
|
+
available: UNSET,
|
|
16
|
+
granted: UNSET
|
|
17
|
+
)
|
|
18
|
+
super(
|
|
19
|
+
available: available,
|
|
20
|
+
granted: granted
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryApiStarter < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
active: ["active", :boolean, true, false, false],
|
|
8
|
+
cancel_at_period_end: ["cancelAtPeriodEnd", :boolean, true, false, false],
|
|
9
|
+
current_period_end: ["currentPeriodEnd", [:union, :string, :null], true, false, false],
|
|
10
|
+
current_period_start: ["currentPeriodStart", [:union, :string, :null], true, false, false],
|
|
11
|
+
limit: ["limit", :integer, true, false, false],
|
|
12
|
+
plan: ["plan", [:union, -> { ::Vectali::BillingSummaryApiStarterPlan }, :null], false, false, false],
|
|
13
|
+
remaining: ["remaining", :integer, true, false, false],
|
|
14
|
+
status: ["status", [:union, :string, :null], true, false, false],
|
|
15
|
+
used: ["used", :integer, true, false, false],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
attr_reader :active
|
|
19
|
+
attr_reader :cancel_at_period_end
|
|
20
|
+
attr_reader :current_period_end
|
|
21
|
+
attr_reader :current_period_start
|
|
22
|
+
attr_reader :limit
|
|
23
|
+
attr_reader :plan
|
|
24
|
+
attr_reader :remaining
|
|
25
|
+
attr_reader :status
|
|
26
|
+
attr_reader :used
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
active: UNSET,
|
|
30
|
+
cancel_at_period_end: UNSET,
|
|
31
|
+
current_period_end: UNSET,
|
|
32
|
+
current_period_start: UNSET,
|
|
33
|
+
limit: UNSET,
|
|
34
|
+
plan: UNSET,
|
|
35
|
+
remaining: UNSET,
|
|
36
|
+
status: UNSET,
|
|
37
|
+
used: UNSET
|
|
38
|
+
)
|
|
39
|
+
super(
|
|
40
|
+
active: active,
|
|
41
|
+
cancel_at_period_end: cancel_at_period_end,
|
|
42
|
+
current_period_end: current_period_end,
|
|
43
|
+
current_period_start: current_period_start,
|
|
44
|
+
limit: limit,
|
|
45
|
+
plan: plan,
|
|
46
|
+
remaining: remaining,
|
|
47
|
+
status: status,
|
|
48
|
+
used: used
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module BillingSummaryApiStarterPlan
|
|
6
|
+
API_100K = "api_100k"
|
|
7
|
+
API_10K = "api_10k"
|
|
8
|
+
API_15K = "api_15k"
|
|
9
|
+
API_20K = "api_20k"
|
|
10
|
+
API_25K = "api_25k"
|
|
11
|
+
API_50K = "api_50k"
|
|
12
|
+
API_75K = "api_75k"
|
|
13
|
+
API_GROWTH = "api_growth"
|
|
14
|
+
API_SCALE = "api_scale"
|
|
15
|
+
API_STARTER = "api_starter"
|
|
16
|
+
SCHEMA = Codec.immutable([:enum, [API_100K, API_10K, API_15K, API_20K, API_25K, API_50K, API_75K, API_GROWTH, API_SCALE, API_STARTER]])
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
def parse(value)
|
|
20
|
+
Codec.decode(value, SCHEMA)
|
|
21
|
+
end
|
|
22
|
+
alias_method :from_h, :parse
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module BillingSummaryAvailablePlansItem
|
|
6
|
+
API_100K = "api_100k"
|
|
7
|
+
API_10K = "api_10k"
|
|
8
|
+
API_15K = "api_15k"
|
|
9
|
+
API_20K = "api_20k"
|
|
10
|
+
API_25K = "api_25k"
|
|
11
|
+
API_50K = "api_50k"
|
|
12
|
+
API_75K = "api_75k"
|
|
13
|
+
API_GROWTH = "api_growth"
|
|
14
|
+
API_SCALE = "api_scale"
|
|
15
|
+
API_STARTER = "api_starter"
|
|
16
|
+
WEB_CREDIT_PACK = "web_credit_pack"
|
|
17
|
+
WEB_PRO = "web_pro"
|
|
18
|
+
SCHEMA = Codec.immutable([:enum, [API_100K, API_10K, API_15K, API_20K, API_25K, API_50K, API_75K, API_GROWTH, API_SCALE, API_STARTER, WEB_CREDIT_PACK, WEB_PRO]])
|
|
19
|
+
|
|
20
|
+
class << self
|
|
21
|
+
def parse(value)
|
|
22
|
+
Codec.decode(value, SCHEMA)
|
|
23
|
+
end
|
|
24
|
+
alias_method :from_h, :parse
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryFreeApiConversions < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
limit: ["limit", [:enum, [3]], true, false, false],
|
|
8
|
+
remaining: ["remaining", :integer, true, false, false],
|
|
9
|
+
used: ["used", :integer, true, false, false],
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
attr_reader :limit
|
|
13
|
+
attr_reader :remaining
|
|
14
|
+
attr_reader :used
|
|
15
|
+
|
|
16
|
+
def initialize(
|
|
17
|
+
limit: UNSET,
|
|
18
|
+
remaining: UNSET,
|
|
19
|
+
used: UNSET
|
|
20
|
+
)
|
|
21
|
+
super(
|
|
22
|
+
limit: limit,
|
|
23
|
+
remaining: remaining,
|
|
24
|
+
used: used
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryFreeExports < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
limit: ["limit", [:enum, [3]], true, false, false],
|
|
8
|
+
remaining: ["remaining", :integer, true, false, false],
|
|
9
|
+
used: ["used", :integer, true, false, false],
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
attr_reader :limit
|
|
13
|
+
attr_reader :remaining
|
|
14
|
+
attr_reader :used
|
|
15
|
+
|
|
16
|
+
def initialize(
|
|
17
|
+
limit: UNSET,
|
|
18
|
+
remaining: UNSET,
|
|
19
|
+
used: UNSET
|
|
20
|
+
)
|
|
21
|
+
super(
|
|
22
|
+
limit: limit,
|
|
23
|
+
remaining: remaining,
|
|
24
|
+
used: used
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module BillingSummaryMode
|
|
6
|
+
LIVE = "live"
|
|
7
|
+
TEST = "test"
|
|
8
|
+
SCHEMA = Codec.immutable([:enum, [LIVE, TEST]])
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def parse(value)
|
|
12
|
+
Codec.decode(value, SCHEMA)
|
|
13
|
+
end
|
|
14
|
+
alias_method :from_h, :parse
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryWebCredits < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
available: ["available", :integer, true, false, false],
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
attr_reader :available
|
|
11
|
+
|
|
12
|
+
def initialize(
|
|
13
|
+
available: UNSET
|
|
14
|
+
)
|
|
15
|
+
super(
|
|
16
|
+
available: available
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class BillingSummaryWebPro < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
active: ["active", :boolean, true, false, false],
|
|
8
|
+
cancel_at_period_end: ["cancelAtPeriodEnd", :boolean, true, false, false],
|
|
9
|
+
current_period_end: ["currentPeriodEnd", [:union, :string, :null], true, false, false],
|
|
10
|
+
status: ["status", [:union, :string, :null], true, false, false],
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
attr_reader :active
|
|
14
|
+
attr_reader :cancel_at_period_end
|
|
15
|
+
attr_reader :current_period_end
|
|
16
|
+
attr_reader :status
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
active: UNSET,
|
|
20
|
+
cancel_at_period_end: UNSET,
|
|
21
|
+
current_period_end: UNSET,
|
|
22
|
+
status: UNSET
|
|
23
|
+
)
|
|
24
|
+
super(
|
|
25
|
+
active: active,
|
|
26
|
+
cancel_at_period_end: cancel_at_period_end,
|
|
27
|
+
current_period_end: current_period_end,
|
|
28
|
+
status: status
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class Conversion < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
allowance_used_this_call: ["allowance_used_this_call", -> { ::Vectali::ConversionAllowanceUsedThisCall }, false, false, false],
|
|
8
|
+
conversion_id: ["conversion_id", :string, true, false, false],
|
|
9
|
+
format: ["format", -> { ::Vectali::ConversionFormat }, true, false, false],
|
|
10
|
+
optimized_bytes: ["optimized_bytes", :integer, true, false, false],
|
|
11
|
+
paths: ["paths", :integer, true, false, false],
|
|
12
|
+
processing_ms: ["processing_ms", :integer, true, false, false],
|
|
13
|
+
reused_result: ["reused_result", :boolean, false, false, false],
|
|
14
|
+
svg: ["svg", :string, true, false, false],
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
attr_reader :allowance_used_this_call
|
|
18
|
+
attr_reader :conversion_id
|
|
19
|
+
attr_reader :format
|
|
20
|
+
attr_reader :optimized_bytes
|
|
21
|
+
# Artwork path count, excluding clipping paths, masks, definitions and seam helpers. Not a quality score.
|
|
22
|
+
attr_reader :paths
|
|
23
|
+
attr_reader :processing_ms
|
|
24
|
+
attr_reader :reused_result
|
|
25
|
+
attr_reader :svg
|
|
26
|
+
|
|
27
|
+
def initialize(
|
|
28
|
+
allowance_used_this_call: UNSET,
|
|
29
|
+
conversion_id: UNSET,
|
|
30
|
+
format: UNSET,
|
|
31
|
+
optimized_bytes: UNSET,
|
|
32
|
+
paths: UNSET,
|
|
33
|
+
processing_ms: UNSET,
|
|
34
|
+
reused_result: UNSET,
|
|
35
|
+
svg: UNSET
|
|
36
|
+
)
|
|
37
|
+
super(
|
|
38
|
+
allowance_used_this_call: allowance_used_this_call,
|
|
39
|
+
conversion_id: conversion_id,
|
|
40
|
+
format: format,
|
|
41
|
+
optimized_bytes: optimized_bytes,
|
|
42
|
+
paths: paths,
|
|
43
|
+
processing_ms: processing_ms,
|
|
44
|
+
reused_result: reused_result,
|
|
45
|
+
svg: svg
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module ConversionAllowanceUsedThisCall
|
|
6
|
+
VALUE_0 = 0
|
|
7
|
+
VALUE_1 = 1
|
|
8
|
+
SCHEMA = Codec.immutable([:enum, [VALUE_0, VALUE_1]])
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def parse(value)
|
|
12
|
+
Codec.decode(value, SCHEMA)
|
|
13
|
+
end
|
|
14
|
+
alias_method :from_h, :parse
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module ConversionFormat
|
|
6
|
+
SVG = "svg"
|
|
7
|
+
SCHEMA = Codec.immutable([:enum, [SVG]])
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def parse(value)
|
|
11
|
+
Codec.decode(value, SCHEMA)
|
|
12
|
+
end
|
|
13
|
+
alias_method :from_h, :parse
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class Error < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
code: ["code", :string, true, false, false],
|
|
8
|
+
error: ["error", :string, true, false, false],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
attr_reader :code
|
|
12
|
+
attr_reader :error
|
|
13
|
+
|
|
14
|
+
def initialize(
|
|
15
|
+
code: UNSET,
|
|
16
|
+
error: UNSET
|
|
17
|
+
)
|
|
18
|
+
super(
|
|
19
|
+
code: code,
|
|
20
|
+
error: error
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
module GetVectorFormat
|
|
6
|
+
DXF = "dxf"
|
|
7
|
+
EPS = "eps"
|
|
8
|
+
PDF = "pdf"
|
|
9
|
+
SVG = "svg"
|
|
10
|
+
SCHEMA = Codec.immutable([:enum, [DXF, EPS, PDF, SVG]])
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def parse(value)
|
|
14
|
+
Codec.decode(value, SCHEMA)
|
|
15
|
+
end
|
|
16
|
+
alias_method :from_h, :parse
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class Health < Codec::Record
|
|
6
|
+
FIELDS = Codec.immutable({
|
|
7
|
+
ok: ["ok", [:enum, [true]], true, false, false],
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
attr_reader :ok
|
|
11
|
+
|
|
12
|
+
def initialize(
|
|
13
|
+
ok: UNSET
|
|
14
|
+
)
|
|
15
|
+
super(
|
|
16
|
+
ok: ok
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class ConvertImageRequest < Codec::Record
|
|
6
|
+
OPERATION = Codec.immutable({
|
|
7
|
+
method: "POST",
|
|
8
|
+
path: "/api/v1/vectorize",
|
|
9
|
+
headers: { idempotency_key: "Idempotency-Key" },
|
|
10
|
+
body: {
|
|
11
|
+
fields: { image: ["image", :binary] },
|
|
12
|
+
default: "multipart/form-data",
|
|
13
|
+
media: {
|
|
14
|
+
"multipart/form-data" => [:multipart, :unknown],
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
responses: {
|
|
18
|
+
"200" => { "application/json" => -> { ::Vectali::Conversion } },
|
|
19
|
+
},
|
|
20
|
+
errors: {
|
|
21
|
+
"400" => { "application/json" => -> { ::Vectali::Error } },
|
|
22
|
+
"401" => { "application/json" => -> { ::Vectali::Error } },
|
|
23
|
+
"402" => { "application/json" => -> { ::Vectali::Error } },
|
|
24
|
+
"403" => { "application/json" => -> { ::Vectali::Error } },
|
|
25
|
+
"409" => { "application/json" => -> { ::Vectali::Error } },
|
|
26
|
+
"413" => { "application/json" => -> { ::Vectali::Error } },
|
|
27
|
+
"415" => { "application/json" => -> { ::Vectali::Error } },
|
|
28
|
+
"422" => { "application/json" => -> { ::Vectali::Error } },
|
|
29
|
+
"429" => { "application/json" => -> { ::Vectali::Error } },
|
|
30
|
+
"500" => { "application/json" => -> { ::Vectali::Error } },
|
|
31
|
+
"502" => { "application/json" => -> { ::Vectali::Error } },
|
|
32
|
+
"503" => { "application/json" => -> { ::Vectali::Error } },
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
FIELDS = Codec.immutable({
|
|
37
|
+
idempotency_key: ["idempotency_key", :string, false, false, false],
|
|
38
|
+
image: ["image", :binary, true, false, false],
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
# Recommended: reuse the same key with identical image bytes when retrying. Different bytes with a completed key return 409 idempotency_conflict. Omission creates a fresh key per call.
|
|
42
|
+
attr_reader :idempotency_key
|
|
43
|
+
# PNG, JPG, GIF, BMP or WebP, up to 10485760 bytes and 4000000 pixels (4096 per side).
|
|
44
|
+
attr_reader :image
|
|
45
|
+
|
|
46
|
+
def initialize(
|
|
47
|
+
idempotency_key: UNSET,
|
|
48
|
+
image:
|
|
49
|
+
)
|
|
50
|
+
super(
|
|
51
|
+
idempotency_key: idempotency_key,
|
|
52
|
+
image: image
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Code generated by forge. DO NOT EDIT.
|
|
3
|
+
|
|
4
|
+
module Vectali
|
|
5
|
+
class GetAllowanceRequest < Codec::Record
|
|
6
|
+
OPERATION = Codec.immutable({
|
|
7
|
+
method: "GET",
|
|
8
|
+
path: "/api/v1/billing",
|
|
9
|
+
responses: {
|
|
10
|
+
"200" => { "application/json" => -> { ::Vectali::BillingSummary } },
|
|
11
|
+
},
|
|
12
|
+
errors: {
|
|
13
|
+
"401" => { "application/json" => -> { ::Vectali::Error } },
|
|
14
|
+
"403" => { "application/json" => -> { ::Vectali::Error } },
|
|
15
|
+
"429" => { "application/json" => -> { ::Vectali::Error } },
|
|
16
|
+
"500" => { "application/json" => -> { ::Vectali::Error } },
|
|
17
|
+
"503" => { "application/json" => -> { ::Vectali::Error } },
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
FIELDS = {}.freeze
|
|
22
|
+
end
|
|
23
|
+
end
|