Skip to content

Commit

Permalink
add updateProduct, updateCustomer
Browse files Browse the repository at this point in the history
  • Loading branch information
nnsier committed Jan 30, 2024
1 parent 20d3b3e commit a7aa3f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions api/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a7aa3f3

Please sign in to comment.