1.1.3 • Published 5 years ago
hotpot-swagger-client v1.1.3
hotpot-swagger-client
Simple swagger client by typescript
Usage
The manager instance initialization
const swagger = new Swagger({
spec: {...},
});
Swagger can build the client instance by swagger 'tags' defined in spec.
const client = swagger.get('order')
const params = {
body: {
...
},
query: {
...
}
};
const res = await client.exec('getOrder', params)
// or
const res = await client.getOrder(params)
Swagger custom fetch
interface FetchableInterface {
fetch(url, options): Promise<any>;
}
class myHttpClient implements FetchableInterface {
fetch(url, options): Promise<any> {
throw new Error()
}
}
const swagger = new Swagger({
spec: {...},
httpClient: myHttpClient
});
Model mapping
swagger.mappings({
'order': [
{from: 'addressLine', to: 'address'},
{from: 'addressLine', to: 'address', process: (address) => {
return address[0] + address[1]
}},
]
})
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4-wechat
5 years ago
1.0.3-esnext
5 years ago
1.0.4
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.3
5 years ago
1.0.0
5 years ago