Swift SDK for Jellyfin
Go to file
2024-05-20 12:37:34 -06:00
.github/workflows Add Make unstable generation (#27) 2023-11-02 12:18:04 -06:00
Plugins/CreateAPI 10.9.2 Generation (#35) 2024-05-20 12:37:34 -06:00
Sources 10.9.2 Generation (#35) 2024-05-20 12:37:34 -06:00
.gitignore Update .gitignore 2022-08-16 23:39:51 -06:00
.spi.yml Update 10.8.13 (#32) 2024-02-18 22:34:53 -05:00
.swiftformat Update 10.8.13 (#32) 2024-02-18 22:34:53 -05:00
Makefile Add Make unstable generation (#27) 2023-11-02 12:18:04 -06:00
Package.resolved Update Get (#21) 2023-08-30 13:13:49 -06:00
Package.swift Update to CreateAPI 0.2.0 (#22) 2023-08-30 16:09:52 -06:00
README.md Provide Quick Connect Authorization Flow (#36) 2024-05-14 11:53:22 -06:00

Swift SDK Jellyfin

Swift SDK to work with Jellyfin servers.

Generated using CreateAPI

Documentation

Documentation is available on Swift Package Index.

Usage

JellyfinClient uses an underlying Get APIClient to provide basic functionality for interfacing with a Jellyfin server:

  • inject required Authorization header for every request
  • encoding/decoding of expected Date values
  • signIn for generating a session access token
  • signOut for 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.

Quick Connect

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()

Generation

# Download latest spec and run CreateAPI
$ make update

Alternatively, you can generate your own Swift Jellyfin SDK using CreateAPI or any other OpenAPI generator.