mmews-n4 db478c3452
Support language N4JS (2nd) (#15397)
* n4js initial commit

* incorporate feedback from user

* add tests

* fix media type in case of DELETE method

* fix media type

* some minor fixes

* options fix for booleans

* small fixes

* generated files by ./bin/utils/ensure-up-to-date

* remove String::toLowerCase due to de.thetaphi:forbiddenapis

* adjust test expectation

* fix test expectations

* fix test expectation

* add note to section 'Languages/Generators'

* remove file according to review

* replace tabs by spaces

* replace tabs by spaces (2)

* update two generated files

* remove test file

* move statement
2023-05-03 20:50:21 +08:00

224 lines
6.9 KiB
Plaintext

/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ApiExecuterI, ApiError, checkRequiredParams, cleanCopyBody } from "api/ApiHelper"
import { ApiResponse } from 'model/ApiResponse';
import { Pet } from 'model/Pet';
/**
*
* @summary Add a new pet to the store
* @param fe Callback interface that runs the fetch query
* @param pet Pet object that needs to be added to the store
* @response 200 [Pet] successful operation
* @response 405 [undefined] Invalid input
*/
export public async function PetApi__addPet(fe : ApiExecuterI, pet: Pet) : Promise<Pet, Object | ApiError<>> {
checkRequiredParams('addPet', { 'pet': pet });
const _pathParams = { };
const _queryParams = { };
const _headerParams = { };
const _body = cleanCopyBody(pet, 'id', 'category', 'name', 'photoUrls', 'tags', 'status');
return await fe.<Pet, >exec(
'POST', '/v2' + '/pet',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
*
* @summary Deletes a pet
* @param fe Callback interface that runs the fetch query
* @param petId Pet id to delete
* @param apiKey
* @response 400 [undefined] Invalid pet value
*/
export public async function PetApi__deletePet(fe : ApiExecuterI, petId: int, apiKey: string=) : Promise<undefined, Object | ApiError<>> {
checkRequiredParams('deletePet', { 'petId': petId, });
const _pathParams = {
'petId': petId };
const _queryParams = { };
const _headerParams = {
'api_key': apiKey };
const _body = undefined;
await fe.exec(
'DELETE', '/v2' + '/pet/{petId}',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param fe Callback interface that runs the fetch query
* @param status Status values that need to be considered for filter
* @response 200 [Pet[]] successful operation
* @response 400 [undefined] Invalid status value
*/
export public async function PetApi__findPetsByStatus(fe : ApiExecuterI, status: "available" | "pending" | "sold"[]) : Promise<Pet[], Object | ApiError<>> {
checkRequiredParams('findPetsByStatus', { 'status': status });
const _pathParams = { };
const _queryParams = {
'status': status };
const _headerParams = { };
const _body = undefined;
return await fe.<Pet[], >exec(
'GET', '/v2' + '/pet/findByStatus',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param fe Callback interface that runs the fetch query
* @param tags Tags to filter by
* @response 200 [Pet[]] successful operation
* @response 400 [undefined] Invalid tag value
*/
export public async function PetApi__findPetsByTags(fe : ApiExecuterI, tags: string[]) : Promise<Pet[], Object | ApiError<>> {
checkRequiredParams('findPetsByTags', { 'tags': tags });
const _pathParams = { };
const _queryParams = {
'tags': tags };
const _headerParams = { };
const _body = undefined;
return await fe.<Pet[], >exec(
'GET', '/v2' + '/pet/findByTags',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
* Returns a single pet
* @summary Find pet by ID
* @param fe Callback interface that runs the fetch query
* @param petId ID of pet to return
* @response 200 [Pet] successful operation
* @response 400 [undefined] Invalid ID supplied
* @response 404 [undefined] Pet not found
*/
export public async function PetApi__getPetById(fe : ApiExecuterI, petId: int) : Promise<Pet, Object | ApiError<>> {
checkRequiredParams('getPetById', { 'petId': petId });
const _pathParams = {
'petId': petId };
const _queryParams = { };
const _headerParams = { };
const _body = undefined;
return await fe.<Pet, >exec(
'GET', '/v2' + '/pet/{petId}',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
*
* @summary Update an existing pet
* @param fe Callback interface that runs the fetch query
* @param pet Pet object that needs to be added to the store
* @response 200 [Pet] successful operation
* @response 400 [undefined] Invalid ID supplied
* @response 404 [undefined] Pet not found
* @response 405 [undefined] Validation exception
*/
export public async function PetApi__updatePet(fe : ApiExecuterI, pet: Pet) : Promise<Pet, Object | ApiError<>> {
checkRequiredParams('updatePet', { 'pet': pet });
const _pathParams = { };
const _queryParams = { };
const _headerParams = { };
const _body = cleanCopyBody(pet, 'id', 'category', 'name', 'photoUrls', 'tags', 'status');
return await fe.<Pet, >exec(
'PUT', '/v2' + '/pet',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
*
* @summary Updates a pet in the store with form data
* @param fe Callback interface that runs the fetch query
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
* @response 405 [undefined] Invalid input
*/
export public async function PetApi__updatePetWithForm(fe : ApiExecuterI, petId: int, name: string=, status: string=) : Promise<undefined, Object | ApiError<>> {
checkRequiredParams('updatePetWithForm', { 'petId': petId, });
const _pathParams = {
'petId': petId };
const _queryParams = { };
const _headerParams = { };
const _body = undefined;
await fe.exec(
'POST', '/v2' + '/pet/{petId}',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}
/**
*
* @summary uploads an image
* @param fe Callback interface that runs the fetch query
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @response 200 [ApiResponse] successful operation
*/
export public async function PetApi__uploadFile(fe : ApiExecuterI, petId: int, additionalMetadata: string=, file: any=) : Promise<ApiResponse, Object> {
checkRequiredParams('uploadFile', { 'petId': petId, });
const _pathParams = {
'petId': petId };
const _queryParams = { };
const _headerParams = { };
const _body = undefined;
return await fe.<ApiResponse, undefined>exec(
'POST', '/v2' + '/pet/{petId}/uploadImage',
_pathParams, _queryParams, _headerParams,
undefined,
_body
);
}