1.3.1 • Published 4 years ago

peachy-client v1.3.1

Weekly downloads
1
License
UNLICENSED
Repository
github
Last release
4 years ago

peachy-client

Peachy API client

Install

npm i peachymarket/peachy-client

Usage

import PeachyClient from 'peachy-client'

const client = new PeachyClient()

async function example() {
  // authenticate the client (client.token now holds the bearer token)
  await client.authenticate(username, password) 

  // get user's info
  await client.me() // { id, firstName, lastName, email, ... }

  // get user's default address
  await client.listAddresses({ isDefault: true }) // [{ id, address, unit, city, state, zip, country, ... }]
}

Documentation

All methods return a promise.

new PeachyClient(options)

options {Object}

  • baseURL defaults to https://api.peachymarket.com/v1

Generic Requests

  • get(path, query)
  • post(path, body)
  • patch(path, body)
  • put(path, body)
  • delete(path)

Authentication

  • authenticate(username, password)
  • me()

Search

  • search(keyword)

Users

  • addUser(data)
  • getUser(id)
  • listUsers(query)
  • updateUser(id, data)
  • deleteUser(id

Addresses

  • addAddress(data)
  • getAddress(id)
  • listAddresses(query)
  • updateAddress(id, data)
  • deleteAddress(id)

Payment Methods

  • addPaymentMethod(data)
  • getPaymentMethod(id)
  • listPaymentMethods(query)
  • updatePaymentMethod(id, data)
  • deletePaymentMethod(id)

Cart

  • addItemToCart(data)
  • listItemsInCart(query)
  • updateItemInCart(id, data)
  • deleteItemInCart(id)

Orders

  • getCheckoutInfo()
  • submitOrder(data)
  • listOrders(query)
  • cancelOrder(id, data)

Vendors

  • addVendor(data)
  • getVendor(id)
  • listVendors(query)
  • updateVendor(id, data)
  • deleteVendor(id)

Products

  • addProduct(data)
  • getProduct(id)
  • listProducts(query)
  • updateProduct(id, data)
  • deleteProduct(id)
1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago