Ursus Airlock
An Urbit HTTP/%eyre client for iOS/macOS in Swift.
See my Ursus Chat repository for a demo project.
Usage
Ursus Airlock is very much a work in progress - better documentation and a demo app to come. Here's a quick sketch for now:
let airlock = Airlock(url: URL(string: "http://localhost")!, code: "fipfes-fipfes-fipfes-fipfes")
airlock.loginRequest() { result in
switch result {
case .success(let ship):
airlock.connect()
airlock.subscribeRequest(ship: ship, app: "chat-view", path: "/primary") { event in
print(event)
}
case .failure(let error):
print(error)
}
}Installation
Ursus can be installed using Cocoapods by adding the following line to your podfile:
pod 'UrsusAirlock', '~> 1.8'I can probably help set up Carthage or Swift Package Manager support if you need it.
Todo list
Things that would make this codebase nicer:
- Should the new
%logoutendpoint clear theurbauthcookie? - Pass IDs back through to the event handlers so unsubscribe requests can be made.
- Event source request should initially
.putto create a new channel before.getto retrieve the existing channel; have tried this but%eyrereturns a 400 error code. - Login and channel requests could use state enums to maintain
LoginStateandChannelState- If user is not authenticated or the channel is not connected, then requests can be chained together.
- Poke and subscribe handlers could be removed with a custom response serializer.
- Test
UnsubscribeRequest,DeleteRequestproperly. - Better documentation/examples.