mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
128 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 | ||
|
|
00eaf93095 | ||
|
|
d3a82b8467 | ||
|
|
85ce11cadc | ||
|
|
1b4f9dbf96 | ||
|
|
2f0a7b96d4 | ||
|
|
fa3519f1bb | ||
|
|
8afc3f323d | ||
|
|
7fd2b4ceda | ||
|
|
87bb486f1f | ||
|
|
18c735a920 | ||
|
|
331618b77a | ||
|
|
5f601ecf65 | ||
|
|
8eeef06c9c | ||
|
|
bc9335abcf | ||
|
|
792fedc759 | ||
|
|
e343455e77 | ||
|
|
7a7931b0d0 | ||
|
|
b3c26fd1a7 | ||
|
|
26fa0aef86 | ||
|
|
74ecefac8b | ||
|
|
8855195c09 | ||
|
|
227636620e | ||
|
|
5866739942 | ||
|
|
0eacb0e7c4 | ||
|
|
c0efb9a732 | ||
|
|
71484de76e | ||
|
|
be73efff0b | ||
|
|
a00c394526 | ||
|
|
3d57b22b26 | ||
|
|
995bbedbb6 | ||
|
|
d638acb5d2 | ||
|
|
f87006d3e8 | ||
|
|
fcab6f2532 | ||
|
|
4c552faaf5 | ||
|
|
7ea8776750 | ||
|
|
b9487a78df | ||
|
|
4addcb43e0 | ||
|
|
05444f54ad | ||
|
|
a7139cc510 | ||
|
|
ddbf96d1d1 | ||
|
|
a40e1f6ee9 | ||
|
|
b37ec6d21e | ||
|
|
b868a95db1 | ||
|
|
7d18553ff0 | ||
|
|
e83d09070a | ||
|
|
0794b8457e | ||
|
|
c6ba56222a | ||
|
|
e8f38b8d0a | ||
|
|
898fa0212d | ||
|
|
67a632bbc2 | ||
|
|
19c72dd7d3 | ||
|
|
f4e18606ce | ||
|
|
dfb04b01ca | ||
|
|
59185de71e | ||
|
|
ef52691a35 | ||
|
|
5ae5c02dbf | ||
|
|
3da49e7178 | ||
|
|
e8658f4d85 | ||
|
|
db5f6e554a | ||
|
|
05e801ee19 | ||
|
|
b4e644b42b | ||
|
|
6c27a91f07 | ||
|
|
abc76a4a13 | ||
|
|
1021fd9033 | ||
|
|
5cf4bcc6f6 | ||
|
|
7c7a7acbd9 | ||
|
|
ec6c29f064 | ||
|
|
caa2765c5f | ||
|
|
1ec095ed56 | ||
|
|
aefb6027f3 | ||
|
|
dc44c91c24 | ||
|
|
d6277545f3 | ||
|
|
bebf4d93ae | ||
|
|
2b8140dc54 | ||
|
|
7cb29166f7 | ||
|
|
ea30cd0cc5 | ||
|
|
1be0bd7858 | ||
|
|
ec8a3f7026 | ||
|
|
866ca99ca2 | ||
|
|
01738e4720 | ||
|
|
d2c3838c84 | ||
|
|
b57c6be086 | ||
|
|
747686ef12 | ||
|
|
7bc89004b3 | ||
|
|
b29457e4fb | ||
|
|
8af9e78276 | ||
|
|
a9c96763c0 | ||
|
|
84942e4573 | ||
|
|
ab8210088d | ||
|
|
49516f4698 | ||
|
|
0dd1acd733 | ||
|
|
d5d4cf625d | ||
|
|
0acf65e505 | ||
|
|
644d4d0e4a | ||
|
|
632f8d111f |
12
.github/workflows/build_pr.yml
vendored
12
.github/workflows/build_pr.yml
vendored
@@ -26,17 +26,17 @@ jobs:
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "16"
|
||||
|
||||
|
||||
- name: Build TS SDK
|
||||
id: buildTS
|
||||
run: |
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar -O openapi-generator-cli.jar
|
||||
rm -rf sdk-output/
|
||||
java -jar openapi-generator-cli.jar generate -i api-specs/referenced/plex-api-spec.yaml -g typescript-axios -o sdk-output/ --global-property skipFormModel=false --config config.yaml
|
||||
|
||||
rm -rf plexjs/
|
||||
java -jar openapi-generator-cli.jar generate -i api-specs/referenced/plex-api-spec.yaml -g typescript-axios -o plexjs/ --global-property skipFormModel=false --config config.yaml
|
||||
|
||||
- name: Run npm install and build Typescript SDK
|
||||
id: buildSDK
|
||||
if: steps.buildTS.outcome == 'success'
|
||||
run: |
|
||||
cd plexjs
|
||||
npm install
|
||||
npm run build
|
||||
npm run build
|
||||
|
||||
50
.github/workflows/bump_version.yml
vendored
50
.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:
|
||||
@@ -19,14 +21,13 @@ jobs:
|
||||
ref: ${{ github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
- name: Checkout API Specs Repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: lukehagar/plex-api-spec
|
||||
path: api-specs
|
||||
ref: main
|
||||
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
@@ -54,7 +55,8 @@ jobs:
|
||||
- name: Update config files with new version
|
||||
id: updateVersion
|
||||
run: |
|
||||
yq -i '.npmVersion = "${{ github.event.inputs.version }}"' config.yaml
|
||||
yq -i '.npmVersion = "${{ github.event.inputs.version }}"' sdk-resources/pms-config.yaml
|
||||
yq -i '.npmVersion = "${{ github.event.inputs.version }}"' sdk-resources/plextv-config.yaml
|
||||
|
||||
## Update package.json file with new version
|
||||
- name: Update package.json version
|
||||
@@ -62,25 +64,51 @@ jobs:
|
||||
if: steps.updateVersion.outcome == 'success'
|
||||
run: |
|
||||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
cd plexjs
|
||||
jq '.version = "${{ github.event.inputs.version }}"' package.json > package.json.tmp && mv package.json.tmp package.json
|
||||
|
||||
- name: Build TS SDK
|
||||
id: buildTS
|
||||
- name: Build PMS SDK
|
||||
id: buildPMS
|
||||
run: |
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar -O openapi-generator-cli.jar
|
||||
rm -rf sdk-output/
|
||||
java -jar openapi-generator-cli.jar generate -i api-specs/referenced/plex-api-spec.yaml -g typescript-axios -o sdk-output/ --global-property skipFormModel=false --config config.yaml
|
||||
|
||||
rm -rf plexjs/pms
|
||||
java -jar openapi-generator-cli.jar generate -i api-specs/pms/pms-spec.yaml -g typescript-axios -o plexjs/pms --global-property skipFormModel=false --config sdk-resources/pms-config.yaml
|
||||
|
||||
- name: Build PTV SDK
|
||||
id: buildPTV
|
||||
if: steps.buildPMS.outcome == 'success'
|
||||
run: |
|
||||
rm -rf plexjs/plextv
|
||||
java -jar openapi-generator-cli.jar generate -i api-specs/plextv/plextv-spec.yaml -g typescript-axios -o plexjs/plextv --global-property skipFormModel=false --config sdk-resources/plextv-config.yaml
|
||||
|
||||
- name: After SDK Build
|
||||
id: buildSDK
|
||||
if: steps.buildTS.outcome == 'success'
|
||||
if: steps.buildPTV.outcome == 'success'
|
||||
run: |
|
||||
cd plexjs
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
|
||||
- name: Publish to NPM
|
||||
id: publish
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
package: ./plexjs/package.json
|
||||
|
||||
- name: Commit changes and create new version tag
|
||||
if: steps.buildSDK.outcome == 'success'
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Bump version to ${{ github.event.inputs.version }}
|
||||
tagging_message: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.version }}
|
||||
release_name: ${{ github.event.inputs.version }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
20
.github/workflows/publish-to-npm.yml
vendored
20
.github/workflows/publish-to-npm.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Publish SDK package to npmjs
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12
|
||||
- run: |
|
||||
npm ci
|
||||
- id: publish
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
package: ./package.json
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1 +1,5 @@
|
||||
node_modules/
|
||||
node_modules
|
||||
build
|
||||
dist
|
||||
api-specs
|
||||
.env
|
||||
Submodule api-specs deleted from 462e131304
147
dist/configuration.d.ts
vendored
147
dist/configuration.d.ts
vendored
@@ -1,147 +0,0 @@
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
export interface ConfigurationParameters {
|
||||
baseurl?: string;
|
||||
clientId?: string;
|
||||
clientSecret?: string;
|
||||
accessToken?: string;
|
||||
tokenUrl?: string;
|
||||
}
|
||||
export interface Configuration {
|
||||
activeenvironment?: string;
|
||||
authtype?: string;
|
||||
customexporttemplatespath?: string;
|
||||
customsearchtemplatespath?: string;
|
||||
debug?: boolean;
|
||||
environments?: {
|
||||
[key: string]: Environment;
|
||||
};
|
||||
}
|
||||
export interface Environment {
|
||||
baseurl: string;
|
||||
pat: Pat;
|
||||
tenanturl: string;
|
||||
}
|
||||
export interface Pat {
|
||||
clientid: string;
|
||||
clientsecret: string;
|
||||
}
|
||||
export declare class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
/**
|
||||
* parameter for clientId
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
clientId?: string;
|
||||
/**
|
||||
* parameter for clientSecret
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
clientSecret?: string;
|
||||
/**
|
||||
* parameter for clientSecret
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
/**
|
||||
* parameter for oauth2 security
|
||||
* @param name security name
|
||||
* @param scopes oauth2 scope
|
||||
* @memberof Configuration
|
||||
*/
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
/**
|
||||
* parameter for clientId
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
tokenUrl?: string;
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePathBeta?: string;
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePathV3?: string;
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePathV2?: string;
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePathCC?: string;
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig;
|
||||
constructor(param?: ConfigurationParameters);
|
||||
private getParams;
|
||||
private getAccessToken;
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
isJsonMime(mime: string): boolean;
|
||||
}
|
||||
126
dist/configuration.js
vendored
126
dist/configuration.js
vendored
@@ -1,126 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Configuration = void 0;
|
||||
var axios_1 = require("axios");
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
var yaml = require("js-yaml");
|
||||
var fs = require("fs");
|
||||
var Configuration = /** @class */ (function () {
|
||||
function Configuration(param) {
|
||||
if (!param) {
|
||||
param = this.getParams();
|
||||
}
|
||||
this.basePathBeta = param.baseurl + "/beta";
|
||||
this.basePathV3 = param.baseurl + "/v3";
|
||||
this.basePathV2 = param.baseurl + "/v2";
|
||||
this.basePathCC = param.baseurl;
|
||||
this.tokenUrl = param.tokenUrl;
|
||||
this.clientId = param.clientId;
|
||||
this.clientSecret = param.clientSecret;
|
||||
var url = "".concat(this.tokenUrl, "?grant_type=client_credentials&client_id=").concat(this.clientId, "&client_secret=").concat(this.clientSecret);
|
||||
if (!this.accessToken) {
|
||||
this.accessToken = this.getAccessToken(url);
|
||||
}
|
||||
}
|
||||
Configuration.prototype.getParams = function () {
|
||||
var config = {};
|
||||
try {
|
||||
var homeDir = os.homedir();
|
||||
var configPath = path.join(homeDir, '.sailpoint', 'config.yaml');
|
||||
var doc = yaml.load(fs.readFileSync(configPath, 'utf8'));
|
||||
if (doc.authtype && doc.authtype.toLowerCase() === 'pat') {
|
||||
config.baseurl = doc.environments[doc.activeenvironment].baseurl;
|
||||
config.clientId = doc.environments[doc.activeenvironment].pat.clientid;
|
||||
config.clientSecret = doc.environments[doc.activeenvironment].pat.clientsecret;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log('unable to find config file');
|
||||
}
|
||||
config.baseurl = process.env["SAIL_BASE_URL"] ? process.env["BASE_URL"] : config.baseurl;
|
||||
config.clientId = process.env["SAIL_CLIENT_ID"] ? process.env["CLIENT_ID"] : config.clientId;
|
||||
config.clientSecret = process.env["SAIL_CLIENT_SECRET"] ? process.env["CLIENT_SECRET"] : config.clientSecret;
|
||||
config.tokenUrl = config.baseurl + '/oauth/token';
|
||||
return config;
|
||||
};
|
||||
Configuration.prototype.getAccessToken = function (url) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _a, data, status_1, error_1;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
_b.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, axios_1.default.post(url)];
|
||||
case 1:
|
||||
_a = _b.sent(), data = _a.data, status_1 = _a.status;
|
||||
if (status_1 === 200) {
|
||||
return [2 /*return*/, data.access_token];
|
||||
}
|
||||
else {
|
||||
throw new Error("Unauthorized");
|
||||
}
|
||||
return [3 /*break*/, 3];
|
||||
case 2:
|
||||
error_1 = _b.sent();
|
||||
console.error("Unable to fetch access token. Aborting.");
|
||||
throw new Error(error_1);
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
Configuration.prototype.isJsonMime = function (mime) {
|
||||
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
};
|
||||
return Configuration;
|
||||
}());
|
||||
exports.Configuration = Configuration;
|
||||
//# sourceMappingURL=configuration.js.map
|
||||
1
dist/configuration.js.map
vendored
1
dist/configuration.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../configuration.ts"],"names":[],"mappings":"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"}
|
||||
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@@ -1,3 +0,0 @@
|
||||
export * from "./sdk-output/api";
|
||||
export { Configuration, ConfigurationParameters } from "./sdk-output/configuration";
|
||||
export * as axiosRetry from "axios-retry";
|
||||
22
dist/index.js
vendored
22
dist/index.js
vendored
@@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.axiosRetry = exports.Configuration = void 0;
|
||||
__exportStar(require("./sdk-output/api"), exports);
|
||||
var configuration_1 = require("./sdk-output/configuration");
|
||||
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.Configuration; } });
|
||||
exports.axiosRetry = require("axios-retry");
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/index.js.map
vendored
1
dist/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiC;AAEjC,4DAAkF;AAA1E,8GAAA,aAAa,OAAA;AAErB,4CAAyC"}
|
||||
39
dist/paginator.d.ts
vendored
39
dist/paginator.d.ts
vendored
@@ -1,39 +0,0 @@
|
||||
export interface PaginationParams {
|
||||
/**
|
||||
* Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
||||
* @type {number}
|
||||
* @memberof AccountsApiListAccounts
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
||||
* @type {number}
|
||||
* @memberof AccountsApiListAccounts
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
||||
* @type {boolean}
|
||||
* @memberof AccountsApiListAccounts
|
||||
*/
|
||||
count?: boolean;
|
||||
/**
|
||||
* Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **id**: *eq, in* **identityId**: *eq* **name**: *eq, in* **nativeIdentity**: *eq, in* **sourceId**: *eq, in* **uncorrelated**: *eq*
|
||||
* @type {string}
|
||||
* @memberof AccountsApiListAccounts
|
||||
*/
|
||||
filters?: string;
|
||||
}
|
||||
export interface AxiosResponse<T = any, D = any> {
|
||||
data: T;
|
||||
status: number;
|
||||
statusText: string;
|
||||
request?: any;
|
||||
headers: AxiosResponseHeaders;
|
||||
}
|
||||
export declare type AxiosResponseHeaders = Record<string, string> & {
|
||||
"set-cookie"?: string[];
|
||||
};
|
||||
export declare class Paginator {
|
||||
static paginate<T, TResult, A extends PaginationParams>(thisArg: T, callbackFn: (this: T, args: A) => Promise<AxiosResponse<TResult[], any>>, args?: A, increment?: number): Promise<AxiosResponse<TResult[], any>>;
|
||||
}
|
||||
81
dist/paginator.js
vendored
81
dist/paginator.js
vendored
@@ -1,81 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Paginator = void 0;
|
||||
var Paginator = /** @class */ (function () {
|
||||
function Paginator() {
|
||||
}
|
||||
Paginator.paginate = function (thisArg, callbackFn, args, increment) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var params, maxLimit, modified, results;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
params = args ? args : { limit: 0, offset: 0 };
|
||||
maxLimit = params && params.limit ? params.limit : 0;
|
||||
if (!params.offset) {
|
||||
params.offset = 0;
|
||||
}
|
||||
if (!increment) {
|
||||
increment = 250;
|
||||
}
|
||||
params.limit = increment;
|
||||
modified = [];
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
if (!true) return [3 /*break*/, 3];
|
||||
console.log("Paginating call, offset = ".concat(params.offset));
|
||||
return [4 /*yield*/, callbackFn.call(thisArg, params)];
|
||||
case 2:
|
||||
results = _a.sent();
|
||||
modified.push.apply(modified, results.data);
|
||||
if (results.data.length < increment || (params.offset >= maxLimit && maxLimit > 0)) {
|
||||
results.data = modified;
|
||||
return [2 /*return*/, results];
|
||||
}
|
||||
params.offset += increment;
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return Paginator;
|
||||
}());
|
||||
exports.Paginator = Paginator;
|
||||
//# sourceMappingURL=paginator.js.map
|
||||
1
dist/paginator.js.map
vendored
1
dist/paginator.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"paginator.js","sourceRoot":"","sources":["../paginator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;IAAA;IAwBA,CAAC;IAvBuB,kBAAQ,GAA5B,UAAqE,OAAU,EAAE,UAAwE,EAAE,IAAQ,EAAE,SAAkB;;;;;;wBAC/K,MAAM,GAAqB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAA;wBAC5D,QAAQ,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;wBAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;4BAChB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;yBACpB;wBACD,IAAI,CAAC,SAAS,EAAE;4BACZ,SAAS,GAAG,GAAG,CAAA;yBAClB;wBACD,MAAM,CAAC,KAAK,GAAG,SAAS,CAAA;wBAEpB,QAAQ,GAAc,EAAE,CAAA;;;6BACrB,IAAI;wBACP,OAAO,CAAC,GAAG,CAAC,oCAA6B,MAAM,CAAC,MAAM,CAAE,CAAC,CAAA;wBAC3C,qBAAM,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;;wBAAhD,OAAO,GAAG,SAAsC;wBACpD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;wBAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,IAAI,QAAQ,GAAG,CAAC,CAAC,EAAE;4BAChF,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAA;4BACvB,sBAAO,OAAO,EAAA;yBACjB;wBACD,MAAM,CAAC,MAAM,IAAI,SAAS,CAAA;;;;;;KAEjC;IACL,gBAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,8BAAS"}
|
||||
2861
dist/sdk-output/api.d.ts
vendored
2861
dist/sdk-output/api.d.ts
vendored
File diff suppressed because it is too large
Load Diff
4291
dist/sdk-output/api.js
vendored
4291
dist/sdk-output/api.js
vendored
File diff suppressed because it is too large
Load Diff
1
dist/sdk-output/api.js.map
vendored
1
dist/sdk-output/api.js.map
vendored
File diff suppressed because one or more lines are too long
55
dist/sdk-output/base.d.ts
vendored
55
dist/sdk-output/base.d.ts
vendored
@@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Configuration } from "./configuration";
|
||||
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
export declare const BASE_PATH: string;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const COLLECTION_FORMATS: {
|
||||
csv: string;
|
||||
ssv: string;
|
||||
tsv: string;
|
||||
pipes: string;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RequestArgs
|
||||
*/
|
||||
export interface RequestArgs {
|
||||
url: string;
|
||||
axiosOptions: AxiosRequestConfig;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export declare class BaseAPI {
|
||||
protected basePath: string;
|
||||
protected axios: AxiosInstance;
|
||||
protected configuration: Configuration | undefined;
|
||||
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export declare class RequiredError extends Error {
|
||||
field: string;
|
||||
name: "RequiredError";
|
||||
constructor(field: string, msg?: string);
|
||||
}
|
||||
83
dist/sdk-output/base.js
vendored
83
dist/sdk-output/base.js
vendored
@@ -1,83 +0,0 @@
|
||||
"use strict";
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
var axios_1 = require("axios");
|
||||
exports.BASE_PATH = "http://10.10.10.47:32400".replace(/\/+$/, "");
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
exports.COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
var BaseAPI = /** @class */ (function () {
|
||||
function BaseAPI(configuration, basePath, axios) {
|
||||
if (basePath === void 0) { basePath = exports.BASE_PATH; }
|
||||
if (axios === void 0) { axios = axios_1.default; }
|
||||
this.basePath = basePath;
|
||||
this.axios = axios;
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
return BaseAPI;
|
||||
}());
|
||||
exports.BaseAPI = BaseAPI;
|
||||
;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
var RequiredError = /** @class */ (function (_super) {
|
||||
__extends(RequiredError, _super);
|
||||
function RequiredError(field, msg) {
|
||||
var _this = _super.call(this, msg) || this;
|
||||
_this.field = field;
|
||||
_this.name = "RequiredError";
|
||||
return _this;
|
||||
}
|
||||
return RequiredError;
|
||||
}(Error));
|
||||
exports.RequiredError = RequiredError;
|
||||
//# sourceMappingURL=base.js.map
|
||||
1
dist/sdk-output/base.js.map
vendored
1
dist/sdk-output/base.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../sdk-output/base.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;AAIH,yDAAyD;AACzD,aAAa;AACb,+BAAqF;AAExE,QAAA,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAExE;;;GAGG;AACU,QAAA,kBAAkB,GAAG;IAC9B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,GAAG;CACb,CAAC;AAYF;;;;GAIG;AACH;IAGI,iBAAY,aAA6B,EAAY,QAA4B,EAAY,KAAkC;QAA1E,yBAAA,EAAA,WAAmB,iBAAS;QAAY,sBAAA,EAAA,QAAuB,eAAW;QAA1E,aAAQ,GAAR,QAAQ,CAAoB;QAAY,UAAK,GAAL,KAAK,CAA6B;QAC3H,IAAI,aAAa,EAAE;YACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;YACnC,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;SAC3D;IACL,CAAC;IACL,cAAC;AAAD,CAAC,AATD,IASC;AATY,0BAAO;AASnB,CAAC;AAEF;;;;;GAKG;AACH;IAAmC,iCAAK;IAEpC,uBAAmB,KAAa,EAAE,GAAY;QAA9C,YACI,kBAAM,GAAG,CAAC,SACb;QAFkB,WAAK,GAAL,KAAK,CAAQ;QADhC,UAAI,GAAoB,eAAe,CAAC;;IAGxC,CAAC;IACL,oBAAC;AAAD,CAAC,AALD,CAAmC,KAAK,GAKvC;AALY,sCAAa"}
|
||||
50
dist/sdk-output/common.d.ts
vendored
50
dist/sdk-output/common.d.ts
vendored
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequestArgs } from "./base";
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const DUMMY_BASE_URL = "https://example.com";
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const toPathString: (url: URL) => string;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
||||
176
dist/sdk-output/common.js
vendored
176
dist/sdk-output/common.js
vendored
@@ -1,176 +0,0 @@
|
||||
"use strict";
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
||||
var base_1 = require("./base");
|
||||
var axios_retry_1 = require("axios-retry");
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
exports.DUMMY_BASE_URL = 'https://example.com';
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
var assertParamExists = function (functionName, paramName, paramValue) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new base_1.RequiredError(paramName, "Required parameter ".concat(paramName, " was null or undefined when calling ").concat(functionName, "."));
|
||||
}
|
||||
};
|
||||
exports.assertParamExists = assertParamExists;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
var setApiKeyToObject = function (object, keyParamName, configuration) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var localVarApiKeyValue, _a;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
if (!(configuration && configuration.apiKey)) return [3 /*break*/, 5];
|
||||
if (!(typeof configuration.apiKey === 'function')) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, configuration.apiKey(keyParamName)];
|
||||
case 1:
|
||||
_a = _b.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 2: return [4 /*yield*/, configuration.apiKey];
|
||||
case 3:
|
||||
_a = _b.sent();
|
||||
_b.label = 4;
|
||||
case 4:
|
||||
localVarApiKeyValue = _a;
|
||||
object[keyParamName] = localVarApiKeyValue;
|
||||
_b.label = 5;
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.setApiKeyToObject = setApiKeyToObject;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
var setSearchParams = function (url) {
|
||||
var objects = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
objects[_i - 1] = arguments[_i];
|
||||
}
|
||||
var searchParams = new URLSearchParams(url.search);
|
||||
for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
|
||||
var object = objects_1[_a];
|
||||
for (var key in object) {
|
||||
if (Array.isArray(object[key])) {
|
||||
searchParams.delete(key);
|
||||
for (var _b = 0, _c = object[key]; _b < _c.length; _b++) {
|
||||
var item = _c[_b];
|
||||
searchParams.append(key, item);
|
||||
}
|
||||
}
|
||||
else {
|
||||
searchParams.set(key, object[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
url.search = searchParams.toString();
|
||||
};
|
||||
exports.setSearchParams = setSearchParams;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
var serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
||||
var nonString = typeof value !== 'string';
|
||||
var needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: (value || "");
|
||||
};
|
||||
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
var toPathString = function (url) {
|
||||
return url.pathname + url.search + url.hash;
|
||||
};
|
||||
exports.toPathString = toPathString;
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
||||
return function (axios, basePath) {
|
||||
if (axios === void 0) { axios = globalAxios; }
|
||||
if (basePath === void 0) { basePath = BASE_PATH; }
|
||||
(0, axios_retry_1.default)(globalAxios, configuration.retriesConfig);
|
||||
var axiosRequestArgs = __assign(__assign({}, axiosArgs.axiosOptions), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url });
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
};
|
||||
exports.createRequestFunction = createRequestFunction;
|
||||
//# sourceMappingURL=common.js.map
|
||||
1
dist/sdk-output/common.js.map
vendored
1
dist/sdk-output/common.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../sdk-output/common.ts"],"names":[],"mappings":"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"}
|
||||
65
dist/sdk-output/configuration.d.ts
vendored
65
dist/sdk-output/configuration.d.ts
vendored
@@ -1,65 +0,0 @@
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
basePath?: string;
|
||||
}
|
||||
export declare class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig;
|
||||
constructor(param?: ConfigurationParameters);
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
isJsonMime(mime: string): boolean;
|
||||
}
|
||||
40
dist/sdk-output/configuration.js
vendored
40
dist/sdk-output/configuration.js
vendored
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Configuration = void 0;
|
||||
var Configuration = /** @class */ (function () {
|
||||
function Configuration(param) {
|
||||
if (param === void 0) { param = {}; }
|
||||
this.apiKey = param.apiKey;
|
||||
this.basePath = param.basePath;
|
||||
}
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
Configuration.prototype.isJsonMime = function (mime) {
|
||||
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
};
|
||||
return Configuration;
|
||||
}());
|
||||
exports.Configuration = Configuration;
|
||||
//# sourceMappingURL=configuration.js.map
|
||||
1
dist/sdk-output/configuration.js.map
vendored
1
dist/sdk-output/configuration.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../sdk-output/configuration.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;AAWH;IAyCI,uBAAY,KAAmC;QAAnC,sBAAA,EAAA,UAAmC;QAE3C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAEnC,CAAC;IAED;;;;;;;;;OASG;IACI,kCAAU,GAAjB,UAAkB,IAAY;QAC1B,IAAM,QAAQ,GAAW,IAAI,MAAM,CAAC,+DAA+D,EAAE,GAAG,CAAC,CAAC;QAC1G,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,6BAA6B,CAAC,CAAC;IAC1G,CAAC;IACL,oBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,sCAAa"}
|
||||
31
dist/sdk-output/index.js
vendored
31
dist/sdk-output/index.js
vendored
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./api"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/sdk-output/index.js.map
vendored
1
dist/sdk-output/index.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../sdk-output/index.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;AAGH,wCAAsB"}
|
||||
6
examples/.eslintignore
Normal file
6
examples/.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
# don't ever lint node_modules
|
||||
node_modules
|
||||
# don't lint build output (make sure it's set to your correct build folder name)
|
||||
build
|
||||
# don't lint nyc coverage output
|
||||
coverage
|
||||
19
examples/.eslintrc
Normal file
19
examples/.eslintrc
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint", "prettier", "jest"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"no-console": 1,
|
||||
"prettier/prettier": 2
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
||||
107
examples/.gitignore
vendored
Normal file
107
examples/.gitignore
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
43
examples/README.md
Normal file
43
examples/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 🧰 Simple TypeScript Starter | 2022
|
||||
|
||||
> We talk about a lot of **advanced Node.js and TypeScript** concepts on [the blog](https://khalilstemmler.com), particularly focused around Domain-Driven Design and large-scale enterprise application patterns. However, I received a few emails from readers that were interested in seeing what a basic TypeScript starter project looks like. So I've put together just that.
|
||||
|
||||
### Features
|
||||
|
||||
- Minimal
|
||||
- TypeScript v4
|
||||
- Testing with Jest
|
||||
- Linting with Eslint and Prettier
|
||||
- Pre-commit hooks with Husky
|
||||
- VS Code debugger scripts
|
||||
- Local development with Nodemon
|
||||
|
||||
### Scripts
|
||||
|
||||
#### `npm run start:dev`
|
||||
|
||||
Starts the application in development using `nodemon` and `ts-node` to do hot reloading.
|
||||
|
||||
#### `npm run start`
|
||||
|
||||
Starts the app in production by first building the project with `npm run build`, and then executing the compiled JavaScript at `build/index.js`.
|
||||
|
||||
#### `npm run build`
|
||||
|
||||
Builds the app at `build`, cleaning the folder first.
|
||||
|
||||
#### `npm run test`
|
||||
|
||||
Runs the `jest` tests once.
|
||||
|
||||
#### `npm run test:dev`
|
||||
|
||||
Run the `jest` tests in watch mode, waiting for file changes.
|
||||
|
||||
#### `npm run prettier-format`
|
||||
|
||||
Format your code.
|
||||
|
||||
#### `npm run prettier-watch`
|
||||
|
||||
Format your code in watch mode, waiting for file changes.
|
||||
6
examples/nodemon.json
Normal file
6
examples/nodemon.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"ext": ".ts,.js",
|
||||
"ignore": [],
|
||||
"exec": "npx ts-node ./src/index.ts"
|
||||
}
|
||||
17353
examples/package-lock.json
generated
Normal file
17353
examples/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
31
examples/package.json
Normal file
31
examples/package.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "typescript-starter",
|
||||
"version": "1.0.0",
|
||||
"description": "A basic typescript app starter for 2023.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "rimraf ./build && tsc",
|
||||
"dev": "npx nodemon",
|
||||
"start": "npm run build && node build/index.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@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.1",
|
||||
"run-script-os": "^1.1.6",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest-cucumber": "^3.0.1"
|
||||
}
|
||||
}
|
||||
14
examples/src/index.ts
Normal file
14
examples/src/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Configuration, ServerApi, PlexTvApi } 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 PlexTvApi(config).getDevices().then((resp) => console.log(resp));
|
||||
|
||||
new PlexTvApi(config).getUserDetails().then((resp) => console.log(resp));
|
||||
16
examples/tsconfig.json
Normal file
16
examples/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"allowJs": true,
|
||||
"outDir": "build",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["node", "jest"],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["src/**/*.spec.ts"]
|
||||
}
|
||||
4379
examples/yarn.lock
Normal file
4379
examples/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
5
index.ts
5
index.ts
@@ -1,5 +0,0 @@
|
||||
export * from "./sdk-output/api";
|
||||
|
||||
export {Configuration, ConfigurationParameters} from "./sdk-output/configuration";
|
||||
|
||||
export * as axiosRetry from "axios-retry"
|
||||
200
package-lock.json
generated
200
package-lock.json
generated
@@ -1,200 +0,0 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios-retry": "^3.4.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.20.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
|
||||
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/js-yaml": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
|
||||
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@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
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"is-retry-allowed": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/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==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/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=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.20.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
|
||||
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
}
|
||||
},
|
||||
"@types/js-yaml": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
|
||||
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
|
||||
"dev": true
|
||||
},
|
||||
"@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
|
||||
},
|
||||
"argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"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=="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"requires": {
|
||||
"argparse": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"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.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
49
plexjs/README.md
Normal file
49
plexjs/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 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)
|
||||
|
||||
## Installation
|
||||
|
||||
npm
|
||||
```bash
|
||||
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));
|
||||
```
|
||||
187
plexjs/configuration.ts
Normal file
187
plexjs/configuration.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export type ConfigurationParameters = {
|
||||
plexToken?: string;
|
||||
clientIdentifier?: string;
|
||||
device?: string;
|
||||
deviceName?: string;
|
||||
platform?: string;
|
||||
platformVersion?: string;
|
||||
product?: string;
|
||||
version?: string;
|
||||
basePath?: string;
|
||||
}
|
||||
|
||||
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
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.plexToken = param.plexToken || "";
|
||||
this.clientIdentifier = param.clientIdentifier || "plexjs";
|
||||
this.device = param.device || "plexjs";
|
||||
this.deviceName = param.deviceName || "plexjs";
|
||||
this.platform = param.platform || "plexjs";
|
||||
this.platformVersion = param.platformVersion || "0.0.22";
|
||||
this.product = param.product || "plexjs";
|
||||
this.version = param.version || "0.0.22";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public setAuthToken(token: string) {
|
||||
this.plexToken = token
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
@@ -9,4 +11,7 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
export * from "./api";
|
||||
|
||||
export * from "./plextv/api";
|
||||
export * from "./pms/api";
|
||||
export { Configuration, ConfigurationParameters } from "./configuration";
|
||||
103
plexjs/package-lock.json
generated
Normal file
103
plexjs/package-lock.json
generated
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.29",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.29",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios-retry": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"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"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@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
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"node_modules/axios-retry": {
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/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==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/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=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
@@ -10,29 +10,28 @@
|
||||
"keywords": [
|
||||
"axios",
|
||||
"typescript",
|
||||
"sdk",
|
||||
"plex"
|
||||
"openapi",
|
||||
"api",
|
||||
"plex",
|
||||
"plex media server",
|
||||
"pms",
|
||||
"plexjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/LukeHagar/plexjs/issues"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --outDir dist/",
|
||||
"build": "tsc --outDir ./dist",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios-retry": "^3.4.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
"axios-retry": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
}
|
||||
23
plexjs/plextv/.openapi-generator-ignore
Normal file
23
plexjs/plextv/.openapi-generator-ignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
12
plexjs/plextv/.openapi-generator/FILES
Normal file
12
plexjs/plextv/.openapi-generator/FILES
Normal file
@@ -0,0 +1,12 @@
|
||||
.gitignore
|
||||
.npmignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
package.json
|
||||
tsconfig.json
|
||||
1
plexjs/plextv/.openapi-generator/VERSION
Normal file
1
plexjs/plextv/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
6.3.0
|
||||
@@ -1,4 +1,4 @@
|
||||
## plexjs@0.0.5
|
||||
## 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.5 --save
|
||||
npm install plexjs@0.0.29 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
1127
plexjs/plextv/api.ts
Normal file
1127
plexjs/plextv/api.ts
Normal file
File diff suppressed because it is too large
Load Diff
71
plexjs/plextv/base.ts
Normal file
71
plexjs/plextv/base.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
|
||||
export const BASE_PATH = "https://plex.tv/api/v2".replace(/\/+$/, "");
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RequestArgs
|
||||
*/
|
||||
export interface RequestArgs {
|
||||
url: string;
|
||||
axiosOptions: AxiosRequestConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export class BaseAPI {
|
||||
protected configuration: Configuration | undefined;
|
||||
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = "https://plex.tv/api/v2" || this.basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
name: "RequiredError" = "RequiredError";
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
105
plexjs/plextv/common.ts
Normal file
105
plexjs/plextv/common.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import axiosRetry from "axios-retry";
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const DUMMY_BASE_URL = 'https://example.com'
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey(keyParamName)
|
||||
: await configuration.apiKey;
|
||||
object[keyParamName] = localVarApiKeyValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||
const searchParams = new URLSearchParams(url.search);
|
||||
for (const object of objects) {
|
||||
for (const key in object) {
|
||||
if (Array.isArray(object[key])) {
|
||||
searchParams.delete(key);
|
||||
for (const item of object[key]) {
|
||||
searchParams.append(key, item);
|
||||
}
|
||||
} else {
|
||||
searchParams.set(key, object[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
url.search = searchParams.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||
const nonString = typeof value !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: (value || "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const toPathString = function (url: URL) {
|
||||
return url.pathname + url.search + url.hash
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
axiosRetry(globalAxios, configuration.retriesConfig)
|
||||
const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
187
plexjs/plextv/configuration.ts
Normal file
187
plexjs/plextv/configuration.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export type ConfigurationParameters = {
|
||||
plexToken?: string;
|
||||
clientIdentifier?: string;
|
||||
device?: string;
|
||||
deviceName?: string;
|
||||
platform?: string;
|
||||
platformVersion?: string;
|
||||
product?: string;
|
||||
version?: string;
|
||||
basePath?: string;
|
||||
}
|
||||
|
||||
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
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.plexToken = param.plexToken || "";
|
||||
this.clientIdentifier = param.clientIdentifier || "plexjs";
|
||||
this.device = param.device || "plexjs";
|
||||
this.deviceName = param.deviceName || "plexjs";
|
||||
this.platform = param.platform || "plexjs";
|
||||
this.platformVersion = param.platformVersion || "0.0.29";
|
||||
this.product = param.product || "plexjs";
|
||||
this.version = param.version || "0.0.29";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public setAuthToken(token: string) {
|
||||
this.plexToken = token
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
57
plexjs/plextv/git_push.sh
Normal file
57
plexjs/plextv/git_push.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
18
plexjs/plextv/index.ts
Normal file
18
plexjs/plextv/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
{
|
||||
"name": "plexjs",
|
||||
"version": "0.0.5",
|
||||
"description": "OpenAPI client for plexjs",
|
||||
"author": "OpenAPI-Generator Contributors",
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
|
||||
"url": "https://github.com/LukeHagar/plexjs.git"
|
||||
},
|
||||
"keywords": [
|
||||
"axios",
|
||||
"typescript",
|
||||
"openapi-client",
|
||||
"openapi-generator",
|
||||
"openapi",
|
||||
"api",
|
||||
"plex",
|
||||
"plex media server",
|
||||
"pms",
|
||||
"plexjs"
|
||||
],
|
||||
"license": "Unlicense",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/LukeHagar/plexjs/issues"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --outDir dist/",
|
||||
"build": "tsc --outDir ./dist",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -28,8 +34,5 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "lukehagar"
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"./dist/**/*"
|
||||
]
|
||||
}
|
||||
4
plexjs/pms/.gitignore
vendored
Normal file
4
plexjs/pms/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
1
plexjs/pms/.npmignore
Normal file
1
plexjs/pms/.npmignore
Normal file
@@ -0,0 +1 @@
|
||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
||||
23
plexjs/pms/.openapi-generator-ignore
Normal file
23
plexjs/pms/.openapi-generator-ignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
12
plexjs/pms/.openapi-generator/FILES
Normal file
12
plexjs/pms/.openapi-generator/FILES
Normal file
@@ -0,0 +1,12 @@
|
||||
.gitignore
|
||||
.npmignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
package.json
|
||||
tsconfig.json
|
||||
1
plexjs/pms/.openapi-generator/VERSION
Normal file
1
plexjs/pms/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
6.3.0
|
||||
45
plexjs/pms/README.md
Normal file
45
plexjs/pms/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
## 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:
|
||||
|
||||
Environment
|
||||
* Node.js
|
||||
* Webpack
|
||||
* Browserify
|
||||
|
||||
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))
|
||||
|
||||
### Building
|
||||
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 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.29 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
File diff suppressed because it is too large
Load Diff
187
plexjs/pms/configuration.ts
Normal file
187
plexjs/pms/configuration.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export type ConfigurationParameters = {
|
||||
plexToken?: string;
|
||||
clientIdentifier?: string;
|
||||
device?: string;
|
||||
deviceName?: string;
|
||||
platform?: string;
|
||||
platformVersion?: string;
|
||||
product?: string;
|
||||
version?: string;
|
||||
basePath?: string;
|
||||
}
|
||||
|
||||
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
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.plexToken = param.plexToken || "";
|
||||
this.clientIdentifier = param.clientIdentifier || "plexjs";
|
||||
this.device = param.device || "plexjs";
|
||||
this.deviceName = param.deviceName || "plexjs";
|
||||
this.platform = param.platform || "plexjs";
|
||||
this.platformVersion = param.platformVersion || "0.0.29";
|
||||
this.product = param.product || "plexjs";
|
||||
this.version = param.version || "0.0.29";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public setAuthToken(token: string) {
|
||||
this.plexToken = token
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
57
plexjs/pms/git_push.sh
Normal file
57
plexjs/pms/git_push.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
@@ -14,4 +14,5 @@
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
||||
|
||||
38
plexjs/pms/package.json
Normal file
38
plexjs/pms/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@lukehagar/plexjs",
|
||||
"version": "0.0.29",
|
||||
"description": "Community Made Plex JS/TS Module",
|
||||
"author": "Luke Hagar",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/LukeHagar/plexjs.git"
|
||||
},
|
||||
"keywords": [
|
||||
"axios",
|
||||
"typescript",
|
||||
"openapi",
|
||||
"api",
|
||||
"plex",
|
||||
"plex media server",
|
||||
"pms",
|
||||
"plexjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/LukeHagar/plexjs/issues"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --outDir ./dist",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios-retry": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,12 @@
|
||||
],
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
],
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"./dist/**/*"
|
||||
]
|
||||
}
|
||||
23
plexjs/tsconfig.json
Normal file
23
plexjs/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"target": "ES5",
|
||||
"module": "CommonJS",
|
||||
"noImplicitAny": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": ".",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules",
|
||||
"./dist/**/*"
|
||||
]
|
||||
}
|
||||
42
readme.md
42
readme.md
@@ -1,11 +1,49 @@
|
||||
# Plex API Client
|
||||
|
||||
[](https://discord.gg/HQTPSJnWhb)
|
||||
[](https://npmjs.com/package/@lukehagar/plexjs)
|
||||
[](https://GitHub.com/LukeHagar/plexjs/tags/)
|
||||
|
||||
## 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));
|
||||
```
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Plex-API
|
||||
* An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.3
|
||||
* Contact: Lukeslakemail@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
basePath?: string;
|
||||
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
|
||||
this.apiKey = param.apiKey;
|
||||
this.basePath = param.basePath;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
{{>licenseInfo}}
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
basePath?: string;
|
||||
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
|
||||
this.apiKey = param.apiKey;
|
||||
this.basePath = param.basePath;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "{{npmName}}",
|
||||
"version": "{{npmVersion}}",
|
||||
"description": "OpenAPI client for {{npmName}}",
|
||||
"author": "OpenAPI-Generator Contributors",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
|
||||
},
|
||||
"keywords": [
|
||||
"axios",
|
||||
"typescript",
|
||||
"openapi-client",
|
||||
"openapi-generator",
|
||||
"{{npmName}}"
|
||||
],
|
||||
"license": "Unlicense",
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --outDir dist/",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"axios-retry": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.11.5",
|
||||
"typescript": "^4.0"
|
||||
}{{#npmRepository}},{{/npmRepository}}
|
||||
{{#npmRepository}}
|
||||
"publishConfig": {
|
||||
"registry": "{{npmRepository}}"
|
||||
}
|
||||
{{/npmRepository}}
|
||||
}
|
||||
176
sdk-resources/plexjs-resources/configuration.mustache
Normal file
176
sdk-resources/plexjs-resources/configuration.mustache
Normal file
@@ -0,0 +1,176 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
{{>licenseInfo}}
|
||||
import { IAxiosRetryConfig } from "axios-retry";
|
||||
|
||||
export type ConfigurationParameters = {
|
||||
plexToken?: string;
|
||||
clientIdentifier?: string;
|
||||
device?: string;
|
||||
deviceName?: string;
|
||||
platform?: string;
|
||||
platformVersion?: string;
|
||||
product?: string;
|
||||
version?: string;
|
||||
basePath?: string;
|
||||
}
|
||||
|
||||
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
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
/**
|
||||
* axios retry configuration
|
||||
*
|
||||
* @type {IAxiosRetryConfig}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
retriesConfig?: IAxiosRetryConfig
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.plexToken = param.plexToken || "";
|
||||
this.clientIdentifier = param.clientIdentifier || "{{npmName}}";
|
||||
this.device = param.device || "{{npmName}}";
|
||||
this.deviceName = param.deviceName || "{{npmName}}";
|
||||
this.platform = param.platform || "{{npmName}}";
|
||||
this.platformVersion = param.platformVersion || "{{npmVersion}}";
|
||||
this.product = param.product || "{{npmName}}";
|
||||
this.version = param.version || "{{npmVersion}}";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public setAuthToken(token: string) {
|
||||
this.plexToken = token
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
4
sdk-resources/plexjs-resources/gitignore
Normal file
4
sdk-resources/plexjs-resources/gitignore
Normal file
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
@@ -3,4 +3,5 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
export * from "./api";
|
||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
||||
{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user