chore(docs): Generated API Reference (#2572)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
884322447e
commit
325b1e9017
@@ -0,0 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.currencies.list()
|
||||
.then(({ currencies, count, offset, limit }) => {
|
||||
console.log(currencies.length);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.currencies.update(code, {
|
||||
includes_tax: true
|
||||
})
|
||||
.then(({ currency }) => {
|
||||
console.log(currency.id);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.discounts.deleteConditionResourceBatch(discount_id, condition_id, {
|
||||
resources: [{ id: item_id }]
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.discounts.addConditionResourceBatch(discount_id, condition_id, {
|
||||
resources: [{ id: item_id }]
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdits.list()
|
||||
.then(({ order_edits, count, limit, offset }) => {
|
||||
console.log(order_edits.length)
|
||||
})
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdit.create({ order_id, internal_note })
|
||||
medusa.admin.orderEdits.create({ order_id })
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdits.delete(edit_id)
|
||||
medusa.admin.orderEdits.delete(order_edit_id)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdit.retrieve(orderEditId)
|
||||
medusa.admin.orderEdits.retrieve(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
const params = {internal_note: "internal reason XY"}
|
||||
medusa.admin.orderEdit.update(orderEditId, params)
|
||||
medusa.admin.orderEdits.update(order_edit_id, {
|
||||
internal_note: "internal reason XY"
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdit.cancel(orderEditId)
|
||||
medusa.admin.orderEdits.cancel(order_edit_id)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdits.deleteItemChange(item_change_id, order_edit_id)
|
||||
medusa.admin.orderEdits.deleteItemChange(order_edit_id, item_change_id)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdit.confirm(orderEditId)
|
||||
medusa.admin.orderEdits.confirm(order_edit_id)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdit.addLineItem(order_edit_id, { variant_id, quantity })
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
medusa.admin.orderEdits.addLineItem(order_edit_id, {
|
||||
variant_id,
|
||||
quantity
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id)
|
||||
medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id, {
|
||||
quantity: 5
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.orderEdits.requestConfirmation(edit_id)
|
||||
medusa.admin.orderEdits.requestConfirmation(order_edit_id)
|
||||
.then({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -9,6 +9,6 @@ medusa.admin.returns.receive(return_id, {
|
||||
}
|
||||
]
|
||||
})
|
||||
.then(({ return }) => {
|
||||
console.log(return.id);
|
||||
.then((data) => {
|
||||
console.log(data.return.id);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.uploads.createProtected(file)
|
||||
.then(({ uploads }) => {
|
||||
console.log(uploads.length);
|
||||
});
|
||||
Reference in New Issue
Block a user