1 Star 1 Fork 1

UI自动化学习小组 / SwaggerCodeGenDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
StoreApi.md 4.74 KB
一键复制 编辑 原始数据 按行查看 历史
douliyou 提交于 2021-06-29 14:56 . 首次提交代码与配置

StoreApi

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

Method HTTP request Description
deleteOrder DELETE /store/order/{orderId} Delete purchase order by ID
getInventory GET /store/inventory Returns pet inventories by status
getOrderById GET /store/order/{orderId} 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 positive integer value. Negative or non-integer values will generate API errors

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;


StoreApi apiInstance = new StoreApi();
Long orderId = 789L; // Long | ID of the order that needs to be deleted
try {
    apiInstance.deleteOrder(orderId);
} catch (ApiException e) {
    System.err.println("Exception when calling StoreApi#deleteOrder");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
orderId Long 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: application/json, application/xml

getInventory

Map<String, Integer> getInventory()

Returns pet inventories by status

Returns a map of status codes to quantities

Example

// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.StoreApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");

StoreApi apiInstance = new StoreApi();
try {
    Map<String, Integer> result = apiInstance.getInventory();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling StoreApi#getInventory");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

Map<String, Integer>

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 >= 1 and <= 10. Other values will generated exceptions

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;


StoreApi apiInstance = new StoreApi();
Long orderId = 789L; // Long | ID of pet that needs to be fetched
try {
    Order result = apiInstance.getOrderById(orderId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling StoreApi#getOrderById");
    e.printStackTrace();
}

Parameters

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

Return type

Order

Authorization

No authorization required

HTTP request headers

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

placeOrder

Order placeOrder(body)

Place an order for a pet

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.StoreApi;


StoreApi apiInstance = new StoreApi();
Order body = new Order(); // Order | order placed for purchasing the pet
try {
    Order result = apiInstance.placeOrder(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling StoreApi#placeOrder");
    e.printStackTrace();
}

Parameters

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

Return type

Order

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/xml
1
https://gitee.com/ui_automation_learning_group/swagger-code-gen-demo.git
git@gitee.com:ui_automation_learning_group/swagger-code-gen-demo.git
ui_automation_learning_group
swagger-code-gen-demo
SwaggerCodeGenDemo
master

搜索帮助