(store)
Access to Petstore orders
Find out more about our store http://swagger.io
- getInventory - Returns pet inventories by status
- placeOrder - Place an order for a pet
- getOrderById - Find purchase order by ID
- deleteOrder - Delete purchase order by ID
Returns a map of status codes to quantities
import { Petstore } from "ryan-simple-test-act";
const petstore = new Petstore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await petstore.store.getInventory();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PetstoreCore } from "ryan-simple-test-act/core.js";
import { storeGetInventory } from "ryan-simple-test-act/funcs/storeGetInventory.js";
// Use `PetstoreCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const petstore = new PetstoreCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await storeGetInventory(petstore);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<{ [k: string]: number }>
Error Type | Status Code | Content Type |
---|---|---|
errors.ApiErrorUnauthorized | 401 | application/json |
errors.ApiErrorNotFound | 404 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Place a new order in the store
import { Petstore } from "ryan-simple-test-act";
const petstore = new Petstore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await petstore.store.placeOrder({
id: 10,
petId: 198772,
quantity: 7,
status: "approved",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PetstoreCore } from "ryan-simple-test-act/core.js";
import { storePlaceOrder } from "ryan-simple-test-act/funcs/storePlaceOrder.js";
// Use `PetstoreCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const petstore = new PetstoreCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await storePlaceOrder(petstore, {
id: 10,
petId: 198772,
quantity: 7,
status: "approved",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.Order | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.Order>
Error Type | Status Code | Content Type |
---|---|---|
errors.ApiErrorUnauthorized | 401 | application/json |
errors.ApiErrorNotFound | 404 | application/json |
errors.SDKError | 4XX, 5XX | */* |
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
import { Petstore } from "ryan-simple-test-act";
const petstore = new Petstore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await petstore.store.getOrderById({
orderId: 614993,
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PetstoreCore } from "ryan-simple-test-act/core.js";
import { storeGetOrderById } from "ryan-simple-test-act/funcs/storeGetOrderById.js";
// Use `PetstoreCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const petstore = new PetstoreCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await storeGetOrderById(petstore, {
orderId: 614993,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetOrderByIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.Order>
Error Type | Status Code | Content Type |
---|---|---|
errors.ApiErrorInvalidInput | 400 | application/json |
errors.ApiErrorUnauthorized | 401 | application/json |
errors.ApiErrorNotFound | 404 | application/json |
errors.SDKError | 4XX, 5XX | */* |
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
import { Petstore } from "ryan-simple-test-act";
const petstore = new Petstore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await petstore.store.deleteOrder({
orderId: 127902,
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PetstoreCore } from "ryan-simple-test-act/core.js";
import { storeDeleteOrder } from "ryan-simple-test-act/funcs/storeDeleteOrder.js";
// Use `PetstoreCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const petstore = new PetstoreCore({
apiKey: "<YOUR_API_KEY_HERE>",
});
async function run() {
const res = await storeDeleteOrder(petstore, {
orderId: 127902,
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteOrderRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.Order>
Error Type | Status Code | Content Type |
---|---|---|
errors.ApiErrorInvalidInput | 400 | application/json |
errors.ApiErrorUnauthorized | 401 | application/json |
errors.ApiErrorNotFound | 404 | application/json |
errors.SDKError | 4XX, 5XX | */* |