-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from bas-kirill/feature/openapi-edit-instrument
feat(edit-instrument): use openapi for server side
- Loading branch information
Showing
19 changed files
with
582 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Client Error | ||
* Client Error | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
import type { Configuration } from "../configuration"; | ||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios"; | ||
import globalAxios from "axios"; | ||
// Some imports not used depending on template conditions | ||
// @ts-ignore | ||
import { | ||
DUMMY_BASE_URL, | ||
assertParamExists, | ||
setApiKeyToObject, | ||
setBasicAuthToObject, | ||
setBearerAuthToObject, | ||
setOAuthToObject, | ||
setSearchParams, | ||
serializeDataIfNeeded, | ||
toPathString, | ||
createRequestFunction, | ||
} from "../common"; | ||
// @ts-ignore | ||
import { | ||
BASE_PATH, | ||
COLLECTION_FORMATS, | ||
type RequestArgs, | ||
BaseAPI, | ||
RequiredError, | ||
operationServerMap, | ||
} from "../base"; | ||
// @ts-ignore | ||
import type { ClientError } from "../model"; | ||
// @ts-ignore | ||
import type { EditInstrumentRequestBody } from "../model"; | ||
// @ts-ignore | ||
import type { ServerError } from "../model"; | ||
/** | ||
* EditInstrumentApi - axios parameter creator | ||
* @export | ||
*/ | ||
export const EditInstrumentApiAxiosParamCreator = function ( | ||
configuration?: Configuration, | ||
) { | ||
return { | ||
/** | ||
* Edit Instrument | ||
* @summary Edit Instrument | ||
* @param {EditInstrumentRequestBody} editInstrumentRequestBody | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
editInstrument: async ( | ||
editInstrumentRequestBody: EditInstrumentRequestBody, | ||
options: RawAxiosRequestConfig = {}, | ||
): Promise<RequestArgs> => { | ||
// verify required parameter 'editInstrumentRequestBody' is not null or undefined | ||
assertParamExists( | ||
"editInstrument", | ||
"editInstrumentRequestBody", | ||
editInstrumentRequestBody, | ||
); | ||
const localVarPath = `/instrument/edit`; | ||
// use dummy base URL string because the URL constructor only accepts absolute URLs. | ||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); | ||
let baseOptions; | ||
if (configuration) { | ||
baseOptions = configuration.baseOptions; | ||
} | ||
|
||
const localVarRequestOptions = { | ||
method: "POST", | ||
...baseOptions, | ||
...options, | ||
}; | ||
const localVarHeaderParameter = {} as any; | ||
const localVarQueryParameter = {} as any; | ||
|
||
localVarHeaderParameter["Content-Type"] = "application/json"; | ||
|
||
setSearchParams(localVarUrlObj, localVarQueryParameter); | ||
let headersFromBaseOptions = | ||
baseOptions && baseOptions.headers ? baseOptions.headers : {}; | ||
localVarRequestOptions.headers = { | ||
...localVarHeaderParameter, | ||
...headersFromBaseOptions, | ||
...options.headers, | ||
}; | ||
localVarRequestOptions.data = serializeDataIfNeeded( | ||
editInstrumentRequestBody, | ||
localVarRequestOptions, | ||
configuration, | ||
); | ||
|
||
return { | ||
url: toPathString(localVarUrlObj), | ||
options: localVarRequestOptions, | ||
}; | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* EditInstrumentApi - functional programming interface | ||
* @export | ||
*/ | ||
export const EditInstrumentApiFp = function (configuration?: Configuration) { | ||
const localVarAxiosParamCreator = | ||
EditInstrumentApiAxiosParamCreator(configuration); | ||
return { | ||
/** | ||
* Edit Instrument | ||
* @summary Edit Instrument | ||
* @param {EditInstrumentRequestBody} editInstrumentRequestBody | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
async editInstrument( | ||
editInstrumentRequestBody: EditInstrumentRequestBody, | ||
options?: RawAxiosRequestConfig, | ||
): Promise< | ||
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object> | ||
> { | ||
const localVarAxiosArgs = await localVarAxiosParamCreator.editInstrument( | ||
editInstrumentRequestBody, | ||
options, | ||
); | ||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; | ||
const localVarOperationServerBasePath = | ||
operationServerMap["EditInstrumentApi.editInstrument"]?.[ | ||
localVarOperationServerIndex | ||
]?.url; | ||
return (axios, basePath) => | ||
createRequestFunction( | ||
localVarAxiosArgs, | ||
globalAxios, | ||
BASE_PATH, | ||
configuration, | ||
)(axios, localVarOperationServerBasePath || basePath); | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* EditInstrumentApi - factory interface | ||
* @export | ||
*/ | ||
export const EditInstrumentApiFactory = function ( | ||
configuration?: Configuration, | ||
basePath?: string, | ||
axios?: AxiosInstance, | ||
) { | ||
const localVarFp = EditInstrumentApiFp(configuration); | ||
return { | ||
/** | ||
* Edit Instrument | ||
* @summary Edit Instrument | ||
* @param {EditInstrumentRequestBody} editInstrumentRequestBody | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
*/ | ||
editInstrument( | ||
editInstrumentRequestBody: EditInstrumentRequestBody, | ||
options?: RawAxiosRequestConfig, | ||
): AxiosPromise<object> { | ||
return localVarFp | ||
.editInstrument(editInstrumentRequestBody, options) | ||
.then((request) => request(axios, basePath)); | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* EditInstrumentApi - object-oriented interface | ||
* @export | ||
* @class EditInstrumentApi | ||
* @extends {BaseAPI} | ||
*/ | ||
export class EditInstrumentApi extends BaseAPI { | ||
/** | ||
* Edit Instrument | ||
* @summary Edit Instrument | ||
* @param {EditInstrumentRequestBody} editInstrumentRequestBody | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
* @memberof EditInstrumentApi | ||
*/ | ||
public editInstrument( | ||
editInstrumentRequestBody: EditInstrumentRequestBody, | ||
options?: RawAxiosRequestConfig, | ||
) { | ||
return EditInstrumentApiFp(this.configuration) | ||
.editInstrument(editInstrumentRequestBody, options) | ||
.then((request) => request(this.axios, this.basePath)); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
client/src/generated/model/edit-instrument-request-body.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Client Error | ||
* Client Error | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
/** | ||
* | ||
* @export | ||
* @interface EditInstrumentRequestBody | ||
*/ | ||
export interface EditInstrumentRequestBody { | ||
/** | ||
* | ||
* @type {number} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
instrument_id?: number; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
instrument_name: string; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
instrument_type: string; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
manufacturer_name: string; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
manufacturer_date: string; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
release_date: string; | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
country: string; | ||
/** | ||
* | ||
* @type {Array<string>} | ||
* @memberof EditInstrumentRequestBody | ||
*/ | ||
materials: Array<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.