The Operations API allows you to create and manage operations at restaurants. An operation refers to different services a restaurant may offer. For example, a restaurant may offer a takeaway operation and a catering operation, where each one would work with different time frames, availabilities, and fees.
With the Operations API, you can:
It’s important to note the following points before starting to code:
To use the Operations API, install the @wix/restaurants
package using npm or Yarn:
npm install @wix/restaurants
or
yarn add @wix/restaurants
Then import { operations }
from @wix/restaurants
:
import { operations } from "@wix/restaurants";
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a new operation.
function createOperation(operation: Operation): Promise<Operation>;
Operation to create.
import { operations } from "@wix/restaurants";
async function createOperation(operation) {
const response = await operations.createOperation(operation);
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Deletes an operation.
function deleteOperation(operationId: string): Promise<void>;
ID of the operation to delete.
import { operations } from "@wix/restaurants";
async function deleteOperation(operationId) {
const response = await operations.deleteOperation(operationId);
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.