api-swift.git
ird-api-swift — native Swift client for the whole
ird API on iOS 16+ and macOS 13+.
Every one of the API's 161 operations is a typed async throws method —
domains, DNS, servers, IPFS, tunnels, p2p apps, credits, support, sharing,
transfers, jobs and API keys — with models generated from the OpenAPI spec.
One library product, IrdAPI; the p2p SDK lives in
swift.git.
Use as a dependency
No registry — a Swift Package served straight from this domain:
// Package.swift
dependencies: [
.package(url: "https://ird.cod-sursa.ro/api-swift.git", from: "0.1.0"),
],
targets: [
.target(name: "MyApp", dependencies: [.product(name: "IrdAPI", package: "api-swift")]),
]
The latest release is v0.1.0
(8411686). To pin that exact commit:
.package(url: "https://ird.cod-sursa.ro/api-swift.git", revision: "8411686ebd7bd0b39f1b9ec24a8e78c251e7ce8d")
These coordinates are filled from releases.json,
which scripts and agents can read directly (head, tag,
tag_sha per repo).
Xcode
File ▸ Add Package Dependencies…, paste
https://ird.cod-sursa.ro/api-swift.git, choose “Up to Next Major
Version” from 0.1.0, and add the IrdAPI product to your app
target. The package has no dependencies.
Quickstart
import IrdAPI
let client = IrdClient(apiKey: "ird_...") // or IrdClient(credential: KeychainCredentialStore())
let balance = try await client.credits.balance() // balance.total is a decimal String
let servers = try await client.vps.listInstances().instances
let check = try await IrdClient().domains.check(domain: "numele-meu.ro")
if check.status == .available {
let queued = try await client.registrations.register(
body: RegisterBody(domain: check.domain, years: 1, useOurDns: true))
let action = try await client.registrations.waitForAction(id: queued.action.id)
}
let upload = try await client.ipfs.addFile(url: fileURL) // grant → bytes → poll
let answer = try await client.jobs.run(.llmChat(messages: [.user("Salut!")]))
The full guide — device login and the Keychain credential store, the error
table, the domain gate for agents, pagination and every async flow — is in the
repo's README.md.
Clone
git clone https://ird.cod-sursa.ro/api-swift.git
browse the source in your browser →
What's inside
Sources/IrdAPI/Generated/— the 161 operations and their models, emitted byscripts/gen-api.pyfromspec/openapi.jsonSources/IrdAPI/Core/— client, request builder, decode table, errors, polling, pagination,JSONValueSources/IrdAPI/Credentials/— API key or account session, in memory or in the KeychainSources/IrdAPI/Gate/— the client-side domain allow/deny gate for agentsSources/IrdAPI/Flows/— jobs, uploads, device login, action polling,listAllcompanionsExamples/IrdManager/— a SwiftUI account manager for macOSTests/— offline suites, the generated inventory, env-gated live smoke and conformance sweeps
License
MIT.