Compare commits

..

5 Commits

109 changed files with 1147 additions and 602 deletions

View File

@@ -1,19 +1,20 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: 16f22cbf-f23f-4419-8924-3a4b06381947 id: 16f22cbf-f23f-4419-8924-3a4b06381947
management: management:
docChecksum: 34d22936f2456c2c461abdfc773e3fc4 docChecksum: 45c73686e6dbe8c29b7e2857b6194ccf
docVersion: 0.0.3 docVersion: 0.0.3
speakeasyVersion: internal speakeasyVersion: internal
generationVersion: 2.228.1 generationVersion: 2.237.2
releaseVersion: 0.3.1 releaseVersion: 0.4.1
configChecksum: 708deaec8a7918d4523ce16e1e18874a configChecksum: 2bbf5255fdb0ef20c753ed46816eda5b
repoURL: https://github.com/LukeHagar/plexjs.git repoURL: https://github.com/LukeHagar/plexjs.git
repoSubDirectory: . repoSubDirectory: .
installationURL: https://github.com/LukeHagar/plexjs installationURL: https://github.com/LukeHagar/plexjs
published: true published: true
features: features:
typescript: typescript:
core: 3.4.2 constsAndDefaults: 0.1.1
core: 3.4.7
flattening: 2.81.1 flattening: 2.81.1
globalSecurity: 2.82.2 globalSecurity: 2.82.2
globalServerURLs: 2.82.1 globalServerURLs: 2.82.1
@@ -35,12 +36,14 @@ generatedFiles:
- src/sdk/sdk.ts - src/sdk/sdk.ts
- .eslintrc.js - .eslintrc.js
- .npmignore - .npmignore
- RUNTIMES.md
- package-lock.json - package-lock.json
- package.json - package.json
- src/index.ts - src/index.ts
- src/lib/base64.ts - src/lib/base64.ts
- src/lib/config.ts - src/lib/config.ts
- src/lib/encodings.ts - src/lib/encodings.ts
- src/lib/event-streams.ts
- src/lib/http.ts - src/lib/http.ts
- src/lib/retries.ts - src/lib/retries.ts
- src/lib/sdks.ts - src/lib/sdks.ts
@@ -262,6 +265,10 @@ generatedFiles:
- docs/models/operations/getrecentlyaddedmediacontainer.md - docs/models/operations/getrecentlyaddedmediacontainer.md
- docs/models/operations/getrecentlyaddedresponsebody.md - docs/models/operations/getrecentlyaddedresponsebody.md
- docs/models/operations/getrecentlyaddedresponse.md - docs/models/operations/getrecentlyaddedresponse.md
- docs/models/operations/location.md
- docs/models/operations/getlibrariesdirectory.md
- docs/models/operations/getlibrariesmediacontainer.md
- docs/models/operations/getlibrariesresponsebody.md
- docs/models/operations/getlibrariesresponse.md - docs/models/operations/getlibrariesresponse.md
- docs/models/operations/includedetails.md - docs/models/operations/includedetails.md
- docs/models/operations/getlibraryrequest.md - docs/models/operations/getlibraryrequest.md

View File

@@ -36,13 +36,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerCapabilities(); const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result);
}
// handle response
} }
run(); run();
@@ -172,20 +169,23 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerCapabilities().catch((err) => { let result;
if (err instanceof errors.GetServerCapabilitiesResponseBody) { try {
console.error(err); // handle exception result = await sdk.server.getServerCapabilities();
return null; } catch (err) {
} else { switch (true) {
throw err; case err instanceof errors.GetServerCapabilitiesResponseBody: {
console.error(err); // handle exception
return;
}
default: {
throw err;
}
} }
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
} }
// handle response // Handle the result
console.log(result);
} }
run(); run();
@@ -198,13 +198,30 @@ run();
### Select Server by Index ### Select Server by Index
You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: You can override the default server globally by passing a server index to the `serverIdx` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables | | # | Server | Variables |
| - | ------ | --------- | | - | ------ | --------- |
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `http`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) | | 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `http`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
```typescript
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
serverIdx: 0,
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerCapabilities();
// Handle the result
console.log(result);
}
run();
```
#### Variables #### Variables
@@ -215,7 +232,26 @@ Some of the server options above contain variables. If you want to set the value
### Override Server URL Per-Client ### Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example: The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example:
```typescript
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
serverURL: "{protocol}://{ip}:{port}",
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerCapabilities();
// Handle the result
console.log(result);
}
run();
```
<!-- End Server Selection [server] --> <!-- End Server Selection [server] -->
<!-- Start Custom HTTP Client [http-client] --> <!-- Start Custom HTTP Client [http-client] -->
@@ -287,13 +323,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerCapabilities(); const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result);
}
// handle response
} }
run(); run();
@@ -301,6 +334,12 @@ run();
``` ```
<!-- End Authentication [security] --> <!-- End Authentication [security] -->
<!-- Start Requirements [requirements] -->
## Requirements
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
<!-- End Requirements [requirements] -->
<!-- Placeholder for Future Speakeasy SDK Sections --> <!-- Placeholder for Future Speakeasy SDK Sections -->
# Development # Development

View File

