@ -1,6 +1,6 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi' ;
import { request } from '@ umijs/max ' ;
/** Update an existing pet PUT /pet */
export async function updatePet ( body : API.Pet , options ? : { [ key : string ] : any } ) {
@ -26,89 +26,44 @@ export async function addPet(body: API.Pet, options?: { [key: string]: any }) {
} ) ;
}
/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
export async function findPetsByStatus (
params : {
// query
/** Status values that need to be considered for filter */
status : 'available' | 'pending' | 'sold' [ ] ;
} ,
options ? : { [ key : string ] : any } ,
) {
return request < API.Pet [ ] > ( '/pet/findByStatus' , {
method : 'GET' ,
params : {
. . . params ,
} ,
. . . ( options || { } ) ,
} ) ;
}
/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
export async function findPetsByTags (
params : {
// query
/** Tags to filter by */
tags : string [ ] ;
} ,
options ? : { [ key : string ] : any } ,
) {
return request < API.Pet [ ] > ( '/pet/findByTags' , {
method : 'GET' ,
params : {
. . . params ,
} ,
. . . ( options || { } ) ,
} ) ;
}
/** Find pet by ID Returns a single pet GET /pet/${param0} */
export async function getPetById (
params : {
// path
/** ID of pet to return */
petId : number ;
} ,
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.getPetByIdParams ,
options ? : { [ key : string ] : any } ,
) {
const { petId : param0 } = params ;
const { petId : param0 , . . . queryParams } = params ;
return request < API.Pet > ( ` /pet/ ${ param0 } ` , {
method : 'GET' ,
params : { . . . params } ,
params : { . . . queryParams } ,
. . . ( options || { } ) ,
} ) ;
}
/** Updates a pet in the store with form data POST /pet/${param0} */
export async function updatePetWithForm (
params : {
// path
/** ID of pet that needs to be updated */
petId : number ;
} ,
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.updatePetWithFormParams ,
body : { name? : string ; status? : string } ,
options ? : { [ key : string ] : any } ,
) {
const { petId : param0 } = params ;
const { petId : param0 , . . . queryParams } = params ;
const formData = new FormData ( ) ;
Object . keys ( body ) . forEach ( ( ele ) = > {
const item = ( body as any ) [ ele ] ;
if ( item !== undefined && item !== null ) {
formData . append ( ele , typeof item === 'object' ? JSON . stringify ( item ) : item ) ;
formData . append (
ele ,
typeof item === 'object' && ! ( item instanceof File ) ? JSON . stringify ( item ) : item ,
) ;
}
} ) ;
return request < any > ( ` /pet/ ${ param0 } ` , {
method : 'POST' ,
headers : {
'Content-Type' : 'application/x-www-form-urlencoded' ,
} ,
params : { . . . params } ,
params : { . . . queryParams } ,
data : formData ,
. . . ( options || { } ) ,
} ) ;
@ -116,51 +71,83 @@ export async function updatePetWithForm(
/** Deletes a pet DELETE /pet/${param0} */
export async function deletePet (
params : {
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.deletePetParams & {
// header
api_key? : string ;
// path
/** Pet id to delete */
petId : number ;
} ,
options ? : { [ key : string ] : any } ,
) {
const { petId : param0 } = params ;
const { petId : param0 , . . . queryParams } = params ;
return request < any > ( ` /pet/ ${ param0 } ` , {
method : 'DELETE' ,
params : { . . . params } ,
headers : { } ,
params : { . . . queryParams } ,
. . . ( options || { } ) ,
} ) ;
}
/** uploads an image POST /pet/${param0}/uploadImage */
export async function uploadFile (
params : {
// path
/** ID of pet to update */
petId : number ;
} ,
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.uploadFileParams ,
body : { additionalMetadata? : string ; file? : string } ,
file? : File ,
options ? : { [ key : string ] : any } ,
) {
const { petId : param0 } = params ;
const { petId : param0 , . . . queryParams } = params ;
const formData = new FormData ( ) ;
if ( file ) {
formData . append ( 'file' , file ) ;
}
Object . keys ( body ) . forEach ( ( ele ) = > {
const item = ( body as any ) [ ele ] ;
if ( item !== undefined && item !== null ) {
formData . append ( ele , typeof item === 'object' ? JSON . stringify ( item ) : item ) ;
formData . append (
ele ,
typeof item === 'object' && ! ( item instanceof File ) ? JSON . stringify ( item ) : item ,
) ;
}
} ) ;
return request < API.ApiResponse > ( ` /pet/ ${ param0 } /uploadImage ` , {
method : 'POST' ,
headers : {
'Content-Type' : 'multipart/form-data' ,
} ,
params : { . . . params } ,
params : { . . . queryParams } ,
data : formData ,
requestType : 'form' ,
. . . ( options || { } ) ,
} ) ;
}
/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
export async function findPetsByStatus (
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.findPetsByStatusParams ,
options ? : { [ key : string ] : any } ,
) {
return request < API.Pet [ ] > ( '/pet/findByStatus' , {
method : 'GET' ,
params : {
. . . params ,
} ,
. . . ( options || { } ) ,
} ) ;
}
/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
export async function findPetsByTags (
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params : API.findPetsByTagsParams ,
options ? : { [ key : string ] : any } ,
) {
return request < API.Pet [ ] > ( '/pet/findByTags' , {
method : 'GET' ,
params : {
. . . params ,
} ,
. . . ( options || { } ) ,
} ) ;
}