Skip to content

Latest commit

 

History

History
391 lines (269 loc) · 28.1 KB

README.md

File metadata and controls

391 lines (269 loc) · 28.1 KB

Recipes

(recipes)

Overview

Available Operations

  • getAll - Get all recipes
  • create - Create a new recipe
  • getById - Get a recipe by ID
  • update - Update an existing recipe by ID
  • delete - Delete a recipe by ID

getAll

Get all recipes

Example Usage

import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";

const speakeasyRecipeBook = new SpeakeasyRecipeBook();

async function run() {
  const result = await speakeasyRecipeBook.recipes.getAll({
    page: 461008,
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyRecipeBookCore } from "speakeasy-recipe-book/core.js";
import { recipesGetAll } from "speakeasy-recipe-book/funcs/recipesGetAll.js";

// Use `SpeakeasyRecipeBookCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyRecipeBook = new SpeakeasyRecipeBookCore();

async function run() {
  const res = await recipesGetAll(speakeasyRecipeBook, {
    page: 461008,
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request custom_operations.GetRecipesRequest ✔️ 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<custom_operations.GetRecipesRes>

Errors

Error Type Status Code Content Type
custom_errors.AuthError 401 application/json
custom_errors.SDKError 4XX, 5XX */*

create

Create a new recipe

Example Usage

import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";

const speakeasyRecipeBook = new SpeakeasyRecipeBook();

async function run() {
  const result = await speakeasyRecipeBook.recipes.create({
    name: "<value>",
    ingredients: [
      "<value>",
    ],
    instructions: "<value>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyRecipeBookCore } from "speakeasy-recipe-book/core.js";
import { recipesCreate } from "speakeasy-recipe-book/funcs/recipesCreate.js";

// Use `SpeakeasyRecipeBookCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyRecipeBook = new SpeakeasyRecipeBookCore();

async function run() {
  const res = await recipesCreate(speakeasyRecipeBook, {
    name: "<value>",
    ingredients: [
      "<value>",
    ],
    instructions: "<value>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request custom_components.RecipeInput ✔️ 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<custom_components.Recipe>

Errors

Error Type Status Code Content Type
custom_errors.SDKError 4XX, 5XX */*

getById

Get a recipe by ID

Example Usage

import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";

const speakeasyRecipeBook = new SpeakeasyRecipeBook();

async function run() {
  const result = await speakeasyRecipeBook.recipes.getById({
    recipeId: "<id>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyRecipeBookCore } from "speakeasy-recipe-book/core.js";
import { recipesGetById } from "speakeasy-recipe-book/funcs/recipesGetById.js";

// Use `SpeakeasyRecipeBookCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyRecipeBook = new SpeakeasyRecipeBookCore();

async function run() {
  const res = await recipesGetById(speakeasyRecipeBook, {
    recipeId: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request custom_operations.GetRecipeByIdRequest ✔️ 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<custom_components.Recipe>

Errors

Error Type Status Code Content Type
custom_errors.SDKError 4XX, 5XX */*

update

Update an existing recipe by ID

Example Usage

import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";

const speakeasyRecipeBook = new SpeakeasyRecipeBook();

async function run() {
  await speakeasyRecipeBook.recipes.update({
    recipeId: "<id>",
    recipeInput: {
      name: "<value>",
      ingredients: [
        "<value>",
      ],
      instructions: "<value>",
    },
  });


}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyRecipeBookCore } from "speakeasy-recipe-book/core.js";
import { recipesUpdate } from "speakeasy-recipe-book/funcs/recipesUpdate.js";

// Use `SpeakeasyRecipeBookCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyRecipeBook = new SpeakeasyRecipeBookCore();

async function run() {
  const res = await recipesUpdate(speakeasyRecipeBook, {
    recipeId: "<id>",
    recipeInput: {
      name: "<value>",
      ingredients: [
        "<value>",
      ],
      instructions: "<value>",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
request custom_operations.UpdateRecipeRequest ✔️ 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<void>

Errors

Error Type Status Code Content Type
custom_errors.SDKError 4XX, 5XX */*

delete

Delete a recipe by ID

Example Usage

import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";

const speakeasyRecipeBook = new SpeakeasyRecipeBook();

async function run() {
  await speakeasyRecipeBook.recipes.delete({
    recipeId: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyRecipeBookCore } from "speakeasy-recipe-book/core.js";
import { recipesDelete } from "speakeasy-recipe-book/funcs/recipesDelete.js";

// Use `SpeakeasyRecipeBookCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyRecipeBook = new SpeakeasyRecipeBookCore();

async function run() {
  const res = await recipesDelete(speakeasyRecipeBook, {
    recipeId: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

Parameters

Parameter Type Required Description
request custom_operations.DeleteRecipeRequest ✔️ 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<void>

Errors

Error Type Status Code Content Type
custom_errors.SDKError 4XX, 5XX */*