diff --git a/src/api/generated/core/ApiError.ts b/src/api/generated/core/ApiError.ts index 2820b8d6..d6b8fcc3 100644 --- a/src/api/generated/core/ApiError.ts +++ b/src/api/generated/core/ApiError.ts @@ -6,24 +6,20 @@ import type { ApiRequestOptions } from './ApiRequestOptions'; import type { ApiResult } from './ApiResult'; export class ApiError extends Error { - public readonly url: string; - public readonly status: number; - public readonly statusText: string; - public readonly body: any; - public readonly request: ApiRequestOptions; + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; - constructor( - request: ApiRequestOptions, - response: ApiResult, - message: string, - ) { - super(message); + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); - this.name = 'ApiError'; - this.url = response.url; - this.status = response.status; - this.statusText = response.statusText; - this.body = response.body; - this.request = request; - } + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } } diff --git a/src/api/generated/core/ApiRequestOptions.ts b/src/api/generated/core/ApiRequestOptions.ts index 20cd2157..c19adcc9 100644 --- a/src/api/generated/core/ApiRequestOptions.ts +++ b/src/api/generated/core/ApiRequestOptions.ts @@ -3,22 +3,15 @@ /* tslint:disable */ /* eslint-disable */ export type ApiRequestOptions = { - readonly method: - | 'GET' - | 'PUT' - | 'POST' - | 'DELETE' - | 'OPTIONS' - | 'HEAD' - | 'PATCH'; - readonly url: string; - readonly path?: Record; - readonly cookies?: Record; - readonly headers?: Record; - readonly query?: Record; - readonly formData?: Record; - readonly body?: any; - readonly mediaType?: string; - readonly responseHeader?: string; - readonly errors?: Record; + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; }; diff --git a/src/api/generated/core/ApiResult.ts b/src/api/generated/core/ApiResult.ts index 63ed6c44..ad8fef2b 100644 --- a/src/api/generated/core/ApiResult.ts +++ b/src/api/generated/core/ApiResult.ts @@ -3,9 +3,9 @@ /* tslint:disable */ /* eslint-disable */ export type ApiResult = { - readonly url: string; - readonly ok: boolean; - readonly status: number; - readonly statusText: string; - readonly body: any; + readonly url: string; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly body: any; }; diff --git a/src/api/generated/core/CancelablePromise.ts b/src/api/generated/core/CancelablePromise.ts index 24716774..55fef851 100644 --- a/src/api/generated/core/CancelablePromise.ts +++ b/src/api/generated/core/CancelablePromise.ts @@ -3,128 +3,129 @@ /* tslint:disable */ /* eslint-disable */ export class CancelError extends Error { - constructor(message: string) { - super(message); - this.name = 'CancelError'; - } - - public get isCancelled(): boolean { - return true; - } + + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } } export interface OnCancel { - readonly isResolved: boolean; - readonly isRejected: boolean; - readonly isCancelled: boolean; + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; - (cancelHandler: () => void): void; + (cancelHandler: () => void): void; } export class CancelablePromise implements Promise { - #isResolved: boolean; - #isRejected: boolean; - #isCancelled: boolean; - readonly #cancelHandlers: (() => void)[]; - readonly #promise: Promise; - #resolve?: (value: T | PromiseLike) => void; - #reject?: (reason?: any) => void; - - constructor( - executor: ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: any) => void, - onCancel: OnCancel, - ) => void, - ) { - this.#isResolved = false; - this.#isRejected = false; - this.#isCancelled = false; - this.#cancelHandlers = []; - this.#promise = new Promise((resolve, reject) => { - this.#resolve = resolve; - this.#reject = reject; - - const onResolve = (value: T | PromiseLike): void => { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { - return; - } - this.#isResolved = true; - this.#resolve?.(value); - }; + #isResolved: boolean; + #isRejected: boolean; + #isCancelled: boolean; + readonly #cancelHandlers: (() => void)[]; + readonly #promise: Promise; + #resolve?: (value: T | PromiseLike) => void; + #reject?: (reason?: any) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: any) => void, + onCancel: OnCancel + ) => void + ) { + this.#isResolved = false; + this.#isRejected = false; + this.#isCancelled = false; + this.#cancelHandlers = []; + this.#promise = new Promise((resolve, reject) => { + this.#resolve = resolve; + this.#reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isResolved = true; + this.#resolve?.(value); + }; + + const onReject = (reason?: any): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isRejected = true; + this.#reject?.(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this.#isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this.#isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this.#isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } - const onReject = (reason?: any): void => { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { - return; - } - this.#isRejected = true; - this.#reject?.(reason); - }; + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } - const onCancel = (cancelHandler: () => void): void => { + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.#promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { + return this.#promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.#promise.finally(onFinally); + } + + public cancel(): void { if (this.#isResolved || this.#isRejected || this.#isCancelled) { - return; + return; } - this.#cancelHandlers.push(cancelHandler); - }; - - Object.defineProperty(onCancel, 'isResolved', { - get: (): boolean => this.#isResolved, - }); - - Object.defineProperty(onCancel, 'isRejected', { - get: (): boolean => this.#isRejected, - }); - - Object.defineProperty(onCancel, 'isCancelled', { - get: (): boolean => this.#isCancelled, - }); - - return executor(onResolve, onReject, onCancel as OnCancel); - }); - } - - get [Symbol.toStringTag]() { - return 'Cancellable Promise'; - } - - public then( - onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onRejected?: ((reason: any) => TResult2 | PromiseLike) | null, - ): Promise { - return this.#promise.then(onFulfilled, onRejected); - } - - public catch( - onRejected?: ((reason: any) => TResult | PromiseLike) | null, - ): Promise { - return this.#promise.catch(onRejected); - } - - public finally(onFinally?: (() => void) | null): Promise { - return this.#promise.finally(onFinally); - } - - public cancel(): void { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { - return; - } - this.#isCancelled = true; - if (this.#cancelHandlers.length) { - try { - for (const cancelHandler of this.#cancelHandlers) { - cancelHandler(); + this.#isCancelled = true; + if (this.#cancelHandlers.length) { + try { + for (const cancelHandler of this.#cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } } - } catch (error) { - console.warn('Cancellation threw an error', error); - return; - } + this.#cancelHandlers.length = 0; + this.#reject?.(new CancelError('Request aborted')); } - this.#cancelHandlers.length = 0; - this.#reject?.(new CancelError('Request aborted')); - } - public get isCancelled(): boolean { - return this.#isCancelled; - } + public get isCancelled(): boolean { + return this.#isCancelled; + } } diff --git a/src/api/generated/core/OpenAPI.ts b/src/api/generated/core/OpenAPI.ts index 21de30a6..d210b7ad 100644 --- a/src/api/generated/core/OpenAPI.ts +++ b/src/api/generated/core/OpenAPI.ts @@ -8,25 +8,25 @@ type Resolver = (options: ApiRequestOptions) => Promise; type Headers = Record; export type OpenAPIConfig = { - BASE: string; - VERSION: string; - WITH_CREDENTIALS: boolean; - CREDENTIALS: 'include' | 'omit' | 'same-origin'; - TOKEN?: string | Resolver | undefined; - USERNAME?: string | Resolver | undefined; - PASSWORD?: string | Resolver | undefined; - HEADERS?: Headers | Resolver | undefined; - ENCODE_PATH?: ((path: string) => string) | undefined; + BASE: string; + VERSION: string; + WITH_CREDENTIALS: boolean; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + HEADERS?: Headers | Resolver | undefined; + ENCODE_PATH?: ((path: string) => string) | undefined; }; export const OpenAPI: OpenAPIConfig = { - BASE: '', - VERSION: '1', - WITH_CREDENTIALS: false, - CREDENTIALS: 'include', - TOKEN: undefined, - USERNAME: undefined, - PASSWORD: undefined, - HEADERS: undefined, - ENCODE_PATH: undefined, + BASE: '', + VERSION: '1', + WITH_CREDENTIALS: false, + CREDENTIALS: 'include', + TOKEN: undefined, + USERNAME: undefined, + PASSWORD: undefined, + HEADERS: undefined, + ENCODE_PATH: undefined, }; diff --git a/src/api/generated/core/request.ts b/src/api/generated/core/request.ts index 4601c08b..1142d432 100644 --- a/src/api/generated/core/request.ts +++ b/src/api/generated/core/request.ts @@ -3,12 +3,7 @@ /* tslint:disable */ /* eslint-disable */ import axios from 'axios'; -import type { - AxiosError, - AxiosRequestConfig, - AxiosResponse, - AxiosInstance, -} from 'axios'; +import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios'; import FormData from 'form-data'; import { ApiError } from './ApiError'; @@ -18,294 +13,270 @@ import { CancelablePromise } from './CancelablePromise'; import type { OnCancel } from './CancelablePromise'; import type { OpenAPIConfig } from './OpenAPI'; -export const isDefined = ( - value: T | null | undefined, -): value is Exclude => { - return value !== undefined && value !== null; +export const isDefined = (value: T | null | undefined): value is Exclude => { + return value !== undefined && value !== null; }; export const isString = (value: any): value is string => { - return typeof value === 'string'; + return typeof value === 'string'; }; export const isStringWithValue = (value: any): value is string => { - return isString(value) && value !== ''; + return isString(value) && value !== ''; }; export const isBlob = (value: any): value is Blob => { - return ( - typeof value === 'object' && - typeof value.type === 'string' && - typeof value.stream === 'function' && - typeof value.arrayBuffer === 'function' && - typeof value.constructor === 'function' && - typeof value.constructor.name === 'string' && - /^(Blob|File)$/.test(value.constructor.name) && - /^(Blob|File)$/.test(value[Symbol.toStringTag]) - ); + return ( + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); }; export const isFormData = (value: any): value is FormData => { - return value instanceof FormData; + return value instanceof FormData; }; export const isSuccess = (status: number): boolean => { - return status >= 200 && status < 300; + return status >= 200 && status < 300; }; export const base64 = (str: string): string => { - try { - return btoa(str); - } catch (err) { - // @ts-ignore - return Buffer.from(str).toString('base64'); - } + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } }; export const getQueryString = (params: Record): string => { - const qs: string[] = []; + const qs: string[] = []; - const append = (key: string, value: any) => { - qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); - }; + const append = (key: string, value: any) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; - const process = (key: string, value: any) => { - if (isDefined(value)) { - if (Array.isArray(value)) { - value.forEach((v) => { - process(key, v); - }); - } else if (typeof value === 'object') { - Object.entries(value).forEach(([k, v]) => { - process(`${key}[${k}]`, v); - }); - } else { - append(key, value); - } - } - }; + const process = (key: string, value: any) => { + if (isDefined(value)) { + if (Array.isArray(value)) { + value.forEach(v => { + process(key, v); + }); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => { + process(`${key}[${k}]`, v); + }); + } else { + append(key, value); + } + } + }; - Object.entries(params).forEach(([key, value]) => { - process(key, value); - }); + Object.entries(params).forEach(([key, value]) => { + process(key, value); + }); - if (qs.length > 0) { - return `?${qs.join('&')}`; - } + if (qs.length > 0) { + return `?${qs.join('&')}`; + } - return ''; + return ''; }; const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { - const encoder = config.ENCODE_PATH || encodeURI; - - const path = options.url - .replace('{api-version}', config.VERSION) - .replace(/{(.*?)}/g, (substring: string, group: string) => { - if (options.path?.hasOwnProperty(group)) { - return encoder(String(options.path[group])); - } - return substring; - }); + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); - const url = `${config.BASE}${path}`; - if (options.query) { - return `${url}${getQueryString(options.query)}`; - } - return url; + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; }; -export const getFormData = ( - options: ApiRequestOptions, -): FormData | undefined => { - if (options.formData) { - const formData = new FormData(); - - const process = (key: string, value: any) => { - if (isString(value) || isBlob(value)) { - formData.append(key, value); - } else { - formData.append(key, JSON.stringify(value)); - } - }; +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); - Object.entries(options.formData) - .filter(([_, value]) => isDefined(value)) - .forEach(([key, value]) => { - if (Array.isArray(value)) { - value.forEach((v) => process(key, v)); - } else { - process(key, value); - } - }); + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; - return formData; - } - return undefined; + Object.entries(options.formData) + .filter(([_, value]) => isDefined(value)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; }; type Resolver = (options: ApiRequestOptions) => Promise; -export const resolve = async ( - options: ApiRequestOptions, - resolver?: T | Resolver, -): Promise => { - if (typeof resolver === 'function') { - return (resolver as Resolver)(options); - } - return resolver; +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; }; -export const getHeaders = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, - formData?: FormData, -): Promise> => { - const token = await resolve(options, config.TOKEN); - const username = await resolve(options, config.USERNAME); - const password = await resolve(options, config.PASSWORD); - const additionalHeaders = await resolve(options, config.HEADERS); - const formHeaders = - (typeof formData?.getHeaders === 'function' && formData?.getHeaders()) || - {}; - - const headers = Object.entries({ - Accept: 'application/json', - ...additionalHeaders, - ...options.headers, - ...formHeaders, - }) +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise> => { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const additionalHeaders = await resolve(options, config.HEADERS); + const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {} + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + ...formHeaders, + }) .filter(([_, value]) => isDefined(value)) - .reduce( - (headers, [key, value]) => ({ + .reduce((headers, [key, value]) => ({ ...headers, [key]: String(value), - }), - {} as Record, - ); + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } - if (isStringWithValue(token)) { - headers['Authorization'] = `Bearer ${token}`; - } - - if (isStringWithValue(username) && isStringWithValue(password)) { - const credentials = base64(`${username}:${password}`); - headers['Authorization'] = `Basic ${credentials}`; - } - - if (options.body) { - if (options.mediaType) { - headers['Content-Type'] = options.mediaType; - } else if (isBlob(options.body)) { - headers['Content-Type'] = options.body.type || 'application/octet-stream'; - } else if (isString(options.body)) { - headers['Content-Type'] = 'text/plain'; - } else if (!isFormData(options.body)) { - headers['Content-Type'] = 'application/json'; + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } } - } - return headers; + return headers; }; export const getRequestBody = (options: ApiRequestOptions): any => { - if (options.body) { - return options.body; - } - return undefined; + if (options.body) { + return options.body; + } + return undefined; }; export const sendRequest = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, - url: string, - body: any, - formData: FormData | undefined, - headers: Record, - onCancel: OnCancel, - axiosClient: AxiosInstance, + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Record, + onCancel: OnCancel, + axiosClient: AxiosInstance ): Promise> => { - const source = axios.CancelToken.source(); - - const requestConfig: AxiosRequestConfig = { - url, - headers, - data: body ?? formData, - method: options.method, - withCredentials: config.WITH_CREDENTIALS, - cancelToken: source.token, - }; - - onCancel(() => source.cancel('The user aborted a request.')); - - try { - return await axiosClient.request(requestConfig); - } catch (error) { - const axiosError = error as AxiosError; - if (axiosError.response) { - return axiosError.response; + const source = axios.CancelToken.source(); + + const requestConfig: AxiosRequestConfig = { + url, + headers, + data: body ?? formData, + method: options.method, + withCredentials: config.WITH_CREDENTIALS, + cancelToken: source.token, + }; + + onCancel(() => source.cancel('The user aborted a request.')); + + try { + return await axiosClient.request(requestConfig); + } catch (error) { + const axiosError = error as AxiosError; + if (axiosError.response) { + return axiosError.response; + } + throw error; } - throw error; - } }; -export const getResponseHeader = ( - response: AxiosResponse, - responseHeader?: string, -): string | undefined => { - if (responseHeader) { - const content = response.headers[responseHeader]; - if (isString(content)) { - return content; +export const getResponseHeader = (response: AxiosResponse, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers[responseHeader]; + if (isString(content)) { + return content; + } } - } - return undefined; + return undefined; }; export const getResponseBody = (response: AxiosResponse): any => { - if (response.status !== 204) { - return response.data; - } - return undefined; + if (response.status !== 204) { + return response.data; + } + return undefined; }; -export const catchErrorCodes = ( - options: ApiRequestOptions, - result: ApiResult, -): void => { - const errors: Record = { - 400: 'Bad Request', - 401: 'Unauthorized', - 403: 'Forbidden', - 404: 'Not Found', - 500: 'Internal Server Error', - 502: 'Bad Gateway', - 503: 'Service Unavailable', - ...options.errors, - }; - - const error = errors[result.status]; - if (error) { - throw new ApiError(options, result, error); - } - - if (!result.ok) { - const errorStatus = result.status ?? 'unknown'; - const errorStatusText = result.statusText ?? 'unknown'; - const errorBody = (() => { - try { - return JSON.stringify(result.body, null, 2); - } catch (e) { - return undefined; - } - })(); - - throw new ApiError( - options, - result, - `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`, - ); - } +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } }; /** @@ -316,49 +287,33 @@ export const catchErrorCodes = ( * @returns CancelablePromise * @throws ApiError */ -export const request = ( - config: OpenAPIConfig, - options: ApiRequestOptions, - axiosClient: AxiosInstance = axios, -): CancelablePromise => { - return new CancelablePromise(async (resolve, reject, onCancel) => { - try { - const url = getUrl(config, options); - const formData = getFormData(options); - const body = getRequestBody(options); - const headers = await getHeaders(config, options, formData); - - if (!onCancel.isCancelled) { - const response = await sendRequest( - config, - options, - url, - body, - formData, - headers, - onCancel, - axiosClient, - ); - const responseBody = getResponseBody(response); - const responseHeader = getResponseHeader( - response, - options.responseHeader, - ); - - const result: ApiResult = { - url, - ok: isSuccess(response.status), - status: response.status, - statusText: response.statusText, - body: responseHeader ?? responseBody, - }; - - catchErrorCodes(options, result); - - resolve(result.body); - } - } catch (error) { - reject(error); - } - }); +export const request = (config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options, formData); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient); + const responseBody = getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: isSuccess(response.status), + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); }; diff --git a/src/api/generated/models/AddAnalogueModelParameterCommandForm.ts b/src/api/generated/models/AddAnalogueModelParameterCommandForm.ts index 951572d4..685a6880 100644 --- a/src/api/generated/models/AddAnalogueModelParameterCommandForm.ts +++ b/src/api/generated/models/AddAnalogueModelParameterCommandForm.ts @@ -6,5 +6,5 @@ import type { AddParameterDto } from './AddParameterDto'; export type AddAnalogueModelParameterCommandForm = { - parameters?: Array | null; + parameters?: Array | null; }; diff --git a/src/api/generated/models/AddAnalogueModelParameterCommandResponse.ts b/src/api/generated/models/AddAnalogueModelParameterCommandResponse.ts index d94e3490..cf1e7d0f 100644 --- a/src/api/generated/models/AddAnalogueModelParameterCommandResponse.ts +++ b/src/api/generated/models/AddAnalogueModelParameterCommandResponse.ts @@ -6,9 +6,9 @@ import type { AddAnalogueModelParameterDto } from './AddAnalogueModelParameterDto'; export type AddAnalogueModelParameterCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: AddAnalogueModelParameterDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: AddAnalogueModelParameterDto; }; diff --git a/src/api/generated/models/AddAnalogueModelParameterDto.ts b/src/api/generated/models/AddAnalogueModelParameterDto.ts index b94b0909..43c29dc6 100644 --- a/src/api/generated/models/AddAnalogueModelParameterDto.ts +++ b/src/api/generated/models/AddAnalogueModelParameterDto.ts @@ -6,9 +6,9 @@ import type { AddParameterDto } from './AddParameterDto'; export type AddAnalogueModelParameterDto = { - analogueModelId?: string; - name?: string | null; - description?: string | null; - sourceType?: string | null; - parameters?: Array | null; + analogueModelId?: string; + name?: string | null; + description?: string | null; + sourceType?: string | null; + parameters?: Array | null; }; diff --git a/src/api/generated/models/AddParameterDto.ts b/src/api/generated/models/AddParameterDto.ts index f98889da..162b9357 100644 --- a/src/api/generated/models/AddParameterDto.ts +++ b/src/api/generated/models/AddParameterDto.ts @@ -4,6 +4,6 @@ /* eslint-disable */ export type AddParameterDto = { - parameterId?: string; - parameterValue?: string | null; + parameterId: string; + parameterValue: string; }; diff --git a/src/api/generated/models/AnalogueList.ts b/src/api/generated/models/AnalogueList.ts index 3e9a83a8..ee042dde 100644 --- a/src/api/generated/models/AnalogueList.ts +++ b/src/api/generated/models/AnalogueList.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type AnalogueList = { - analogueId?: string; - name: string; - description?: string | null; + analogueId: string; + name: string; + description: string; }; diff --git a/src/api/generated/models/AnalogueModelDetail.ts b/src/api/generated/models/AnalogueModelDetail.ts index 05c3530d..5961b75e 100644 --- a/src/api/generated/models/AnalogueModelDetail.ts +++ b/src/api/generated/models/AnalogueModelDetail.ts @@ -8,11 +8,11 @@ import type { AnalogueModelSourceType } from './AnalogueModelSourceType'; import type { UploadList } from './UploadList'; export type AnalogueModelDetail = { - analogueModelId?: string; - name?: string | null; - description?: string | null; - isProcessed?: boolean; - sourceType?: AnalogueModelSourceType; - analogues?: Array | null; - fileUploads?: Array | null; + analogueModelId: string; + name: string; + description: string; + isProcessed: boolean; + sourceType: AnalogueModelSourceType; + analogues: Array; + fileUploads: Array; }; diff --git a/src/api/generated/models/AnalogueModelList.ts b/src/api/generated/models/AnalogueModelList.ts index 3235a3a3..716daf09 100644 --- a/src/api/generated/models/AnalogueModelList.ts +++ b/src/api/generated/models/AnalogueModelList.ts @@ -6,9 +6,9 @@ import type { AnalogueModelSourceType } from './AnalogueModelSourceType'; export type AnalogueModelList = { - analogueModelId?: string; - name?: string | null; - description?: string | null; - isProcessed?: boolean; - sourceType?: AnalogueModelSourceType; + analogueModelId: string; + name: string; + description: string; + isProcessed: boolean; + sourceType: AnalogueModelSourceType; }; diff --git a/src/api/generated/models/AnalogueModelSourceType.ts b/src/api/generated/models/AnalogueModelSourceType.ts index f6aab801..b7a58f91 100644 --- a/src/api/generated/models/AnalogueModelSourceType.ts +++ b/src/api/generated/models/AnalogueModelSourceType.ts @@ -4,6 +4,6 @@ /* eslint-disable */ export enum AnalogueModelSourceType { - DELTARES = 'Deltares', - RES_QML = 'ResQML', + DELTARES = 'Deltares', + RES_QML = 'ResQML', } diff --git a/src/api/generated/models/ConvertAnalogueModelCommand.ts b/src/api/generated/models/ConvertAnalogueModelCommand.ts index 44366348..418ec344 100644 --- a/src/api/generated/models/ConvertAnalogueModelCommand.ts +++ b/src/api/generated/models/ConvertAnalogueModelCommand.ts @@ -4,5 +4,5 @@ /* eslint-disable */ export type ConvertAnalogueModelCommand = { - modelId?: string; + modelId: string; }; diff --git a/src/api/generated/models/ConvertAnalogueModelCommandResponse.ts b/src/api/generated/models/ConvertAnalogueModelCommandResponse.ts index daf8090b..f4e1016a 100644 --- a/src/api/generated/models/ConvertAnalogueModelCommandResponse.ts +++ b/src/api/generated/models/ConvertAnalogueModelCommandResponse.ts @@ -6,9 +6,9 @@ import type { ConvertAnalogueModelDto } from './ConvertAnalogueModelDto'; export type ConvertAnalogueModelCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: ConvertAnalogueModelDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: ConvertAnalogueModelDto; }; diff --git a/src/api/generated/models/ConvertAnalogueModelDto.ts b/src/api/generated/models/ConvertAnalogueModelDto.ts index 69ddc57e..109d22fa 100644 --- a/src/api/generated/models/ConvertAnalogueModelDto.ts +++ b/src/api/generated/models/ConvertAnalogueModelDto.ts @@ -7,8 +7,8 @@ import type { JobStatus } from './JobStatus'; import type { JobType } from './JobType'; export type ConvertAnalogueModelDto = { - jobId?: string; - name?: string | null; - jobStatus?: JobStatus; - jobType?: JobType; + jobId: string; + name: string; + jobStatus: JobStatus; + jobType: JobType; }; diff --git a/src/api/generated/models/CreateAnalogueCommand.ts b/src/api/generated/models/CreateAnalogueCommand.ts index 1bfafb66..b9d70d52 100644 --- a/src/api/generated/models/CreateAnalogueCommand.ts +++ b/src/api/generated/models/CreateAnalogueCommand.ts @@ -4,6 +4,6 @@ /* eslint-disable */ export type CreateAnalogueCommand = { - name?: string | null; - description?: string | null; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/CreateAnalogueCommandResponse.ts b/src/api/generated/models/CreateAnalogueCommandResponse.ts index c07bac90..fec675b7 100644 --- a/src/api/generated/models/CreateAnalogueCommandResponse.ts +++ b/src/api/generated/models/CreateAnalogueCommandResponse.ts @@ -6,9 +6,9 @@ import type { CreateAnalogueDto } from './CreateAnalogueDto'; export type CreateAnalogueCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: CreateAnalogueDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: CreateAnalogueDto; }; diff --git a/src/api/generated/models/CreateAnalogueDto.ts b/src/api/generated/models/CreateAnalogueDto.ts index 9a4c3a0c..0c6b6b68 100644 --- a/src/api/generated/models/CreateAnalogueDto.ts +++ b/src/api/generated/models/CreateAnalogueDto.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type CreateAnalogueDto = { - analogueId?: string; - name?: string | null; - description?: string | null; + analogueId?: string; + name?: string | null; + description?: string | null; }; diff --git a/src/api/generated/models/CreateAnalogueModelCommand.ts b/src/api/generated/models/CreateAnalogueModelCommand.ts index cebcf42c..87562f72 100644 --- a/src/api/generated/models/CreateAnalogueModelCommand.ts +++ b/src/api/generated/models/CreateAnalogueModelCommand.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type CreateAnalogueModelCommand = { - name?: string | null; - description?: string | null; - sourceType?: string | null; + name: string; + description?: string | null; + sourceType: string; }; diff --git a/src/api/generated/models/CreateAnalogueModelCommandResponse.ts b/src/api/generated/models/CreateAnalogueModelCommandResponse.ts index a0a56d73..4111de94 100644 --- a/src/api/generated/models/CreateAnalogueModelCommandResponse.ts +++ b/src/api/generated/models/CreateAnalogueModelCommandResponse.ts @@ -6,9 +6,9 @@ import type { CreateAnalogueModelDto } from './CreateAnalogueModelDto'; export type CreateAnalogueModelCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: CreateAnalogueModelDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: CreateAnalogueModelDto; }; diff --git a/src/api/generated/models/CreateAnalogueModelDto.ts b/src/api/generated/models/CreateAnalogueModelDto.ts index e9057a39..4425566f 100644 --- a/src/api/generated/models/CreateAnalogueModelDto.ts +++ b/src/api/generated/models/CreateAnalogueModelDto.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type CreateAnalogueModelDto = { - analogueModelId?: string; - name?: string | null; - description?: string | null; + analogueModelId: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/CreateParameterCommand.ts b/src/api/generated/models/CreateParameterCommand.ts index ebaa0ac0..32a7e8a5 100644 --- a/src/api/generated/models/CreateParameterCommand.ts +++ b/src/api/generated/models/CreateParameterCommand.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type CreateParameterCommand = { - identifier?: string | null; - name?: string | null; - description?: string | null; + identifier: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/ErrorResponse.ts b/src/api/generated/models/ErrorResponse.ts index 8363684f..604ad45c 100644 --- a/src/api/generated/models/ErrorResponse.ts +++ b/src/api/generated/models/ErrorResponse.ts @@ -4,9 +4,9 @@ /* eslint-disable */ export type ErrorResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: string; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: string; }; diff --git a/src/api/generated/models/EstimateChannelCommand.ts b/src/api/generated/models/EstimateChannelCommand.ts index 57ddbc24..f357decb 100644 --- a/src/api/generated/models/EstimateChannelCommand.ts +++ b/src/api/generated/models/EstimateChannelCommand.ts @@ -4,5 +4,5 @@ /* eslint-disable */ export type EstimateChannelCommand = { - modelId?: string; + modelId: string; }; diff --git a/src/api/generated/models/GetAnalogueListQueryResponse.ts b/src/api/generated/models/GetAnalogueListQueryResponse.ts index e80cea4f..b7fac3f1 100644 --- a/src/api/generated/models/GetAnalogueListQueryResponse.ts +++ b/src/api/generated/models/GetAnalogueListQueryResponse.ts @@ -6,9 +6,9 @@ import type { AnalogueList } from './AnalogueList'; export type GetAnalogueListQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: Array; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: Array; }; diff --git a/src/api/generated/models/GetAnalogueModelListQueryResponse.ts b/src/api/generated/models/GetAnalogueModelListQueryResponse.ts index 09ee26cb..cc4cf1d0 100644 --- a/src/api/generated/models/GetAnalogueModelListQueryResponse.ts +++ b/src/api/generated/models/GetAnalogueModelListQueryResponse.ts @@ -6,9 +6,9 @@ import type { AnalogueModelList } from './AnalogueModelList'; export type GetAnalogueModelListQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: Array; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: Array; }; diff --git a/src/api/generated/models/GetAnalogueModelQueryResponse.ts b/src/api/generated/models/GetAnalogueModelQueryResponse.ts index 3faeea2c..fb4e4c78 100644 --- a/src/api/generated/models/GetAnalogueModelQueryResponse.ts +++ b/src/api/generated/models/GetAnalogueModelQueryResponse.ts @@ -6,9 +6,9 @@ import type { AnalogueModelDetail } from './AnalogueModelDetail'; export type GetAnalogueModelQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: AnalogueModelDetail; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: AnalogueModelDetail; }; diff --git a/src/api/generated/models/GetCurrentJobStatusCommandResponse.ts b/src/api/generated/models/GetCurrentJobStatusCommandResponse.ts index e218c374..6fae735a 100644 --- a/src/api/generated/models/GetCurrentJobStatusCommandResponse.ts +++ b/src/api/generated/models/GetCurrentJobStatusCommandResponse.ts @@ -6,9 +6,9 @@ import type { GetCurrentJobStatusDto } from './GetCurrentJobStatusDto'; export type GetCurrentJobStatusCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: GetCurrentJobStatusDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: GetCurrentJobStatusDto; }; diff --git a/src/api/generated/models/GetCurrentJobStatusDto.ts b/src/api/generated/models/GetCurrentJobStatusDto.ts index 2c36f35a..3bbd002d 100644 --- a/src/api/generated/models/GetCurrentJobStatusDto.ts +++ b/src/api/generated/models/GetCurrentJobStatusDto.ts @@ -7,8 +7,8 @@ import type { JobStatus } from './JobStatus'; import type { JobType } from './JobType'; export type GetCurrentJobStatusDto = { - jobId?: string; - name?: string | null; - jobStatus?: JobStatus; - jobType?: JobType; + jobId: string; + name: string; + jobStatus: JobStatus; + jobType: JobType; }; diff --git a/src/api/generated/models/GetJobDetailQueryResponse.ts b/src/api/generated/models/GetJobDetailQueryResponse.ts index c3c366e2..15619b7c 100644 --- a/src/api/generated/models/GetJobDetailQueryResponse.ts +++ b/src/api/generated/models/GetJobDetailQueryResponse.ts @@ -6,9 +6,9 @@ import type { JobDetail } from './JobDetail'; export type GetJobDetailQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: JobDetail; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: JobDetail; }; diff --git a/src/api/generated/models/GetJobListQueryResponse.ts b/src/api/generated/models/GetJobListQueryResponse.ts index aac45bcb..4d54e07d 100644 --- a/src/api/generated/models/GetJobListQueryResponse.ts +++ b/src/api/generated/models/GetJobListQueryResponse.ts @@ -6,9 +6,9 @@ import type { JobList } from './JobList'; export type GetJobListQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: Array; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: Array; }; diff --git a/src/api/generated/models/GetParameterDetailQueryResponse.ts b/src/api/generated/models/GetParameterDetailQueryResponse.ts index 265ba905..3f84e72f 100644 --- a/src/api/generated/models/GetParameterDetailQueryResponse.ts +++ b/src/api/generated/models/GetParameterDetailQueryResponse.ts @@ -6,9 +6,9 @@ import type { ParameterDetail } from './ParameterDetail'; export type GetParameterDetailQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: ParameterDetail; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: ParameterDetail; }; diff --git a/src/api/generated/models/GetParameterListQueryResponse.ts b/src/api/generated/models/GetParameterListQueryResponse.ts index 7e15d320..1c93fe2d 100644 --- a/src/api/generated/models/GetParameterListQueryResponse.ts +++ b/src/api/generated/models/GetParameterListQueryResponse.ts @@ -6,9 +6,9 @@ import type { ParameterList } from './ParameterList'; export type GetParameterListQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: Array; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: Array; }; diff --git a/src/api/generated/models/GetUploadDetailQueryResponse.ts b/src/api/generated/models/GetUploadDetailQueryResponse.ts index 4891d23a..0b40507e 100644 --- a/src/api/generated/models/GetUploadDetailQueryResponse.ts +++ b/src/api/generated/models/GetUploadDetailQueryResponse.ts @@ -6,9 +6,9 @@ import type { UploadDetail } from './UploadDetail'; export type GetUploadDetailQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: UploadDetail; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: UploadDetail; }; diff --git a/src/api/generated/models/GetUploadListQueryResponse.ts b/src/api/generated/models/GetUploadListQueryResponse.ts index 5d6b48f4..836c9662 100644 --- a/src/api/generated/models/GetUploadListQueryResponse.ts +++ b/src/api/generated/models/GetUploadListQueryResponse.ts @@ -6,9 +6,9 @@ import type { UploadList } from './UploadList'; export type GetUploadListQueryResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: Array; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: Array; }; diff --git a/src/api/generated/models/JobDetail.ts b/src/api/generated/models/JobDetail.ts index 4ca5c800..4cc55962 100644 --- a/src/api/generated/models/JobDetail.ts +++ b/src/api/generated/models/JobDetail.ts @@ -7,8 +7,8 @@ import type { JobStatus } from './JobStatus'; import type { JobType } from './JobType'; export type JobDetail = { - jobId?: string; - name?: string | null; - jobStatus?: JobStatus; - jobType?: JobType; + jobId?: string; + name?: string | null; + jobStatus?: JobStatus; + jobType?: JobType; }; diff --git a/src/api/generated/models/JobList.ts b/src/api/generated/models/JobList.ts index 38fe161c..fe72a898 100644 --- a/src/api/generated/models/JobList.ts +++ b/src/api/generated/models/JobList.ts @@ -8,10 +8,10 @@ import type { JobStatus } from './JobStatus'; import type { JobType } from './JobType'; export type JobList = { - jobId?: string; - name?: string | null; - jobStatus?: JobStatus; - jobType?: JobType; - updated?: string; - uploads?: Array | null; + jobId: string; + name: string; + jobStatus: JobStatus; + jobType: JobType; + updated: string; + uploads?: Array | null; }; diff --git a/src/api/generated/models/JobListUploadsDto.ts b/src/api/generated/models/JobListUploadsDto.ts index f981c94e..1eb8691b 100644 --- a/src/api/generated/models/JobListUploadsDto.ts +++ b/src/api/generated/models/JobListUploadsDto.ts @@ -7,7 +7,7 @@ import type { UploadFileType } from './UploadFileType'; import type { UploadStatus } from './UploadStatus'; export type JobListUploadsDto = { - uploadId?: string; - uploadStatus?: UploadStatus; - uploadFileType?: UploadFileType; + uploadId: string; + uploadStatus: UploadStatus; + uploadFileType: UploadFileType; }; diff --git a/src/api/generated/models/JobStatus.ts b/src/api/generated/models/JobStatus.ts index f253d603..49f7dc72 100644 --- a/src/api/generated/models/JobStatus.ts +++ b/src/api/generated/models/JobStatus.ts @@ -4,11 +4,11 @@ /* eslint-disable */ export enum JobStatus { - UNKNOWN = 'Unknown', - CREATED = 'Created', - STARTED = 'Started', - RUNNING = 'Running', - SUCCESSFUL = 'Successful', - SUCCEEDED = 'Succeeded', - FAILED = 'Failed', + UNKNOWN = 'Unknown', + CREATED = 'Created', + STARTED = 'Started', + RUNNING = 'Running', + SUCCESSFUL = 'Successful', + SUCCEEDED = 'Succeeded', + FAILED = 'Failed', } diff --git a/src/api/generated/models/JobType.ts b/src/api/generated/models/JobType.ts index 7bd1760c..7c327e37 100644 --- a/src/api/generated/models/JobType.ts +++ b/src/api/generated/models/JobType.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export enum JobType { - NRRESQML = 'Nrresqml', - NRCHANNEL = 'Nrchannel', - NRVARIOGRAM = 'Nrvariogram', + NRRESQML = 'Nrresqml', + NRCHANNEL = 'Nrchannel', + NRVARIOGRAM = 'Nrvariogram', } diff --git a/src/api/generated/models/Operation.ts b/src/api/generated/models/Operation.ts index 9f9b0e51..ab4f383d 100644 --- a/src/api/generated/models/Operation.ts +++ b/src/api/generated/models/Operation.ts @@ -6,9 +6,9 @@ import type { OperationType } from './OperationType'; export type Operation = { - operationType?: OperationType; - path?: string | null; - op?: string | null; - from?: string | null; - value?: any; + operationType?: OperationType; + path?: string | null; + op?: string | null; + from?: string | null; + value?: any; }; diff --git a/src/api/generated/models/OperationType.ts b/src/api/generated/models/OperationType.ts index 43055013..76a8da95 100644 --- a/src/api/generated/models/OperationType.ts +++ b/src/api/generated/models/OperationType.ts @@ -4,11 +4,11 @@ /* eslint-disable */ export enum OperationType { - ADD = 'Add', - REMOVE = 'Remove', - REPLACE = 'Replace', - MOVE = 'Move', - COPY = 'Copy', - TEST = 'Test', - INVALID = 'Invalid', + ADD = 'Add', + REMOVE = 'Remove', + REPLACE = 'Replace', + MOVE = 'Move', + COPY = 'Copy', + TEST = 'Test', + INVALID = 'Invalid', } diff --git a/src/api/generated/models/ParameterDetail.ts b/src/api/generated/models/ParameterDetail.ts index 1603ae38..553f422e 100644 --- a/src/api/generated/models/ParameterDetail.ts +++ b/src/api/generated/models/ParameterDetail.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type ParameterDetail = { - parameterId?: string; - identifier?: string | null; - name?: string | null; - description?: string | null; + parameterId: string; + identifier: string; + name: string; + description: string; }; diff --git a/src/api/generated/models/ParameterList.ts b/src/api/generated/models/ParameterList.ts index c063991f..b5fcfb79 100644 --- a/src/api/generated/models/ParameterList.ts +++ b/src/api/generated/models/ParameterList.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type ParameterList = { - parameterId?: string; - identifier?: string | null; - name: string; - description?: string | null; + parameterId: string; + identifier: string; + name: string; + description: string; }; diff --git a/src/api/generated/models/PatchAnalogueModelCommandResponse.ts b/src/api/generated/models/PatchAnalogueModelCommandResponse.ts index 1da71bde..682852c3 100644 --- a/src/api/generated/models/PatchAnalogueModelCommandResponse.ts +++ b/src/api/generated/models/PatchAnalogueModelCommandResponse.ts @@ -6,9 +6,9 @@ import type { PatchAnalogueModelDto } from './PatchAnalogueModelDto'; export type PatchAnalogueModelCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: PatchAnalogueModelDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: PatchAnalogueModelDto; }; diff --git a/src/api/generated/models/PatchAnalogueModelDto.ts b/src/api/generated/models/PatchAnalogueModelDto.ts index d1709952..40554d81 100644 --- a/src/api/generated/models/PatchAnalogueModelDto.ts +++ b/src/api/generated/models/PatchAnalogueModelDto.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type PatchAnalogueModelDto = { - analogueModelId?: string; - name?: string | null; - description?: string | null; + analogueModelId: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/PatchParameterCommandResponse.ts b/src/api/generated/models/PatchParameterCommandResponse.ts index a76331e5..50e9ea84 100644 --- a/src/api/generated/models/PatchParameterCommandResponse.ts +++ b/src/api/generated/models/PatchParameterCommandResponse.ts @@ -6,9 +6,9 @@ import type { PatchParameterDto } from './PatchParameterDto'; export type PatchParameterCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: PatchParameterDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: PatchParameterDto; }; diff --git a/src/api/generated/models/PatchParameterDto.ts b/src/api/generated/models/PatchParameterDto.ts index 1f6c94b1..cde3ab40 100644 --- a/src/api/generated/models/PatchParameterDto.ts +++ b/src/api/generated/models/PatchParameterDto.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type PatchParameterDto = { - parameterId?: string; - identifier?: string | null; - name?: string | null; - description?: string | null; + parameterId: string; + identifier: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/UpdateAnalogueModelCommandBody.ts b/src/api/generated/models/UpdateAnalogueModelCommandBody.ts index d2983ccd..56efffc5 100644 --- a/src/api/generated/models/UpdateAnalogueModelCommandBody.ts +++ b/src/api/generated/models/UpdateAnalogueModelCommandBody.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type UpdateAnalogueModelCommandBody = { - name?: string | null; - description?: string | null; - sourceType?: string | null; + name: string; + description?: string | null; + sourceType: string; }; diff --git a/src/api/generated/models/UpdateAnalogueModelCommandResponse.ts b/src/api/generated/models/UpdateAnalogueModelCommandResponse.ts index ed7e4cdb..62448970 100644 --- a/src/api/generated/models/UpdateAnalogueModelCommandResponse.ts +++ b/src/api/generated/models/UpdateAnalogueModelCommandResponse.ts @@ -6,9 +6,9 @@ import type { UpdateAnalogueModelDto } from './UpdateAnalogueModelDto'; export type UpdateAnalogueModelCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: UpdateAnalogueModelDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: UpdateAnalogueModelDto; }; diff --git a/src/api/generated/models/UpdateAnalogueModelDto.ts b/src/api/generated/models/UpdateAnalogueModelDto.ts index bd170f57..c0ddce60 100644 --- a/src/api/generated/models/UpdateAnalogueModelDto.ts +++ b/src/api/generated/models/UpdateAnalogueModelDto.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type UpdateAnalogueModelDto = { - analogueModelId?: string; - name?: string | null; - description?: string | null; - sourceType?: string | null; + analogueModelId: string; + name: string; + description?: string | null; + sourceType: string; }; diff --git a/src/api/generated/models/UpdateJobStatusCommand.ts b/src/api/generated/models/UpdateJobStatusCommand.ts index 39dda540..751ce749 100644 --- a/src/api/generated/models/UpdateJobStatusCommand.ts +++ b/src/api/generated/models/UpdateJobStatusCommand.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type UpdateJobStatusCommand = { - name?: string | null; - started?: string | null; - ended?: string | null; - status?: string | null; + name: string; + started?: string | null; + ended?: string | null; + status: string; }; diff --git a/src/api/generated/models/UpdateParameterCommandBody.ts b/src/api/generated/models/UpdateParameterCommandBody.ts index 46b559bd..e902ae03 100644 --- a/src/api/generated/models/UpdateParameterCommandBody.ts +++ b/src/api/generated/models/UpdateParameterCommandBody.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type UpdateParameterCommandBody = { - identifier?: string | null; - name?: string | null; - description?: string | null; + identifier: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/UpdateParameterCommandResponse.ts b/src/api/generated/models/UpdateParameterCommandResponse.ts index c98f63c7..694819cc 100644 --- a/src/api/generated/models/UpdateParameterCommandResponse.ts +++ b/src/api/generated/models/UpdateParameterCommandResponse.ts @@ -6,9 +6,9 @@ import type { UpdateParameterDto } from './UpdateParameterDto'; export type UpdateParameterCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: UpdateParameterDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: UpdateParameterDto; }; diff --git a/src/api/generated/models/UpdateParameterDto.ts b/src/api/generated/models/UpdateParameterDto.ts index 21347a69..f80b8284 100644 --- a/src/api/generated/models/UpdateParameterDto.ts +++ b/src/api/generated/models/UpdateParameterDto.ts @@ -4,8 +4,8 @@ /* eslint-disable */ export type UpdateParameterDto = { - parameterId?: string; - identifier?: string | null; - name?: string | null; - description?: string | null; + parameterId: string; + identifier: string; + name: string; + description?: string | null; }; diff --git a/src/api/generated/models/UploadAnalogueModelCommandResponse.ts b/src/api/generated/models/UploadAnalogueModelCommandResponse.ts index ed5e76ce..8f976421 100644 --- a/src/api/generated/models/UploadAnalogueModelCommandResponse.ts +++ b/src/api/generated/models/UploadAnalogueModelCommandResponse.ts @@ -6,9 +6,9 @@ import type { UploadAnalogueModelDto } from './UploadAnalogueModelDto'; export type UploadAnalogueModelCommandResponse = { - success?: boolean; - count?: number | null; - message?: string | null; - validationErrors?: Array | null; - data: UploadAnalogueModelDto; + success?: boolean; + count?: number | null; + message?: string | null; + validationErrors?: Array | null; + data: UploadAnalogueModelDto; }; diff --git a/src/api/generated/models/UploadAnalogueModelDto.ts b/src/api/generated/models/UploadAnalogueModelDto.ts index 6e186e6f..3318b1e6 100644 --- a/src/api/generated/models/UploadAnalogueModelDto.ts +++ b/src/api/generated/models/UploadAnalogueModelDto.ts @@ -8,9 +8,9 @@ import type { UploadFileType } from './UploadFileType'; import type { UploadStatus } from './UploadStatus'; export type UploadAnalogueModelDto = { - uploadId?: string; - originalFileName?: string | null; - uploadStatus?: UploadStatus; - uploadFileType?: UploadFileType; - uploadFileCategory?: UploadFileCategory; + uploadId: string; + originalFileName: string; + uploadStatus: UploadStatus; + uploadFileType: UploadFileType; + uploadFileCategory: UploadFileCategory; }; diff --git a/src/api/generated/models/UploadDetail.ts b/src/api/generated/models/UploadDetail.ts index 4e9f527a..fbcf1e3d 100644 --- a/src/api/generated/models/UploadDetail.ts +++ b/src/api/generated/models/UploadDetail.ts @@ -8,9 +8,9 @@ import type { UploadFileType } from './UploadFileType'; import type { UploadStatus } from './UploadStatus'; export type UploadDetail = { - uploadId?: string; - originalFileName?: string | null; - uploadStatus?: UploadStatus; - uploadFileType?: UploadFileType; - uploadFileCategory?: UploadFileCategory; + uploadId: string; + originalFileName: string; + uploadStatus: UploadStatus; + uploadFileType: UploadFileType; + uploadFileCategory: UploadFileCategory; }; diff --git a/src/api/generated/models/UploadFileCategory.ts b/src/api/generated/models/UploadFileCategory.ts index 161f4914..889c5bc3 100644 --- a/src/api/generated/models/UploadFileCategory.ts +++ b/src/api/generated/models/UploadFileCategory.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export enum UploadFileCategory { - INPUT_MODEL = 'InputModel', - INPUT_METADATA = 'InputMetadata', - RES_QML_MODEL = 'ResQmlModel', + INPUT_MODEL = 'InputModel', + INPUT_METADATA = 'InputMetadata', + RES_QML_MODEL = 'ResQmlModel', } diff --git a/src/api/generated/models/UploadFileType.ts b/src/api/generated/models/UploadFileType.ts index 30f322b0..1aff0b08 100644 --- a/src/api/generated/models/UploadFileType.ts +++ b/src/api/generated/models/UploadFileType.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export enum UploadFileType { - NET_CDF = 'NetCDF', - RES_QMLEPC = 'ResQMLEpc', - RES_QMLDATA = 'ResQMLData', + NET_CDF = 'NetCDF', + RES_QMLEPC = 'ResQMLEpc', + RES_QMLDATA = 'ResQMLData', } diff --git a/src/api/generated/models/UploadList.ts b/src/api/generated/models/UploadList.ts index e90bc574..5bc87ee5 100644 --- a/src/api/generated/models/UploadList.ts +++ b/src/api/generated/models/UploadList.ts @@ -8,10 +8,10 @@ import type { UploadFileType } from './UploadFileType'; import type { UploadStatus } from './UploadStatus'; export type UploadList = { - uploadId?: string; - analogueModelId?: string; - originalFileName?: string | null; - uploadStatus?: UploadStatus; - uploadFileType?: UploadFileType; - uploadFileCategory?: UploadFileCategory; + uploadId: string; + analogueModelId: string; + originalFileName: string; + uploadStatus: UploadStatus; + uploadFileType: UploadFileType; + uploadFileCategory: UploadFileCategory; }; diff --git a/src/api/generated/models/UploadStatus.ts b/src/api/generated/models/UploadStatus.ts index 32922171..3fefd82f 100644 --- a/src/api/generated/models/UploadStatus.ts +++ b/src/api/generated/models/UploadStatus.ts @@ -4,9 +4,9 @@ /* eslint-disable */ export enum UploadStatus { - STARTED = 'Started', - READY_FOR_PROCESSING = 'ReadyForProcessing', - PROCESSING = 'Processing', - PROCESSED = 'Processed', - FAILED = 'Failed', + STARTED = 'Started', + READY_FOR_PROCESSING = 'ReadyForProcessing', + PROCESSING = 'Processing', + PROCESSED = 'Processed', + FAILED = 'Failed', } diff --git a/src/api/generated/services/AnalogueModelParametersService.ts b/src/api/generated/services/AnalogueModelParametersService.ts index 4d190550..c81f5925 100644 --- a/src/api/generated/services/AnalogueModelParametersService.ts +++ b/src/api/generated/services/AnalogueModelParametersService.ts @@ -10,24 +10,26 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class AnalogueModelParametersService { - /** - * @param id - * @param requestBody - * @returns AddAnalogueModelParameterCommandResponse Success - * @throws ApiError - */ - public static postApiAnalogueModelsParameters( - id: string, - requestBody?: AddAnalogueModelParameterCommandForm, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/analogue-models/{id}/parameters', - path: { - id: id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } + + /** + * @param id + * @param requestBody + * @returns AddAnalogueModelParameterCommandResponse Success + * @throws ApiError + */ + public static postApiAnalogueModelsParameters( +id: string, +requestBody?: AddAnalogueModelParameterCommandForm, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/analogue-models/{id}/parameters', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } + } diff --git a/src/api/generated/services/AnalogueModelsService.ts b/src/api/generated/services/AnalogueModelsService.ts index 889276bd..f3f935c7 100644 --- a/src/api/generated/services/AnalogueModelsService.ts +++ b/src/api/generated/services/AnalogueModelsService.ts @@ -18,174 +18,178 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class AnalogueModelsService { - /** - * Get a list of all AnalogueModels - * @returns GetAnalogueModelListQueryResponse Success - * @throws ApiError - */ - public static getApiAnalogueModels(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/analogue-models', - }); - } - /** - * Create new Analogue Model - * @param requestBody - * @returns CreateAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static postApiAnalogueModels( - requestBody?: CreateAnalogueModelCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/analogue-models', - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - }, - }); - } + /** + * Get a list of all AnalogueModels + * @returns GetAnalogueModelListQueryResponse Success + * @throws ApiError + */ + public static getApiAnalogueModels(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/analogue-models', + }); + } - /** - * Get AnalogueModel by id - * @param id - * @returns GetAnalogueModelQueryResponse Success - * @throws ApiError - */ - public static getApiAnalogueModels1( - id: string, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/analogue-models/{id}', - path: { - id: id, - }, - }); - } + /** + * Create new Analogue Model + * @param requestBody + * @returns CreateAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static postApiAnalogueModels( +requestBody?: CreateAnalogueModelCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/analogue-models', + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + }, + }); + } - /** - * Patch a AnalogueModel by Id with new values - * @param id - * @param requestBody - * @returns PatchAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static patchApiAnalogueModels( - id: string, - requestBody?: Array, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/analogue-models/{id}', - path: { - id: id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Get AnalogueModel by id + * @param id + * @returns GetAnalogueModelQueryResponse Success + * @throws ApiError + */ + public static getApiAnalogueModels1( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/analogue-models/{id}', + path: { + 'id': id, + }, + }); + } - /** - * Update AnalogueModel by Id - * @param id - * @param requestBody - * @returns UpdateAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static putApiAnalogueModels( - id: string, - requestBody?: UpdateAnalogueModelCommandBody, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/analogue-models/{id}', - path: { - id: id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Patch a AnalogueModel by Id with new values + * @param id + * @param requestBody + * @returns PatchAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static patchApiAnalogueModels( +id: string, +requestBody?: Array, +): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/analogue-models/{id}', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } - /** - * Delete a AnalogueModel by id - * @param id - * @returns void - * @throws ApiError - */ - public static deleteApiAnalogueModels(id: string): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/analogue-models/{id}', - path: { - id: id, - }, - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Update AnalogueModel by Id + * @param id + * @param requestBody + * @returns UpdateAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static putApiAnalogueModels( +id: string, +requestBody?: UpdateAnalogueModelCommandBody, +): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/analogue-models/{id}', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } - /** - * Upload model files that later can be converted to PEPM models. - * @param id - * @param formData - * @returns UploadAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static postApiAnalogueModelsInputModels( - id: string, - formData?: { - File?: Blob; - FileType?: UploadFileType; - }, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/analogue-models/{id}/input-models', - path: { - id: id, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } + /** + * Delete a AnalogueModel by id + * @param id + * @returns void + * @throws ApiError + */ + public static deleteApiAnalogueModels( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/analogue-models/{id}', + path: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } + + /** + * Upload model files that later can be converted to PEPM models. + * @param id + * @param formData + * @returns UploadAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static postApiAnalogueModelsInputModels( +id: string, +formData?: { +File: Blob; +FileType: UploadFileType; +}, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/analogue-models/{id}/input-models', + path: { + 'id': id, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * Upload NetCDF model files that later can be converted to PEPM models. + * @param id + * @param formData + * @returns UploadAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static postApiAnalogueModelsNetcdfModels( +id: string, +formData?: { +file?: Blob; +}, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/analogue-models/{id}/netcdf-models', + path: { + 'id': id, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } - /** - * Upload NetCDF model files that later can be converted to PEPM models. - * @param id - * @param formData - * @returns UploadAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static postApiAnalogueModelsNetcdfModels( - id: string, - formData?: { - file?: Blob; - }, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/analogue-models/{id}/netcdf-models', - path: { - id: id, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } } diff --git a/src/api/generated/services/AnaloguesService.ts b/src/api/generated/services/AnaloguesService.ts index 2b4a45d6..fceac673 100644 --- a/src/api/generated/services/AnaloguesService.ts +++ b/src/api/generated/services/AnaloguesService.ts @@ -11,30 +11,32 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class AnaloguesService { - /** - * @returns GetAnalogueListQueryResponse Success - * @throws ApiError - */ - public static getApiAnalogues(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/analogues', - }); - } - /** - * @param requestBody - * @returns CreateAnalogueCommandResponse Success - * @throws ApiError - */ - public static postApiAnalogues( - requestBody?: CreateAnalogueCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/analogues', - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } + /** + * @returns GetAnalogueListQueryResponse Success + * @throws ApiError + */ + public static getApiAnalogues(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/analogues', + }); + } + + /** + * @param requestBody + * @returns CreateAnalogueCommandResponse Success + * @throws ApiError + */ + public static postApiAnalogues( +requestBody?: CreateAnalogueCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/analogues', + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } + } diff --git a/src/api/generated/services/JobsService.ts b/src/api/generated/services/JobsService.ts index 04b9f053..46713370 100644 --- a/src/api/generated/services/JobsService.ts +++ b/src/api/generated/services/JobsService.ts @@ -16,112 +16,114 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class JobsService { - /** - * @returns GetJobListQueryResponse Success - * @throws ApiError - */ - public static getApiJobs(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/jobs', - }); - } - /** - * @param id - * @returns GetJobDetailQueryResponse Success - * @throws ApiError - */ - public static getApiJobs1( - id: string, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/jobs/{id}', - path: { - id: id, - }, - }); - } + /** + * @returns GetJobListQueryResponse Success + * @throws ApiError + */ + public static getApiJobs(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/jobs', + }); + } - /** - * Get current job status for job. This will fetch current status from underlying compute engine and update the status for the supplied Job Id. - * @param id - * @returns GetCurrentJobStatusCommandResponse Success - * @throws ApiError - */ - public static getApiJobsStatus( - id: string, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/jobs/{id}/status', - path: { - id: id, - }, - }); - } + /** + * @param id + * @returns GetJobDetailQueryResponse Success + * @throws ApiError + */ + public static getApiJobs1( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/jobs/{id}', + path: { + 'id': id, + }, + }); + } - /** - * Update current job status for job. This will fetch current status from underlying compute engine and update the status for the supplied Job Name. - * @param requestBody - * @returns ConvertAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static postApiJobsStatus( - requestBody?: UpdateJobStatusCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/jobs/status', - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } + /** + * Get current job status for job. This will fetch current status from underlying compute engine and update the status for the supplied Job Id. + * @param id + * @returns GetCurrentJobStatusCommandResponse Success + * @throws ApiError + */ + public static getApiJobsStatus( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/jobs/{id}/status', + path: { + 'id': id, + }, + }); + } - /** - * Get current job status for all jobs. This will fetch current status from underlying compute engine and update the status for all matching Jobs. - * @returns GetCurrentJobStatusListCommand Success - * @throws ApiError - */ - public static getApiJobsStatus1(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/jobs/status', - }); - } + /** + * Update current job status for job. This will fetch current status from underlying compute engine and update the status for the supplied Job Name. + * @param requestBody + * @returns ConvertAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static postApiJobsStatus( +requestBody?: UpdateJobStatusCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/jobs/status', + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } - /** - * Convert AnalogueModels to the internal format used by PEPM in order to perform calculations. - * @param requestBody - * @returns any Accepted - * @throws ApiError - */ - public static postApiJobsComputeModelConversions( - requestBody?: ConvertAnalogueModelCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/jobs/compute/model-conversions', - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } + /** + * Get current job status for all jobs. This will fetch current status from underlying compute engine and update the status for all matching Jobs. + * @returns GetCurrentJobStatusListCommand Success + * @throws ApiError + */ + public static getApiJobsStatus1(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/jobs/status', + }); + } + + /** + * Convert AnalogueModels to the internal format used by PEPM in order to perform calculations. + * @param requestBody + * @returns any Accepted + * @throws ApiError + */ + public static postApiJobsComputeModelConversions( +requestBody?: ConvertAnalogueModelCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/jobs/compute/model-conversions', + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } + + /** + * Estimate channel on a Deltares based model. + * @param requestBody + * @returns any Accepted + * @throws ApiError + */ + public static postApiJobsComputeChannelEstimations( +requestBody?: EstimateChannelCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/jobs/compute/channel-estimations', + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } - /** - * Estimate channel on a Deltares based model. - * @param requestBody - * @returns any Accepted - * @throws ApiError - */ - public static postApiJobsComputeChannelEstimations( - requestBody?: EstimateChannelCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/jobs/compute/channel-estimations', - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } } diff --git a/src/api/generated/services/ParametersService.ts b/src/api/generated/services/ParametersService.ts index db2ee647..e38cf699 100644 --- a/src/api/generated/services/ParametersService.ts +++ b/src/api/generated/services/ParametersService.ts @@ -15,129 +15,133 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class ParametersService { - /** - * Get a list of all Parameters - * @returns GetParameterListQueryResponse Success - * @throws ApiError - */ - public static getApiParameters(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/parameters', - }); - } - /** - * Create new Parameter - * @param requestBody - * @returns void - * @throws ApiError - */ - public static postApiParameters( - requestBody?: CreateParameterCommand, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/parameters', - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - }, - }); - } + /** + * Get a list of all Parameters + * @returns GetParameterListQueryResponse Success + * @throws ApiError + */ + public static getApiParameters(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/parameters', + }); + } - /** - * Get Parameter details by Id - * @param id - * @returns GetParameterDetailQueryResponse Success - * @throws ApiError - */ - public static getApiParameters1( - id: string, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/parameters/{id}', - path: { - id: id, - }, - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Create new Parameter + * @param requestBody + * @returns void + * @throws ApiError + */ + public static postApiParameters( +requestBody?: CreateParameterCommand, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/parameters', + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + }, + }); + } - /** - * Patch a Parameter by Id with new values - * @param id - * @param requestBody - * @returns PatchParameterCommandResponse Success - * @throws ApiError - */ - public static patchApiParameters( - id: string, - requestBody?: Array, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/parameters/{id}', - path: { - id: id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Get Parameter details by Id + * @param id + * @returns GetParameterDetailQueryResponse Success + * @throws ApiError + */ + public static getApiParameters1( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/parameters/{id}', + path: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } - /** - * Update Parameter by Id - * @param id - * @param requestBody - * @returns UpdateParameterCommandResponse Success - * @throws ApiError - */ - public static putApiParameters( - id: string, - requestBody?: UpdateParameterCommandBody, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/parameters/{id}', - path: { - id: id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } + /** + * Patch a Parameter by Id with new values + * @param id + * @param requestBody + * @returns PatchParameterCommandResponse Success + * @throws ApiError + */ + public static patchApiParameters( +id: string, +requestBody?: Array, +): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/parameters/{id}', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } + + /** + * Update Parameter by Id + * @param id + * @param requestBody + * @returns UpdateParameterCommandResponse Success + * @throws ApiError + */ + public static putApiParameters( +id: string, +requestBody?: UpdateParameterCommandBody, +): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/parameters/{id}', + path: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } + + /** + * Delete a parameter by id + * @param id + * @returns void + * @throws ApiError + */ + public static deleteApiParameters( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/parameters/{id}', + path: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + 404: `Not Found`, + }, + }); + } - /** - * Delete a parameter by id - * @param id - * @returns void - * @throws ApiError - */ - public static deleteApiParameters(id: string): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/parameters/{id}', - path: { - id: id, - }, - errors: { - 400: `Bad Request`, - 404: `Not Found`, - }, - }); - } } diff --git a/src/api/generated/services/UploadsService.ts b/src/api/generated/services/UploadsService.ts index a8014302..edb90fd7 100644 --- a/src/api/generated/services/UploadsService.ts +++ b/src/api/generated/services/UploadsService.ts @@ -12,50 +12,54 @@ import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class UploadsService { - /** - * @returns GetUploadListQueryResponse Success - * @throws ApiError - */ - public static getApiUploads(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/uploads', - }); - } - /** - * @param id - * @returns GetUploadDetailQueryResponse Success - * @throws ApiError - */ - public static getApiUploads1( - id: string, - ): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/uploads/{id}', - path: { - id: id, - }, - }); - } + /** + * @returns GetUploadListQueryResponse Success + * @throws ApiError + */ + public static getApiUploads(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/uploads', + }); + } + + /** + * @param id + * @returns GetUploadDetailQueryResponse Success + * @throws ApiError + */ + public static getApiUploads1( +id: string, +): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/uploads/{id}', + path: { + 'id': id, + }, + }); + } + + /** + * Upload model files that later can be converted to PEPM models. + * @param formData + * @returns UploadAnalogueModelCommandResponse Success + * @throws ApiError + */ + public static postApiUploadsModels( +formData?: { +ModelId: string; +File: Blob; +FileType: UploadFileType; +}, +): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/uploads/models', + formData: formData, + mediaType: 'multipart/form-data', + }); + } - /** - * Upload model files that later can be converted to PEPM models. - * @param formData - * @returns UploadAnalogueModelCommandResponse Success - * @throws ApiError - */ - public static postApiUploadsModels(formData?: { - ModelId?: string; - File?: Blob; - FileType?: UploadFileType; - }): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/uploads/models', - formData: formData, - mediaType: 'multipart/form-data', - }); - } } diff --git a/src/pages/Browse/Browse.tsx b/src/pages/Browse/Browse.tsx index 1fb476aa..430c42f2 100644 --- a/src/pages/Browse/Browse.tsx +++ b/src/pages/Browse/Browse.tsx @@ -59,7 +59,7 @@ export const Browse = () => { async function uploadModel(file: File, metadata: Partial) { setUploadStatus(UploadProcess.STARTED); const ModelBody: CreateAnalogueModelCommand = { - name: metadata.name, + name: metadata.name ? metadata.name : '', description: metadata.description, sourceType: 'ResQML', };