mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b562d2a68e | ||
|
|
09060624f9 | ||
|
|
a6620dfce9 |
@@ -1,12 +1,12 @@
|
|||||||
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: a14d0ae27d4f5bd83b80747112f74352
|
||||||
docVersion: 0.0.3
|
docVersion: 0.0.3
|
||||||
speakeasyVersion: internal
|
speakeasyVersion: internal
|
||||||
generationVersion: 2.233.2
|
generationVersion: 2.237.2
|
||||||
releaseVersion: 0.4.0
|
releaseVersion: 0.4.2
|
||||||
configChecksum: 857d3a3d03c912d0f09faf0342203722
|
configChecksum: 6e80d271f4991201f5c573665ed48a76
|
||||||
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
|
||||||
@@ -14,7 +14,7 @@ management:
|
|||||||
features:
|
features:
|
||||||
typescript:
|
typescript:
|
||||||
constsAndDefaults: 0.1.1
|
constsAndDefaults: 0.1.1
|
||||||
core: 3.4.6
|
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
|
||||||
@@ -43,6 +43,7 @@ generatedFiles:
|
|||||||
- 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
|
||||||
@@ -264,9 +265,16 @@ 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
|
||||||
|
- docs/models/operations/getlibrarydirectory.md
|
||||||
|
- docs/models/operations/getlibrarymediacontainer.md
|
||||||
|
- docs/models/operations/getlibraryresponsebody.md
|
||||||
- docs/models/operations/getlibraryresponse.md
|
- docs/models/operations/getlibraryresponse.md
|
||||||
- docs/models/operations/deletelibraryrequest.md
|
- docs/models/operations/deletelibraryrequest.md
|
||||||
- docs/models/operations/deletelibraryresponse.md
|
- docs/models/operations/deletelibraryresponse.md
|
||||||
|
|||||||
32
RELEASES.md
32
RELEASES.md
@@ -78,4 +78,34 @@ Based on:
|
|||||||
### Generated
|
### Generated
|
||||||
- [typescript v0.4.0] .
|
- [typescript v0.4.0] .
|
||||||
### Releases
|
### Releases
|
||||||
- [NPM v0.4.0] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.0 - .
|
- [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 - .
|
||||||
|
|
||||||
|
## 2024-01-19 17:27:25
|
||||||
|
### 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.2] .
|
||||||
|
### Releases
|
||||||
|
- [NPM v0.4.2] https://www.npmjs.com/package/@lukehagar/plexjs/v/0.4.2 - .
|
||||||
28
docs/models/operations/getlibrariesdirectory.md
Normal file
28
docs/models/operations/getlibrariesdirectory.md
Normal 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"}] |
|
||||||
11
docs/models/operations/getlibrariesmediacontainer.md
Normal file
11
docs/models/operations/getlibrariesmediacontainer.md
Normal 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"}] |
|
||||||
@@ -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 |
|
||||||
10
docs/models/operations/getlibrariesresponsebody.md
Normal file
10
docs/models/operations/getlibrariesresponsebody.md
Normal 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 |
|
||||||
12
docs/models/operations/getlibrarydirectory.md
Normal file
12
docs/models/operations/getlibrarydirectory.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# GetLibraryDirectory
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
|
||||||
|
| `secondary` | *boolean* | :heavy_minus_sign: | N/A | true |
|
||||||
|
| `prompt` | *string* | :heavy_minus_sign: | N/A | Search Movies |
|
||||||
|
| `search` | *boolean* | :heavy_minus_sign: | N/A | true |
|
||||||
|
| `key` | *string* | :heavy_minus_sign: | N/A | search?type=1 |
|
||||||
|
| `title` | *string* | :heavy_minus_sign: | N/A | Search... |
|
||||||
20
docs/models/operations/getlibrarymediacontainer.md
Normal file
20
docs/models/operations/getlibrarymediacontainer.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# GetLibraryMediaContainer
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description | Example |
|
||||||
|
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||||
|
| `size` | *number* | :heavy_minus_sign: | N/A | 20 |
|
||||||
|
| `allowSync` | *boolean* | :heavy_minus_sign: | N/A | false |
|
||||||
|
| `art` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg |
|
||||||
|
| `content` | *string* | :heavy_minus_sign: | N/A | secondary |
|
||||||
|
| `identifier` | *string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library |
|
||||||
|
| `librarySectionID` | *number* | :heavy_minus_sign: | N/A | 1 |
|
||||||
|
| `mediaTagPrefix` | *string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ |
|
||||||
|
| `mediaTagVersion` | *number* | :heavy_minus_sign: | N/A | 1698860922 |
|
||||||
|
| `thumb` | *string* | :heavy_minus_sign: | N/A | /:/resources/movie.png |
|
||||||
|
| `title1` | *string* | :heavy_minus_sign: | N/A | Movies |
|
||||||
|
| `viewGroup` | *string* | :heavy_minus_sign: | N/A | secondary |
|
||||||
|
| `viewMode` | *number* | :heavy_minus_sign: | N/A | 65592 |
|
||||||
|
| `directory` | [operations.GetLibraryDirectory](../../models/operations/getlibrarydirectory.md)[] | :heavy_minus_sign: | N/A | [{"key":"search?type=1","prompt":"Search Movies","search":true,"secondary":true,"title":"Search..."}] |
|
||||||
@@ -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.GetLibraryResponseBody](../../models/operations/getlibraryresponsebody.md) | :heavy_minus_sign: | The details of the library |
|
||||||
10
docs/models/operations/getlibraryresponsebody.md
Normal file
10
docs/models/operations/getlibraryresponsebody.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# GetLibraryResponseBody
|
||||||
|
|
||||||
|
The details of the library
|
||||||
|
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
| Field | Type | Required | Description |
|
||||||
|
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
|
||||||
|
| `mediaContainer` | [operations.GetLibraryMediaContainer](../../models/operations/getlibrarymediacontainer.md) | :heavy_minus_sign: | N/A |
|
||||||
9
docs/models/operations/location.md
Normal file
9
docs/models/operations/location.md
Normal 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 |
|
||||||
2
gen.yaml
2
gen.yaml
@@ -8,7 +8,7 @@ generation:
|
|||||||
fixes:
|
fixes:
|
||||||
nameResolutionDec2023: false
|
nameResolutionDec2023: false
|
||||||
typescript:
|
typescript:
|
||||||
version: 0.4.0
|
version: 0.4.2
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
clientServerStatusCodesAsErrors: true
|
clientServerStatusCodesAsErrors: true
|
||||||
flattenGlobalSecurity: true
|
flattenGlobalSecurity: true
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.4.0",
|
"version": "0.4.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.4.0",
|
"version": "0.4.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"decimal.js": "^10.4.3",
|
"decimal.js": "^10.4.3",
|
||||||
"jsonpath": "^1.1.1"
|
"jsonpath": "^1.1.1"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"name": "@lukehagar/plexjs",
|
"name": "@lukehagar/plexjs",
|
||||||
"version": "0.4.0",
|
"version": "0.4.2",
|
||||||
"author": "LukeHagar",
|
"author": "LukeHagar",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
|
|||||||
@@ -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.4.0",
|
sdkVersion: "0.4.2",
|
||||||
genVersion: "2.233.2",
|
genVersion: "2.237.2",
|
||||||
userAgent: "speakeasy-sdk/typescript 0.4.0 2.233.2 0.0.3 @lukehagar/plexjs",
|
userAgent: "speakeasy-sdk/typescript 0.4.2 2.237.2 0.0.3 @lukehagar/plexjs",
|
||||||
});
|
});
|
||||||
|
|||||||
192
src/lib/event-streams.ts
Normal file
192
src/lib/event-streams.ts
Normal 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);
|
||||||
|
}
|
||||||
@@ -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 }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,37 @@ export type GetLibraryRequest = {
|
|||||||
includeDetails?: IncludeDetails | undefined;
|
includeDetails?: IncludeDetails | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type GetLibraryDirectory = {
|
||||||
|
secondary?: boolean | undefined;
|
||||||
|
prompt?: string | undefined;
|
||||||
|
search?: boolean | undefined;
|
||||||
|
key?: string | undefined;
|
||||||
|
title?: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetLibraryMediaContainer = {
|
||||||
|
size?: number | undefined;
|
||||||
|
allowSync?: boolean | undefined;
|
||||||
|
art?: string | undefined;
|
||||||
|
content?: string | undefined;
|
||||||
|
identifier?: string | undefined;
|
||||||
|
librarySectionID?: number | undefined;
|
||||||
|
mediaTagPrefix?: string | undefined;
|
||||||
|
mediaTagVersion?: number | undefined;
|
||||||
|
thumb?: string | undefined;
|
||||||
|
title1?: string | undefined;
|
||||||
|
viewGroup?: string | undefined;
|
||||||
|
viewMode?: number | undefined;
|
||||||
|
directory?: Array<GetLibraryDirectory> | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The details of the library
|
||||||
|
*/
|
||||||
|
export type GetLibraryResponseBody = {
|
||||||
|
mediaContainer?: GetLibraryMediaContainer | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export type GetLibraryResponse = {
|
export type GetLibraryResponse = {
|
||||||
/**
|
/**
|
||||||
* HTTP response content type for this operation
|
* HTTP response content type for this operation
|
||||||
@@ -44,6 +75,10 @@ export type GetLibraryResponse = {
|
|||||||
* Raw HTTP response; suitable for custom response parsing
|
* Raw HTTP response; suitable for custom response parsing
|
||||||
*/
|
*/
|
||||||
rawResponse: Response;
|
rawResponse: Response;
|
||||||
|
/**
|
||||||
|
* The details of the library
|
||||||
|
*/
|
||||||
|
object?: GetLibraryResponseBody | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
@@ -86,12 +121,210 @@ export namespace GetLibraryRequest$ {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
export namespace GetLibraryDirectory$ {
|
||||||
|
export type Inbound = {
|
||||||
|
secondary?: boolean | undefined;
|
||||||
|
prompt?: string | undefined;
|
||||||
|
search?: boolean | undefined;
|
||||||
|
key?: string | undefined;
|
||||||
|
title?: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inboundSchema: z.ZodType<GetLibraryDirectory, z.ZodTypeDef, Inbound> = z
|
||||||
|
.object({
|
||||||
|
secondary: z.boolean().optional(),
|
||||||
|
prompt: z.string().optional(),
|
||||||
|
search: z.boolean().optional(),
|
||||||
|
key: z.string().optional(),
|
||||||
|
title: z.string().optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.secondary === undefined ? null : { secondary: v.secondary }),
|
||||||
|
...(v.prompt === undefined ? null : { prompt: v.prompt }),
|
||||||
|
...(v.search === undefined ? null : { search: v.search }),
|
||||||
|
...(v.key === undefined ? null : { key: v.key }),
|
||||||
|
...(v.title === undefined ? null : { title: v.title }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export type Outbound = {
|
||||||
|
secondary?: boolean | undefined;
|
||||||
|
prompt?: string | undefined;
|
||||||
|
search?: boolean | undefined;
|
||||||
|
key?: string | undefined;
|
||||||
|
title?: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryDirectory> = z
|
||||||
|
.object({
|
||||||
|
secondary: z.boolean().optional(),
|
||||||
|
prompt: z.string().optional(),
|
||||||
|
search: z.boolean().optional(),
|
||||||
|
key: z.string().optional(),
|
||||||
|
title: z.string().optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.secondary === undefined ? null : { secondary: v.secondary }),
|
||||||
|
...(v.prompt === undefined ? null : { prompt: v.prompt }),
|
||||||
|
...(v.search === undefined ? null : { search: v.search }),
|
||||||
|
...(v.key === undefined ? null : { key: v.key }),
|
||||||
|
...(v.title === undefined ? null : { title: v.title }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
export namespace GetLibraryMediaContainer$ {
|
||||||
|
export type Inbound = {
|
||||||
|
size?: number | undefined;
|
||||||
|
allowSync?: boolean | undefined;
|
||||||
|
art?: string | undefined;
|
||||||
|
content?: string | undefined;
|
||||||
|
identifier?: string | undefined;
|
||||||
|
librarySectionID?: number | undefined;
|
||||||
|
mediaTagPrefix?: string | undefined;
|
||||||
|
mediaTagVersion?: number | undefined;
|
||||||
|
thumb?: string | undefined;
|
||||||
|
title1?: string | undefined;
|
||||||
|
viewGroup?: string | undefined;
|
||||||
|
viewMode?: number | undefined;
|
||||||
|
Directory?: Array<GetLibraryDirectory$.Inbound> | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inboundSchema: z.ZodType<GetLibraryMediaContainer, z.ZodTypeDef, Inbound> = z
|
||||||
|
.object({
|
||||||
|
size: z.number().int().optional(),
|
||||||
|
allowSync: z.boolean().optional(),
|
||||||
|
art: z.string().optional(),
|
||||||
|
content: z.string().optional(),
|
||||||
|
identifier: z.string().optional(),
|
||||||
|
librarySectionID: z.number().int().optional(),
|
||||||
|
mediaTagPrefix: z.string().optional(),
|
||||||
|
mediaTagVersion: z.number().int().optional(),
|
||||||
|
thumb: z.string().optional(),
|
||||||
|
title1: z.string().optional(),
|
||||||
|
viewGroup: z.string().optional(),
|
||||||
|
viewMode: z.number().int().optional(),
|
||||||
|
Directory: z.array(z.lazy(() => GetLibraryDirectory$.inboundSchema)).optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.size === undefined ? null : { size: v.size }),
|
||||||
|
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
|
||||||
|
...(v.art === undefined ? null : { art: v.art }),
|
||||||
|
...(v.content === undefined ? null : { content: v.content }),
|
||||||
|
...(v.identifier === undefined ? null : { identifier: v.identifier }),
|
||||||
|
...(v.librarySectionID === undefined
|
||||||
|
? null
|
||||||
|
: { librarySectionID: v.librarySectionID }),
|
||||||
|
...(v.mediaTagPrefix === undefined ? null : { mediaTagPrefix: v.mediaTagPrefix }),
|
||||||
|
...(v.mediaTagVersion === undefined
|
||||||
|
? null
|
||||||
|
: { mediaTagVersion: v.mediaTagVersion }),
|
||||||
|
...(v.thumb === undefined ? null : { thumb: v.thumb }),
|
||||||
|
...(v.title1 === undefined ? null : { title1: v.title1 }),
|
||||||
|
...(v.viewGroup === undefined ? null : { viewGroup: v.viewGroup }),
|
||||||
|
...(v.viewMode === undefined ? null : { viewMode: v.viewMode }),
|
||||||
|
...(v.Directory === undefined ? null : { directory: v.Directory }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export type Outbound = {
|
||||||
|
size?: number | undefined;
|
||||||
|
allowSync?: boolean | undefined;
|
||||||
|
art?: string | undefined;
|
||||||
|
content?: string | undefined;
|
||||||
|
identifier?: string | undefined;
|
||||||
|
librarySectionID?: number | undefined;
|
||||||
|
mediaTagPrefix?: string | undefined;
|
||||||
|
mediaTagVersion?: number | undefined;
|
||||||
|
thumb?: string | undefined;
|
||||||
|
title1?: string | undefined;
|
||||||
|
viewGroup?: string | undefined;
|
||||||
|
viewMode?: number | undefined;
|
||||||
|
Directory?: Array<GetLibraryDirectory$.Outbound> | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryMediaContainer> = z
|
||||||
|
.object({
|
||||||
|
size: z.number().int().optional(),
|
||||||
|
allowSync: z.boolean().optional(),
|
||||||
|
art: z.string().optional(),
|
||||||
|
content: z.string().optional(),
|
||||||
|
identifier: z.string().optional(),
|
||||||
|
librarySectionID: z.number().int().optional(),
|
||||||
|
mediaTagPrefix: z.string().optional(),
|
||||||
|
mediaTagVersion: z.number().int().optional(),
|
||||||
|
thumb: z.string().optional(),
|
||||||
|
title1: z.string().optional(),
|
||||||
|
viewGroup: z.string().optional(),
|
||||||
|
viewMode: z.number().int().optional(),
|
||||||
|
directory: z.array(z.lazy(() => GetLibraryDirectory$.outboundSchema)).optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.size === undefined ? null : { size: v.size }),
|
||||||
|
...(v.allowSync === undefined ? null : { allowSync: v.allowSync }),
|
||||||
|
...(v.art === undefined ? null : { art: v.art }),
|
||||||
|
...(v.content === undefined ? null : { content: v.content }),
|
||||||
|
...(v.identifier === undefined ? null : { identifier: v.identifier }),
|
||||||
|
...(v.librarySectionID === undefined
|
||||||
|
? null
|
||||||
|
: { librarySectionID: v.librarySectionID }),
|
||||||
|
...(v.mediaTagPrefix === undefined ? null : { mediaTagPrefix: v.mediaTagPrefix }),
|
||||||
|
...(v.mediaTagVersion === undefined
|
||||||
|
? null
|
||||||
|
: { mediaTagVersion: v.mediaTagVersion }),
|
||||||
|
...(v.thumb === undefined ? null : { thumb: v.thumb }),
|
||||||
|
...(v.title1 === undefined ? null : { title1: v.title1 }),
|
||||||
|
...(v.viewGroup === undefined ? null : { viewGroup: v.viewGroup }),
|
||||||
|
...(v.viewMode === undefined ? null : { viewMode: v.viewMode }),
|
||||||
|
...(v.directory === undefined ? null : { Directory: v.directory }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
export namespace GetLibraryResponseBody$ {
|
||||||
|
export type Inbound = {
|
||||||
|
MediaContainer?: GetLibraryMediaContainer$.Inbound | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inboundSchema: z.ZodType<GetLibraryResponseBody, z.ZodTypeDef, Inbound> = z
|
||||||
|
.object({
|
||||||
|
MediaContainer: z.lazy(() => GetLibraryMediaContainer$.inboundSchema).optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.MediaContainer === undefined ? null : { mediaContainer: v.MediaContainer }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export type Outbound = {
|
||||||
|
MediaContainer?: GetLibraryMediaContainer$.Outbound | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryResponseBody> = z
|
||||||
|
.object({
|
||||||
|
mediaContainer: z.lazy(() => GetLibraryMediaContainer$.outboundSchema).optional(),
|
||||||
|
})
|
||||||
|
.transform((v) => {
|
||||||
|
return {
|
||||||
|
...(v.mediaContainer === undefined ? null : { MediaContainer: v.mediaContainer }),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export namespace GetLibraryResponse$ {
|
export namespace GetLibraryResponse$ {
|
||||||
export type Inbound = {
|
export type Inbound = {
|
||||||
ContentType: string;
|
ContentType: string;
|
||||||
StatusCode: number;
|
StatusCode: number;
|
||||||
RawResponse: Response;
|
RawResponse: Response;
|
||||||
|
object?: GetLibraryResponseBody$.Inbound | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const inboundSchema: z.ZodType<GetLibraryResponse, z.ZodTypeDef, Inbound> = z
|
export const inboundSchema: z.ZodType<GetLibraryResponse, z.ZodTypeDef, Inbound> = z
|
||||||
@@ -99,12 +332,14 @@ export namespace GetLibraryResponse$ {
|
|||||||
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(() => GetLibraryResponseBody$.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 }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -112,6 +347,7 @@ export namespace GetLibraryResponse$ {
|
|||||||
ContentType: string;
|
ContentType: string;
|
||||||
StatusCode: number;
|
StatusCode: number;
|
||||||
RawResponse: never;
|
RawResponse: never;
|
||||||
|
object?: GetLibraryResponseBody$.Outbound | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryResponse> = z
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, GetLibraryResponse> = z
|
||||||
@@ -121,12 +357,14 @@ export namespace GetLibraryResponse$ {
|
|||||||
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(() => GetLibraryResponseBody$.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 }),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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$);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -296,8 +299,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.GetLibraryResponse$.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.GetLibraryResponseBody$.inboundSchema.parse({
|
const result = errors.GetLibraryResponseBody$.inboundSchema.parse({
|
||||||
@@ -309,8 +317,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.GetLibraryResponse$.inboundSchema.parse(responseFields$);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user