openapistack / openapi-client-axios

JavaScript client library for consuming OpenAPI-enabled APIs with axios
https://openapistack.co
MIT License
558 stars 67 forks source link

Implement paths dictionary for operations #22

Closed anttiviljami closed 4 years ago

anttiviljami commented 4 years ago

This PR implements a new way to call operations, without using the operationId.

A new paths dictionary is added to the OpenAPIClient instance, where each entry contains the operation functions for each method.

Examples:

client.paths['/pets'].get(); // GET /pets
client.paths['/pets'].post(); // POST /pets
client.paths['/pets/{petId}'].put(1); // PUT /pets/1
client.paths['/pets/{petId}/owner/{ownerId}'].get({ petId: 1, ownerId: 2 }) ; // GET /pets/1/owner/2