npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chinkara/sdk

v0.0.1-unstable.202310151704

Published

A TypeScript SDK for Jellyfin.

Downloads

2,128

Readme


A TypeScript SDK for Jellyfin.

Warning: This project is under active development, so API changes may occur.

Install

npm i --save @jellyfin/sdk

or

yarn add @jellyfin/sdk

Supported Jellyfin Versions

| SDK Version | Jellyfin Version | |:-:|:-:| | 0.8.2 - 0.6.0 | 10.8.1 - 10.8.9 | | 0.5.0 | 10.8.0 | | <0.5.0 | 10.7.x |

Note: Versions prior to 0.7.0 were published as @thornbill/jellyfin-sdk.

React Native

The generated Axios client used in this library depends on URL and URLSearchParams to be available on the global scope. React Native only includes incomplete implementations for these classes, so a polyfill is required. React Native URL Polyfill seems like a good solution for this.

Usage

// Create a new instance of the SDK
const jellyfin = new Jellyfin({
    clientInfo: {
        name: 'My Client Application',
        version: '1.0.0'
    },
    deviceInfo: {
        name: 'Device Name',
        id: 'unique-device-id'
    }
});

// Find a valid server by trying to connect using common protocols and ports.
// Each server receives a score based on security, speed, and other criteria.
const servers = await jellyfin.discovery.getRecommendedServerCandidates('demo.jellyfin.org/stable');
// A utility function for finding the best result is available.
// If there is no "best" server, an error message should be displayed.
const best = jellyfin.discovery.findBestServer(servers);

// Create an API instance
const api = jellyfin.createApi(best.address);

// Each API endpoint is represented by a class in the generated client.
// Helper utility functions are provided under `/lib/utils/api/` to create an
// instance of a specific Jellyfin API using the shared Configuration and Axios
// instance from the `api` object created above.

// For example, the SystemApi can be generated using the `getSystemApi`
// function in `/lib/utils/api/system-api`.

// Fetch the public system info
const info = await getSystemApi(api).getPublicSystemInfo();
console.log('Info =>', info.data);

// Fetch the list of public users
const users = await getUserApi(api).getPublicUsers();
console.log('Users =>', users.data);

// A helper method for authentication has been added to the SDK because
// the default method exposed in the generated Axios client is rather
// cumbersome to use.
const auth = await api.authenticateUserByName('demo', '');
console.log('Auth =>', auth.data);

// Authentication state is stored internally in the Api class, so now
// requests that require authentication can be made normally
const libraries = await getLibraryApi(api).getMediaFolders();
console.log('Libraries =>', libraries.data);

// A helper method for logging out the current user has been added to the
// SDK so the internal state is updated correctly.
await api.logout();

Breaking Changes

v0.8.0

  • The library is now fully targeted to ES6/ES2015. #341
  • Axios received a major version upgrade. #300

v0.7.0

  • Renamed package to @jellyfin/sdk. #262

v0.6.0

  • Updated OpenAPI spec for Jellyfin 10.8.1. #208

v0.5.0

  • Build directory is now lib instead of dist. Any imports used that were previously in dist will need updated. #147
  • Duplicated exports were removed. Any imports may need updated if you referenced one of the duplicates. #148
  • API classes are no longer exposed via getters. Instead you need to call a function passing the Api instance as a parameter. For example: getSystemApi(api). While I do feel this is a slightly worse developer experience, it was a necessary change to support tree-shaking. #149
  • BaseItemKind is now included in the generated client. Imports will need updated. #187

Roadmap to 1.0

  • [x] Use custom generator templates for API versions #231 (Currently uses sed to update the value could be improved.)
  • [x] Automate OpenAPI spec updates using GitHub #351
  • [x] Create branch tracking unstable Jellyfin builds with automated builds #354
  • [ ] Fix authentication header escaping
  • [ ] Add WebSocket API support
  • [ ] Add example projects for different ecosystems #186
  • [ ] Add utility function for getFile #164
  • [ ] More complete device profile generation utilities