openapi-generator/samples/client/petstore/javascript-es6/docs/StoreApi.md
Stian Liknes 24104dac35 Add option modelPropertyNaming to javascript generator (#299)
* Add option modelPropertyNaming to javascript generator

Fixes 6530

* Update Petstore sample
2018-06-14 19:19:23 +08:00

4.4 KiB

OpenApiPetstore.StoreApi

All URIs are relative to http://petstore.swagger.io:80/v2

Method HTTP request Description
deleteOrder DELETE /store/order/{order_id} Delete purchase order by ID
getInventory GET /store/inventory Returns pet inventories by status
getOrderById GET /store/order/{order_id} Find purchase order by ID
placeOrder POST /store/order Place an order for a pet

deleteOrder

deleteOrder(orderId)

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.StoreApi();
let orderId = "orderId_example"; // String | ID of the order that needs to be deleted
apiInstance.deleteOrder(orderId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
orderId String ID of the order that needs to be deleted

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getInventory

{String: Number} getInventory()

Returns pet inventories by status

Returns a map of status codes to quantities

Example

import OpenApiPetstore from 'open_api_petstore';
let defaultClient = OpenApiPetstore.ApiClient.instance;

// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';

let apiInstance = new OpenApiPetstore.StoreApi();
apiInstance.getInventory((error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

This endpoint does not need any parameter.

Return type

{String: Number}

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getOrderById

Order getOrderById(orderId)

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.StoreApi();
let orderId = 789; // Number | ID of pet that needs to be fetched
apiInstance.getOrderById(orderId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
orderId Number ID of pet that needs to be fetched

Return type

Order

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

placeOrder

Order placeOrder(order)

Place an order for a pet

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.StoreApi();
let order = new OpenApiPetstore.Order(); // Order | order placed for purchasing the pet
apiInstance.placeOrder(order, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
order Order order placed for purchasing the pet

Return type

Order

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json