infrawrench-sdk
Generated Ruby client for the Infrawrench API (API version 0.3.0).
Do not edit this gem by hand — it is regenerated from openapi.json and is
not checked into the repository. Run
pnpm --filter @infrawrench/web generate:sdk to rebuild it; the generator lives
in app/packages/web/scripts/sdk.
Requires Ruby 3.0+. No runtime dependencies — net/http, uri and json
from the standard library, nothing else.
Usage
require "infrawrench/sdk"
client = Infrawrench::APIV1Client.new(
api_key: ENV.fetch("INFRAWRENCH_API_KEY"),
org_id: ENV.fetch("INFRAWRENCH_ORG_ID")
)
begin
accounts = client.accounts.list
rescue Infrawrench::ApiError => e
warn "#{e.status} #{e.code}: #{e.body}"
end
Calls are namespaced to mirror the URL structure, so
POST /api/org/{orgId}/accounts/{id}/sync is
client.accounts.sync(id: id), and nesting goes as deep as the paths do —
client.invitations.by_token.get. Set org_id: once on the client and every org-scoped call can
omit it; pass org_id: on an individual call to override it.
Every method takes an optional trailing request_options: hash (:headers,
:timeout, :open_timeout).
Responses and errors
Responses are the plain Hash/Array that JSON.parse returns, with String
keys spelled exactly as the wire spells them. There are no model classes — see
sig/infrawrench/sdk.rbs for the shape of every one of the
183 schemas, as RBS type aliases that steep and TypeProf can read.
Non-2xx responses raise Infrawrench::ApiError, which carries #status,
the parsed #body, and the machine-readable #code when the API sends one —
branch on #code, not on the message. A missing org_id raises
Infrawrench::ConfigurationError before anything is sent.
Uploads
File fields accept a String of bytes, any IO, or an Infrawrench::Upload when
you want to control the filename and content type:
client.storage.upload(
body: {
"accountId" => account_id,
"bucket" => bucket,
"key" => "logs/today.txt",
"file" => File.open("today.txt")
}
)
Testing
http_handler: replaces the network call. It receives (URI, Net::HTTPRequest)
and returns anything that answers code, body and []:
client = Infrawrench::APIV1Client.new(
api_key: "test",
org_id: "org_1",
http_handler: ->(uri, req) { recorded << [req.method, uri.to_s]; fake_response }
)
Scope
This gem covers the published API surface only. Operations marked
x-internal in the spec — the admin surface, webhook receivers, desktop sync,
push registration, and the browser auth redirects — are not generated.
License
MIT — see LICENSE. Copyright (c) 2026 Infrawrench LLC.
Note that this client is more permissively licensed than the service it talks to: the Infrawrench source is BUSL-1.1, but the generated clients are MIT so you can link one into your own software without inheriting those terms.