forked from loafle/openapi-generator-original
* 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
116 lines
3.7 KiB
Plaintext
116 lines
3.7 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 { Order } from 'model/Order';
|
|
|
|
|
|
|
|
|
|
/**
|
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
* @summary Delete purchase order by ID
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param orderId ID of the order that needs to be deleted
|
|
* @response 400 [undefined] Invalid ID supplied
|
|
* @response 404 [undefined] Order not found
|
|
*/
|
|
export public async function StoreApi__deleteOrder(fe : ApiExecuterI, orderId: string) : Promise<undefined, Object | ApiError<>> {
|
|
checkRequiredParams('deleteOrder', { 'orderId': orderId });
|
|
|
|
const _pathParams = {
|
|
'orderId': orderId };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
await fe.exec(
|
|
'DELETE', '/v2' + '/store/order/{orderId}',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns a map of status codes to quantities
|
|
* @summary Returns pet inventories by status
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @response 200 [~Object+] successful operation
|
|
*/
|
|
export public async function StoreApi__getInventory(fe : ApiExecuterI, ) : Promise<~Object+, Object> {
|
|
checkRequiredParams('getInventory', { });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
return await fe.<~Object+, undefined>exec(
|
|
'GET', '/v2' + '/store/inventory',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
|
|
* @summary Find purchase order by ID
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param orderId ID of pet that needs to be fetched
|
|
* @response 200 [Order] successful operation
|
|
* @response 400 [undefined] Invalid ID supplied
|
|
* @response 404 [undefined] Order not found
|
|
*/
|
|
export public async function StoreApi__getOrderById(fe : ApiExecuterI, orderId: int) : Promise<Order, Object | ApiError<>> {
|
|
checkRequiredParams('getOrderById', { 'orderId': orderId });
|
|
|
|
const _pathParams = {
|
|
'orderId': orderId };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
return await fe.<Order, >exec(
|
|
'GET', '/v2' + '/store/order/{orderId}',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Place an order for a pet
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param order order placed for purchasing the pet
|
|
* @response 200 [Order] successful operation
|
|
* @response 400 [undefined] Invalid Order
|
|
*/
|
|
export public async function StoreApi__placeOrder(fe : ApiExecuterI, order: Order) : Promise<Order, Object | ApiError<>> {
|
|
checkRequiredParams('placeOrder', { 'order': order });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = cleanCopyBody(order, 'id', 'petId', 'quantity', 'shipDate', 'status', 'complete');
|
|
|
|
return await fe.<Order, >exec(
|
|
'POST', '/v2' + '/store/order',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|