@@ -48,4 +48,54 @@ Based on:
### Generated ### Generated
- [typescript v0.3.1] . - [typescript v0.3.1] .
### Releases ### Releases
- [NPM v0.3.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.1 - . - [NPM v0.3.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.1 - .
## 2024-01-09 00:28:08
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.134.0 (2.230.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.3.2] .
### Releases
- [NPM v0.3.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.2 - .
## 2024-01-10 00:27:58
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.134.1 (2.230.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.3.3] .
### Releases
- [NPM v0.3.3] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.3.3 - .
## 2024-01-16 00:27:43
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.141.1 (2.233.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.4.0] .
### Releases
- [NPM v0.4.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.0 - .
## 2024-01-17 00:27:57
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.142.1 (2.234.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.4.0] .
### Releases
- [NPM v0.4.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.0 - .
## 2024-01-18 23:37:12
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.147.0 (2.237.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.4.1] .
### Releases
- [NPM v0.4.1] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.1 - .

22
RUNTIMES.md Normal file
View File

@@ -0,0 +1,22 @@
# Supported JavaScript runtimes
This SDK is intended to be used in JavaScript runtimes that support the following features:
* [Web Fetch API][web-fetch]
* [Web Streams API](web-streams) and in particular `ReadableStream`
* [Async iterables][async-iter] using `Symbol.asyncIterator`
[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
Runtime environments that are explicitly supported are:
- Evergreen browsers which include: Chrome, Safari, Edge, Firefox
- Node.js active and maintenance LTS releases
- Currently, this is v18 and v20
- Bun v1 and above
- Deno v1.39
- Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
[deno-file-streaming]: https://github.com/denoland/deno/issues/11018

View File

@@ -7,13 +7,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerCapabilities(); const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result);
}
// handle response
} }
run(); run();

View File

@@ -0,0 +1,28 @@
# GetLibrariesDirectory
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | true |
| `art` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg |
| `composite` | *string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 |
| `filters` | *boolean* | :heavy_minus_sign: | N/A | true |
| `refreshing` | *boolean* | :heavy_minus_sign: | N/A | false |
| `thumb` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie.png |
| `key` | *string* | :heavy_minus_sign: | N/A | 1 |
| `type` | *string* | :heavy_minus_sign: | N/A | movie |
| `title` | *string* | :heavy_minus_sign: | N/A | Movies |
| `agent` | *string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie |
| `scanner` | *string* | :heavy_minus_sign: | N/A | Plex Movie |
| `language` | *string* | :heavy_minus_sign: | N/A | en-US |
| `uuid` | *string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 |
| `updatedAt` | *number* | :heavy_minus_sign: | N/A | 1705615634 |
| `createdAt` | *number* | :heavy_minus_sign: | N/A | 1654131312 |
| `scannedAt` | *number* | :heavy_minus_sign: | N/A | 1705615584 |
| `content` | *boolean* | :heavy_minus_sign: | N/A | true |
| `directory` | *boolean* | :heavy_minus_sign: | N/A | true |
| `contentChangedAt` | *number* | :heavy_minus_sign: | N/A | 3192854 |
| `hidden` | *number* | :heavy_minus_sign: | N/A | 0 |
| `location` | [operations.Location](../../models/operations/location.md)[] | :heavy_minus_sign: | N/A | [{"id":1,"path":"/movies"}] |

View File

@@ -0,0 +1,11 @@
# GetLibrariesMediaContainer
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `size` | *number* | :heavy_minus_sign: | N/A | 5 |
| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | false |
| `title1` | *string* | :heavy_minus_sign: | N/A | Plex Library |
| `directory` | [operations.GetLibrariesDirectory](../../models/operations/getlibrariesdirectory.md)[] | :heavy_minus_sign: | N/A | [{"Location":[{"id":1,"path":"/movies"}],"agent":"tv.plex.agents.movie","allowSync":true,"art":"/:/resources/movie-fanart.jpg","composite":"/library/sections/1/composite/1705615584","content":true,"contentChangedAt":3192854,"createdAt":1654131312,"directory":true,"filters":true,"hidden":0,"key":"1","language":"en-US","refreshing":false,"scannedAt":1705615584,"scanner":"Plex Movie","thumb":"/:/resources/movie.png","title":"Movies","type":"movie","updatedAt":1705615634,"uuid":"322a231a-b7f7-49f5-920f-14c61199cd30"}] |

View File

@@ -3,8 +3,9 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
| `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation | | `statusCode` | *number* | :heavy_check_mark: | HTTP response status code for this operation |
| `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | `rawResponse` | [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
| `object` | [operations.GetLibrariesResponseBody](../../models/operations/getlibrariesresponsebody.md) | :heavy_minus_sign: | The libraries available on the Server |

View File

@@ -0,0 +1,10 @@
# GetLibrariesResponseBody
The libraries available on the Server
## Fields
| Field | Type | Required | Description |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `mediaContainer` | [operations.GetLibrariesMediaContainer](../../models/operations/getlibrariesmediacontainer.md) | :heavy_minus_sign: | N/A |

View File

@@ -0,0 +1,9 @@
# Location
## Fields
| Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| `id` | *number* | :heavy_minus_sign: | N/A | 1 |
| `path` | *string* | :heavy_minus_sign: | N/A | /movies |

View File

@@ -31,13 +31,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.activities.getServerActivities(); const result = await sdk.activities.getServerActivities();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -77,13 +74,10 @@ async function run() {
const activityUUID = "string"; const activityUUID = "string";
const res = await sdk.activities.cancelServerActivities(activityUUID); const result = await sdk.activities.cancelServerActivities(activityUUID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -28,13 +28,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.butler.getButlerTasks(); const result = await sdk.butler.getButlerTasks();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -77,13 +74,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.butler.startAllTasks(); const result = await sdk.butler.startAllTasks();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -122,13 +116,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.butler.stopAllTasks(); const result = await sdk.butler.stopAllTasks();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -174,13 +165,10 @@ async function run() {
const taskName = TaskName.CleanOldBundles; const taskName = TaskName.CleanOldBundles;
const res = await sdk.butler.startTask(taskName); const result = await sdk.butler.startTask(taskName);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -223,13 +211,10 @@ async function run() {
const taskName = PathParamTaskName.BackupDatabase; const taskName = PathParamTaskName.BackupDatabase;
const res = await sdk.butler.stopTask(taskName); const result = await sdk.butler.stopTask(taskName);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -29,13 +29,10 @@ async function run() {
const count = 1262.49; const count = 1262.49;
const onlyTransient = OnlyTransient.One; const onlyTransient = OnlyTransient.One;
const res = await sdk.hubs.getGlobalHubs(count, onlyTransient); const result = await sdk.hubs.getGlobalHubs(count, onlyTransient);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -81,13 +78,10 @@ async function run() {
const count = 9010.22; const count = 9010.22;
const onlyTransient = QueryParamOnlyTransient.Zero; const onlyTransient = QueryParamOnlyTransient.Zero;
const res = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient); const result = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -38,13 +38,10 @@ async function run() {
const url = "file://C:\Image.png&type=13"; const url = "file://C:\Image.png&type=13";
const type = 4462.17; const type = 4462.17;
const res = await sdk.library.getFileHash(url, type); const result = await sdk.library.getFileHash(url, type);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -85,13 +82,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.library.getRecentlyAdded(); const result = await sdk.library.getRecentlyAdded();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -135,13 +129,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.library.getLibraries(); const result = await sdk.library.getLibraries();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -202,13 +193,10 @@ async function run() {
const sectionId = 1000; const sectionId = 1000;
const includeDetails = IncludeDetails.Zero; const includeDetails = IncludeDetails.Zero;
const res = await sdk.library.getLibrary(sectionId, includeDetails); const result = await sdk.library.getLibrary(sectionId, includeDetails);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -250,13 +238,10 @@ async function run() {
const sectionId = 1000; const sectionId = 1000;
const res = await sdk.library.deleteLibrary(sectionId); const result = await sdk.library.deleteLibrary(sectionId);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -300,13 +285,10 @@ async function run() {
const type = 760.66; const type = 760.66;
const filter = "string"; const filter = "string";
const res = await sdk.library.getLibraryItems(sectionId, type, filter); const result = await sdk.library.getLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -350,13 +332,10 @@ async function run() {
const sectionId = 934.16; const sectionId = 934.16;
const res = await sdk.library.refreshLibrary(sectionId); const result = await sdk.library.refreshLibrary(sectionId);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -400,13 +379,10 @@ async function run() {
const type = 8015.12; const type = 8015.12;
const filter = "string"; const filter = "string";
const res = await sdk.library.getLatestLibraryItems(sectionId, type, filter); const result = await sdk.library.getLatestLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -452,13 +428,10 @@ async function run() {
const type = 2760.31; const type = 2760.31;
const filter = "string"; const filter = "string";
const res = await sdk.library.getCommonLibraryItems(sectionId, type, filter); const result = await sdk.library.getCommonLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -502,13 +475,10 @@ async function run() {
const ratingKey = 8382.31; const ratingKey = 8382.31;
const res = await sdk.library.getMetadata(ratingKey); const result = await sdk.library.getMetadata(ratingKey);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -550,13 +520,10 @@ async function run() {
const ratingKey = 1539.14; const ratingKey = 1539.14;
const res = await sdk.library.getMetadataChildren(ratingKey); const result = await sdk.library.getMetadataChildren(ratingKey);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -596,13 +563,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.library.getOnDeck(); const result = await sdk.library.getOnDeck();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -32,13 +32,10 @@ async function run() {
const message = "string"; const message = "string";
const source = "string"; const source = "string";
const res = await sdk.log.logLine(level, message, source); const result = await sdk.log.logLine(level, message, source);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -80,13 +77,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.log.logMultiLine(); const result = await sdk.log.logMultiLine();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -125,13 +119,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.log.enablePaperTrail(); const result = await sdk.log.enablePaperTrail();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -28,13 +28,10 @@ async function run() {
const key = 59398; const key = 59398;
const res = await sdk.media.markPlayed(key); const result = await sdk.media.markPlayed(key);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -75,13 +72,10 @@ async function run() {
const key = 59398; const key = 59398;
const res = await sdk.media.markUnplayed(key); const result = await sdk.media.markUnplayed(key);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -125,13 +119,10 @@ async function run() {
const time = 6900.91; const time = 6900.91;
const state = "string"; const state = "string";
const res = await sdk.media.updatePlayProgress(key, time, state); const result = await sdk.media.updatePlayProgress(key, time, state);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -39,17 +39,14 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.playlists.createPlaylist({ const result = await sdk.playlists.createPlaylist({
title: "string", title: "string",
type: TypeT.Photo, type: TypeT.Photo,
smart: Smart.One, smart: Smart.One,
}); });
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -92,13 +89,10 @@ async function run() {
const playlistType = PlaylistType.Audio; const playlistType = PlaylistType.Audio;
const smart = QueryParamSmart.Zero; const smart = QueryParamSmart.Zero;
const res = await sdk.playlists.getPlaylists(playlistType, smart); const result = await sdk.playlists.getPlaylists(playlistType, smart);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -142,13 +136,10 @@ async function run() {
const playlistID = 4109.48; const playlistID = 4109.48;
const res = await sdk.playlists.getPlaylist(playlistID); const result = await sdk.playlists.getPlaylist(playlistID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -190,13 +181,10 @@ async function run() {
const playlistID = 216.22; const playlistID = 216.22;
const res = await sdk.playlists.deletePlaylist(playlistID); const result = await sdk.playlists.deletePlaylist(playlistID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -238,13 +226,10 @@ async function run() {
const playlistID = 3915; const playlistID = 3915;
const res = await sdk.playlists.updatePlaylist(playlistID); const result = await sdk.playlists.updatePlaylist(playlistID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -290,13 +275,10 @@ async function run() {
const playlistID = 5004.46; const playlistID = 5004.46;
const type = 9403.59; const type = 9403.59;
const res = await sdk.playlists.getPlaylistContents(playlistID, type); const result = await sdk.playlists.getPlaylistContents(playlistID, type);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -339,13 +321,10 @@ async function run() {
const playlistID = 1893.18; const playlistID = 1893.18;
const res = await sdk.playlists.clearPlaylistContents(playlistID); const result = await sdk.playlists.clearPlaylistContents(playlistID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -390,13 +369,10 @@ async function run() {
const uri = "library://.."; const uri = "library://..";
const playQueueID = 123; const playQueueID = 123;
const res = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID); const result = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -442,13 +418,10 @@ async function run() {
const path = "/home/barkley/playlist.m3u"; const path = "/home/barkley/playlist.m3u";
const force = Force.Zero; const force = Force.Zero;
const res = await sdk.playlists.uploadPlaylist(path, force); const result = await sdk.playlists.uploadPlaylist(path, force);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -42,13 +42,10 @@ async function run() {
const sectionId = 1516.53; const sectionId = 1516.53;
const limit = 5; const limit = 5;
const res = await sdk.search.performSearch(query, sectionId, limit); const result = await sdk.search.performSearch(query, sectionId, limit);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -97,13 +94,10 @@ async function run() {
const sectionId = 4094.8; const sectionId = 4094.8;
const limit = 5; const limit = 5;
const res = await sdk.search.performVoiceSearch(query, sectionId, limit); const result = await sdk.search.performVoiceSearch(query, sectionId, limit);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -146,13 +140,10 @@ async function run() {
const query = "110"; const query = "110";
const res = await sdk.search.getSearchResults(query); const result = await sdk.search.getSearchResults(query);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -30,13 +30,10 @@ async function run() {
const type = QueryParamType.Delegation; const type = QueryParamType.Delegation;
const scope = Scope.All; const scope = Scope.All;
const res = await sdk.security.getTransientToken(type, scope); const result = await sdk.security.getTransientToken(type, scope);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -80,13 +77,10 @@ async function run() {
const source = "server://client-identifier"; const source = "server://client-identifier";
const res = await sdk.security.getSourceConnectionInformation(source); const result = await sdk.security.getSourceConnectionInformation(source);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -31,13 +31,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerCapabilities(); const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -75,13 +72,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerPreferences(); const result = await sdk.server.getServerPreferences();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -119,13 +113,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getAvailableClients(); const result = await sdk.server.getAvailableClients();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -163,13 +154,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getDevices(); const result = await sdk.server.getDevices();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -207,13 +195,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerIdentity(); const result = await sdk.server.getServerIdentity();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -251,13 +236,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getMyPlexAccount(); const result = await sdk.server.getMyPlexAccount();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -297,7 +279,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getResizedPhoto({ const result = await sdk.server.getResizedPhoto({
width: 110, width: 110,
height: 165, height: 165,
opacity: 643869, opacity: 643869,
@@ -307,11 +289,8 @@ async function run() {
url: "/library/metadata/49564/thumb/1654258204", url: "/library/metadata/49564/thumb/1654258204",
}); });
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -350,13 +329,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.server.getServerList(); const result = await sdk.server.getServerList();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -27,13 +27,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.sessions.getSessions(); const result = await sdk.sessions.getSessions();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -71,13 +68,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.sessions.getSessionHistory(); const result = await sdk.sessions.getSessionHistory();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -115,13 +109,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.sessions.getTranscodeSessions(); const result = await sdk.sessions.getTranscodeSessions();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -161,13 +152,10 @@ async function run() {
const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep"; const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep";
const res = await sdk.sessions.stopTranscodeSession(sessionKey); const result = await sdk.sessions.stopTranscodeSession(sessionKey);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -27,13 +27,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.updater.getUpdateStatus(); const result = await sdk.updater.getUpdateStatus();
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -74,13 +71,10 @@ async function run() {
const download = Download.One; const download = Download.One;
const res = await sdk.updater.checkForUpdates(download); const result = await sdk.updater.checkForUpdates(download);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -124,13 +118,10 @@ async function run() {
const tonight = Tonight.One; const tonight = Tonight.One;
const skip = Skip.Zero; const skip = Skip.Zero;
const res = await sdk.updater.applyUpdates(tonight, skip); const result = await sdk.updater.applyUpdates(tonight, skip);
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -25,7 +25,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.video.startUniversalTranscode({ const result = await sdk.video.startUniversalTranscode({
hasMDE: 8924.99, hasMDE: 8924.99,
path: "/etc/mail", path: "/etc/mail",
mediaIndex: 9962.95, mediaIndex: 9962.95,
@@ -33,11 +33,8 @@ async function run() {
protocol: "string", protocol: "string",
}); });
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();
@@ -77,7 +74,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>", accessToken: "<YOUR_API_KEY_HERE>",
}); });
const res = await sdk.video.getTimeline({ const result = await sdk.video.getTimeline({
ratingKey: 716.56, ratingKey: 716.56,
key: "<key>", key: "<key>",
state: State.Paused, state: State.Paused,
@@ -90,11 +87,8 @@ async function run() {
row: 3536.42, row: 3536.42,
}); });
if (res?.statusCode !== 200) { // Handle the result
throw new Error("Unexpected status code: " + res?.statusCode || "-"); console.log(result)
}
// handle response
} }
run(); run();

View File

@@ -8,7 +8,7 @@ generation:
fixes: fixes:
nameResolutionDec2023: false nameResolutionDec2023: false
typescript: typescript:
version: 0.3.1 version: 0.4.1
author: LukeHagar author: LukeHagar
clientServerStatusCodesAsErrors: true clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true flattenGlobalSecurity: true

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@lukehagar/plexjs", "name": "@lukehagar/plexjs",
"version": "0.3.1", "version": "0.4.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lukehagar/plexjs", "name": "@lukehagar/plexjs",
"version": "0.3.1", "version": "0.4.1",
"dependencies": { "dependencies": {
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
"jsonpath": "^1.1.1" "jsonpath": "^1.1.1"

View File

@@ -1,7 +1,7 @@
{ {
"type": "commonjs", "type": "commonjs",
"name": "@lukehagar/plexjs", "name": "@lukehagar/plexjs",
"version": "0.3.1", "version": "0.4.1",
"author": "LukeHagar", "author": "LukeHagar",
"main": "./index.js", "main": "./index.js",
"sideEffects": false, "sideEffects": false,

View File

@@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL {
export const SDK_METADATA = Object.freeze({ export const SDK_METADATA = Object.freeze({
language: "typescript", language: "typescript",
openapiDocVersion: "0.0.3", openapiDocVersion: "0.0.3",
sdkVersion: "0.3.1", sdkVersion: "0.4.1",
genVersion: "2.228.1", genVersion: "2.237.2",
userAgent: "speakeasy-sdk/typescript 0.3.1 2.228.1 0.0.3 @lukehagar/plexjs", userAgent: "speakeasy-sdk/typescript 0.4.1 2.237.2 0.0.3 @lukehagar/plexjs",
}); });

View File

@@ -5,8 +5,8 @@
import { bytesToBase64 } from "./base64"; import { bytesToBase64 } from "./base64";
export class EncodingError extends Error { export class EncodingError extends Error {
constructor(message: string, options?: ErrorOptions) { constructor(message: string) {
super(message, options); super(message);
this.name = "EncodingError"; this.name = "EncodingError";
} }
} }
@@ -201,7 +201,12 @@ export function encodeDeepObject(
value: unknown, value: unknown,
options?: { charEncoding?: "percent" | "none" }, options?: { charEncoding?: "percent" | "none" },
) { ) {
if (value == null) {
return "";
}
let out = ""; let out = "";
const encodeString = (v: string) => { const encodeString = (v: string) => {
return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
}; };

192
src/lib/event-streams.ts Normal file
View File

@@ -0,0 +1,192 @@
/*
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/
export type ServerEvent<T> = {
data?: T | undefined;
event?: string | undefined;
retry?: number | undefined;
id?: string | undefined;
};
const LF = 0x0a;
const CR = 0x0d;
const NEWLINE_CHARS = new Set([LF, CR]);
const MESSAGE_BOUNDARIES = [
new Uint8Array([CR, LF, CR, LF]),
new Uint8Array([CR, CR]),
new Uint8Array([LF, LF]),
];
export class EventStream<Event extends ServerEvent<unknown>> {
private readonly stream: ReadableStream<Uint8Array>;
private readonly decoder: (rawEvent: ServerEvent<string>) => Event;
constructor(init: {
stream: ReadableStream<Uint8Array>;
decoder: (rawEvent: ServerEvent<string>) => Event;
}) {
this.stream = init.stream;
this.decoder = init.decoder;
}
async *[Symbol.asyncIterator]() {
const reader = this.stream.getReader();
let buffer = new Uint8Array([]);
let position = 0;
try {
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
const newBuffer = new Uint8Array(buffer.length + value.length);
newBuffer.set(buffer);
newBuffer.set(value, buffer.length);
buffer = newBuffer;
for (let i = position; i < buffer.length; i++) {
const boundary = findBoundary(buffer, i);
if (boundary == null) {
continue;
}
const chunk = buffer.slice(position, i);
position = i + boundary.length;
const event = parseEvent(chunk, this.decoder);
if (event != null) {
yield event;
}
}
if (position > 0) {
buffer = buffer.slice(position);
position = 0;
}
}
if (buffer.length > 0) {
const event = parseEvent(buffer, this.decoder);
if (event != null) {
yield event;
}
}
} finally {
reader.releaseLock();
}
}
}
function findBoundary(buffer: Uint8Array, start: number): Uint8Array | null {
const char1 = buffer[start];
const char2 = buffer[start + 1];
// Don't bother checking if the first two characters are not new line
// characters.
if (
char1 == null ||
char2 == null ||
!NEWLINE_CHARS.has(char1) ||
!NEWLINE_CHARS.has(char2)
) {
return null;
}
for (const s of MESSAGE_BOUNDARIES) {
const seq = peekSequence(start, buffer, s);
if (seq != null) {
return seq;
}
}
return null;
}
function peekSequence(
position: number,
buffer: Uint8Array,
sequence: Uint8Array,
): Uint8Array | null {
if (sequence.length > buffer.length - position) {
return null;
}
for (let i = 0; i < sequence.length; i++) {
if (buffer[position + i] !== sequence[i]) {
return null;
}
}
return sequence;
}
function parseEvent<Event extends ServerEvent<unknown>>(
chunk: Uint8Array,
decoder: (rawEvent: ServerEvent<string>) => Event,
) {
if (!chunk.length) {
return null;
}
const td = new TextDecoder();
const raw = td.decode(chunk);
const lines = raw.split(/\r?\n|\r/g);
let publish = false;
const rawEvent: ServerEvent<string> = {};
for (const line of lines) {
if (!line) {
continue;
}
const delim = line.indexOf(":");
// Lines starting with a colon are ignored.
if (delim === 0) {
continue;
}
const field = delim > 0 ? line.substring(0, delim) : "";
let value = delim > 0 ? line.substring(delim + 1) : "";
if (value.charAt(0) === " ") {
value = value.substring(1);
}
switch (field) {
case "event": {
publish = true;
rawEvent.event = value;
break;
}
case "data": {
publish = true;
rawEvent.data ??= "";
rawEvent.data += value + "\n";
break;
}
case "id": {
publish = true;
rawEvent.id = value;
break;
}
case "retry": {
const r = parseInt(value, 10);
if (!Number.isNaN(r)) {
publish = true;
rawEvent.retry = r;
}
break;
}
}
}
if (!publish) {
return null;
}
if (rawEvent.data != null) {
rawEvent.data = rawEvent.data.slice(0, -1);
}
return decoder(rawEvent);
}

View File

@@ -23,14 +23,14 @@ type RequestConfig = {
}; };
export class ClientSDK { export class ClientSDK {
readonly #client: HTTPClient; private readonly client: HTTPClient;
protected readonly baseURL: URL; protected readonly baseURL: URL;
constructor(init: { client: HTTPClient; baseURL: URL }) { constructor(init: { client: HTTPClient; baseURL: URL }) {
const url = init.baseURL; const url = init.baseURL;
url.pathname = url.pathname.replace(/\/+$/, "") + "/"; url.pathname = url.pathname.replace(/\/+$/, "") + "/";
this.#client = init.client; this.client = init.client;
this.baseURL = url; this.baseURL = url;
} }
@@ -92,7 +92,7 @@ export class ClientSDK {
method, method,
}); });
return this.#client.request(req); return this.client.request(req);
} }
protected unpackHeaders = unpackHeaders; protected unpackHeaders = unpackHeaders;

View File

@@ -10,8 +10,8 @@ export enum SecurityErrorCode {
} }
export class SecurityError extends Error { export class SecurityError extends Error {
constructor(public code: SecurityErrorCode, message: string, options?: ErrorOptions) { constructor(public code: SecurityErrorCode, message: string) {
super(message, options); super(message);
this.name = "SecurityError"; this.name = "SecurityError";
} }

View File

@@ -34,8 +34,8 @@ export class AddPlaylistContentsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: AddPlaylistContentsResponseBodyData; data$: AddPlaylistContentsResponseBodyData;
constructor(err: AddPlaylistContentsResponseBodyData, options?: ErrorOptions) { constructor(err: AddPlaylistContentsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class ApplyUpdatesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: ApplyUpdatesResponseBodyData; data$: ApplyUpdatesResponseBodyData;
constructor(err: ApplyUpdatesResponseBodyData, options?: ErrorOptions) { constructor(err: ApplyUpdatesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class CancelServerActivitiesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: CancelServerActivitiesResponseBodyData; data$: CancelServerActivitiesResponseBodyData;
constructor(err: CancelServerActivitiesResponseBodyData, options?: ErrorOptions) { constructor(err: CancelServerActivitiesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class CheckForUpdatesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: CheckForUpdatesResponseBodyData; data$: CheckForUpdatesResponseBodyData;
constructor(err: CheckForUpdatesResponseBodyData, options?: ErrorOptions) { constructor(err: CheckForUpdatesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class ClearPlaylistContentsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: ClearPlaylistContentsResponseBodyData; data$: ClearPlaylistContentsResponseBodyData;
constructor(err: ClearPlaylistContentsResponseBodyData, options?: ErrorOptions) { constructor(err: ClearPlaylistContentsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class CreatePlaylistResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: CreatePlaylistResponseBodyData; data$: CreatePlaylistResponseBodyData;
constructor(err: CreatePlaylistResponseBodyData, options?: ErrorOptions) { constructor(err: CreatePlaylistResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class DeleteLibraryResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: DeleteLibraryResponseBodyData; data$: DeleteLibraryResponseBodyData;
constructor(err: DeleteLibraryResponseBodyData, options?: ErrorOptions) { constructor(err: DeleteLibraryResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class DeletePlaylistResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: DeletePlaylistResponseBodyData; data$: DeletePlaylistResponseBodyData;
constructor(err: DeletePlaylistResponseBodyData, options?: ErrorOptions) { constructor(err: DeletePlaylistResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class EnablePaperTrailResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: EnablePaperTrailResponseBodyData; data$: EnablePaperTrailResponseBodyData;
constructor(err: EnablePaperTrailResponseBodyData, options?: ErrorOptions) { constructor(err: EnablePaperTrailResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetAvailableClientsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetAvailableClientsResponseBodyData; data$: GetAvailableClientsResponseBodyData;
constructor(err: GetAvailableClientsResponseBodyData, options?: ErrorOptions) { constructor(err: GetAvailableClientsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetButlerTasksResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetButlerTasksResponseBodyData; data$: GetButlerTasksResponseBodyData;
constructor(err: GetButlerTasksResponseBodyData, options?: ErrorOptions) { constructor(err: GetButlerTasksResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetCommonLibraryItemsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetCommonLibraryItemsResponseBodyData; data$: GetCommonLibraryItemsResponseBodyData;
constructor(err: GetCommonLibraryItemsResponseBodyData, options?: ErrorOptions) { constructor(err: GetCommonLibraryItemsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetDevicesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetDevicesResponseBodyData; data$: GetDevicesResponseBodyData;
constructor(err: GetDevicesResponseBodyData, options?: ErrorOptions) { constructor(err: GetDevicesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetFileHashResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetFileHashResponseBodyData; data$: GetFileHashResponseBodyData;
constructor(err: GetFileHashResponseBodyData, options?: ErrorOptions) { constructor(err: GetFileHashResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetGlobalHubsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetGlobalHubsResponseBodyData; data$: GetGlobalHubsResponseBodyData;
constructor(err: GetGlobalHubsResponseBodyData, options?: ErrorOptions) { constructor(err: GetGlobalHubsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetLatestLibraryItemsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetLatestLibraryItemsResponseBodyData; data$: GetLatestLibraryItemsResponseBodyData;
constructor(err: GetLatestLibraryItemsResponseBodyData, options?: ErrorOptions) { constructor(err: GetLatestLibraryItemsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetLibrariesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetLibrariesResponseBodyData; data$: GetLibrariesResponseBodyData;
constructor(err: GetLibrariesResponseBodyData, options?: ErrorOptions) { constructor(err: GetLibrariesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetLibraryResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetLibraryResponseBodyData; data$: GetLibraryResponseBodyData;
constructor(err: GetLibraryResponseBodyData, options?: ErrorOptions) { constructor(err: GetLibraryResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetLibraryHubsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetLibraryHubsResponseBodyData; data$: GetLibraryHubsResponseBodyData;
constructor(err: GetLibraryHubsResponseBodyData, options?: ErrorOptions) { constructor(err: GetLibraryHubsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetLibraryItemsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetLibraryItemsResponseBodyData; data$: GetLibraryItemsResponseBodyData;
constructor(err: GetLibraryItemsResponseBodyData, options?: ErrorOptions) { constructor(err: GetLibraryItemsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetMetadataResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetMetadataResponseBodyData; data$: GetMetadataResponseBodyData;
constructor(err: GetMetadataResponseBodyData, options?: ErrorOptions) { constructor(err: GetMetadataResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetMetadataChildrenResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetMetadataChildrenResponseBodyData; data$: GetMetadataChildrenResponseBodyData;
constructor(err: GetMetadataChildrenResponseBodyData, options?: ErrorOptions) { constructor(err: GetMetadataChildrenResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetMyPlexAccountResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetMyPlexAccountResponseBodyData; data$: GetMyPlexAccountResponseBodyData;
constructor(err: GetMyPlexAccountResponseBodyData, options?: ErrorOptions) { constructor(err: GetMyPlexAccountResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetOnDeckResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetOnDeckResponseBodyData; data$: GetOnDeckResponseBodyData;
constructor(err: GetOnDeckResponseBodyData, options?: ErrorOptions) { constructor(err: GetOnDeckResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetPlaylistResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetPlaylistResponseBodyData; data$: GetPlaylistResponseBodyData;
constructor(err: GetPlaylistResponseBodyData, options?: ErrorOptions) { constructor(err: GetPlaylistResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetPlaylistContentsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetPlaylistContentsResponseBodyData; data$: GetPlaylistContentsResponseBodyData;
constructor(err: GetPlaylistContentsResponseBodyData, options?: ErrorOptions) { constructor(err: GetPlaylistContentsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetPlaylistsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetPlaylistsResponseBodyData; data$: GetPlaylistsResponseBodyData;
constructor(err: GetPlaylistsResponseBodyData, options?: ErrorOptions) { constructor(err: GetPlaylistsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetRecentlyAddedResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetRecentlyAddedResponseBodyData; data$: GetRecentlyAddedResponseBodyData;
constructor(err: GetRecentlyAddedResponseBodyData, options?: ErrorOptions) { constructor(err: GetRecentlyAddedResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetResizedPhotoResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetResizedPhotoResponseBodyData; data$: GetResizedPhotoResponseBodyData;
constructor(err: GetResizedPhotoResponseBodyData, options?: ErrorOptions) { constructor(err: GetResizedPhotoResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetSearchResultsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetSearchResultsResponseBodyData; data$: GetSearchResultsResponseBodyData;
constructor(err: GetSearchResultsResponseBodyData, options?: ErrorOptions) { constructor(err: GetSearchResultsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetServerActivitiesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetServerActivitiesResponseBodyData; data$: GetServerActivitiesResponseBodyData;
constructor(err: GetServerActivitiesResponseBodyData, options?: ErrorOptions) { constructor(err: GetServerActivitiesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetServerCapabilitiesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetServerCapabilitiesResponseBodyData; data$: GetServerCapabilitiesResponseBodyData;
constructor(err: GetServerCapabilitiesResponseBodyData, options?: ErrorOptions) { constructor(err: GetServerCapabilitiesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetServerIdentityResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetServerIdentityResponseBodyData; data$: GetServerIdentityResponseBodyData;
constructor(err: GetServerIdentityResponseBodyData, options?: ErrorOptions) { constructor(err: GetServerIdentityResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetServerListResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetServerListResponseBodyData; data$: GetServerListResponseBodyData;
constructor(err: GetServerListResponseBodyData, options?: ErrorOptions) { constructor(err: GetServerListResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetServerPreferencesResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetServerPreferencesResponseBodyData; data$: GetServerPreferencesResponseBodyData;
constructor(err: GetServerPreferencesResponseBodyData, options?: ErrorOptions) { constructor(err: GetServerPreferencesResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetSessionHistoryResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetSessionHistoryResponseBodyData; data$: GetSessionHistoryResponseBodyData;
constructor(err: GetSessionHistoryResponseBodyData, options?: ErrorOptions) { constructor(err: GetSessionHistoryResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetSessionsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetSessionsResponseBodyData; data$: GetSessionsResponseBodyData;
constructor(err: GetSessionsResponseBodyData, options?: ErrorOptions) { constructor(err: GetSessionsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetSourceConnectionInformationResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetSourceConnectionInformationResponseBodyData; data$: GetSourceConnectionInformationResponseBodyData;
constructor(err: GetSourceConnectionInformationResponseBodyData, options?: ErrorOptions) { constructor(err: GetSourceConnectionInformationResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetTimelineResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetTimelineResponseBodyData; data$: GetTimelineResponseBodyData;
constructor(err: GetTimelineResponseBodyData, options?: ErrorOptions) { constructor(err: GetTimelineResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetTranscodeSessionsResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetTranscodeSessionsResponseBodyData; data$: GetTranscodeSessionsResponseBodyData;
constructor(err: GetTranscodeSessionsResponseBodyData, options?: ErrorOptions) { constructor(err: GetTranscodeSessionsResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetTransientTokenResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetTransientTokenResponseBodyData; data$: GetTransientTokenResponseBodyData;
constructor(err: GetTransientTokenResponseBodyData, options?: ErrorOptions) { constructor(err: GetTransientTokenResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class GetUpdateStatusResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: GetUpdateStatusResponseBodyData; data$: GetUpdateStatusResponseBodyData;
constructor(err: GetUpdateStatusResponseBodyData, options?: ErrorOptions) { constructor(err: GetUpdateStatusResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class LogLineResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: LogLineResponseBodyData; data$: LogLineResponseBodyData;
constructor(err: LogLineResponseBodyData, options?: ErrorOptions) { constructor(err: LogLineResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class LogMultiLineResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: LogMultiLineResponseBodyData; data$: LogMultiLineResponseBodyData;
constructor(err: LogMultiLineResponseBodyData, options?: ErrorOptions) { constructor(err: LogMultiLineResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class MarkPlayedResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: MarkPlayedResponseBodyData; data$: MarkPlayedResponseBodyData;
constructor(err: MarkPlayedResponseBodyData, options?: ErrorOptions) { constructor(err: MarkPlayedResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class MarkUnplayedResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: MarkUnplayedResponseBodyData; data$: MarkUnplayedResponseBodyData;
constructor(err: MarkUnplayedResponseBodyData, options?: ErrorOptions) { constructor(err: MarkUnplayedResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class PerformSearchResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: PerformSearchResponseBodyData; data$: PerformSearchResponseBodyData;
constructor(err: PerformSearchResponseBodyData, options?: ErrorOptions) { constructor(err: PerformSearchResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class PerformVoiceSearchResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: PerformVoiceSearchResponseBodyData; data$: PerformVoiceSearchResponseBodyData;
constructor(err: PerformVoiceSearchResponseBodyData, options?: ErrorOptions) { constructor(err: PerformVoiceSearchResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class RefreshLibraryResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: RefreshLibraryResponseBodyData; data$: RefreshLibraryResponseBodyData;
constructor(err: RefreshLibraryResponseBodyData, options?: ErrorOptions) { constructor(err: RefreshLibraryResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StartAllTasksResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StartAllTasksResponseBodyData; data$: StartAllTasksResponseBodyData;
constructor(err: StartAllTasksResponseBodyData, options?: ErrorOptions) { constructor(err: StartAllTasksResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StartTaskResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StartTaskResponseBodyData; data$: StartTaskResponseBodyData;
constructor(err: StartTaskResponseBodyData, options?: ErrorOptions) { constructor(err: StartTaskResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StartUniversalTranscodeResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StartUniversalTranscodeResponseBodyData; data$: StartUniversalTranscodeResponseBodyData;
constructor(err: StartUniversalTranscodeResponseBodyData, options?: ErrorOptions) { constructor(err: StartUniversalTranscodeResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StopAllTasksResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StopAllTasksResponseBodyData; data$: StopAllTasksResponseBodyData;
constructor(err: StopAllTasksResponseBodyData, options?: ErrorOptions) { constructor(err: StopAllTasksResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StopTaskResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StopTaskResponseBodyData; data$: StopTaskResponseBodyData;
constructor(err: StopTaskResponseBodyData, options?: ErrorOptions) { constructor(err: StopTaskResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class StopTranscodeSessionResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: StopTranscodeSessionResponseBodyData; data$: StopTranscodeSessionResponseBodyData;
constructor(err: StopTranscodeSessionResponseBodyData, options?: ErrorOptions) { constructor(err: StopTranscodeSessionResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class UpdatePlaylistResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: UpdatePlaylistResponseBodyData; data$: UpdatePlaylistResponseBodyData;
constructor(err: UpdatePlaylistResponseBodyData, options?: ErrorOptions) { constructor(err: UpdatePlaylistResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class UpdatePlayProgressResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: UpdatePlayProgressResponseBodyData; data$: UpdatePlayProgressResponseBodyData;
constructor(err: UpdatePlayProgressResponseBodyData, options?: ErrorOptions) { constructor(err: UpdatePlayProgressResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -34,8 +34,8 @@ export class UploadPlaylistResponseBody extends Error {
/** The original data that was passed to this error instance. */ /** The original data that was passed to this error instance. */
data$: UploadPlaylistResponseBodyData; data$: UploadPlaylistResponseBodyData;
constructor(err: UploadPlaylistResponseBodyData, options?: ErrorOptions) { constructor(err: UploadPlaylistResponseBodyData) {
super("", options); super("");
this.data$ = err; this.data$ = err;
if (err.errors != null) { if (err.errors != null) {

View File

@@ -4,6 +4,49 @@
import { z } from "zod"; import { z } from "zod";
export type Location = {
id?: number | undefined;
path?: string | undefined;
};
export type GetLibrariesDirectory = {
allowSync?: boolean | undefined;
art?: string | undefined;
composite?: string | undefined;
filters?: boolean | undefined;
refreshing?: boolean | undefined;
thumb?: string | undefined;
key?: string | undefined;
type?: string | undefined;
title?: string | undefined;
agent?: string | undefined;
scanner?: string | undefined;
language?: string | undefined;
uuid?: string | undefined;
updatedAt?: number | undefined;
createdAt?: number | undefined;
scannedAt?: number | undefined;
content?: boolean | undefined;
directory?: boolean | undefined;
contentChangedAt?: number | undefined;
hidden?: number | undefined;
location?: Array<Location> | undefined;
};
export type GetLibrariesMediaContainer = {
size?: number | undefined;
allowSync?: boolean | undefined;
title1?: string | undefined;
directory?: Array<GetLibrariesDirectory> | undefined;
};
/**
* The libraries available on the Server
*/
export type GetLibrariesResponseBody = {
mediaContainer?: GetLibrariesMediaContainer | undefined;
};
export type GetLibrariesResponse = { export type GetLibrariesResponse = {
/** /**
* HTTP response content type for this operation * HTTP response content type for this operation
@@ -17,14 +60,291 @@ export type GetLibrariesResponse = {
* Raw HTTP response; suitable for custom response parsing * Raw HTTP response; suitable for custom response parsing
*/ */
rawResponse: Response; rawResponse: Response;
/**
* The libraries available on the Server
*/
object?: GetLibrariesResponseBody | undefined;
}; };
/** @internal */
export namespace Location$ {
export type Inbound = {
id?: number | undefined;
path?: string | undefined;
};
export const inboundSchema: z.ZodType<Location, z.ZodTypeDef, Inbound> = z
.object({
id: z.number().int().optional(),
path: z.string().optional(),
})
.transform((v) => {
return {
...(v.id === undefined ? null : { id: v.id }),
...(v.path === undefined ? null : { path: v.path }),
};
});
export type Outbound = {
id?: number | undefined;
path?: string | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Location> = z
.object({
id: z.number().int().optional(),
path: z.string().optional(),
})
.transform((v) => {
return {
...(v.id === undefined ? null : { id: v.id }),
...(v.path === undefined ? null : { path: v.path }),
};
});
}
/** @internal */
export namespace GetLibrariesDirectory$ {
export type Inbound = {
allowSync?: boolean | undefined;
art?: string | undefined;
composite?: string | undefined;
filters?: boolean | undefined;
refreshing?: boolean | undefined;
thumb?: string | undefined;
key?: string | undefined;
type?: string | undefined;
title?: string | undefined;
agent?: string | undefined;
scanner?: string | undefined;
language?: string | undefined;
uuid?: string | undefined;
updatedAt?: number | undefined;
createdAt?: number | undefined;
scannedAt?: number | undefined;
content?: boolean | undefined;
directory?: boolean | undefined;
contentChangedAt?: number | undefined;
hidden?: number | undefined;
Location?: Array<Location$.Inbound> | undefined;
};
export const inboundSchema: z.ZodType<GetLibrariesDirectory, z.ZodTypeDef, Inbound> = z
.object({
allowSync: z.boolean().optional(),
art: z.string().optional(),
composite: z.string().optional(),
filters: z.boolean().optional(),
refreshing: z.boolean().optional(),
thumb: z.string().optional(),
key: z.string().optional(),
type: z.string().optional(),
title: z.string().optional(),
agent: z.string().optional(),
scanner: z.string().optional(),
language: z.string().optional(),
uuid: z.string().optional(),
updatedAt: z.number().int().optional(),
createdAt: z.number().int().optional(),
scannedAt: z.number().int().optional(),
content: z.boolean().optional(),
directory: z.boolean().optional(),
contentChangedAt: z.number().int().optional(),
hidden: z.number().int().optional(),
Location: z.array(z.lazy(() => Location$.inboundSchema)).optional(),
})
.transform((v) => {
return {
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
...(v.art === undefined ? null : { art: v.art }),
...(v.composite === undefined ? null : { composite: v.composite }),
...(v.filters === undefined ? null : { filters: v.filters }),
...(v.refreshing === undefined ? null : { refreshing: v.refreshing }),
...(v.thumb === undefined ? null : { thumb: v.thumb }),
...(v.key === undefined ? null : { key: v.key }),
...(v.type === undefined ? null : { type: v.type }),
...(v.title === undefined ? null : { title: v.title }),
...(v.agent === undefined ? null : { agent: v.agent }),
...(v.scanner === undefined ? null : { scanner: v.scanner }),
...(v.language === undefined ? null : { language: v.language }),
...(v.uuid === undefined ? null : { uuid: v.uuid }),
...(v.updatedAt === undefined ? null : { updatedAt: v.updatedAt }),
...(v.createdAt === undefined ? null : { createdAt: v.createdAt }),
...(v.scannedAt === undefined ? null : { scannedAt: v.scannedAt }),
...(v.content === undefined ? null : { content: v.content }),
...(v.directory === undefined ? null : { directory: v.directory }),
...(v.contentChangedAt === undefined
? null
: { contentChangedAt: v.contentChangedAt }),
...(v.hidden === undefined ? null : { hidden: v.hidden }),
...(v.Location === undefined ? null : { location: v.Location }),
};
});
export type Outbound = {
allowSync?: boolean | undefined;
art?: string | undefined;
composite?: string | undefined;
filters?: boolean | undefined;
refreshing?: boolean | undefined;
thumb?: string | undefined;
key?: string | undefined;
type?: string | undefined;
title?: string | undefined;
agent?: string | undefined;
scanner?: string | undefined;
language?: string | undefined;
uuid?: string | undefined;
updatedAt?: number | undefined;
createdAt?: number | undefined;
scannedAt?: number | undefined;
content?: boolean | undefined;
directory?: boolean | undefined;
contentChangedAt?: number | undefined;
hidden?: number | undefined;
Location?: Array<Location$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibrariesDirectory> = z
.object({
allowSync: z.boolean().optional(),
art: z.string().optional(),
composite: z.string().optional(),
filters: z.boolean().optional(),
refreshing: z.boolean().optional(),
thumb: z.string().optional(),
key: z.string().optional(),
type: z.string().optional(),
title: z.string().optional(),
agent: z.string().optional(),
scanner: z.string().optional(),
language: z.string().optional(),
uuid: z.string().optional(),
updatedAt: z.number().int().optional(),
createdAt: z.number().int().optional(),
scannedAt: z.number().int().optional(),
content: z.boolean().optional(),
directory: z.boolean().optional(),
contentChangedAt: z.number().int().optional(),
hidden: z.number().int().optional(),
location: z.array(z.lazy(() => Location$.outboundSchema)).optional(),
})
.transform((v) => {
return {
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
...(v.art === undefined ? null : { art: v.art }),
...(v.composite === undefined ? null : { composite: v.composite }),
...(v.filters === undefined ? null : { filters: v.filters }),
...(v.refreshing === undefined ? null : { refreshing: v.refreshing }),
...(v.thumb === undefined ? null : { thumb: v.thumb }),
...(v.key === undefined ? null : { key: v.key }),
...(v.type === undefined ? null : { type: v.type }),
...(v.title === undefined ? null : { title: v.title }),
...(v.agent === undefined ? null : { agent: v.agent }),
...(v.scanner === undefined ? null : { scanner: v.scanner }),
...(v.language === undefined ? null : { language: v.language }),
...(v.uuid === undefined ? null : { uuid: v.uuid }),
...(v.updatedAt === undefined ? null : { updatedAt: v.updatedAt }),
...(v.createdAt === undefined ? null : { createdAt: v.createdAt }),
...(v.scannedAt === undefined ? null : { scannedAt: v.scannedAt }),
...(v.content === undefined ? null : { content: v.content }),
...(v.directory === undefined ? null : { directory: v.directory }),
...(v.contentChangedAt === undefined
? null
: { contentChangedAt: v.contentChangedAt }),
...(v.hidden === undefined ? null : { hidden: v.hidden }),
...(v.location === undefined ? null : { Location: v.location }),
};
});
}
/** @internal */
export namespace GetLibrariesMediaContainer$ {
export type Inbound = {
size?: number | undefined;
allowSync?: boolean | undefined;
title1?: string | undefined;
Directory?: Array<GetLibrariesDirectory$.Inbound> | undefined;
};
export const inboundSchema: z.ZodType<GetLibrariesMediaContainer, z.ZodTypeDef, Inbound> = z
.object({
size: z.number().int().optional(),
allowSync: z.boolean().optional(),
title1: z.string().optional(),
Directory: z.array(z.lazy(() => GetLibrariesDirectory$.inboundSchema)).optional(),
})
.transform((v) => {
return {
...(v.size === undefined ? null : { size: v.size }),
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
...(v.title1 === undefined ? null : { title1: v.title1 }),
...(v.Directory === undefined ? null : { directory: v.Directory }),
};
});
export type Outbound = {
size?: number | undefined;
allowSync?: boolean | undefined;
title1?: string | undefined;
Directory?: Array<GetLibrariesDirectory$.Outbound> | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibrariesMediaContainer> = z
.object({
size: z.number().int().optional(),
allowSync: z.boolean().optional(),
title1: z.string().optional(),
directory: z.array(z.lazy(() => GetLibrariesDirectory$.outboundSchema)).optional(),
})
.transform((v) => {
return {
...(v.size === undefined ? null : { size: v.size }),
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
...(v.title1 === undefined ? null : { title1: v.title1 }),
...(v.directory === undefined ? null : { Directory: v.directory }),
};
});
}
/** @internal */
export namespace GetLibrariesResponseBody$ {
export type Inbound = {
MediaContainer?: GetLibrariesMediaContainer$.Inbound | undefined;
};
export const inboundSchema: z.ZodType<GetLibrariesResponseBody, z.ZodTypeDef, Inbound> = z
.object({
MediaContainer: z.lazy(() => GetLibrariesMediaContainer$.inboundSchema).optional(),
})
.transform((v) => {
return {
...(v.MediaContainer === undefined ? null : { mediaContainer: v.MediaContainer }),
};
});
export type Outbound = {
MediaContainer?: GetLibrariesMediaContainer$.Outbound | undefined;
};
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibrariesResponseBody> = z
.object({
mediaContainer: z.lazy(() => GetLibrariesMediaContainer$.outboundSchema).optional(),
})
.transform((v) => {
return {
...(v.mediaContainer === undefined ? null : { MediaContainer: v.mediaContainer }),
};
});
}
/** @internal */ /** @internal */
export namespace GetLibrariesResponse$ { export namespace GetLibrariesResponse$ {
export type Inbound = { export type Inbound = {
ContentType: string; ContentType: string;
StatusCode: number; StatusCode: number;
RawResponse: Response; RawResponse: Response;
object?: GetLibrariesResponseBody$.Inbound | undefined;
}; };
export const inboundSchema: z.ZodType<GetLibrariesResponse, z.ZodTypeDef, Inbound> = z export const inboundSchema: z.ZodType<GetLibrariesResponse, z.ZodTypeDef, Inbound> = z
@@ -32,12 +352,14 @@ export namespace GetLibrariesResponse$ {
ContentType: z.string(), ContentType: z.string(),
StatusCode: z.number().int(), StatusCode: z.number().int(),
RawResponse: z.instanceof(Response), RawResponse: z.instanceof(Response),
object: z.lazy(() => GetLibrariesResponseBody$.inboundSchema).optional(),
}) })
.transform((v) => { .transform((v) => {
return { return {
contentType: v.ContentType, contentType: v.ContentType,
statusCode: v.StatusCode, statusCode: v.StatusCode,
rawResponse: v.RawResponse, rawResponse: v.RawResponse,
...(v.object === undefined ? null : { object: v.object }),
}; };
}); });
@@ -45,6 +367,7 @@ export namespace GetLibrariesResponse$ {
ContentType: string; ContentType: string;
StatusCode: number; StatusCode: number;
RawResponse: never; RawResponse: never;
object?: GetLibrariesResponseBody$.Outbound | undefined;
}; };
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibrariesResponse> = z export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibrariesResponse> = z
@@ -54,12 +377,14 @@ export namespace GetLibrariesResponse$ {
rawResponse: z.instanceof(Response).transform(() => { rawResponse: z.instanceof(Response).transform(() => {
throw new Error("Response cannot be serialized"); throw new Error("Response cannot be serialized");
}), }),
object: z.lazy(() => GetLibrariesResponseBody$.outboundSchema).optional(),
}) })
.transform((v) => { .transform((v) => {
return { return {
ContentType: v.contentType, ContentType: v.contentType,
StatusCode: v.statusCode, StatusCode: v.statusCode,
RawResponse: v.rawResponse, RawResponse: v.rawResponse,
...(v.object === undefined ? null : { object: v.object }),
}; };
}); });
} }

View File

@@ -59,7 +59,7 @@ export namespace GetLibraryRequest$ {
export const inboundSchema: z.ZodType<GetLibraryRequest, z.ZodTypeDef, Inbound> = z export const inboundSchema: z.ZodType<GetLibraryRequest, z.ZodTypeDef, Inbound> = z
.object({ .object({
sectionId: z.number(), sectionId: z.number(),
includeDetails: IncludeDetails$.optional(), includeDetails: IncludeDetails$.default(IncludeDetails.Zero),
}) })
.transform((v) => { .transform((v) => {
return { return {
@@ -70,18 +70,18 @@ export namespace GetLibraryRequest$ {
export type Outbound = { export type Outbound = {
sectionId: number; sectionId: number;
includeDetails?: IncludeDetails | undefined; includeDetails: IncludeDetails;
}; };
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryRequest> = z export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryRequest> = z
.object({ .object({
sectionId: z.number(), sectionId: z.number(),
includeDetails: IncludeDetails$.optional(), includeDetails: IncludeDetails$.default(IncludeDetails.Zero),
}) })
.transform((v) => { .transform((v) => {
return { return {
sectionId: v.sectionId, sectionId: v.sectionId,
...(v.includeDetails === undefined ? null : { includeDetails: v.includeDetails }), includeDetails: v.includeDetails,
}; };
}); });
} }

View File

@@ -32,7 +32,7 @@ export type GetResizedPhotoRequest = {
/** /**
* The opacity for the resized photo * The opacity for the resized photo
*/ */
opacity: number; opacity?: number | undefined;
/** /**
* The width for the resized photo * The width for the resized photo
*/ */
@@ -77,7 +77,7 @@ export namespace GetResizedPhotoRequest$ {
export type Inbound = { export type Inbound = {
width: number; width: number;
height: number; height: number;
opacity: number; opacity?: number | undefined;
blur: number; blur: number;
minSize: MinSize; minSize: MinSize;
upscale: Upscale; upscale: Upscale;
@@ -88,7 +88,7 @@ export namespace GetResizedPhotoRequest$ {
.object({ .object({
width: z.number(), width: z.number(),
height: z.number(), height: z.number(),
opacity: z.number().int(), opacity: z.number().int().default(100),
blur: z.number(), blur: z.number(),
minSize: MinSize$, minSize: MinSize$,
upscale: Upscale$, upscale: Upscale$,
@@ -98,7 +98,7 @@ export namespace GetResizedPhotoRequest$ {
return { return {
width: v.width, width: v.width,
height: v.height, height: v.height,
opacity: v.opacity, ...(v.opacity === undefined ? null : { opacity: v.opacity }),
blur: v.blur, blur: v.blur,
minSize: v.minSize, minSize: v.minSize,
upscale: v.upscale, upscale: v.upscale,
@@ -120,7 +120,7 @@ export namespace GetResizedPhotoRequest$ {
.object({ .object({
width: z.number(), width: z.number(),
height: z.number(), height: z.number(),
opacity: z.number().int(), opacity: z.number().int().default(100),
blur: z.number(), blur: z.number(),
minSize: MinSize$, minSize: MinSize$,
upscale: Upscale$, upscale: Upscale$,

View File

@@ -46,7 +46,7 @@ export namespace PerformSearchRequest$ {
.object({ .object({
query: z.string(), query: z.string(),
sectionId: z.number().optional(), sectionId: z.number().optional(),
limit: z.number().optional(), limit: z.number().default(3),
}) })
.transform((v) => { .transform((v) => {
return { return {
@@ -59,20 +59,20 @@ export namespace PerformSearchRequest$ {
export type Outbound = { export type Outbound = {
query: string; query: string;
sectionId?: number | undefined; sectionId?: number | undefined;
limit?: number | undefined; limit: number;
}; };
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, PerformSearchRequest> = z export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, PerformSearchRequest> = z
.object({ .object({
query: z.string(), query: z.string(),
sectionId: z.number().optional(), sectionId: z.number().optional(),
limit: z.number().optional(), limit: z.number().default(3),
}) })
.transform((v) => { .transform((v) => {
return { return {
query: v.query, query: v.query,
...(v.sectionId === undefined ? null : { sectionId: v.sectionId }), ...(v.sectionId === undefined ? null : { sectionId: v.sectionId }),
...(v.limit === undefined ? null : { limit: v.limit }), limit: v.limit,
}; };
}); });
} }

View File

@@ -46,7 +46,7 @@ export namespace PerformVoiceSearchRequest$ {
.object({ .object({
query: z.string(), query: z.string(),
sectionId: z.number().optional(), sectionId: z.number().optional(),
limit: z.number().optional(), limit: z.number().default(3),
}) })
.transform((v) => { .transform((v) => {
return { return {
@@ -59,20 +59,20 @@ export namespace PerformVoiceSearchRequest$ {
export type Outbound = { export type Outbound = {
query: string; query: string;
sectionId?: number | undefined; sectionId?: number | undefined;
limit?: number | undefined; limit: number;
}; };
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, PerformVoiceSearchRequest> = z export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, PerformVoiceSearchRequest> = z
.object({ .object({
query: z.string(), query: z.string(),
sectionId: z.number().optional(), sectionId: z.number().optional(),
limit: z.number().optional(), limit: z.number().default(3),
}) })
.transform((v) => { .transform((v) => {
return { return {
query: v.query, query: v.query,
...(v.sectionId === undefined ? null : { sectionId: v.sectionId }), ...(v.sectionId === undefined ? null : { sectionId: v.sectionId }),
...(v.limit === undefined ? null : { limit: v.limit }), limit: v.limit,
}; };
}); });
} }

View File

@@ -47,7 +47,7 @@ export class Activities extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );
@@ -119,7 +119,7 @@ export class Activities extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "delete", method: "DELETE",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,

View File

@@ -45,7 +45,7 @@ export class Butler extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );
@@ -104,7 +104,7 @@ export class Butler extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "post", path: path$, headers: headers$ }, { security: securitySettings$, method: "POST", path: path$, headers: headers$ },
options options
); );
@@ -156,7 +156,7 @@ export class Butler extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "delete", path: path$, headers: headers$ }, { security: securitySettings$, method: "DELETE", path: path$, headers: headers$ },
options options
); );
@@ -230,7 +230,7 @@ export class Butler extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "post", method: "POST",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,
@@ -304,7 +304,7 @@ export class Butler extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "delete", method: "DELETE",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,

View File

@@ -68,7 +68,7 @@ export class Hubs extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -157,7 +157,7 @@ export class Hubs extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,

View File

@@ -65,7 +65,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -122,7 +122,7 @@ export class Library extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );
@@ -182,7 +182,7 @@ export class Library extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );
@@ -192,8 +192,13 @@ export class Library extends ClientSDK {
RawResponse: response, RawResponse: response,
}; };
if (this.matchStatusCode(response, 200)) { if (this.matchResponse(response, 200, "application/json")) {
// fallthrough const responseBody = await response.json();
const result = operations.GetLibrariesResponse$.inboundSchema.parse({
...responseFields$,
object: responseBody,
});
return result;
} else if (this.matchResponse(response, 401, "application/json")) { } else if (this.matchResponse(response, 401, "application/json")) {
const responseBody = await response.json(); const responseBody = await response.json();
const result = errors.GetLibrariesResponseBody$.inboundSchema.parse({ const result = errors.GetLibrariesResponseBody$.inboundSchema.parse({
@@ -205,8 +210,6 @@ export class Library extends ClientSDK {
const responseBody = await response.text(); const responseBody = await response.text();
throw new errors.SDKError("Unexpected API response", response, responseBody); throw new errors.SDKError("Unexpected API response", response, responseBody);
} }
return operations.GetLibrariesResponse$.inboundSchema.parse(responseFields$);
} }
/** /**
@@ -281,7 +284,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -355,7 +358,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "delete", method: "DELETE",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,
@@ -440,7 +443,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -517,7 +520,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,
@@ -604,7 +607,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -692,7 +695,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -767,7 +770,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,
@@ -843,7 +846,7 @@ export class Library extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
body: body$, body: body$,
@@ -899,7 +902,7 @@ export class Library extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );

View File

@@ -72,7 +72,7 @@ export class Log extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -129,7 +129,7 @@ export class Log extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "post", path: path$, headers: headers$ }, { security: securitySettings$, method: "POST", path: path$, headers: headers$ },
options options
); );
@@ -181,7 +181,7 @@ export class Log extends ClientSDK {
const securitySettings$ = this.resolveGlobalSecurity(security$); const securitySettings$ = this.resolveGlobalSecurity(security$);
const response = await this.fetch$( const response = await this.fetch$(
{ security: securitySettings$, method: "get", path: path$, headers: headers$ }, { security: securitySettings$, method: "GET", path: path$, headers: headers$ },
options options
); );

View File

@@ -62,7 +62,7 @@ export class Media extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -135,7 +135,7 @@ export class Media extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "get", method: "GET",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,
@@ -215,7 +215,7 @@ export class Media extends ClientSDK {
const response = await this.fetch$( const response = await this.fetch$(
{ {
security: securitySettings$, security: securitySettings$,
method: "post", method: "POST",
path: path$, path: path$,
headers: headers$, headers: headers$,
query: query$, query: query$,

Some files were not shown because too many files have changed in this diff Show More