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
214 lines
6.5 KiB
Plaintext
214 lines
6.5 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 { User } from 'model/User';
|
|
|
|
|
|
|
|
|
|
/**
|
|
* This can only be done by the logged in user.
|
|
* @summary Create user
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param user Created user object
|
|
* @response 0 [undefined] successful operation
|
|
*/
|
|
export public async function UserApi__createUser(fe : ApiExecuterI, user: User) : Promise<undefined, Object> {
|
|
checkRequiredParams('createUser', { 'user': user });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = cleanCopyBody(user, 'id', 'username', 'firstName', 'lastName', 'email', 'password', 'phone', 'userStatus');
|
|
|
|
await fe.exec(
|
|
'POST', '/v2' + '/user',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Creates list of users with given input array
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param user List of user object
|
|
* @response 0 [undefined] successful operation
|
|
*/
|
|
export public async function UserApi__createUsersWithArrayInput(fe : ApiExecuterI, user: User[]) : Promise<undefined, Object> {
|
|
checkRequiredParams('createUsersWithArrayInput', { 'user': user });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = user;
|
|
|
|
await fe.exec(
|
|
'POST', '/v2' + '/user/createWithArray',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Creates list of users with given input array
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param user List of user object
|
|
* @response 0 [undefined] successful operation
|
|
*/
|
|
export public async function UserApi__createUsersWithListInput(fe : ApiExecuterI, user: User[]) : Promise<undefined, Object> {
|
|
checkRequiredParams('createUsersWithListInput', { 'user': user });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = user;
|
|
|
|
await fe.exec(
|
|
'POST', '/v2' + '/user/createWithList',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
* This can only be done by the logged in user.
|
|
* @summary Delete user
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param username The name that needs to be deleted
|
|
* @response 400 [undefined] Invalid username supplied
|
|
* @response 404 [undefined] User not found
|
|
*/
|
|
export public async function UserApi__deleteUser(fe : ApiExecuterI, username: string) : Promise<undefined, Object | ApiError<>> {
|
|
checkRequiredParams('deleteUser', { 'username': username });
|
|
|
|
const _pathParams = {
|
|
'username': username };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
await fe.exec(
|
|
'DELETE', '/v2' + '/user/{username}',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Get user by user name
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
|
* @response 200 [User] successful operation
|
|
* @response 400 [undefined] Invalid username supplied
|
|
* @response 404 [undefined] User not found
|
|
*/
|
|
export public async function UserApi__getUserByName(fe : ApiExecuterI, username: string) : Promise<User, Object | ApiError<>> {
|
|
checkRequiredParams('getUserByName', { 'username': username });
|
|
|
|
const _pathParams = {
|
|
'username': username };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
return await fe.<User, >exec(
|
|
'GET', '/v2' + '/user/{username}',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Logs user into the system
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param username The user name for login
|
|
* @param password The password for login in clear text
|
|
* @response 200 [string] successful operation
|
|
* @response 400 [undefined] Invalid username/password supplied
|
|
*/
|
|
export public async function UserApi__loginUser(fe : ApiExecuterI, username: string, password: string) : Promise<string, Object | ApiError<>> {
|
|
checkRequiredParams('loginUser', { 'username': username, 'password': password });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = {
|
|
'username': username,
|
|
'password': password };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
return await fe.<string, >exec(
|
|
'GET', '/v2' + '/user/login',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @summary Logs out current logged in user session
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @response 0 [undefined] successful operation
|
|
*/
|
|
export public async function UserApi__logoutUser(fe : ApiExecuterI, ) : Promise<undefined, Object> {
|
|
checkRequiredParams('logoutUser', { });
|
|
|
|
const _pathParams = { };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = undefined;
|
|
|
|
await fe.exec(
|
|
'GET', '/v2' + '/user/logout',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|
|
|
|
/**
|
|
* This can only be done by the logged in user.
|
|
* @summary Updated user
|
|
* @param fe Callback interface that runs the fetch query
|
|
* @param username name that need to be deleted
|
|
* @param user Updated user object
|
|
* @response 400 [undefined] Invalid user supplied
|
|
* @response 404 [undefined] User not found
|
|
*/
|
|
export public async function UserApi__updateUser(fe : ApiExecuterI, username: string, user: User) : Promise<undefined, Object | ApiError<>> {
|
|
checkRequiredParams('updateUser', { 'username': username, 'user': user });
|
|
|
|
const _pathParams = {
|
|
'username': username };
|
|
const _queryParams = { };
|
|
const _headerParams = { };
|
|
const _body = cleanCopyBody(user, 'id', 'username', 'firstName', 'lastName', 'email', 'password', 'phone', 'userStatus');
|
|
|
|
await fe.exec(
|
|
'PUT', '/v2' + '/user/{username}',
|
|
_pathParams, _queryParams, _headerParams,
|
|
undefined,
|
|
_body
|
|
);
|
|
}
|