SDK Reference
Swift SDK
vendo-sdk-swift v1.0.0 — install, public surface, and reference links.
Package
| Package | vendo-sdk-swift |
| Version | 1.0.0 |
| Source | github.com/runvendo/vendo-sdk-swift |
| Changelog | CHANGELOG.md |
| Platforms | iOS 15+, macOS 12+, tvOS 15+, watchOS 8+ |
| Requires | Swift 5.9+ |
Install
In Package.swift:
.package(
url: "https://github.com/runvendo/vendo-sdk-swift",
from: "1.0.0"
)Then add "Vendo" to your target's dependencies.
Public surface
Vendo class
import Vendo
// Vendo mode (reads VENDO_API_KEY from env)
let vendo = try Vendo()
// OSS/BYOK mode
let vendo = try Vendo(apiKey: "byok")
// Explicit
let vendo = try Vendo(apiKey: "vendo_sk_...", baseURL: URL(string: "https://vendo.run/api")!)Token methods
try await vendo.token(_ slug: String) -> String
try await vendo.tokens(_ slugs: [String]) -> [String: String?]Scoping
vendo.forRequest(headers: [String: String]) throws -> Vendo // Vendo mode only
vendo.forUser(jwt: String) -> Vendo // Vendo mode onlyConnect URL
try vendo.connectURL(slug: String, returnTo: String? = nil) -> URL // Vendo mode onlySub-APIs
vendo.connections // ConnectionsAPI
vendo.integrations // IntegrationsAPI
vendo.billing // BillingAPI (Vendo mode only)
vendo.events // EventsAPI (Vendo mode only)
vendo.webhooks // WebhooksAPI (both modes)ConnectionsAPI
try await vendo.connections.list() -> [Connection]
try await vendo.connections.get(slug: String) -> Connection?IntegrationsAPI
try await vendo.integrations.list() -> [Integration]
try await vendo.integrations.get(slug: String) -> Integration?
vendo.integrations.envVars(for slug: String) -> [String] // no network callBillingAPI (Vendo mode only)
try await vendo.billing.balance() -> Balance
try await vendo.billing.spendCaps() -> [SpendCap]
try await vendo.billing.usage(period: BillingPeriod) -> UsageEventsAPI (Vendo mode only)
let stream = try vendo.events.subscribe() // AsyncThrowingStream<VendoEvent, Error>
for try await event in stream {
print(event.type, event.data)
}WebhooksAPI
let webhooks = WebhooksAPI(secret: "whsec_...")
// or:
vendo.webhooks.verify(
headers: [String: String],
body: String,
maxAgeSeconds: Int = 300
) throws -> WebhookEventVendoError enum
public enum VendoError: Error {
case auth(String)
case notConnected(String, String)
case needsReauth(String, String, URL?)
case balanceExhausted(String)
case spendCapExceeded(String)
case rateLimited(Int?)
case upstream(String)
case validation(String)
case idempotencyConflict(String)
case vendoOnlyFeature(String)
case identityNotPresent
case other(String)
}See Concepts: Errors for usage.
The Swift SDK is the only one that exposes a synchronous envVars(for:) method on IntegrationsAPI — it reads from a bundled catalog and requires no network call.