@jellyfin/sdk
    Preparing search index...

    Class Api

    Class representing the Jellyfin API.

    Index

    Constructors

    • Parameters

      • basePath: string
      • clientInfo: ClientInfo
      • deviceInfo: DeviceInfo
      • accessToken: string = ''
      • axiosInstance: AxiosInstance = globalInstance

      Returns Api

    Properties

    axiosInstance: AxiosInstance

    Accessors

    • get accessToken(): string

      Returns string

    • get authorizationHeader(): string

      Returns string

    • get basePath(): string

      Returns string

    Methods

    • Convenience method for authenticating a user by name.

      Parameters

      • username: string

        The username.

      • Optionalpassword: string

        The user password if required.

      Returns Promise<AxiosResponse<AuthenticationResult, any, {}>>

      Use getUserApi().authenticateUserByName() instead.

    • Gets a full URI for a relative URL to the Jellyfin server for a given SDK Api instance.

      Parameters

      • url: string

        The relative URL.

      • Optionalparams: object

        Any URL parameters.

      Returns string

      The complete URI with protocol, host, and base URL (if any).

    • Convenience method for logging out.

      Returns Promise<AxiosResponse<void, any, {}> | AxiosResponse<never, any, {}>>

      Use getSessionApi().reportSessionEnded() instead.

    • Type Parameters

      • T extends
            | "Play"
            | "ForceKeepAlive"
            | "GeneralCommand"
            | "UserDataChanged"
            | "Sessions"
            | "SyncPlayCommand"
            | "SyncPlayGroupUpdate"
            | "Playstate"
            | "RestartRequired"
            | "ServerShuttingDown"
            | "ServerRestarting"
            | "LibraryChanged"
            | "UserDeleted"
            | "UserUpdated"
            | "SeriesTimerCreated"
            | "TimerCreated"
            | "SeriesTimerCancelled"
            | "TimerCancelled"
            | "RefreshProgress"
            | "ScheduledTaskEnded"
            | "PackageInstallationCancelled"
            | "PackageInstallationFailed"
            | "PackageInstallationCompleted"
            | "PackageInstalling"
            | "PackageUninstalled"
            | "ActivityLogEntry"
            | "ScheduledTasksInfo"
            | "KeepAlive"

      Parameters

      • messageTypes: T[]
      • onMessage: SocketMessageHandler<T>

      Returns () => void

    • Updates this Api instance with new data.

      If the access token is cleared, any existing WebSocket connection will be closed.

      If the base path or access token changes while a WebSocket connection is active, the connection will be reconnected with the new credentials.

      Parameters

      • data: Partial<
            {
                accessToken: string;
                basePath: string;
                clientInfo: ClientInfo;
                deviceInfo: DeviceInfo;
            },
        >

        The data to update.

      Returns void