Compare commits

...

7 Commits

Author SHA1 Message Date
LukeHagar
3db513ac7d Bump version to 0.0.26 2023-04-25 02:19:26 +00:00
GitHub Action Bot
fe8f8f571b Automated build 'Merge branch 'main' of https://github.com/LukeHagar/plex-api-spec' typescript-axios sdk: 4792974837 2023-04-25 02:17:43 +00:00
Luke Hagar
e65a0f1719 Merge branch 'main' of https://github.com/LukeHagar/plexjs 2023-04-19 22:48:04 -05:00
Luke Hagar
29ea6c0d75 Plex.tv works!!!! 2023-04-19 22:47:57 -05:00
LukeHagar
c5d773bf41 Bump version to 0.0.25 2023-04-20 03:43:31 +00:00
Luke Hagar
35cf322f7b Merge branch 'main' of https://github.com/LukeHagar/plexjs 2023-04-19 22:42:35 -05:00
Luke Hagar
1d03f750b9 Updated Plex.tv package template 2023-04-19 22:42:29 -05:00
16 changed files with 285 additions and 38 deletions

View File

@@ -12,9 +12,9 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@lukehagar/plexjs": "^0.0.22", "@lukehagar/plexjs": "^0.0.25",
"@types/jest": "^29.5.1", "@types/jest": "^29.5.1",
"@types/node": "^18.6.1", "@types/node": "^18.15.12",
"@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0", "@typescript-eslint/parser": "^5.31.0",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",

View File

@@ -1,9 +1,4 @@
import { import { Configuration, ServerApi, PlexTvApi } from "@lukehagar/plexjs";
Configuration,
ServerApi,
DevicesApi,
PlexTvApi,
} from "@lukehagar/plexjs";
import dotenv from "dotenv"; import dotenv from "dotenv";
dotenv.config(); dotenv.config();
@@ -12,10 +7,8 @@ const config = new Configuration({
plexToken: process.env.PLEX_TOKEN, plexToken: process.env.PLEX_TOKEN,
}); });
// new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp)); new ServerApi(config).getServerCapabilities().then((resp) => console.log(resp));
// new DevicesApi(config).getDevices().then((resp) => console.log(resp)); new PlexTvApi(config).getDevices().then((resp) => console.log(resp));
new PlexTvApi(config) new PlexTvApi(config).getUserDetails().then((resp) => console.log(resp));
.getUserDetails({ baseURL: "https://plex.tv/api/v2" })
.then((resp) => console.log(resp));

View File

@@ -592,10 +592,10 @@
"@jridgewell/resolve-uri" "3.1.0" "@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14" "@jridgewell/sourcemap-codec" "1.4.14"
"@lukehagar/plexjs@^0.0.22": "@lukehagar/plexjs@^0.0.25":
version "0.0.22" version "0.0.25"
resolved "https://registry.yarnpkg.com/@lukehagar/plexjs/-/plexjs-0.0.22.tgz#a87b9df5efee2fd553ec1bb7fe6a2b71dfdd8c27" resolved "https://registry.yarnpkg.com/@lukehagar/plexjs/-/plexjs-0.0.25.tgz#198708e8599328bec31e83c7b1e45523cbb24198"
integrity sha512-0XNjk4ocqULuNbA3tfqK0bIxBAeA64Dkk6jZUpDkI/CCji5ND+Ara38ZmDXBzT5fRioFoP35Lb2/zTLfpMc8wg== integrity sha512-qzJCSbTNKnYOjU9enVRKKdhNxmLZNAXCeXiWF4f/PVujMEU5+pMKvyUoLWA/bTOob8AjjYujy33Ab9t8gpz9eQ==
dependencies: dependencies:
axios "^0.26.1" axios "^0.26.1"
axios-retry "^3.4.0" axios-retry "^3.4.0"
@@ -821,10 +821,10 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==
"@types/node@*", "@types/node@>=13.7.0", "@types/node@^18.6.1": "@types/node@*", "@types/node@>=13.7.0", "@types/node@^18.15.12":
version "18.15.11" version "18.15.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.12.tgz#833756634e78c829e1254db006468dadbb0c696b"
integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== integrity sha512-Wha1UwsB3CYdqUm2PPzh/1gujGCNtWVUYF0mB00fJFoR4gTyWTDPjSm+zBF787Ahw8vSGgBja90MkgFwvB86Dg==
"@types/node@^11.9.4": "@types/node@^11.9.4":
version "11.15.54" version "11.15.54"

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
## plexjs@0.0.24 ## plexjs@0.0.26
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
_published:_ _published:_
``` ```
npm install plexjs@0.0.24 --save npm install plexjs@0.0.26 --save
``` ```
_unPublished (not recommended):_ _unPublished (not recommended):_

