import { PlexObject } from './base/plexObject.ts'; import type { Connection, Device, ResourcesResponse, WebLogin } from './myplex.types.ts'; import { PlexServer } from './server.ts'; /** * MyPlex account and profile information. This object represents the data found Account on * the myplex.tv servers at the url https://plex.tv/users/account. You may create this object * directly by passing in your username & password (or token). There is also a convenience * method provided at :class:`~plexapi.server.PlexServer.myPlexAccount()` which will create * and return this object. */ export declare class MyPlexAccount { static key: string; /** * This follows the outline described in https://forums.plex.tv/t/authenticating-with-plex/609370 * to fetch a token and potentially compromise username and password. To use first call `getWebLogin()` * and present the returned uri to a user to go to, then await `webLoginCheck()`. If you pass in a * `forwardUrl`, then send the user to the returned uri, and when a request comes in on the passed in * url, then await `webLoginCheck()`. */ static getWebLogin(forwardUrl?: string | null): Promise; /** * Pass in the `webLogin` object obtained from `getWebLogin()` and this will poll Plex to see if * the user agreed. It returns a connected `MyPlexAccount` or throws an error. */ static webLoginCheck(webLogin: WebLogin, { timeoutSeconds }?: { timeoutSeconds?: number; }): Promise; FRIENDINVITE: string; HOMEUSERCREATE: string; EXISTINGUSER: string; FRIENDSERVERS: string; PLEXSERVERS: string; FRIENDUPDATE: string; REMOVEHOMEUSER: string; REMOVEINVITE: string; REQUESTED: string; REQUESTS: string; SIGNIN: string; WEBHOOKS: string; /** Your Plex account ID */ id?: number; /** Unknown */ uuid?: string; /** * auth token for user by plex */ authenticationToken?: string; /** Unknown */ certificateVersion?: number; /** Unknown. - Looks like an alias for `username` */ title?: string; /** Your current Plex email address */ email?: string; /** URL of your account thumbnail */ thumb?: string; /** Unknown */ guest?: boolean; /** Unknown */ home?: boolean; /** Unknown */ homeSize?: number; /** Unknown */ maxHomeSize?: number; /** Your Plex locale */ locale?: string | null; /** Your current mailing list status. */ mailingListStatus?: 'active' | 'inactive'; mailingListActive?: boolean; /** Email address to add items to your `Watch Later` queue. */ queueEmail?: string; /** Unknown */ restricted?: boolean; /** Description */ scrobbleTypes?: string; /** Name of subscription plan */ subscriptionPlan?: string | null; /** String representation of `subscriptionActive` */ subscriptionStatus?: 'active' | 'inactive'; /** True if your subsctiption is active */ subscriptionActive?: boolean | null; /** List of features allowed on your subscription */ subscriptionFeatures?: string[]; /** List of devices your allowed to use with this account */ entitlements?: string[]; baseUrl: string | null; username?: string; password?: string; token?: string; timeout: number; server?: PlexServer; /** * @param options Connection + auth options. */ constructor({ baseUrl, username, password, token, timeout, server, }?: { baseUrl?: string | null; username?: string; password?: string; token?: string; timeout?: number; server?: PlexServer; }); /** * Returns a new :class:`~server.PlexServer` or :class:`~client.PlexClient` object. * Often times there is more than one address specified for a server or client. * This function will prioritize local connections before remote and HTTPS before HTTP. * After trying to connect to all available addresses for this resource and * assuming at least one connection was successful, the PlexServer object is built and returned. */ connect(): Promise; /** * Returns the :class:`~plexapi.myplex.MyPlexResource` that matches the name specified. */ resource(name: string): Promise; resources(): Promise; /** * @param name Name to match against. * @param clientId clientIdentifier to match against. */ device(name?: string, clientId?: string): Promise; /** * Returns a list of all :class:`~plexapi.myplex.MyPlexDevice` objects connected to the server. */ devices(): Promise; /** * Main method used to handle HTTPS requests to the Plex client. This method helps * by encoding the response to utf-8 and parsing the returned XML into and * ElementTree object. Returns None if no data exists in the response. * TODO: use headers * @param path * @param options */ query({ url, method, headers, username, password, }: { url: string; method?: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete'; headers?: Record; username?: string; password?: string; }): Promise; /** * Returns a str, a new "claim-token", which you can use to register your new Plex Server instance to your account. * @link https://hub.docker.com/r/plexinc/pms-docker/ * @link https://www.plex.tv/claim/ */ claimToken(): Promise; /** * @param token pass token from claimToken */ claimServer(token: string): Promise; _headers(): Record; private _signin; private _loadData; } /** * This object represents resources connected to your Plex server that can provide * content such as Plex Media Servers, iPhone or Android clients, etc. */ export declare class MyPlexResource { static key: string; TAG: string; readonly account: MyPlexAccount; private readonly baseUrl; /** Descriptive name of this resource */ name: string; /** True if this resource is one of your own (you logged into it) */ owned: boolean; /** This resources accesstoken */ accessToken: string; /** Unique ID for this resource */ clientIdentifier: string; /** List of !:class!:`~myplex.ResourceConnection` objects for this resource */ connections: ResourceConnection[]; /** Timestamp this resource first connected to your server */ createdAt: Date; /** Timestamp this resource last connected */ lastSeenAt: Date; /** Best guess on the type of device this is (PS, iPhone, Linux, etc) */ device: string | null; /** Unknown */ home: boolean; /** OS the resource is running (Linux, Windows, Chrome, etc.) */ platform: string; /** Version of the platform */ platformVersion: string; /** True if the resource is online */ presence: boolean; /** Plex product (Plex Media Server, Plex for iOS, Plex Web, etc.) */ product: string; /** Version of the product. */ productVersion: string; /** List of services this resource provides (client, server, player, pubsub-player, etc.) */ provides: string; /** Unknown (possibly True if the resource has synced content?) */ synced: boolean; constructor(account: MyPlexAccount, data: ResourcesResponse, baseUrl?: string | null); connect(ssl?: boolean | null, timeout?: number): Promise; /** Remove this device from your account */ delete(): Promise; private _loadData; } export declare class ResourceConnection { TAG: string; /** Local IP address */ address: string; /** Full local address */ httpuri: string; /** True if local */ local: boolean; /** 32400 */ port: number; /** HTTP or HTTPS */ protocol: string; /** External address */ uri: string; constructor(data: Connection); private _loadData; } /** * This object represents resources connected to your Plex server that provide * playback ability from your Plex Server, iPhone or Android clients, Plex Web, * this API, etc. The raw xml for the data presented here can be found at: * https://plex.tv/devices.xml */ export declare class MyPlexDevice extends PlexObject { static TAG: string; static key: string; name: string; publicAddress: string; product: string; productVersion: string; platform: string; platformVersion: string; device: string; model: string; vendor: string; provides: string; clientIdentifier: string; version: string; id: string; token: string; screenResolution: string; screenDensity: string; createdAt: Date; lastSeenAt: Date; /** List of connection URIs for the device. */ connections?: string[]; connect(timeout?: number): Promise; /** * Remove this device from your account */ delete(): Promise; protected _loadData(data: Device): void; }