Files
plexjs/docs/models/shared/mediaquery.md

9.2 KiB
Raw Blame History

MediaQuery

A querystring-based filtering language used to select subsets of media. When provided as an object, properties are serialized as a querystring using form style with explode.

Only the defined properties below are allowed. The object serializes to a querystring format like: type=4&sourceType=2&sort=duration:desc,index

Example Usage

import { MediaQuery, MediaType } from "@lukehagar/plexjs/models/shared";

let value: MediaQuery = {
  type: MediaType.Episode,
  sourceType: 2,
  sort: "duration:desc,index",
};

Fields

Field Type Required Description Example
type shared.MediaType The type of media to retrieve or filter by.

1 = movie
2 = show
3 = season
4 = episode
5 = artist
6 = album
7 = track
8 = photo_album
9 = photo

E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
2
sourceType number Change the default level to which fields refer (used with type for hierarchical queries)
sort string Field(s) to sort by, with optional modifiers. Use comma to separate multiple fields, and :desc or :nullsLast for modifiers (e.g., "duration:desc,index")
group string Field to group results by (similar to SQL GROUP BY)
limit number Maximum number of results to return