From a7aa3f399f92c4cbc94334b47a26982d722ab2e0 Mon Sep 17 00:00:00 2001 From: Nathan Sierra Date: Tue, 30 Jan 2024 14:29:38 -0500 Subject: [PATCH] add updateProduct, updateCustomer --- api/customers.js | 7 +++++++ api/products.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/api/customers.js b/api/customers.js index bf52a7b..58a49ed 100644 --- a/api/customers.js +++ b/api/customers.js @@ -66,6 +66,13 @@ class CustomersApi extends Api { return r && r.body } + async updateCustomer (customer, opts) { + opts = opts || {} + const request = this.pick(customer, 'id', 'name', 'slug', 'description', 'version', 'customerCategory') + const r = await this.client.put(`/customers/${request.id}`, request, opts) + return r && r.body + } + async createExternalBatch (batch, opts) { opts = opts || {} const orgId = batch.orgId || opts.orgId || await this.client.getOrgId() diff --git a/api/products.js b/api/products.js index 6b13561..426a321 100644 --- a/api/products.js +++ b/api/products.js @@ -66,6 +66,13 @@ class ProductsApi extends Api { return r && r.body } + async updateProduct (product, opts) { + opts = opts || {} + const request = this.pick(product, 'id', 'name', 'slug', 'version', 'productCategory') + const r = await this.client.put(`/products/${request.id}`, request, opts) + return r && r.body + } + async createExternalBatch (batch, opts) { opts = opts || {} const orgId = batch.orgId || opts.orgId || await this.client.getOrgId()