关于项目
大道 是一个智能的日程安排解决方案和综合销售点系统,它增加了沙龙、疗养院和其他预约企业的收入并降低了成本.
通过这个软件开发工具包(SDK),您可以使用大道为自己的业务创建自定义的预订体验.
开始
设置
去那边 大道开发者门户 要设置一个沙盒账户和 API 应用程序。 你需要你的商业身份和API密钥来使用这个包.
const businessId = "312bf55a-b6c5-48f2-ab40-eef5d78277ac";
const apiKey = "00000000-0000-0000-0000-000000000000";
安装 SDK
npm --save install @boulevard/blvd-book-sdk
yarn add @boulevard/blvd-book-sdk
客户端
最简单的流程是未经认证的客户端 API,您可以利用它为新客户端创建预约:
import { Blvd } from "@boulevard/blvd-book-sdk";
// Step 1: Create a `business` object to interact with the API.
const client = new Blvd(apiKey, businessId);
// Step 2: Choose a location and start by creating a cart
const business = await client.businesses.get();
const locations = await business.getLocations();
let cart = await client.carts.create(locations[0]);
// Step 3: Select and add items to the card
const item = cart.availableCategories[0].availableItems[0];
cart = await cart.addBookableItem(item);
// Step 4: Find available timeslots
const dates = await cart.getBookableDates();
const times = await cart.getBookableTimes(dates[0]);
// Step 5: Reserve a timeslot, add details, and book!
await cart.reserve(times[0]);
await cart.update({
email: "[email protected]",
firstName: "John",
lastName: "Doe",
phoneNumber: "+13105555555"
});
await cart.addCardPaymentMethod({
card: {
name: "John Doe",
number: "4242424242424242",
cvv: "111",
exp_month: 1,
exp_year: 2028,
address_postal_code: "90210"
}
});
await cart.checkout();
文档
软件包文档可用 这里。 。 。 .
要看到可用的 API 操作浏览与类定义挂钩的方法 . 示例 - 墨盒操作
发展
刷新 Sched 绑定
这将从 Sched 中获取图克勒 schema 并生成打字符绑定和模拟 .
npm run gen
yarn run gen
运行测试
为了能够运行测试,你需要 ts-node 已安装全局
npm -g install ts-node
yarn global add ts-node
然后你可以进行测试.
npm test
yarn test
部署
注意,除非你是大道员工... ...你需要打开公关 并寻求批准... ...
首先你需要加入npmjs.com的大道组织 添加后运行以下命令:
yarn build && yarn publish
yarn run typedoc
然后提交并按 (inc tags) .
捐款
欢迎拉动请求。 见 捐款准则 更多信息.
问题
如果您在尝试运行启动套件时遇到任何问题, 请创建一个问题 .