1.0.52 • Published 2 months ago

@christopher.kendrick/curri v1.0.52

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

CurriClientService Documentation

The CurriClientService class enables interaction with the Curri API, facilitating operations such as fetching delivery quotes, booking deliveries, managing deliveries with multiple stops, retrieving delivery information, estimating delivery times, and canceling deliveries. This README details how to install, configure, and utilize this service in your projects.

Installation

Ensure Node.js is installed on your system. Include this library in your project using npm or yarn if lib on public registry:

Using npm

npm install @christopher.kendrick/curri --save

Using yarn

yarn add @christopher.kendrick/curri

Configuration

Obtain your user ID and API key from your Curri API account. Initialize the CurriClientService with these credentials:

const { CurriClientService } = require('@christopher.kendrick/curri');
const curri = new CurriClientService({ userID: "********", apiKey: "********" });

Methods

CurriClientService provides methods for:

  • Booking deliveries
  • Booking deliveries with multiple stops
  • Fetching delivery quotes
  • Fetching quotes for deliveries with multiple stops
  • Retrieving delivery information
  • Estimating delivery times
  • Canceling deliveries
  • Updating a delivery
  • Listing deliveries
  • Get current API User

Examples

Booking a Delivery

async function bookDelivery() {
  const booking = await curri.book(req.body);
  console.log(booking);
}

Booking a Delivery with Multiple Stops

async function bookMultiDelivery() {
  const bookingMulti = await curri.bookMulti(req.body);
  console.log(bookingMulti);
}

Fetching a Quote for a Delivery with Multiple Stops

async function fetchMultistopQuote() {
  const quoteMulti = await curri.quoteMultistop(req.query);
  console.log(quoteMulti);
}

Retrieving Delivery Information

async function retrieveDelivery() {
  const delivery = await curri.getDelivery(req.query.delivery_id);
  console.log(delivery);
}

Estimating Delivery Times

async function estimateDelivery() {
  const originLocation = {/* Define origin location */};
  const selectedDeliveryMethod = "MethodHere"; // Define delivery method
  const derivedDeliveryEstimate = await curri.deliveryDerivedEstimate(originLocation, selectedDeliveryMethod);
  console.log(derivedDeliveryEstimate);
}

Canceling a Delivery

async function cancelDeliveryAction() {
  const delivery_id = "YourDeliveryIDHere"; // Define delivery ID
  const reason = "YourReasonHere"; // Define cancellation reason
  const cancelDelivery = await curri.cancelDelivery(delivery_id, `Cancel Delivery Reason: ${reason}`);
  console.log(cancelDelivery);
}

Fetching a Delivery Quote

async function fetchQuote() {
  const quote = await curri.quote(req.query);
  console.log(quote);
}

Updating a Delivery

async function updateDelivery() {
  const updatedDelivery = await curri.updateDelivery(req.body);
  console.log(updatedDelivery);
}

List Deliveries

async function listDeliveries() {
  const deliveries = await curri.listDeliveries();
  console.log(deliveries);
}

Delivery Estimates

async function deliveryEstimates() {
  const deliveryEstimates = await curri.deliveryEstimates(delivery_id);
  console.log(deliveryEstimates);
}

Get Current User

async function currentUser() {
  const currentUser = await curri.getCurrentUser();
  console.log(currentUser);
}

Support

For any issues, questions, or contributions, refer to the project's GitHub repository or directly contact the project maintainers.

1.0.52

2 months ago

1.0.49

2 months ago

1.0.51

2 months ago

1.0.50

2 months ago

1.0.48

3 months ago

1.0.37

4 months ago

1.0.36

4 months ago

1.0.35

11 months ago

1.0.39

4 months ago

1.0.38

4 months ago

1.0.40

4 months ago

1.0.44

4 months ago

1.0.43

4 months ago

1.0.42

4 months ago

1.0.41

4 months ago

1.0.47

4 months ago

1.0.46

4 months ago

1.0.45

4 months ago

1.0.29

12 months ago

1.0.33

11 months ago

1.0.32

11 months ago

1.0.31

11 months ago

1.0.30

12 months ago

1.0.34

11 months ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago