(recipes)
- 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
Get all recipes
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();
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();
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. |
Promise<custom_operations.GetRecipesRes>
Error Type | Status Code | Content Type |
---|---|---|
custom_errors.AuthError | 401 | application/json |
custom_errors.SDKError | 4XX, 5XX | */* |
Create a new recipe
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();
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();
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. |
Promise<custom_components.Recipe>
Error Type | Status Code | Content Type |
---|---|---|
custom_errors.SDKError | 4XX, 5XX | */* |
Get a recipe by ID
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();
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();
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. |
Promise<custom_components.Recipe>
Error Type | Status Code | Content Type |
---|---|---|
custom_errors.SDKError | 4XX, 5XX | */* |
Update an existing recipe by ID
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();
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();
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. |
Promise<void>
Error Type | Status Code | Content Type |
---|---|---|
custom_errors.SDKError | 4XX, 5XX | */* |
Delete a recipe by ID
import { SpeakeasyRecipeBook } from "speakeasy-recipe-book";
const speakeasyRecipeBook = new SpeakeasyRecipeBook();
async function run() {
await speakeasyRecipeBook.recipes.delete({
recipeId: "<id>",
});
}
run();
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();
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. |
Promise<void>
Error Type | Status Code | Content Type |
---|---|---|
custom_errors.SDKError | 4XX, 5XX | */* |