View File

@@ -52,7 +52,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.basePath || this.basePath; this.basePath = "https://plex.tv/api/v2" || this.basePath;
} }
} }
}; };

View File

@@ -137,9 +137,9 @@ export class Configuration {
this.device = param.device || "plexjs"; this.device = param.device || "plexjs";
this.deviceName = param.deviceName || "plexjs"; this.deviceName = param.deviceName || "plexjs";
this.platform = param.platform || "plexjs"; this.platform = param.platform || "plexjs";
this.platformVersion = param.platformVersion || "0.0.24"; this.platformVersion = param.platformVersion || "0.0.26";
this.product = param.product || "plexjs"; this.product = param.product || "plexjs";
this.version = param.version || "0.0.24"; this.version = param.version || "0.0.26";
this.apiKey = (header: string) => { this.apiKey = (header: string) => {
switch (header) { switch (header) {

View File

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

View File

@@ -1,4 +1,4 @@
## plexjs@0.0.24 ## plexjs@0.0.26
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
_published:_ _published:_
``` ```
npm install plexjs@0.0.24 --save npm install plexjs@0.0.26 --save
``` ```
_unPublished (not recommended):_ _unPublished (not recommended):_

View File

@@ -3362,6 +3362,260 @@ export class LogApi extends BaseAPI {
} }
/**
* MediaApi - axios parameter creator
* @export
*/
export const MediaApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* This will mark the provided media key as Played.
* @summary Mark Media Played
* @param {any} key The media key to mark as played
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
markPlayed: async (key: any, axiosOptions: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'key' is not null or undefined
assertParamExists('markPlayed', 'key', key)
const localVarPath = `/:/scrobble`;
// 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: 'GET', ...baseOptions, ...axiosOptions};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication ClientIdentifier required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Client-Identifier", configuration)
// authentication Device required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Device", configuration)
// authentication DeviceName required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Device-Name", configuration)
// authentication Platform required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Platform", configuration)
// authentication PlatformVersion required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Platform-Version", configuration)
// authentication Product required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Product", configuration)
// authentication Token required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Token", configuration)
// authentication Version required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Version", configuration)
if (key !== undefined) {
localVarQueryParameter['key'] = key;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...axiosOptions.headers};
return {
url: toPathString(localVarUrlObj),
axiosOptions: localVarRequestOptions,
};
},
/**
* This will mark the provided media key as Unplayed.
* @summary Mark Media Unplayed
* @param {any} key The media key to mark as Unplayed
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
markUnplayed: async (key: any, axiosOptions: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'key' is not null or undefined
assertParamExists('markUnplayed', 'key', key)
const localVarPath = `/:/unscrobble`;
// 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: 'GET', ...baseOptions, ...axiosOptions};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication ClientIdentifier required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Client-Identifier", configuration)
// authentication Device required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Device", configuration)
// authentication DeviceName required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Device-Name", configuration)
// authentication Platform required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Platform", configuration)
// authentication PlatformVersion required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Platform-Version", configuration)
// authentication Product required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Product", configuration)
// authentication Token required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Token", configuration)
// authentication Version required
await setApiKeyToObject(localVarHeaderParameter, "X-Plex-Version", configuration)
if (key !== undefined) {
localVarQueryParameter['key'] = key;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...axiosOptions.headers};
return {
url: toPathString(localVarUrlObj),
axiosOptions: localVarRequestOptions,
};
},
}
};
/**
* MediaApi - functional programming interface
* @export
*/
export const MediaApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = MediaApiAxiosParamCreator(configuration)
return {
/**
* This will mark the provided media key as Played.
* @summary Mark Media Played
* @param {any} key The media key to mark as played
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
async markPlayed(key: any, axiosOptions?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.markPlayed(key, axiosOptions);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* This will mark the provided media key as Unplayed.
* @summary Mark Media Unplayed
* @param {any} key The media key to mark as Unplayed
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
async markUnplayed(key: any, axiosOptions?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.markUnplayed(key, axiosOptions);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};
/**
* MediaApi - factory interface
* @export
*/
export const MediaApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = MediaApiFp(configuration)
return {
/**
* This will mark the provided media key as Played.
* @summary Mark Media Played
* @param {any} key The media key to mark as played
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
markPlayed(key: any, axiosOptions?: any): AxiosPromise<void> {
return localVarFp.markPlayed(key, axiosOptions).then((request) => request(axios, basePath));
},
/**
* This will mark the provided media key as Unplayed.
* @summary Mark Media Unplayed
* @param {any} key The media key to mark as Unplayed
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
*/
markUnplayed(key: any, axiosOptions?: any): AxiosPromise<void> {
return localVarFp.markUnplayed(key, axiosOptions).then((request) => request(axios, basePath));
},
};
};
/**
* Request parameters for markPlayed operation in MediaApi.
* @export
* @interface MediaApiMarkPlayedRequest
*/
export interface MediaApiMarkPlayedRequest {
/**
* The media key to mark as played
* @type {any}
* @memberof MediaApiMarkPlayed
*/
readonly key: any
}
/**
* Request parameters for markUnplayed operation in MediaApi.
* @export
* @interface MediaApiMarkUnplayedRequest
*/
export interface MediaApiMarkUnplayedRequest {
/**
* The media key to mark as Unplayed
* @type {any}
* @memberof MediaApiMarkUnplayed
*/
readonly key: any
}
/**
* MediaApi - object-oriented interface
* @export
* @class MediaApi
* @extends {BaseAPI}
*/
export class MediaApi extends BaseAPI {
/**
* This will mark the provided media key as Played.
* @summary Mark Media Played
* @param {MediaApiMarkPlayedRequest} requestParameters Request parameters.
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
* @memberof MediaApi
*/
public markPlayed(requestParameters: MediaApiMarkPlayedRequest, axiosOptions?: AxiosRequestConfig) {
return MediaApiFp(this.configuration).markPlayed(requestParameters.key, axiosOptions).then((request) => request(this.axios, this.basePath));
}
/**
* This will mark the provided media key as Unplayed.
* @summary Mark Media Unplayed
* @param {MediaApiMarkUnplayedRequest} requestParameters Request parameters.
* @param {*} [axiosOptions] Override http request option.
* @throws {RequiredError}
* @memberof MediaApi
*/
public markUnplayed(requestParameters: MediaApiMarkUnplayedRequest, axiosOptions?: AxiosRequestConfig) {
return MediaApiFp(this.configuration).markUnplayed(requestParameters.key, axiosOptions).then((request) => request(this.axios, this.basePath));
}
}
/** /**
* MyPlexApi - axios parameter creator * MyPlexApi - axios parameter creator
* @export * @export

View File

@@ -137,9 +137,9 @@ export class Configuration {
this.device = param.device || "plexjs"; this.device = param.device || "plexjs";
this.deviceName = param.deviceName || "plexjs"; this.deviceName = param.deviceName || "plexjs";
this.platform = param.platform || "plexjs"; this.platform = param.platform || "plexjs";
this.platformVersion = param.platformVersion || "0.0.24"; this.platformVersion = param.platformVersion || "0.0.26";
this.product = param.product || "plexjs"; this.product = param.product || "plexjs";
this.version = param.version || "0.0.24"; this.version = param.version || "0.0.26";
this.apiKey = (header: string) => { this.apiKey = (header: string) => {
switch (header) { switch (header) {

View File

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

View File

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

View File

@@ -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.basePath || this.basePath; this.basePath = "https://plex.tv/api/v2" || this.basePath;
} }
} }
}; };

View File

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