forked from loafle/openapi-generator-original
better code format, update samples (#9438)
This commit is contained in:
parent
1751aa7272
commit
4bb5c8ae0f
@ -36,7 +36,6 @@ export type FetchArgs = {
|
||||
options: {};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -79,12 +78,12 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur
|
||||
{{/summary}}
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: RequestOptions): FetchArgs {
|
||||
{{operationId}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: RequestOptions): FetchArgs {
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
// verify required parameter '{{paramName}}' is not null or undefined
|
||||
if ({{paramName}} === null || {{paramName}} === undefined) {
|
||||
throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
|
||||
throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{operationId}}.');
|
||||
}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
@ -227,7 +226,7 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur
|
||||
};
|
||||
|
||||
export type {{classname}}Type = { {{#operation}}
|
||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: RequestOptions): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>,
|
||||
{{operationId}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: RequestOptions): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>,
|
||||
{{/operation}}
|
||||
}
|
||||
|
||||
@ -247,8 +246,8 @@ export const {{classname}} = function(configuration?: Configuration, fetch: Fetc
|
||||
{{/summary}}
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: RequestOptions = {}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
|
||||
const localVarFetchArgs = {{classname}}FetchParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
||||
{{operationId}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: RequestOptions = {}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
|
||||
const localVarFetchArgs = {{classname}}FetchParamCreator(configuration).{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
||||
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
return response{{#returnType}}.json(){{/returnType}};
|
||||
@ -260,6 +259,7 @@ export const {{classname}} = function(configuration?: Configuration, fetch: Fetc
|
||||
{{/operation}}
|
||||
}
|
||||
};
|
||||
|
||||
{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
export type ApiTypes = { {{#apiInfo}}{{#apis}}{{#operations}}
|
||||
{{classname}}: {{classname}}Type,
|
||||
|
@ -1 +1 @@
|
||||
5.0.0-SNAPSHOT
|
||||
5.2.0-SNAPSHOT
|
@ -46,7 +46,6 @@ export type FetchArgs = {
|
||||
options: {};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -765,6 +764,7 @@ export const PetApi = function(configuration?: Configuration, fetch: FetchAPI =
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* StoreApi - fetch parameter creator
|
||||
* @export
|
||||
@ -968,6 +968,7 @@ export const StoreApi = function(configuration?: Configuration, fetch: FetchAPI
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* UserApi - fetch parameter creator
|
||||
* @export
|
||||
@ -1364,6 +1365,7 @@ export const UserApi = function(configuration?: Configuration, fetch: FetchAPI =
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export type ApiTypes = {
|
||||
PetApi: PetApiType,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user