From 9849d78576477f87bbd2d8b76dcf86d2966093cc Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Sat, 16 Mar 2024 12:02:11 +1100 Subject: [PATCH] feat(client): update docs and regenerate latest client Signed-off-by: Jordan Shatford --- README.md | 2 +- packages/client/package.json | 2 +- .../src/generated/core/CancelablePromise.ts | 6 ++-- packages/client/src/generated/core/request.ts | 2 +- .../src/generated/models/AudioFormat.ts | 2 ++ .../models/AvailableDownloadOptions.ts | 10 +++--- .../src/generated/models/DownloadOptions.ts | 10 +++--- .../src/generated/models/DownloadQuality.ts | 2 ++ .../src/generated/models/DownloadState.ts | 2 ++ .../src/generated/models/DownloadStatus.ts | 18 +++++----- .../src/generated/models/ValidationError.ts | 2 +- .../src/generated/models/VideoFormat.ts | 2 ++ pnpm-lock.yaml | 33 ++++++------------- 13 files changed, 44 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index d6f51c18..f8742e77 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,6 @@ Please refer to the [contributing guide](CONTRIBUTING.md) for how to install the - `web`: A web application developed in [SvelteKit](https://kit.svelte.dev/). ### Packages: -- `client`: A TypeScript API client generated from the OpenAPI specification for the API using [OpenAPI TypeScript Codegen](https://github.com/ferdikoomen/openapi-typescript-codegen/). +- `client`: A TypeScript API client generated from the OpenAPI specification for the API using [OpenAPI TypeScript Codegen](https://github.com/nicolas-chaulet/openapi-typescript-codegen). - `config`: Common configs shared between other packages and apps in the monorepo. - `ui`: A UI library used by the project developed in [Svelte](https://svelte.dev/). diff --git a/packages/client/package.json b/packages/client/package.json index 24755587..99836fa2 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -12,7 +12,7 @@ "format": "prettier --write ." }, "devDependencies": { - "@nicolas-chaulet/openapi-typescript-codegen": "^0.27.21", + "@nicolas-chaulet/openapi-typescript-codegen": "^0.27.25", "@yd/config": "workspace:*", "typescript": "^5.4.2" } diff --git a/packages/client/src/generated/core/CancelablePromise.ts b/packages/client/src/generated/core/CancelablePromise.ts index 71f92571..1db49871 100644 --- a/packages/client/src/generated/core/CancelablePromise.ts +++ b/packages/client/src/generated/core/CancelablePromise.ts @@ -85,9 +85,9 @@ export class CancelablePromise implements Promise { }); } - get [Symbol.toStringTag]() { - return "Cancellable Promise"; - } + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } public then( onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, diff --git a/packages/client/src/generated/core/request.ts b/packages/client/src/generated/core/request.ts index 9f7b2f1c..2deaae8c 100644 --- a/packages/client/src/generated/core/request.ts +++ b/packages/client/src/generated/core/request.ts @@ -160,7 +160,7 @@ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptio headers['Authorization'] = `Basic ${credentials}`; } - if (options.body) { + if (options.body !== undefined) { if (options.mediaType) { headers['Content-Type'] = options.mediaType; } else if (isBlob(options.body)) { diff --git a/packages/client/src/generated/models/AudioFormat.ts b/packages/client/src/generated/models/AudioFormat.ts index 86674987..53d720ee 100644 --- a/packages/client/src/generated/models/AudioFormat.ts +++ b/packages/client/src/generated/models/AudioFormat.ts @@ -10,3 +10,5 @@ export enum AudioFormat { OPUS = 'opus', WAV = 'wav', } +export type TAudioFormat = 'aac' | 'flac' | 'm4a' | 'mp3' | 'opus' | 'wav'; + diff --git a/packages/client/src/generated/models/AvailableDownloadOptions.ts b/packages/client/src/generated/models/AvailableDownloadOptions.ts index ef5420e6..6528fc75 100644 --- a/packages/client/src/generated/models/AvailableDownloadOptions.ts +++ b/packages/client/src/generated/models/AvailableDownloadOptions.ts @@ -2,12 +2,12 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { AudioFormat } from './AudioFormat'; -import type { DownloadQuality } from './DownloadQuality'; -import type { VideoFormat } from './VideoFormat'; +import type { TAudioFormat } from './AudioFormat'; +import type { TDownloadQuality } from './DownloadQuality'; +import type { TVideoFormat } from './VideoFormat'; export type AvailableDownloadOptions = { - format: Array<(AudioFormat | VideoFormat)>; - quality: Array; + format: Array; + quality: Array; embed_metadata: Array; embed_thumbnail: Array; embed_subtitles: Array; diff --git a/packages/client/src/generated/models/DownloadOptions.ts b/packages/client/src/generated/models/DownloadOptions.ts index a41bebc1..84357885 100644 --- a/packages/client/src/generated/models/DownloadOptions.ts +++ b/packages/client/src/generated/models/DownloadOptions.ts @@ -2,12 +2,12 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { AudioFormat } from './AudioFormat'; -import type { DownloadQuality } from './DownloadQuality'; -import type { VideoFormat } from './VideoFormat'; +import type { TAudioFormat } from './AudioFormat'; +import type { TDownloadQuality } from './DownloadQuality'; +import type { TVideoFormat } from './VideoFormat'; export type DownloadOptions = { - format: (AudioFormat | VideoFormat); - quality: DownloadQuality; + format: TAudioFormat | TVideoFormat; + quality: TDownloadQuality; embed_metadata: boolean; embed_thumbnail: boolean; embed_subtitles: boolean; diff --git a/packages/client/src/generated/models/DownloadQuality.ts b/packages/client/src/generated/models/DownloadQuality.ts index 4d09f29f..eac0322e 100644 --- a/packages/client/src/generated/models/DownloadQuality.ts +++ b/packages/client/src/generated/models/DownloadQuality.ts @@ -6,3 +6,5 @@ export enum DownloadQuality { BEST = 'best', WORST = 'worst', } +export type TDownloadQuality = 'best' | 'worst'; + diff --git a/packages/client/src/generated/models/DownloadState.ts b/packages/client/src/generated/models/DownloadState.ts index ad9e0e65..491fc9cf 100644 --- a/packages/client/src/generated/models/DownloadState.ts +++ b/packages/client/src/generated/models/DownloadState.ts @@ -9,3 +9,5 @@ export enum DownloadState { DONE = 'DONE', ERROR = 'ERROR', } +export type TDownloadState = 'WAITING' | 'DOWNLOADING' | 'PROCESSING' | 'DONE' | 'ERROR'; + diff --git a/packages/client/src/generated/models/DownloadStatus.ts b/packages/client/src/generated/models/DownloadStatus.ts index e66afddf..0c6a0442 100644 --- a/packages/client/src/generated/models/DownloadStatus.ts +++ b/packages/client/src/generated/models/DownloadStatus.ts @@ -2,15 +2,15 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { DownloadState } from './DownloadState'; +import type { TDownloadState } from './DownloadState'; export type DownloadStatus = { - state: DownloadState; - downloaded_bytes?: (number | null); - total_bytes?: (number | null); - elapsed?: (number | null); - eta?: (number | null); - speed?: (number | null); - postprocessor?: (string | null); - readonly progress: (number | null); + state: TDownloadState; + downloaded_bytes?: number | null; + total_bytes?: number | null; + elapsed?: number | null; + eta?: number | null; + speed?: number | null; + postprocessor?: string | null; + readonly progress: number | null; }; diff --git a/packages/client/src/generated/models/ValidationError.ts b/packages/client/src/generated/models/ValidationError.ts index f3204948..e323f0fc 100644 --- a/packages/client/src/generated/models/ValidationError.ts +++ b/packages/client/src/generated/models/ValidationError.ts @@ -3,7 +3,7 @@ /* tslint:disable */ /* eslint-disable */ export type ValidationError = { - loc: Array<(string | number)>; + loc: Array; msg: string; type: string; }; diff --git a/packages/client/src/generated/models/VideoFormat.ts b/packages/client/src/generated/models/VideoFormat.ts index 89206600..1bd89ba7 100644 --- a/packages/client/src/generated/models/VideoFormat.ts +++ b/packages/client/src/generated/models/VideoFormat.ts @@ -10,3 +10,5 @@ export enum VideoFormat { MP4 = 'mp4', WEBM = 'webm', } +export type TVideoFormat = 'avi' | 'flv' | 'mkv' | 'mov' | 'mp4' | 'webm'; + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 522c3880..520c0378 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,8 +130,8 @@ importers: packages/client: devDependencies: '@nicolas-chaulet/openapi-typescript-codegen': - specifier: ^0.27.21 - version: 0.27.21 + specifier: ^0.27.25 + version: 0.27.25 '@yd/config': specifier: workspace:* version: link:../config @@ -264,15 +264,13 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.23 - /@apidevtools/json-schema-ref-parser@11.1.0: - resolution: {integrity: sha512-g/VW9ZQEFJAOwAyUb8JFf7MLiLy2uEB4rU270rGzDwICxnxMlPy0O11KVePSgS36K1NI29gSlK84n5INGhd4Ag==} + /@apidevtools/json-schema-ref-parser@11.5.4: + resolution: {integrity: sha512-o2fsypTGU0WxRxbax8zQoHiIB4dyrkwYfcm8TxZ+bx9pCzcWZbQtiMqpgBvWA/nJ2TrGjK5adCLfTH8wUeU/Wg==} engines: {node: '>= 16'} dependencies: '@jsdevtools/ono': 7.1.3 '@types/json-schema': 7.0.15 - '@types/lodash.clonedeep': 4.5.9 js-yaml: 4.1.0 - lodash.clonedeep: 4.5.0 dev: true /@babel/code-frame@7.23.5: @@ -1007,15 +1005,18 @@ packages: read-yaml-file: 1.1.0 dev: true - /@nicolas-chaulet/openapi-typescript-codegen@0.27.21: - resolution: {integrity: sha512-DoSY1GCqQufSYy1m/7mE2SrWDNjy2eh//19Fp699ELJx26phicv+xrEgrq2BXiXhKM2aoVoOueGg8ADwRL6kdw==} + /@nicolas-chaulet/openapi-typescript-codegen@0.27.25: + resolution: {integrity: sha512-oXHdATTJ2FKWCTXPlJffRAAs2zJsPsLDlhn3PGognxMbZ0178oNM3XdEqlcKHbNM0rPKv8Ok56zbhoOQV2OFng==} hasBin: true dependencies: - '@apidevtools/json-schema-ref-parser': 11.1.0 + '@apidevtools/json-schema-ref-parser': 11.5.4 camelcase: 6.3.0 commander: 11.1.0 fs-extra: 11.2.0 handlebars: 4.7.8 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding dev: true /@nodelib/fs.scandir@2.1.5: @@ -1346,16 +1347,6 @@ packages: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true - /@types/lodash.clonedeep@4.5.9: - resolution: {integrity: sha512-19429mWC+FyaAhOLzsS8kZUsI+/GmBAQ0HFiCPsKGU+7pBXOQWhyrY6xNNDwUSX8SMZMJvuFVMF9O5dQOlQK9Q==} - dependencies: - '@types/lodash': 4.14.202 - dev: true - - /@types/lodash@4.14.202: - resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} - dev: true - /@types/minimatch@3.0.5: resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} dev: true @@ -4236,10 +4227,6 @@ packages: resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} dev: true - /lodash.clonedeep@4.5.0: - resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} - dev: true - /lodash.isplainobject@4.0.6: resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} dev: true