mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-07 04:20:49 +00:00
Delete sdk-resources directory
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
## {{npmName}}@{{npmVersion}}
|
|
||||||
|
|
||||||
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 {{npmName}}@{{npmVersion}} --save
|
|
||||||
```
|
|
||||||
|
|
||||||
_unPublished (not recommended):_
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
import { Configuration } from './configuration';
|
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
|
||||||
|
|
||||||
{{#models}}
|
|
||||||
{{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{^isEnum}}{{^oneOf}}{{>modelGeneric}}{{/oneOf}}{{/isEnum}}{{/model}}
|
|
||||||
{{/models}}
|
|
||||||
{{#apiInfo}}{{#apis}}
|
|
||||||
{{>apiInner}}
|
|
||||||
{{/apis}}{{/apiInfo}}
|
|
||||||
{{/withSeparateModelsAndApi}}{{#withSeparateModelsAndApi}}
|
|
||||||
{{#apiInfo}}{{#apis}}{{#operations}}export * from './{{tsApiPackage}}/{{classFilename}}';
|
|
||||||
{{/operations}}{{/apis}}{{/apiInfo}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
@@ -1,371 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...axiosOptions};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined && {{paramName}} !== null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String(JSON.stringify({{paramName}}));
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...axiosOptions.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
axiosOptions: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}axiosOptions?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}axiosOptions).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
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 = "{{{basePath}}}".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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import { Configuration } from "./configuration";
|
|
||||||
import { RequiredError, RequestArgs } from "./base";
|
|
||||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
||||||
import axiosRetry from "axios-retry";
|
|
||||||
{{#withNodeImports}}
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{/withNodeImports}}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/* 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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/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="{{{gitHost}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="{{{gitUserId}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="{{{gitRepoId}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="{{{releaseNote}}}"
|
|
||||||
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'
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
wwwroot/*.js
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
dist
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
export * from "./api";
|
|
||||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
|
||||||
{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{appName}}}
|
|
||||||
* {{{appDescription}}}
|
|
||||||
*
|
|
||||||
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
|
|
||||||
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
{{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}}
|
|
||||||
{{#models}}{{#model}}
|
|
||||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}}
|
|
||||||
{{/model}}{{/models}}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* @type {{classname}}{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export type {{classname}} = {{#allOf}}{{{.}}}{{^-last}} & {{/-last}}{{/allOf}};
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
{{#isBoolean}}
|
|
||||||
export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}
|
|
||||||
{{/isBoolean}}
|
|
||||||
|
|
||||||
{{^isBoolean}}
|
|
||||||
{{^stringEnums}}
|
|
||||||
{{>modelObjectEnum}}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{#stringEnums}}
|
|
||||||
{{>modelStringEnum}}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{/isBoolean}}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
|
|
||||||
{{#additionalPropertiesType}}
|
|
||||||
[key: string]: {{{additionalPropertiesType}}}{{^additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}};
|
|
||||||
|
|
||||||
{{/additionalPropertiesType}}
|
|
||||||
{{#vars}}
|
|
||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}
|
|
||||||
{{#deprecated}}
|
|
||||||
* @deprecated
|
|
||||||
{{/deprecated}}
|
|
||||||
*/
|
|
||||||
'{{baseName}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
|
|
||||||
{{/vars}}
|
|
||||||
}{{#hasEnums}}
|
|
||||||
|
|
||||||
{{#vars}}
|
|
||||||
{{#isEnum}}
|
|
||||||
{{#stringEnums}}
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum {{enumName}} {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{^stringEnums}}
|
|
||||||
export const {{enumName}} = {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type {{enumName}} = typeof {{enumName}}[keyof typeof {{enumName}}];
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{/isEnum}}
|
|
||||||
{{/vars}}
|
|
||||||
{{/hasEnums}}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
{{#models}}{{#model}}export * from './{{classFilename}}';{{/model}}
|
|
||||||
{{/models}}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
export const {{classname}} = {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type {{classname}} = typeof {{classname}}[keyof typeof {{classname}}];
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* @type {{classname}}{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
export enum {{classname}} {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@lukehagar/plexjs",
|
|
||||||
"version": "{{npmVersion}}",
|
|
||||||
"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",
|
|
||||||
"{{npmName}}"
|
|
||||||
],
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
|
||||||
"module": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}CommonJS{{/supportsES6}}",
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"outDir": "dist",
|
|
||||||
"rootDir": ".",
|
|
||||||
{{^supportsES6}}
|
|
||||||
"lib": [
|
|
||||||
"es6",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
{{/supportsES6}}
|
|
||||||
"typeRoots": [
|
|
||||||
"node_modules/@types"
|
|
||||||
],
|
|
||||||
"sourceMap": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"dist",
|
|
||||||
"node_modules",
|
|
||||||
"./dist/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
npmName: plexjs
|
|
||||||
npmRepository: lukehagar
|
|
||||||
npmVersion: 0.0.29
|
|
||||||
gitUserID: lukehagar
|
|
||||||
gitRepoID: plexjs
|
|
||||||
license: MIT
|
|
||||||
# useSingleRequestParameter: true
|
|
||||||
# sortParamsByRequiredFlag: true
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
templateDir: ./sdk-resources/plextv-resources
|
|
||||||
files:
|
|
||||||
package.mustache:
|
|
||||||
templateType: SupportingFiles
|
|
||||||
destinationFilename: package.json
|
|
||||||
npmName: plexjs
|
|
||||||
npmRepository: lukehagar
|
|
||||||
npmVersion: 0.0.29
|
|
||||||
gitUserID: lukehagar
|
|
||||||
gitRepoID: plexjs
|
|
||||||
license: MIT
|
|
||||||
useSingleRequestParameter: true
|
|
||||||
sortParamsByRequiredFlag: true
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
## {{npmName}}@{{npmVersion}}
|
|
||||||
|
|
||||||
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 {{npmName}}@{{npmVersion}} --save
|
|
||||||
```
|
|
||||||
|
|
||||||
_unPublished (not recommended):_
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
import { Configuration } from './configuration';
|
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
|
||||||
|
|
||||||
{{#models}}
|
|
||||||
{{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{^isEnum}}{{^oneOf}}{{>modelGeneric}}{{/oneOf}}{{/isEnum}}{{/model}}
|
|
||||||
{{/models}}
|
|
||||||
{{#apiInfo}}{{#apis}}
|
|
||||||
{{>apiInner}}
|
|
||||||
{{/apis}}{{/apiInfo}}
|
|
||||||
{{/withSeparateModelsAndApi}}{{#withSeparateModelsAndApi}}
|
|
||||||
{{#apiInfo}}{{#apis}}{{#operations}}export * from './{{tsApiPackage}}/{{classFilename}}';
|
|
||||||
{{/operations}}{{/apis}}{{/apiInfo}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
@@ -1,371 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...axiosOptions};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined && {{paramName}} !== null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String(JSON.stringify({{paramName}}));
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...axiosOptions.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
axiosOptions: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [axiosOptions] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}axiosOptions?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}axiosOptions).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}axiosOptions?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}axiosOptions).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
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 = "{{{basePath}}}".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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import { Configuration } from "./configuration";
|
|
||||||
import { RequiredError, RequestArgs } from "./base";
|
|
||||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
||||||
import axiosRetry from "axios-retry";
|
|
||||||
{{#withNodeImports}}
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{/withNodeImports}}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/* 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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/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="{{{gitHost}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="{{{gitUserId}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="{{{gitRepoId}}}"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="{{{releaseNote}}}"
|
|
||||||
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'
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
wwwroot/*.js
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
dist
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
export * from "./api";
|
|
||||||
export {Configuration, ConfigurationParameters} from "./configuration";
|
|
||||||
{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{appName}}}
|
|
||||||
* {{{appDescription}}}
|
|
||||||
*
|
|
||||||
* {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
|
|
||||||
* {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
{{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}}
|
|
||||||
import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}}
|
|
||||||
{{#models}}{{#model}}
|
|
||||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}}
|
|
||||||
{{/model}}{{/models}}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* @type {{classname}}{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export type {{classname}} = {{#allOf}}{{{.}}}{{^-last}} & {{/-last}}{{/allOf}};
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
{{#isBoolean}}
|
|
||||||
export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}
|
|
||||||
{{/isBoolean}}
|
|
||||||
|
|
||||||
{{^isBoolean}}
|
|
||||||
{{^stringEnums}}
|
|
||||||
{{>modelObjectEnum}}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{#stringEnums}}
|
|
||||||
{{>modelStringEnum}}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{/isBoolean}}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
|
|
||||||
{{#additionalPropertiesType}}
|
|
||||||
[key: string]: {{{additionalPropertiesType}}}{{^additionalPropertiesIsAnyType}}{{#hasVars}} | any{{/hasVars}}{{/additionalPropertiesIsAnyType}};
|
|
||||||
|
|
||||||
{{/additionalPropertiesType}}
|
|
||||||
{{#vars}}
|
|
||||||
/**
|
|
||||||
* {{{description}}}
|
|
||||||
* @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}
|
|
||||||
{{#deprecated}}
|
|
||||||
* @deprecated
|
|
||||||
{{/deprecated}}
|
|
||||||
*/
|
|
||||||
'{{baseName}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
|
|
||||||
{{/vars}}
|
|
||||||
}{{#hasEnums}}
|
|
||||||
|
|
||||||
{{#vars}}
|
|
||||||
{{#isEnum}}
|
|
||||||
{{#stringEnums}}
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum {{enumName}} {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
}
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{^stringEnums}}
|
|
||||||
export const {{enumName}} = {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type {{enumName}} = typeof {{enumName}}[keyof typeof {{enumName}}];
|
|
||||||
{{/stringEnums}}
|
|
||||||
{{/isEnum}}
|
|
||||||
{{/vars}}
|
|
||||||
{{/hasEnums}}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
{{#models}}{{#model}}export * from './{{classFilename}}';{{/model}}
|
|
||||||
{{/models}}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
export const {{classname}} = {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type {{classname}} = typeof {{classname}}[keyof typeof {{classname}}];
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* @type {{classname}}{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export type {{classname}} = {{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
export enum {{classname}} {
|
|
||||||
{{#allowableValues}}
|
|
||||||
{{#enumVars}}
|
|
||||||
{{#enumDescription}}
|
|
||||||
/**
|
|
||||||
* {{.}}
|
|
||||||
*/
|
|
||||||
{{/enumDescription}}
|
|
||||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
|
||||||
{{/enumVars}}
|
|
||||||
{{/allowableValues}}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@lukehagar/plexjs",
|
|
||||||
"version": "{{npmVersion}}",
|
|
||||||
"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",
|
|
||||||
"{{npmName}}"
|
|
||||||
],
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
|
||||||
"module": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}CommonJS{{/supportsES6}}",
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"outDir": "dist",
|
|
||||||
"rootDir": ".",
|
|
||||||
{{^supportsES6}}
|
|
||||||
"lib": [
|
|
||||||
"es6",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
{{/supportsES6}}
|
|
||||||
"typeRoots": [
|
|
||||||
"node_modules/@types"
|
|
||||||
],
|
|
||||||
"sourceMap": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"dist",
|
|
||||||
"node_modules",
|
|
||||||
"./dist/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
npmName: plexjs
|
|
||||||
npmRepository: lukehagar
|
|
||||||
npmVersion: 0.0.29
|
|
||||||
gitUserID: lukehagar
|
|
||||||
gitRepoID: plexjs
|
|
||||||
license: MIT
|
|
||||||
# useSingleRequestParameter: true
|
|
||||||
# sortParamsByRequiredFlag: true
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
templateDir: ./sdk-resources/plexjs-resources
|
|
||||||
files:
|
|
||||||
package.mustache:
|
|
||||||
templateType: SupportingFiles
|
|
||||||
destinationFilename: package.json
|
|
||||||
npmName: plexjs
|
|
||||||
npmRepository: lukehagar
|
|
||||||
npmVersion: 0.0.29
|
|
||||||
gitUserID: lukehagar
|
|
||||||
gitRepoID: plexjs
|
|
||||||
license: MIT
|
|
||||||
useSingleRequestParameter: true
|
|
||||||
sortParamsByRequiredFlag: true
|
|
||||||
Reference in New Issue
Block a user