Skip to content

Commit 216d5b0

Browse files
committed
Generate sample code
1 parent b2fe2ce commit 216d5b0

File tree

24 files changed

+5796
-0
lines changed

24 files changed

+5796
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
# Category
4+
5+
A category for a pet
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**id** | **Long** | | [optional] |
12+
|**name** | **String** | | [optional] |
13+
14+
15+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
# ModelApiResponse
4+
5+
Describes the result of uploading an image resource
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**code** | **Integer** | | [optional] |
12+
|**type** | **String** | | [optional] |
13+
|**message** | **String** | | [optional] |
14+
15+
16+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
# Order
4+
5+
An order for a pets from the pet store
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**id** | **Long** | | [optional] |
12+
|**petId** | **Long** | | [optional] |
13+
|**quantity** | **Integer** | | [optional] |
14+
|**shipDate** | **OffsetDateTime** | | [optional] |
15+
|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] |
16+
|**complete** | **Boolean** | | [optional] |
17+
18+
19+
20+
## Enum: StatusEnum
21+
22+
| Name | Value |
23+
|---- | -----|
24+
| PLACED | "placed" |
25+
| APPROVED | "approved" |
26+
| DELIVERED | "delivered" |
27+
28+
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
# Pet
4+
5+
A pet for sale in the pet store
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**id** | **Long** | | [optional] |
12+
|**category** | [**Category**](Category.md) | | [optional] |
13+
|**name** | **String** | | |
14+
|**photoUrls** | **List<String>** | | |
15+
|**tags** | [**List<Tag>**](Tag.md) | | [optional] |
16+
|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] |
17+
18+
19+
20+
## Enum: StatusEnum
21+
22+
| Name | Value |
23+
|---- | -----|
24+
| AVAILABLE | "available" |
25+
| PENDING | "pending" |
26+
| SOLD | "sold" |
27+
28+
29+
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
# StoreApi
2+
3+
All URIs are relative to *http://petstore.swagger.io/v2*
4+
5+
| Method | HTTP request | Description |
6+
|------------- | ------------- | -------------|
7+
| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID |
8+
| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status |
9+
| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID |
10+
| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet |
11+
12+
13+
<a id="deleteOrder"></a>
14+
# **deleteOrder**
15+
> deleteOrder(orderId)
16+
17+
Delete purchase order by ID
18+
19+
For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
20+
21+
### Example
22+
```java
23+
// Import classes:
24+
import org.openapitools.client.ApiClient;
25+
import org.openapitools.client.ApiException;
26+
import org.openapitools.client.Configuration;
27+
import org.openapitools.client.models.*;
28+
import org.openapitools.client.api.StoreApi;
29+
30+
public class Example {
31+
public static void main(String[] args) {
32+
ApiClient defaultClient = Configuration.getDefaultApiClient();
33+
defaultClient.setBasePath("http://petstore.swagger.io/v2");
34+
35+
StoreApi apiInstance = new StoreApi(defaultClient);
36+
String orderId = "orderId_example"; // String | ID of the order that needs to be deleted
37+
try {
38+
apiInstance.deleteOrder(orderId);
39+
} catch (ApiException e) {
40+
System.err.println("Exception when calling StoreApi#deleteOrder");
41+
System.err.println("Status code: " + e.getCode());
42+
System.err.println("Reason: " + e.getResponseBody());
43+
System.err.println("Response headers: " + e.getResponseHeaders());
44+
e.printStackTrace();
45+
}
46+
}
47+
}
48+
```
49+
50+
### Parameters
51+
52+
| Name | Type | Description | Notes |
53+
|------------- | ------------- | ------------- | -------------|
54+
| **orderId** | **String**| ID of the order that needs to be deleted | |
55+
56+
### Return type
57+
58+
null (empty response body)
59+
60+
### Authorization
61+
62+
No authorization required
63+
64+
### HTTP request headers
65+
66+
- **Content-Type**: Not defined
67+
- **Accept**: Not defined
68+
69+
### HTTP response details
70+
| Status code | Description | Response headers |
71+
|-------------|-------------|------------------|
72+
| **400** | Invalid ID supplied | - |
73+
| **404** | Order not found | - |
74+
75+
<a id="getInventory"></a>
76+
# **getInventory**
77+
> Map&lt;String, Integer&gt; getInventory()
78+
79+
Returns pet inventories by status
80+
81+
Returns a map of status codes to quantities
82+
83+
### Example
84+
```java
85+
// Import classes:
86+
import org.openapitools.client.ApiClient;
87+
import org.openapitools.client.ApiException;
88+
import org.openapitools.client.Configuration;
89+
import org.openapitools.client.auth.*;
90+
import org.openapitools.client.models.*;
91+
import org.openapitools.client.api.StoreApi;
92+
93+
public class Example {
94+
public static void main(String[] args) {
95+
ApiClient defaultClient = Configuration.getDefaultApiClient();
96+
defaultClient.setBasePath("http://petstore.swagger.io/v2");
97+
98+
// Configure API key authorization: api_key
99+
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
100+
api_key.setApiKey("YOUR API KEY");
101+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
102+
//api_key.setApiKeyPrefix("Token");
103+
104+
StoreApi apiInstance = new StoreApi(defaultClient);
105+
try {
106+
Map<String, Integer> result = apiInstance.getInventory();
107+
System.out.println(result);
108+
} catch (ApiException e) {
109+
System.err.println("Exception when calling StoreApi#getInventory");
110+
System.err.println("Status code: " + e.getCode());
111+
System.err.println("Reason: " + e.getResponseBody());
112+
System.err.println("Response headers: " + e.getResponseHeaders());
113+
e.printStackTrace();
114+
}
115+
}
116+
}
117+
```
118+
119+
### Parameters
120+
This endpoint does not need any parameter.
121+
122+
### Return type
123+
124+
**Map&lt;String, Integer&gt;**
125+
126+
### Authorization
127+
128+
[api_key](../README.md#api_key)
129+
130+
### HTTP request headers
131+
132+
- **Content-Type**: Not defined
133+
- **Accept**: application/json
134+
135+
### HTTP response details
136+
| Status code | Description | Response headers |
137+
|-------------|-------------|------------------|
138+
| **200** | successful operation | - |
139+
140+
<a id="getOrderById"></a>
141+
# **getOrderById**
142+
> Order getOrderById(orderId)
143+
144+
Find purchase order by ID
145+
146+
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
147+
148+
### Example
149+
```java
150+
// Import classes:
151+
import org.openapitools.client.ApiClient;
152+
import org.openapitools.client.ApiException;
153+
import org.openapitools.client.Configuration;
154+
import org.openapitools.client.models.*;
155+
import org.openapitools.client.api.StoreApi;
156+
157+
public class Example {
158+
public static void main(String[] args) {
159+
ApiClient defaultClient = Configuration.getDefaultApiClient();
160+
defaultClient.setBasePath("http://petstore.swagger.io/v2");
161+
162+
StoreApi apiInstance = new StoreApi(defaultClient);
163+
Long orderId = 56L; // Long | ID of pet that needs to be fetched
164+
try {
165+
Order result = apiInstance.getOrderById(orderId);
166+
System.out.println(result);
167+
} catch (ApiException e) {
168+
System.err.println("Exception when calling StoreApi#getOrderById");
169+
System.err.println("Status code: " + e.getCode());
170+
System.err.println("Reason: " + e.getResponseBody());
171+
System.err.println("Response headers: " + e.getResponseHeaders());
172+
e.printStackTrace();
173+
}
174+
}
175+
}
176+
```
177+
178+
### Parameters
179+
180+
| Name | Type | Description | Notes |
181+
|------------- | ------------- | ------------- | -------------|
182+
| **orderId** | **Long**| ID of pet that needs to be fetched | |
183+
184+
### Return type
185+
186+
[**Order**](Order.md)
187+
188+
### Authorization
189+
190+
No authorization required
191+
192+
### HTTP request headers
193+
194+
- **Content-Type**: Not defined
195+
- **Accept**: application/xml, application/json
196+
197+
### HTTP response details
198+
| Status code | Description | Response headers |
199+
|-------------|-------------|------------------|
200+
| **200** | successful operation | - |
201+
| **400** | Invalid ID supplied | - |
202+
| **404** | Order not found | - |
203+
204+
<a id="placeOrder"></a>
205+
# **placeOrder**
206+
> Order placeOrder(order)
207+
208+
Place an order for a pet
209+
210+
211+
212+
### Example
213+
```java
214+
// Import classes:
215+
import org.openapitools.client.ApiClient;
216+
import org.openapitools.client.ApiException;
217+
import org.openapitools.client.Configuration;
218+
import org.openapitools.client.models.*;
219+
import org.openapitools.client.api.StoreApi;
220+
221+
public class Example {
222+
public static void main(String[] args) {
223+
ApiClient defaultClient = Configuration.getDefaultApiClient();
224+
defaultClient.setBasePath("http://petstore.swagger.io/v2");
225+
226+
StoreApi apiInstance = new StoreApi(defaultClient);
227+
Order order = new Order(); // Order | order placed for purchasing the pet
228+
try {
229+
Order result = apiInstance.placeOrder(order);
230+
System.out.println(result);
231+
} catch (ApiException e) {
232+
System.err.println("Exception when calling StoreApi#placeOrder");
233+
System.err.println("Status code: " + e.getCode());
234+
System.err.println("Reason: " + e.getResponseBody());
235+
System.err.println("Response headers: " + e.getResponseHeaders());
236+
e.printStackTrace();
237+
}
238+
}
239+
}
240+
```
241+
242+
### Parameters
243+
244+
| Name | Type | Description | Notes |
245+
|------------- | ------------- | ------------- | -------------|
246+
| **order** | [**Order**](Order.md)| order placed for purchasing the pet | |
247+
248+
### Return type
249+
250+
[**Order**](Order.md)
251+
252+
### Authorization
253+
254+
No authorization required
255+
256+
### HTTP request headers
257+
258+
- **Content-Type**: application/json
259+
- **Accept**: application/xml, application/json
260+
261+
### HTTP response details
262+
| Status code | Description | Response headers |
263+
|-------------|-------------|------------------|
264+
| **200** | successful operation | - |
265+
| **400** | Invalid Order | - |
266+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
# Tag
4+
5+
A tag for a pet
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**id** | **Long** | | [optional] |
12+
|**name** | **String** | | [optional] |
13+
14+
15+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
# User
4+
5+
A User who is purchasing from the pet store
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**id** | **Long** | | [optional] |
12+
|**username** | **String** | | [optional] |
13+
|**firstName** | **String** | | [optional] |
14+
|**lastName** | **String** | | [optional] |
15+
|**email** | **String** | | [optional] |
16+
|**password** | **String** | | [optional] |
17+
|**phone** | **String** | | [optional] |
18+
|**userStatus** | **Integer** | User Status | [optional] |
19+
20+
21+

0 commit comments

Comments
 (0)