Compare commits

...

6 Commits

Author SHA1 Message Date
LukeHagar
d638acb5d2 Bump version to 0.0.20 2023-04-18 21:13:34 +00:00
Luke Hagar
f87006d3e8 Update configuration.mustache 2023-04-18 16:12:34 -05:00
Luke Hagar
fcab6f2532 Update configuration.mustache 2023-04-18 16:06:36 -05:00
Luke Hagar
4c552faaf5 Update bump_version.yml 2023-04-18 16:05:39 -05:00
Luke Hagar
7ea8776750 Updated Configuration 2023-04-18 16:04:31 -05:00
GitHub Action Bot
b9487a78df Automated build 'Update plex-api-spec.yaml' typescript-axios sdk: 4736816010 2023-04-18 20:46:54 +00:00
11 changed files with 1379 additions and 454 deletions

View File

@@ -5,11 +5,6 @@ on:
inputs: inputs:
version: version:
description: The version to bump to description: The version to bump to
push:
branches:
- main
paths:
- plexjs/**
jobs: jobs:
update_typescript_version: update_typescript_version:

View File

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

View File

@@ -6,45 +6,28 @@
"scripts": { "scripts": {
"build": "rimraf ./build && tsc", "build": "rimraf ./build && tsc",
"start:dev": "npx nodemon", "start:dev": "npx nodemon",
"start": "npm run build && node build/index.js", "start": "npm run build && node build/index.js"
"lint": "eslint . --ext .ts",
"prettier-format": "run-script-os",
"prettier-format:win32": "prettier --config .prettierrc \"./src/**/*.ts\" --write",
"prettier-format:darwin:linux": "prettier --config .prettierrc 'src/**/*.ts' --write",
"prettier-format:default": "prettier --config .prettierrc 'src/**/*.ts' --write",
"prettier-watch": "run-script-os",
"prettier-watch:win32": "onchange \"src/**/*.ts\" -- prettier --write {{changed}}",
"prettier-watch:darwin:linux": "onchange 'src/**/*.ts' -- prettier --write {{changed}}",
"prettier-watch:default": "onchange 'src/**/*.ts' -- prettier --write {{changed}}"
},
"husky": {
"hooks": {
"pre-commit": "npm run test && npm run prettier-format && npm run lint"
}
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@lukehagar/plexjs": "^0.0.18", "@lukehagar/plexjs": "^0.0.19",
"@types/jest": "^28.1.8", "@types/jest": "^29.5.0",
"@types/node": "^18.6.1", "@types/node": "^18.6.1",
"@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0", "@typescript-eslint/parser": "^5.31.0",
"eslint": "^8.20.0", "eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.6.0", "eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",
"jest": "^28.1.3",
"nodemon": "^2.0.19", "nodemon": "^2.0.19",
"onchange": "^7.1.0", "onchange": "^7.1.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"rimraf": "^3.0.2", "rimraf": "^5.0.0",
"run-script-os": "^1.1.6", "run-script-os": "^1.1.6",
"ts-jest": "^28.0.7",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.7.4" "typescript": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"jest-cucumber": "^3.0.1" "jest-cucumber": "^3.0.1"

View File

@@ -1,6 +1,9 @@
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
import { Configuration, DevicesApi } from '@lukehagar/plexjs'; import { Configuration, ServerApi } from '@lukehagar/plexjs';
let config = new Configuration({ basePath: 'http://localhost:80' }); const config = new Configuration({ basePath: 'http://10.10.10.47:32400' });
const api = new ServerApi(config);
api.getServerCapabilities();
console.log('Hello world!'); console.log('Hello world!');

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -15,13 +15,82 @@
import { IAxiosRetryConfig } from "axios-retry"; import { IAxiosRetryConfig } from "axios-retry";
export interface ConfigurationParameters { export interface ConfigurationParameters {
plexToken?: string;
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); clientIdentifier?: string;
device?: string;
deviceName?: string;
platform?: string;
platformVersion?: string;
product?: string;
version?: string;
basePath?: string; basePath?: string;
} }
export class Configuration { export class Configuration {
/**
* Plex Media Server or Plex.TV Authentication token
*
* @type {string}
* @memberof Configuration
*/
plexToken?: string;
/**
* UUID, serial number, or other number unique per device
*
* @type {string}
* @memberof Configuration
*/
clientIdentifier?: string;
/**
* Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV
*
* @type {string}
* @memberof Configuration
*/
device?: string;
/**
* Customized Device Name
*
* @type {string}
* @memberof Configuration
*/
deviceName?: string;
/**
* Platform name, eg iOS, MacOSX, Android, LG, etc
*
* @type {string}
* @memberof Configuration
*/
platform?: string;
/**
* Operating system version, eg 4.3.1, 10.6.7, 3.2
*
* @type {string}
* @memberof Configuration
*/
platformVersion?: string;
/**
* Plex application name, eg Laika, Plex Media Server, Media Link
*
* @type {string}
* @memberof Configuration
*/
product?: string;
/**
* Plex application version number
*
* @type {string}
* @memberof Configuration
*/
version?: string;
/** /**
* parameter for apiKey security * parameter for apiKey security
* @param name security name * @param name security name
@@ -63,10 +132,42 @@ export class Configuration {
retriesConfig?: IAxiosRetryConfig retriesConfig?: IAxiosRetryConfig
constructor(param: ConfigurationParameters = {}) { constructor(param: ConfigurationParameters = {}) {
this.plexToken = param.plexToken;
this.clientIdentifier = param.clientIdentifier || "Plexjs";
this.device = param.device || "Unspecified";
this.deviceName = param.deviceName || "Unspecified";
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.apiKey = param.apiKey; this.apiKey = (header: string) => {
switch (header) {
case "X-Plex-Token":
return this.plexToken
case "X-Plex-Client-Identifier":
return this.clientIdentifier
case "X-Plex-Device-Name":
return this.deviceName
case "X-Plex-Device":
return this.device
case "X-Plex-Platform-Version":
return this.platformVersion
case "X-Plex-Platform":
return this.platform
case "X-Plex-Product":
return this.product
case "X-Plex-Version":
return this.version
default:
return "";
}
}
this.basePath = param.basePath; this.basePath = param.basePath;
}
public setAuthToken(token: string) {
this.plexToken = token
} }
/** /**

View File

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

View File

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

View File

@@ -4,13 +4,82 @@
import { IAxiosRetryConfig } from "axios-retry"; import { IAxiosRetryConfig } from "axios-retry";
export interface ConfigurationParameters { export interface ConfigurationParameters {
plexToken?: string;
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); clientIdentifier?: string;
device?: string;
deviceName?: string;
platform?: string;
platformVersion?: string;
product?: string;
version?: string;
basePath?: string; basePath?: string;
} }
export class Configuration { export class Configuration {
/**
* Plex Media Server or Plex.TV Authentication token
*
* @type {string}
* @memberof Configuration
*/
plexToken?: string;
/**
* UUID, serial number, or other number unique per device
*
* @type {string}
* @memberof Configuration
*/
clientIdentifier?: string;
/**
* Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV
*
* @type {string}
* @memberof Configuration
*/
device?: string;
/**
* Customized Device Name
*
* @type {string}
* @memberof Configuration
*/
deviceName?: string;
/**
* Platform name, eg iOS, MacOSX, Android, LG, etc
*
* @type {string}
* @memberof Configuration
*/
platform?: string;
/**
* Operating system version, eg 4.3.1, 10.6.7, 3.2
*
* @type {string}
* @memberof Configuration
*/
platformVersion?: string;
/**
* Plex application name, eg Laika, Plex Media Server, Media Link
*
* @type {string}
* @memberof Configuration
*/
product?: string;
/**
* Plex application version number
*
* @type {string}
* @memberof Configuration
*/
version?: string;
/** /**
* parameter for apiKey security * parameter for apiKey security
* @param name security name * @param name security name
@@ -52,10 +121,42 @@ export class Configuration {
retriesConfig?: IAxiosRetryConfig retriesConfig?: IAxiosRetryConfig
constructor(param: ConfigurationParameters = {}) { constructor(param: ConfigurationParameters = {}) {
this.plexToken = param.plexToken;
this.clientIdentifier = param.clientIdentifier || "Plexjs";
this.device = param.device || "Unspecified";
this.deviceName = param.deviceName || "Unspecified";
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.apiKey = param.apiKey; this.apiKey = (header: string) => {
switch (header) {
case "X-Plex-Token":
return this.plexToken
case "X-Plex-Client-Identifier":
return this.clientIdentifier
case "X-Plex-Device-Name":
return this.deviceName
case "X-Plex-Device":
return this.device
case "X-Plex-Platform-Version":
return this.platformVersion
case "X-Plex-Platform":
return this.platform
case "X-Plex-Product":
return this.product
case "X-Plex-Version":
return this.version
default:
return "";
}
}
this.basePath = param.basePath; this.basePath = param.basePath;
}
public setAuthToken(token: string) {
this.plexToken = token
} }
/** /**