@doordash/sdk

中文文档
0.6.13发布于 2024/10/08MITTypeScriptESM + CJS近 30 天下载 1.2万

The DoorDash Node.js SDK with the ability to request a delivery through the Drive API

原始使用文档
文档目录5 节
  1. Prerequisite
  2. Install
  3. How to use
  4. How can I get onboarded to DoorDash Drive?
  5. Does the SDK support DoorDash Drive Classic API?

DoorDash Node.js SDK

This is a Node.js SDK for the DoorDash API which includes the ability to request deliveries through the Drive API.

Prerequisite

node >= 12

Install

$ npm install --save @doordash/sdk

How to use

If you are using CommonJS modules:

const DoorDashClient = require("@doordash/sdk");
const { v4: uuidv4 } = require("uuid");

const client = new DoorDashClient.DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

const response = client
  .createDelivery({
    external_delivery_id: uuidv4(),
    pickup_address: "1000 4th Ave, Seattle, WA, 98104",
    pickup_phone_number: "+1(650)5555555",
    dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
    dropoff_phone_number: "+1(650)5555555",
  })
  .then(() => {
    // do something
  })
  .catch((err) => {
    // handle error
  });

If you are using ES6 modules:

import { DoorDashClient } from "@doordash/sdk";
import { v4 as uuidv4 } from "uuid";

const client = new DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

const response = await client.createDelivery({
  external_delivery_id: uuidv4(),
  pickup_address: "1000 4th Ave, Seattle, WA, 98104",
  pickup_phone_number: "+1(650)5555555",
  dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
  dropoff_phone_number: "+1(650)5555555",
});

If you are using TypeScript:

import {
  DeliveryResponse,
  DoorDashAuthorizationError,
  DoorDashClient,
  DoorDashResponse,
} from "@doordash/sdk";

import { v4 as uuidv4 } from "uuid";

const client = new DoorDashClient({
  developer_id: "{your developer_id}",
  key_id: "{your key_id}",
  signing_secret: "{your signing_secret}",
});

client
  .createDelivery({
    external_delivery_id: uuidv4(),
    pickup_address: "1000 4th Ave, Seattle, WA, 98104",
    pickup_phone_number: "+1(650)5555555",
    dropoff_address: "1201 3rd Ave, Seattle, WA, 98101",
    dropoff_phone_number: "+1(650)5555555",
  })
  .then((response: DoorDashResponse<DeliveryResponse>) => {
    // do something
  })
  .catch((err: any) => {
    // handle error
  });

How can I get onboarded to DoorDash Drive?

Please visit DoorDash Developer portal for more details.

Does the SDK support DoorDash Drive Classic API?

No. SDK will only support the latest version of Drive API not support Drive Classic API.

版本与发布记录

@doordash/sdk 共发布 12 个版本,首次发布于 2022/01/28;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.6.13latest2024/10/082 年前
0.6.122023/05/253 年前
0.6.102023/04/223 年前
0.6.02023/03/093 年前
0.4.62022/07/264 年前
0.4.32022/06/014 年前

关于 @doordash/sdk 的常见问题

@doordash/sdk 是什么?

The DoorDash Node.js SDK with the ability to request a delivery through the Drive API

如何安装 @doordash/sdk?

在项目目录运行 npm install @doordash/sdk,或使用 pnpm add / yarn add / bun add。

@doordash/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@doordash/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@doordash/sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@doordash/sdk 可以商用吗?

@doordash/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@doordash/sdk 的下载量有多少?

根据 npm 官方下载统计,@doordash/sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 12,449 次,日均约 415 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@doordash/sdk 还在维护吗?

最新版本 0.6.13 发布于 2024/10/08(2 年前);至今共发布 12 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/01/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。