Swift SDK to work with Jellyfin servers.
Generated using CreateAPI
Documentation is available on Swift Package Index.
JellyfinClient uses an underlying Get APIClient to provide basic functionality for interfacing with a Jellyfin server:
- inject required
Authorizationheader for every request - encoding/decoding of expected
Datevalues signInfor generating a session access tokensignOutfor revoking the current access token
// Create client instance
let jellyfinClient = JellyfinClient(configuration: configuration)
// Sign in user with credentials
let response = jellyfinClient.signIn(username: "jelly", password: "fin")Alternatively, you can use your own network stack with the generated Entities and Paths.
The QuickConnect object has been provided to perform the Quick Connect authorization flow.
/// Create a QuickConnect object with a JellyfinClient
let quickConnect = QuickConnect(client: client)
let quickConnectState = Task {
/// Listen to QuickConnect states with async/await or Combine
for await state in quickConnect.$state.values {
switch state {
/// Other cases ommitted
case let .polling(code: code):
print(code)
case let .authenticated(secret: secret):
/// Sign in with the Quick Connect secret
client.signIn(quickConnectSecret: secret)
}
}
}
/// Start the Quick Connect authorization flow
quickConnect.start()# Download latest spec and run CreateAPI
$ make updateAlternatively, you can generate your own Swift Jellyfin SDK using CreateAPI or any other OpenAPI generator.