Compare commits

...

17 Commits

Author SHA1 Message Date
LukeHagar
bc9335abcf Bump version to 0.0.21 2023-04-19 15:21:42 +00:00
GitHub Action Bot
792fedc759 Automated build 'Merge branch 'main' of https://github.com/LukeHagar/plex-api-spec' typescript-axios sdk: 4744818290 2023-04-19 14:59:37 +00:00
GitHub Action Bot
e343455e77 Automated build 'added geoip, adjusted tags' typescript-axios sdk: 4744665738 2023-04-19 14:43:35 +00:00
GitHub Action Bot
7a7931b0d0 Automated build 'Merge branch 'main' of https://github.com/LukeHagar/plex-api-spec' typescript-axios sdk: 4744587370 2023-04-19 14:35:42 +00:00
GitHub Action Bot
b3c26fd1a7 Automated build 'Added Photo, myPlex, and search endpoints' typescript-axios sdk: 4744497330 2023-04-19 14:27:18 +00:00
GitHub Action Bot
26fa0aef86 Automated build 'Added Schemas, Edited endpoint order in referenced spec' typescript-axios sdk: 4744017438 2023-04-19 13:40:37 +00:00
GitHub Action Bot
74ecefac8b Automated build 'Added new endpoints' typescript-axios sdk: 4738906190 2023-04-19 02:29:00 +00:00
Luke Hagar
8855195c09 Update readme.md 2023-04-18 20:27:16 -05:00
Luke Hagar
227636620e Update readme.md 2023-04-18 20:26:37 -05:00
Luke Hagar
5866739942 Merge branch 'main' of https://github.com/LukeHagar/plexjs 2023-04-18 20:24:40 -05:00
Luke Hagar
0eacb0e7c4 Improving examples and intellisense 2023-04-18 20:24:34 -05:00
Luke Hagar
c0efb9a732 Update readme.md 2023-04-18 20:19:53 -05:00
Luke Hagar
71484de76e Update readme.md 2023-04-18 20:19:28 -05:00
Luke Hagar
be73efff0b Update readme.md 2023-04-18 20:12:26 -05:00
Luke Hagar
a00c394526 Update readme.md 2023-04-18 20:11:06 -05:00
Luke Hagar
3d57b22b26 Update readme.md 2023-04-18 20:10:37 -05:00
Luke Hagar
995bbedbb6 Update readme.md 2023-04-18 20:09:24 -05:00
12 changed files with 2691 additions and 1135 deletions

View File

@@ -5,7 +5,7 @@ files:
destinationFilename: package.json
npmName: plexjs
npmRepository: lukehagar
npmVersion: 0.0.20
npmVersion: 0.0.21
useSingleRequestParameter: true
sortParamsByRequiredFlag: true
gitUserID: lukehagar

View File

@@ -1,5 +0,0 @@
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80
}

View File

@@ -5,25 +5,21 @@
"main": "index.js",
"scripts": {
"build": "rimraf ./build && tsc",
"start:dev": "npx nodemon",
"dev": "npx nodemon",
"start": "npm run build && node build/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@lukehagar/plexjs": "^0.0.19",
"@lukehagar/plexjs": "^0.0.20",
"@types/jest": "^29.5.0",
"@types/node": "^18.6.1",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"dotenv": "^16.0.3",
"nodemon": "^2.0.19",
"onchange": "^7.1.0",
"prettier": "^2.7.1",
"rimraf": "^5.0.0",
"run-script-os": "^1.1.6",
"ts-node": "^10.9.1",

View File

@@ -1,9 +1,19 @@
// eslint-disable-next-line no-console
import { Configuration, ServerApi } from '@lukehagar/plexjs';
import {
Configuration,
ServerApi,
DevicesApi,
UserApi,
} from "@lukehagar/plexjs";
import dotenv from "dotenv";
dotenv.config();
const config = new Configuration({ basePath: 'http://10.10.10.47:32400' });
const api = new ServerApi(config);
const config = new Configuration({
basePath: process.env.BASE_PATH,
plexToken: process.env.PLEX_TOKEN,
});
api.getServerCapabilities();
new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp));
console.log('Hello world!');
new DevicesApi(config).getDevices().then((resp) => console.log(resp));
new UserApi(config).getUserDetails().then((resp) => console.log(resp));

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
## plexjs@0.0.20
## plexjs@0.0.21
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.20 --save
npm install plexjs@0.0.21 --save
```
_unPublished (not recommended):_

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
import { IAxiosRetryConfig } from "axios-retry";
export interface ConfigurationParameters {
export type ConfigurationParameters = {
plexToken?: string;
clientIdentifier?: string;
device?: string;
@@ -90,7 +90,7 @@ export class Configuration {
* @memberof Configuration
*/
version?: string;
/**
* parameter for apiKey security
* @param name security name
@@ -134,12 +134,12 @@ export class Configuration {
constructor(param: ConfigurationParameters = {}) {
this.plexToken = param.plexToken;
this.clientIdentifier = param.clientIdentifier || "Plexjs";
this.device = param.device || "Unspecified";
this.deviceName = param.deviceName || "Unspecified";
this.device = param.device;
this.deviceName = param.deviceName;
this.platform = param.platform || "Plexjs";
this.platformVersion = param.platformVersion || process.env.npm_package_version;
this.product = param.product || "Plexjs";
this.version = param.version || process.env.npm_package_version;
this.platformVersion = param.platformVersion;
this.product = param.product;
this.version = param.version;
this.apiKey = (header: string) => {
switch (header) {

View File

@@ -1,12 +1,12 @@
{
"name": "@lukehagar/plexjs",
"version": "0.0.20",
"version": "0.0.21",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@lukehagar/plexjs",
"version": "0.0.20",
"version": "0.0.21",
"license": "MIT",
"dependencies": {
"axios": "^0.26.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@lukehagar/plexjs",
"version": "0.0.20",
"version": "0.0.21",
"description": "Community Made Plex JS/TS Module",
"author": "Luke Hagar",
"repository": {

View File

@@ -2,10 +2,42 @@
## Description
A typescript sdk for accessing the Plex.tv and Plex Media Server REST API's.
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)
## Installation
npm
```bash
npm install plexjs
npm install @lukehagar/plexjs
```
yarn
```bash
yarn add @lukehagar/plexjs
```
## 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));
```

View File

@@ -3,7 +3,7 @@
{{>licenseInfo}}
import { IAxiosRetryConfig } from "axios-retry";
export interface ConfigurationParameters {
export type ConfigurationParameters = {
plexToken?: string;
clientIdentifier?: string;
device?: string;
@@ -79,7 +79,7 @@ export class Configuration {
* @memberof Configuration
*/
version?: string;
/**
* parameter for apiKey security
* @param name security name
@@ -123,12 +123,12 @@ export class Configuration {
constructor(param: ConfigurationParameters = {}) {
this.plexToken = param.plexToken;
this.clientIdentifier = param.clientIdentifier || "Plexjs";
this.device = param.device || "Unspecified";
this.deviceName = param.deviceName || "Unspecified";
this.device = param.device;
this.deviceName = param.deviceName;
this.platform = param.platform || "Plexjs";
this.platformVersion = param.platformVersion || process.env.npm_package_version;
this.product = param.product || "Plexjs";
this.version = param.version || process.env.npm_package_version;
this.platformVersion = param.platformVersion;
this.product = param.product;
this.version = param.version;
this.apiKey = (header: string) => {
switch (header) {