mirror of
https://github.com/jellyfin/jellyfin-sdk-swift.git
synced 2024-11-27 00:10:31 +00:00
Swift SDK for Jellyfin
JellyfinAPI.doccarchive | ||
Plugins/CreateAPI | ||
Sources | ||
.gitignore | ||
.swiftformat | ||
Package.resolved | ||
Package.swift | ||
README.md |
Swift SDK Jellyfin
Swift SDK to work with Jellyfin servers.
Generated using CreateAPI
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 tokensignOut
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.
Generation
The mechanism for generating Entities, Extensions, and Paths with CreateAPI is provided as an Xcode command plugin.
- Download the latest Jellyfin schema
- Move the schema to Sources
- Delete the current Entities, Extensions, and Paths directories
- Run the following command in the package directory:
# runs the CreateAPI Xcode command plugin
$ swift package --allow-writing-to-package-directory generate-api
- New Entities, Extensions, and Paths directories should be available within the package
Alternatively, you can generate your own Swift Jellyfin SDK using CreateAPI or any other OpenAPI generator.