mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 20:47:46 +00:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
f75d22cf6a | ||
|
|
705cd5f26b | ||
|
|
5162542903 | ||
|
|
f412ddd4d5 | ||
|
|
3f4ea2071e | ||
|
|
76726427e2 | ||
|
|
1536e4e888 | ||
|
|
0789f62dcf | ||
|
|
bcbd24903b | ||
|
|
09ad25d937 | ||
|
|
d39c0dd2e2 | ||
|
|
e7c4df7bab | ||
|
|
bc037dd491 | ||
|
|
55f0566e2f | ||
|
|
10fcbd2e6c | ||
|
|
6367e344e7 |
6
.github/workflows/build_pr.yml
vendored
6
.github/workflows/build_pr.yml
vendored
@@ -30,13 +30,13 @@ jobs:
|
|||||||
- name: Build TS SDK
|
- name: Build TS SDK
|
||||||
id: buildTS
|
id: buildTS
|
||||||
run: |
|
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 plexjs/
|
||||||
rm -rf sdk-output/
|
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
|
||||||
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
|
|
||||||
|
|
||||||
- name: Run npm install and build Typescript SDK
|
- name: Run npm install and build Typescript SDK
|
||||||
id: buildSDK
|
id: buildSDK
|
||||||
if: steps.buildTS.outcome == 'success'
|
if: steps.buildTS.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
|
cd plexjs
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
41
.github/workflows/bump_version.yml
vendored
41
.github/workflows/bump_version.yml
vendored
@@ -19,7 +19,6 @@ jobs:
|
|||||||
ref: ${{ github.ref }}
|
ref: ${{ github.ref }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|
||||||
- name: Checkout API Specs Repo
|
- name: Checkout API Specs Repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@@ -56,26 +55,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
yq -i '.npmVersion = "${{ github.event.inputs.version }}"' config.yaml
|
yq -i '.npmVersion = "${{ github.event.inputs.version }}"' config.yaml
|
||||||
|
|
||||||
## Update package.json file with new version
|
|
||||||
- name: Update package.json version
|
|
||||||
id: updatePackageJsonVersion
|
|
||||||
if: steps.updateVersion.outcome == 'success'
|
|
||||||
run: |
|
|
||||||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
|
|
||||||
cd sdk-output
|
|
||||||
jq '.version = "${{ github.event.inputs.version }}"' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
||||||
|
|
||||||
- name: Build TS SDK
|
- name: Build TS SDK
|
||||||
id: buildTS
|
id: buildTS
|
||||||
run: |
|
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 plexjs/
|
||||||
rm -rf sdk-output/
|
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
|
||||||
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
|
|
||||||
|
|
||||||
- name: After SDK Build
|
- name: After SDK Build
|
||||||
id: buildSDK
|
id: buildSDK
|
||||||
if: steps.buildTS.outcome == 'success'
|
if: steps.buildTS.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
|
cd plexjs
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
@@ -85,3 +75,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
commit_message: Bump version to ${{ github.event.inputs.version }}
|
commit_message: Bump version to ${{ github.event.inputs.version }}
|
||||||
tagging_message: ${{ 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
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
- run: |
|
||||||
|
cd plexjs
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
- id: publish
|
||||||
|
uses: JS-DevTools/npm-publish@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.NPM_TOKEN }}
|
||||||
|
package: ./plexjs/package.json
|
||||||
|
|||||||
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: ./sdk-output/package.json
|
|
||||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
build
|
||||||
|
dist
|
||||||
|
api-specs
|
||||||
|
.env
|
||||||
@@ -5,5 +5,8 @@ files:
|
|||||||
destinationFilename: package.json
|
destinationFilename: package.json
|
||||||
npmName: plexjs
|
npmName: plexjs
|
||||||
npmRepository: lukehagar
|
npmRepository: lukehagar
|
||||||
npmVersion: 0.0.1
|
npmVersion: 0.0.13
|
||||||
useSingleRequestParameter: true
|
useSingleRequestParameter: true
|
||||||
|
sortParamsByRequiredFlag: true
|
||||||
|
gitUserID: lukehagar
|
||||||
|
gitRepoID: plexjs
|
||||||
|
|||||||
217
configuration.ts
217
configuration.ts
@@ -1,217 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as yaml from "js-yaml";
|
|
||||||
import * as fs from "fs";
|
|
||||||
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 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) {
|
|
||||||
|
|
||||||
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;
|
|
||||||
const url = `${this.tokenUrl}?grant_type=client_credentials&client_id=${this.clientId}&client_secret=${this.clientSecret}`;
|
|
||||||
if (!this.accessToken) {
|
|
||||||
this.accessToken = this.getAccessToken(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private getParams(): ConfigurationParameters {
|
|
||||||
const config: ConfigurationParameters = {}
|
|
||||||
try {
|
|
||||||
const homeDir = os.homedir()
|
|
||||||
const configPath = path.join(homeDir, '.sailpoint','config.yaml')
|
|
||||||
const doc = yaml.load(fs.readFileSync(configPath, 'utf8')) as Configuration
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getAccessToken(url: string): Promise<string> {
|
|
||||||
try {
|
|
||||||
const {data, status} = await axios.post(url)
|
|
||||||
if (status === 200) {
|
|
||||||
return data.access_token;
|
|
||||||
} else {
|
|
||||||
throw new Error("Unauthorized")
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Unable to fetch access token. Aborting.");
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
examples/index.ts
Normal file
1
examples/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import { Configuration } from "@lukehagar/plexjs";
|
||||||
15
examples/package.json
Normal file
15
examples/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "examples",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Examples using the plexjs package",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npx ts-node index.ts",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "lukehagar",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@lukehagar/plexjs": "^0.0.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
47
examples/yarn-error.log
Normal file
47
examples/yarn-error.log
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
Arguments:
|
||||||
|
C:\Program Files\nodejs\node.exe C:\Users\Luke\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js add --dev plexjs
|
||||||
|
|
||||||
|
PATH:
|
||||||
|
C:\Python311\Scripts\;C:\Python311\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Go\bin;C:\Users\Luke\.console-ninja\.bin;C:\Users\Luke\AppData\Local\Microsoft\WindowsApps;C:\Users\Luke\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Luke\AppData\Local\GitHubDesktop\bin;C:\Users\Luke\go\bin;C:\Users\Luke\AppData\Roaming\npm;C:\Users\Luke\go\bin
|
||||||
|
|
||||||
|
Yarn version:
|
||||||
|
1.22.19
|
||||||
|
|
||||||
|
Node version:
|
||||||
|
18.14.2
|
||||||
|
|
||||||
|
Platform:
|
||||||
|
win32 x64
|
||||||
|
|
||||||
|
Trace:
|
||||||
|
Error: https://registry.yarnpkg.com/plexjs: Not found
|
||||||
|
at params.callback [as _callback] (C:\Users\Luke\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:66145:18)
|
||||||
|
at self.callback (C:\Users\Luke\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:140890:22)
|
||||||
|
at Request.emit (node:events:513:28)
|
||||||
|
at Request.<anonymous> (C:\Users\Luke\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141862:10)
|
||||||
|
at Request.emit (node:events:513:28)
|
||||||
|
at IncomingMessage.<anonymous> (C:\Users\Luke\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:141784:12)
|
||||||
|
at Object.onceWrapper (node:events:627:28)
|
||||||
|
at IncomingMessage.emit (node:events:525:35)
|
||||||
|
at endReadableNT (node:internal/streams/readable:1359:12)
|
||||||
|
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
|
||||||
|
|
||||||
|
npm manifest:
|
||||||
|
{
|
||||||
|
"name": "examples",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Examples using the plexjs package",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npx ts-node index.ts",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "lukehagar",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
|
||||||
|
yarn manifest:
|
||||||
|
No manifest
|
||||||
|
|
||||||
|
Lockfile:
|
||||||
|
No lockfile
|
||||||
48
examples/yarn.lock
Normal file
48
examples/yarn.lock
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@babel/runtime@^7.15.4":
|
||||||
|
version "7.21.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673"
|
||||||
|
integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime "^0.13.11"
|
||||||
|
|
||||||
|
"@lukehagar/plexjs@^0.0.7":
|
||||||
|
version "0.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@lukehagar/plexjs/-/plexjs-0.0.7.tgz#c0d51facae8a6d91cc88f064b3f2427c70cffa8e"
|
||||||
|
integrity sha512-bDMzCkXB89YFTq+EdsmLtePco9o0nKlDW8RTW7a0Xy1tqJJETlA58E/32xC+xuXxLD0uyjsw/SKUN0qBaSDNsg==
|
||||||
|
dependencies:
|
||||||
|
axios "^0.26.1"
|
||||||
|
axios-retry "^3.4.0"
|
||||||
|
|
||||||
|
axios-retry@^3.4.0:
|
||||||
|
version "3.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios-retry/-/axios-retry-3.4.0.tgz#f464dbe9408e5aa78fa319afd38bb69b533d8854"
|
||||||
|
integrity sha512-VdgaP+gHH4iQYCCNUWF2pcqeciVOdGrBBAYUfTY+wPcO5Ltvp/37MLFNCmJKo7Gj3SHvCSdL8ouI1qLYJN3liA==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.15.4"
|
||||||
|
is-retry-allowed "^2.2.0"
|
||||||
|
|
||||||
|
axios@^0.26.1:
|
||||||
|
version "0.26.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
|
||||||
|
integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "^1.14.8"
|
||||||
|
|
||||||
|
follow-redirects@^1.14.8:
|
||||||
|
version "1.15.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||||
|
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||||
|
|
||||||
|
is-retry-allowed@^2.2.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz#88f34cbd236e043e71b6932d09b0c65fb7b4d71d"
|
||||||
|
integrity sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==
|
||||||
|
|
||||||
|
regenerator-runtime@^0.13.11:
|
||||||
|
version "0.13.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
|
||||||
|
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
|
||||||
24
index.ts
24
index.ts
@@ -1,24 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* IdentityNow V3 API
|
|
||||||
* Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 3.0.0
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 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 "./sdk-output/api";
|
|
||||||
export {Configuration as ConfigurationBeta, ConfigurationParameters as ConfigurationParameter} from "./sdk-output/configuration";
|
|
||||||
|
|
||||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
|
||||||
|
|
||||||
export * from "./paginator";
|
|
||||||
|
|
||||||
export * as axiosRetry from "axios-retry"
|
|
||||||
BIN
openapi-generator-cli.jar
Normal file
BIN
openapi-generator-cli.jar
Normal file
Binary file not shown.
63
paginator.ts
63
paginator.ts
@@ -1,63 +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 type AxiosResponseHeaders = Record<string, string> & {
|
|
||||||
"set-cookie"?: string[]
|
|
||||||
};
|
|
||||||
|
|
||||||
export class Paginator {
|
|
||||||
public static async 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>> {
|
|
||||||
let params: PaginationParams = args ? args : {limit: 0, offset: 0}
|
|
||||||
const maxLimit = params && params.limit ? params.limit : 0
|
|
||||||
if (!params.offset) {
|
|
||||||
params.offset = 0
|
|
||||||
}
|
|
||||||
if (!increment) {
|
|
||||||
increment = 250
|
|
||||||
}
|
|
||||||
params.limit = increment
|
|
||||||
|
|
||||||
let modified: TResult[] = []
|
|
||||||
while (true) {
|
|
||||||
console.log(`Paginating call, offset = ${params.offset}`)
|
|
||||||
let results = await callbackFn.call(thisArg, params)
|
|
||||||
modified.push.apply(modified, results.data)
|
|
||||||
if (results.data.length < increment || (params.offset >= maxLimit && maxLimit > 0)) {
|
|
||||||
results.data = modified
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
params.offset += increment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4
plexjs/.gitignore
vendored
Normal file
4
plexjs/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
wwwroot/*.js
|
||||||
|
node_modules
|
||||||
|
typings
|
||||||
|
dist
|
||||||
1
plexjs/.npmignore
Normal file
1
plexjs/.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/.openapi-generator-ignore
Normal file
23
plexjs/.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/.openapi-generator/FILES
Normal file
12
plexjs/.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/.openapi-generator/VERSION
Normal file
1
plexjs/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
|||||||
|
6.3.0
|
||||||
45
plexjs/README.md
Normal file
45
plexjs/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
## plexjs@0.0.13
|
||||||
|
|
||||||
|
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.13 --save
|
||||||
|
```
|
||||||
|
|
||||||
|
_unPublished (not recommended):_
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||||
5250
plexjs/api.ts
Normal file
5250
plexjs/api.ts
Normal file
File diff suppressed because it is too large
Load Diff
71
plexjs/base.ts
Normal file
71
plexjs/base.ts
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/* 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 { Configuration } from "./configuration";
|
||||||
|
// Some imports not used depending on template conditions
|
||||||
|
// @ts-ignore
|
||||||
|
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||||
|
|
||||||
|
export const BASE_PATH = "http://10.10.10.47:32400".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 = configuration.basePath || 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/common.ts
Normal file
105
plexjs/common.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/* 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 { 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
86
plexjs/configuration.ts
Normal file
86
plexjs/configuration.ts
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
57
plexjs/git_push.sh
Normal file
57
plexjs/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/index.ts
Normal file
18
plexjs/index.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export * from "./api";
|
||||||
|
export * from "./configuration";
|
||||||
|
|
||||||
77
package-lock.json → plexjs/package-lock.json
generated
77
package-lock.json → plexjs/package-lock.json
generated
@@ -1,28 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.13",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.13",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.26.1",
|
"axios": "^0.26.1",
|
||||||
"axios-retry": "^3.4.0",
|
"axios-retry": "^3.4.0"
|
||||||
"js-yaml": "^4.1.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "^4.0.5",
|
|
||||||
"@types/node": "^12.11.5",
|
"@types/node": "^12.11.5",
|
||||||
"typescript": "^4.0"
|
"typescript": "^4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
"version": "7.20.13",
|
"version": "7.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
||||||
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
|
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"regenerator-runtime": "^0.13.11"
|
"regenerator-runtime": "^0.13.11"
|
||||||
},
|
},
|
||||||
@@ -30,23 +28,12 @@
|
|||||||
"node": ">=6.9.0"
|
"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": {
|
"node_modules/@types/node": {
|
||||||
"version": "12.20.55",
|
"version": "12.20.55",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
||||||
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
||||||
"dev": true
|
"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": {
|
"node_modules/axios": {
|
||||||
"version": "0.26.1",
|
"version": "0.26.1",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||||
@@ -94,26 +81,15 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"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": {
|
"node_modules/regenerator-runtime": {
|
||||||
"version": "0.13.11",
|
"version": "0.13.11",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.8.4",
|
"version": "4.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
@@ -126,30 +102,19 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": {
|
"@babel/runtime": {
|
||||||
"version": "7.20.13",
|
"version": "7.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
|
||||||
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
|
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"regenerator-runtime": "^0.13.11"
|
"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": {
|
"@types/node": {
|
||||||
"version": "12.20.55",
|
"version": "12.20.55",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
|
||||||
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
|
||||||
"dev": true
|
"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": {
|
"axios": {
|
||||||
"version": "0.26.1",
|
"version": "0.26.1",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||||
@@ -177,23 +142,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz",
|
||||||
"integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="
|
"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": {
|
"regenerator-runtime": {
|
||||||
"version": "0.13.11",
|
"version": "0.13.11",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.8.4",
|
"version": "4.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"name": "plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.13",
|
||||||
"description": "Community Made Plex JS/TS Module",
|
"description": "Community Made Plex JS/TS Module",
|
||||||
"author": "Luke Hagar",
|
"author": "Luke Hagar",
|
||||||
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/lukehagar/plexjs.git"
|
"url": "https://github.com/LukeHagar/plexjs.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"axios",
|
"axios",
|
||||||
"typescript",
|
"typescript",
|
||||||
"sdk",
|
"openapi",
|
||||||
"plex"
|
"api",
|
||||||
|
"plex",
|
||||||
|
"plex media server",
|
||||||
|
"pms",
|
||||||
|
"plexjs"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/lukehagar/plexjs/issues"
|
"url": "https://github.com/LukeHagar/plexjs/issues"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"typings": "./dist/index.d.ts",
|
"typings": "./dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --outDir dist/",
|
"build": "tsc --outDir ./dist",
|
||||||
"prepare": "npm run build"
|
"prepare": "npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.26.1",
|
"axios": "^0.26.1",
|
||||||
"axios-retry": "^3.4.0",
|
"axios-retry": "^3.4.0"
|
||||||
"js-yaml": "^4.1.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "^4.0.5",
|
|
||||||
"@types/node": "^12.11.5",
|
"@types/node": "^12.11.5",
|
||||||
"typescript": "^4.0"
|
"typescript": "^4.0"
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"target": "ES5",
|
"target": "ES5",
|
||||||
"module": "CommonJS",
|
"module": "CommonJS",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"outDir": "dist",
|
"outDir": "./dist",
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6",
|
"es6",
|
||||||
@@ -12,8 +12,7 @@
|
|||||||
],
|
],
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
]
|
||||||
"sourceMap": true
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
|
|
||||||
{{^withSeparateModelsAndApi}}
|
{{^withSeparateModelsAndApi}}
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from './configuration';
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||||
{{#withNodeImports}}
|
{{#withNodeImports}}
|
||||||
// URLSearchParams not necessarily used
|
// URLSearchParams not necessarily used
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
|
|
||||||
import { Configuration } from "../configuration";
|
import { Configuration } from "./configuration";
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||||
@@ -41,7 +41,7 @@ export class BaseAPI {
|
|||||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
this.basePath = configuration.basePathV3 || this.basePath;
|
this.basePath = configuration.basePath || this.basePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
|
|
||||||
import { Configuration } from "../configuration";
|
import { Configuration } from "./configuration";
|
||||||
import { RequiredError, RequestArgs } from "./base";
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||||
import axiosRetry from "axios-retry";
|
import axiosRetry from "axios-retry";
|
||||||
@@ -40,41 +40,6 @@ export const setApiKeyToObject = async function (object: any, keyParamName: stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && (configuration.username || configuration.password)) {
|
|
||||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const accessToken = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken()
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + accessToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken(name, scopes)
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -126,8 +91,7 @@ export const toPathString = function (url: URL) {
|
|||||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
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) => {
|
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
axiosRetry(globalAxios, configuration.retriesConfig)
|
axiosRetry(globalAxios, configuration.retriesConfig)
|
||||||
axiosArgs.axiosOptions.headers['X-SailPoint-SDK'] = 'typescript-{{npmVersion}}'
|
const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePathV3 || basePath) + axiosArgs.url};
|
|
||||||
return axios.request<T, R>(axiosRequestArgs);
|
return axios.request<T, R>(axiosRequestArgs);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
|
import { IAxiosRetryConfig } from "axios-retry";
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
|
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
basePath?: string;
|
basePath?: string;
|
||||||
baseOptions?: any;
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Configuration {
|
export class Configuration {
|
||||||
@@ -19,27 +17,7 @@ export class Configuration {
|
|||||||
* @memberof Configuration
|
* @memberof Configuration
|
||||||
*/
|
*/
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
username?: string;
|
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
password?: string;
|
|
||||||
/**
|
|
||||||
* 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>);
|
|
||||||
/**
|
/**
|
||||||
* override base path
|
* override base path
|
||||||
*
|
*
|
||||||
@@ -47,6 +25,7 @@ export class Configuration {
|
|||||||
* @memberof Configuration
|
* @memberof Configuration
|
||||||
*/
|
*/
|
||||||
basePath?: string;
|
basePath?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base options for axios calls
|
* base options for axios calls
|
||||||
*
|
*
|
||||||
@@ -54,6 +33,7 @@ export class Configuration {
|
|||||||
* @memberof Configuration
|
* @memberof Configuration
|
||||||
*/
|
*/
|
||||||
baseOptions?: any;
|
baseOptions?: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FormData constructor that will be used to create multipart form data
|
* The FormData constructor that will be used to create multipart form data
|
||||||
* requests. You can inject this here so that execution environments that
|
* requests. You can inject this here so that execution environments that
|
||||||
@@ -63,14 +43,19 @@ export class Configuration {
|
|||||||
*/
|
*/
|
||||||
formDataCtor?: new () => any;
|
formDataCtor?: new () => any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* axios retry configuration
|
||||||
|
*
|
||||||
|
* @type {IAxiosRetryConfig}
|
||||||
|
* @memberof Configuration
|
||||||
|
*/
|
||||||
|
retriesConfig?: IAxiosRetryConfig
|
||||||
|
|
||||||
constructor(param: ConfigurationParameters = {}) {
|
constructor(param: ConfigurationParameters = {}) {
|
||||||
|
|
||||||
this.apiKey = param.apiKey;
|
this.apiKey = param.apiKey;
|
||||||
this.username = param.username;
|
|
||||||
this.password = param.password;
|
|
||||||
this.accessToken = param.accessToken;
|
|
||||||
this.basePath = param.basePath;
|
this.basePath = param.basePath;
|
||||||
this.baseOptions = param.baseOptions;
|
|
||||||
this.formDataCtor = param.formDataCtor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
{{>licenseInfo}}
|
{{>licenseInfo}}
|
||||||
|
|
||||||
export * from "./api";
|
export * from "./api";
|
||||||
|
export * from "./configuration";
|
||||||
{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}}
|
{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}}
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "{{npmName}}",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "{{npmVersion}}",
|
"version": "{{npmVersion}}",
|
||||||
"description": "OpenAPI client for {{npmName}}",
|
"description": "Community Made Plex JS/TS Module",
|
||||||
"author": "OpenAPI-Generator Contributors",
|
"author": "Luke Hagar",
|
||||||
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
|
"url": "https://github.com/LukeHagar/plexjs.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"axios",
|
"axios",
|
||||||
"typescript",
|
"typescript",
|
||||||
"openapi-client",
|
"openapi",
|
||||||
"openapi-generator",
|
"api",
|
||||||
|
"plex",
|
||||||
|
"plex media server",
|
||||||
|
"pms",
|
||||||
"{{npmName}}"
|
"{{npmName}}"
|
||||||
],
|
],
|
||||||
"license": "Unlicense",
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/LukeHagar/plexjs/issues"
|
||||||
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"typings": "./dist/index.d.ts",
|
"typings": "./dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --outDir dist/",
|
"build": "tsc --outDir ./dist",
|
||||||
"prepare": "npm run build"
|
"prepare": "npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -28,10 +35,5 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.11.5",
|
"@types/node": "^12.11.5",
|
||||||
"typescript": "^4.0"
|
"typescript": "^4.0"
|
||||||
}{{#npmRepository}},{{/npmRepository}}
|
|
||||||
{{#npmRepository}}
|
|
||||||
"publishConfig": {
|
|
||||||
"registry": "{{npmRepository}}"
|
|
||||||
}
|
}
|
||||||
{{/npmRepository}}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
||||||
"module": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}CommonJS{{/supportsES6}}",
|
"module": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}CommonJS{{/supportsES6}}",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"outDir": "dist",
|
"outDir": "./dist",
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
{{^supportsES6}}
|
{{^supportsES6}}
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|||||||
Reference in New Issue
Block a user