Skip to content

Commit 32b1eaf

Browse files
committed
updated readme
1 parent 2842ed4 commit 32b1eaf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,24 @@ If you don't want to set up the project locally then you can just view the swagg
4343
## What does it look like?
4444
Here's how you use the generated library. These examples use [swagger's petstore example spec](http://petstore.swagger.io):
4545

46+
Basic usage:
47+
48+
```typescript
49+
import { PetApi, Pet } from '../example/api.ts'
50+
51+
async function example() {
52+
const api = new PetApi(config);s
53+
const pet: Pet = await api.getPetById({ petId: 10 });
54+
await api.uploadFile({ petId: 10, file: new File() }); // this is a multipart/form-data request
55+
await api.deletePet({ petId: 10 }); // this is a no-content response
56+
}
57+
58+
example();
4659
```
60+
61+
The same example using middleware:
62+
63+
```typescript
4764
import { PetApi, Pet, Configuration, Middleware, FetchAPI } from '../example/api.ts'
4865

4966
class LoggingMiddleware implements Middleware {

0 commit comments

Comments
 (0)