mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-07 04:20:49 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b07bac6999 | ||
|
|
dcddc72b18 | ||
|
|
591d498f7c | ||
|
|
b1b902eac3 | ||
|
|
ad603e2e66 | ||
|
|
e8423d9480 | ||
|
|
8783e65fd0 | ||
|
|
3a402640e1 | ||
|
|
387996f522 | ||
|
|
6589fbdcd1 | ||
|
|
97586f1313 | ||
|
|
041ff8984a | ||
|
|
925dd2419e | ||
|
|
3df6241d0b | ||
|
|
2178a02b6d | ||
|
|
c170ec368b | ||
|
|
f1f692b8c7 | ||
|
|
690a61d9c2 | ||
|
|
e1c8c15d05 | ||
|
|
c80882f3f7 | ||
|
|
1d2ad047bd | ||
|
|
bc1c4c63ec | ||
|
|
0eb55c9ca6 | ||
|
|
d5eaadc4dc | ||
|
|
eb0fd03f0d | ||
|
|
5dad6a62c6 | ||
|
|
3db513ac7d | ||
|
|
fe8f8f571b | ||
|
|
e65a0f1719 | ||
|
|
29ea6c0d75 | ||
|
|
c5d773bf41 | ||
|
|
35cf322f7b | ||
|
|
1d03f750b9 |
2
.github/workflows/bump_version.yml
vendored
2
.github/workflows/bump_version.yml
vendored
@@ -1,5 +1,7 @@
|
||||
name: "Update Typescript SDK Version"
|
||||
|
||||
run-name: Update Typescript SDK Version to ${{ github.event.inputs.version }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
|
||||
4169
examples/package-lock.json
generated
4169
examples/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,18 +12,18 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@lukehagar/plexjs": "^0.0.22",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/node": "^18.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
||||
"@typescript-eslint/parser": "^5.31.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"nodemon": "^2.0.19",
|
||||
"@lukehagar/plexjs": "^0.0.27",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/node": "^20.4.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
||||
"@typescript-eslint/parser": "^6.1.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"nodemon": "^3.0.1",
|
||||
"onchange": "^7.1.0",
|
||||
"rimraf": "^5.0.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"run-script-os": "^1.1.6",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.4"
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest-cucumber": "^3.0.1"
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Configuration,
|
||||
ServerApi,
|
||||
DevicesApi,
|
||||
PlexTvApi,
|
||||
} from "@lukehagar/plexjs";
|
||||
import { Configuration, ServerApi, PlexTvApi } from "@lukehagar/plexjs";
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
@@ -12,10 +7,8 @@ const config = new Configuration({
|
||||
plexToken: process.env.PLEX_TOKEN,
|
||||
});
|
||||
|
||||
// new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp));
|
||||
new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp));
|
||||
|
||||
// new DevicesApi(config).getDevices().then((resp) => console.log(resp));
|
||||
new PlexTvApi(config).getDevices().then((resp) => console.log(resp));
|
||||
|
||||
new PlexTvApi(config)
|
||||
.getUserDetails({ baseURL: "https://plex.tv/api/v2" })
|
||||
.then((resp) => console.log(resp));
|
||||
new PlexTvApi(config).getUserDetails().then((resp) => console.log(resp));
|
||||
|
||||
1005
examples/yarn.lock
1005
examples/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -1,45 +1,49 @@
|
||||
## plexjs@0.0.22
|
||||
# Plex API Client
|
||||
|
||||
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
||||
[](https://discord.gg/HQTPSJnWhb)
|
||||
[](https://npmjs.com/package/@lukehagar/plexjs)
|
||||
[](https://GitHub.com/LukeHagar/plexjs/tags/)
|
||||
|
||||
Environment
|
||||
* Node.js
|
||||
* Webpack
|
||||
* Browserify
|
||||
## Description
|
||||
|
||||
Language level
|
||||
* ES5 - you must have a Promises/A+ library installed
|
||||
* ES6
|
||||
|
||||
Module system
|
||||
* CommonJS
|
||||
* ES6 module system
|
||||
|
||||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
||||
A typescript sdk for interacting with Plex.tv and Plex Media Server REST API's.
|
||||
|
||||
### Building
|
||||
Documentation for all of the available endpoints [can be found here](https://plexapi.dev/docs/plex)
|
||||
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
## Installation
|
||||
|
||||
npm
|
||||
```bash
|
||||
npm install @lukehagar/plexjs
|
||||
```
|
||||
|
||||
### Publishing
|
||||
|
||||
First build the package then run ```npm publish```
|
||||
|
||||
### Consuming
|
||||
|
||||
navigate to the folder of your consuming project and run one of the following commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install plexjs@0.0.22 --save
|
||||
yarn
|
||||
```bash
|
||||
yarn add @lukehagar/plexjs
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import {
|
||||
Configuration,
|
||||
ServerApi,
|
||||
DevicesApi,
|
||||
UserApi,
|
||||
} from "@lukehagar/plexjs";
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
const config = new Configuration({
|
||||
basePath: process.env.BASE_PATH,
|
||||
plexToken: process.env.PLEX_TOKEN,
|
||||
});
|
||||
|
||||
new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp));
|
||||
|
||||
new DevicesApi(config).getDevices().then((resp) => console.log(resp));
|
||||
|
||||
new UserApi(config).getUserDetails().then((resp) => console.log(resp));
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
|
||||
72
plexjs/package-lock.json
generated
72
plexjs/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.24",
|
||||
"lockfileVersion": 2,
|
||||
"version": "0.0.29",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.29",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
@@ -18,9 +18,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
||||
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
|
||||
"version": "7.22.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz",
|
||||
"integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
},
|
||||
@@ -43,9 +43,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/axios-retry": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.4.0.tgz",
|
||||
"integrity": "sha512-VdgaP+gHH4iQYCCNUWF2pcqeciVOdGrBBAYUfTY+wPcO5Ltvp/37MLFNCmJKo7Gj3SHvCSdL8ouI1qLYJN3liA==",
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.5.1.tgz",
|
||||
"integrity": "sha512-mQRJ4IyAUnYig14BQ4MnnNHHuH1cNH7NW4JxEUD6mNJwK6pwOY66wKLCwZ6Y0o3POpfStalqRC+J4+Hnn6Om7w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"is-retry-allowed": "^2.2.0"
|
||||
@@ -99,59 +99,5 @@
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
||||
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.20.55",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
||||
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"axios-retry": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.4.0.tgz",
|
||||
"integrity": "sha512-VdgaP+gHH4iQYCCNUWF2pcqeciVOdGrBBAYUfTY+wPcO5Ltvp/37MLFNCmJKo7Gj3SHvCSdL8ouI1qLYJN3liA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"is-retry-allowed": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
||||
},
|
||||
"is-retry-allowed": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz",
|
||||
"integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.11",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## plexjs@0.0.24
|
||||
## plexjs@0.0.29
|
||||
|
||||
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
||||
|
||||
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install plexjs@0.0.24 --save
|
||||
npm install plexjs@0.0.29 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
@@ -52,7 +52,7 @@ export class BaseAPI {
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath || this.basePath;
|
||||
this.basePath = "https://plex.tv/api/v2" || this.basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -137,9 +137,9 @@ export class Configuration {
|
||||
this.device = param.device || "plexjs";
|
||||
this.deviceName = param.deviceName || "plexjs";
|
||||
this.platform = param.platform || "plexjs";
|
||||
this.platformVersion = param.platformVersion || "0.0.24";
|
||||
this.platformVersion = param.platformVersion || "0.0.29";
|
||||
this.product = param.product || "plexjs";
|
||||
this.version = param.version || "0.0.24";
|
||||
this.version = param.version || "0.0.29";
|
||||
|
||||
this.apiKey = (header: string) => {
|
||||
switch (header) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## plexjs@0.0.24
|
||||
## plexjs@0.0.29
|
||||
|
||||
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
||||
|
||||
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install plexjs@0.0.24 --save
|
||||
npm install plexjs@0.0.29 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
3155
plexjs/pms/api.ts
3155
plexjs/pms/api.ts
File diff suppressed because it is too large
Load Diff
@@ -137,9 +137,9 @@ export class Configuration {
|
||||
this.device = param.device || "plexjs";
|
||||
this.deviceName = param.deviceName || "plexjs";
|
||||
this.platform = param.platform || "plexjs";
|
||||
this.platformVersion = param.platformVersion || "0.0.24";
|
||||
this.platformVersion = param.platformVersion || "0.0.29";
|
||||
this.product = param.product || "plexjs";
|
||||
this.version = param.version || "0.0.24";
|
||||
this.version = param.version || "0.0.29";
|
||||
|
||||
this.apiKey = (header: string) => {
|
||||
switch (header) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
# Plex API Client
|
||||
|
||||
[](https://discord.gg/HQTPSJnWhb)
|
||||
[](https://npmjs.com/package/@lukehagar/plexjs)
|
||||
[](https://GitHub.com/LukeHagar/plexjs/tags/)
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
|
||||
A typescript sdk for interacting with Plex.tv and Plex Media Server REST API's.
|
||||
|
||||
Documentation for all of the available endpoints [can be found here](https://plexapi.dev/docs/plex)
|
||||
|
||||
@@ -5,7 +5,7 @@ files:
|
||||
destinationFilename: package.json
|
||||
npmName: plexjs
|
||||
npmRepository: lukehagar
|
||||
npmVersion: 0.0.24
|
||||
npmVersion: 0.0.29
|
||||
useSingleRequestParameter: true
|
||||
sortParamsByRequiredFlag: true
|
||||
gitUserID: lukehagar
|
||||
|
||||
@@ -41,7 +41,7 @@ export class BaseAPI {
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath || this.basePath;
|
||||
this.basePath = "https://plex.tv/api/v2" || this.basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ files:
|
||||
destinationFilename: package.json
|
||||
npmName: plexjs
|
||||
npmRepository: lukehagar
|
||||
npmVersion: 0.0.24
|
||||
npmVersion: 0.0.29
|
||||
useSingleRequestParameter: true
|
||||
sortParamsByRequiredFlag: true
|
||||
gitUserID: lukehagar
|
||||
|
||||
Reference in New Issue
Block a user