Skip to content

Latest commit

 

History

History
331 lines (234 loc) · 23 KB

README.md

File metadata and controls

331 lines (234 loc) · 23 KB

Store

(store)

Overview

Access to Petstore orders

Find out more about our store http://swagger.io

Available Operations

getInventory

Returns a map of status codes to quantities

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<{ [k: string]: number }>

Errors

Error Type Status Code Content Type
errors.ApiErrorUnauthorized 401 application/json
errors.ApiErrorNotFound 404 application/json
errors.SDKError 4XX, 5XX */*

placeOrder

Place a new order in the store

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.Order>

Errors

Error Type Status Code Content Type
errors.ApiErrorUnauthorized 401 application/json
errors.ApiErrorNotFound 404 application/json
errors.SDKError 4XX, 5XX */*

getOrderById

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

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.Order>

Errors

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 */*

deleteOrder

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

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<components.Order>

Errors

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 */*