chore(docs): Generated API Reference (#4706)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
This commit is contained in:
committed by
GitHub
parent
efdea04963
commit
658339767b
@@ -1,4 +1,4 @@
|
||||
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
|
||||
// must be previously logged in
|
||||
medusa.admin.auth.deleteSession()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.admin.auth.createSession({
|
||||
email: 'user@example.com',
|
||||
password: 'supersecret'
|
||||
email: "user@example.com",
|
||||
password: "supersecret"
|
||||
})
|
||||
.then(({ user }) => {
|
||||
console.log(user.id);
|
||||
|
||||
@@ -3,5 +3,5 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.batchJobs.list()
|
||||
.then(({ batch_jobs, limit, offset, count }) => {
|
||||
console.log(batch_jobs.length);
|
||||
});
|
||||
console.log(batch_jobs.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.batchJobs.retrieve(batch_job_id)
|
||||
medusa.admin.batchJobs.retrieve(batchJobId)
|
||||
.then(({ batch_job }) => {
|
||||
console.log(batch_job.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.batchJobs.cancel(batch_job_id)
|
||||
medusa.admin.batchJobs.cancel(batchJobId)
|
||||
.then(({ batch_job }) => {
|
||||
console.log(batch_job.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.batchJobs.confirm(batch_job_id)
|
||||
medusa.admin.batchJobs.confirm(batchJobId)
|
||||
.then(({ batch_job }) => {
|
||||
console.log(batch_job.id);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,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.collections.create({
|
||||
title: 'New Collection'
|
||||
title: "New Collection"
|
||||
})
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.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.collections.delete(collection_id)
|
||||
medusa.admin.collections.delete(collectionId)
|
||||
.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.collections.retrieve(collection_id)
|
||||
medusa.admin.collections.retrieve(collectionId)
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.collections.update(collection_id, {
|
||||
title: 'New Collection'
|
||||
medusa.admin.collections.update(collectionId, {
|
||||
title: "New Collection"
|
||||
})
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.id);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
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.collections.removeProducts(collectionId, {
|
||||
product_ids: [
|
||||
productId1,
|
||||
productId2
|
||||
]
|
||||
})
|
||||
.then(({ id, object, removed_products }) => {
|
||||
console.log(removed_products)
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
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.collections.addProducts(collectionId, {
|
||||
product_ids: [
|
||||
productId1,
|
||||
productId2
|
||||
]
|
||||
})
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.products)
|
||||
})
|
||||
@@ -2,7 +2,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.customerGroups.create({
|
||||
name: 'VIP'
|
||||
name: "VIP"
|
||||
})
|
||||
.then(({ customer_group }) => {
|
||||
console.log(customer_group.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.customerGroups.delete(customer_group_id)
|
||||
medusa.admin.customerGroups.delete(customerGroupId)
|
||||
.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.customerGroups.retrieve(customer_group_id)
|
||||
medusa.admin.customerGroups.retrieve(customerGroupId)
|
||||
.then(({ customer_group }) => {
|
||||
console.log(customer_group.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.customerGroups.update(customer_group_id, {
|
||||
name: 'VIP'
|
||||
medusa.admin.customerGroups.update(customerGroupId, {
|
||||
name: "VIP"
|
||||
})
|
||||
.then(({ customer_group }) => {
|
||||
console.log(customer_group.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.customerGroups.listCustomers(customer_group_id)
|
||||
medusa.admin.customerGroups.listCustomers(customerGroupId)
|
||||
.then(({ customers }) => {
|
||||
console.log(customers.length);
|
||||
});
|
||||
|
||||
@@ -1,10 +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.customerGroups.removeCustomers(customer_group_id, {
|
||||
medusa.admin.customerGroups.removeCustomers(customerGroupId, {
|
||||
customer_ids: [
|
||||
{
|
||||
id: customer_id
|
||||
id: customerId
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,10 +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.customerGroups.addCustomers(customer_group_id, {
|
||||
medusa.admin.customerGroups.addCustomers(customerGroupId, {
|
||||
customer_ids: [
|
||||
{
|
||||
id: customer_id
|
||||
id: customerId
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -2,10 +2,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.customers.create({
|
||||
email: 'user@example.com',
|
||||
first_name: 'Caterina',
|
||||
last_name: 'Yost',
|
||||
password: 'supersecret'
|
||||
email: "user@example.com",
|
||||
first_name: "Caterina",
|
||||
last_name: "Yost",
|
||||
password: "supersecret"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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.customers.retrieve(customer_id)
|
||||
medusa.admin.customers.retrieve(customerId)
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.customers.update(customer_id, {
|
||||
first_name: 'Dolly'
|
||||
medusa.admin.customers.update(customerId, {
|
||||
first_name: "Dolly"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AllocationType, DiscountRuleType } from "@medusajs/medusa"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.discounts.create({
|
||||
code: 'TEST',
|
||||
code: "TEST",
|
||||
rule: {
|
||||
type: DiscountRuleType.FIXED,
|
||||
value: 10,
|
||||
|
||||
@@ -2,7 +2,7 @@ import Medusa from "@medusajs/medusa-js"
|
||||
import { DiscountConditionOperator } from "@medusajs/medusa"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.discounts.createCondition(discount_id, {
|
||||
medusa.admin.discounts.createCondition(discountId, {
|
||||
operator: DiscountConditionOperator.IN
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
|
||||
@@ -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.discounts.deleteCondition(discount_id, condition_id)
|
||||
medusa.admin.discounts.deleteCondition(discountId, conditionId)
|
||||
.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.discounts.getCondition(discount_id, condition_id)
|
||||
medusa.admin.discounts.getCondition(discountId, conditionId)
|
||||
.then(({ discount_condition }) => {
|
||||
console.log(discount_condition.id);
|
||||
});
|
||||
|
||||
@@ -1,9 +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.updateCondition(discount_id, condition_id, {
|
||||
medusa.admin.discounts.updateCondition(discountId, conditionId, {
|
||||
products: [
|
||||
product_id
|
||||
productId
|
||||
]
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 }]
|
||||
medusa.admin.discounts.deleteConditionResourceBatch(discountId, conditionId, {
|
||||
resources: [{ id: itemId }]
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 }]
|
||||
medusa.admin.discounts.addConditionResourceBatch(discountId, conditionId, {
|
||||
resources: [{ id: itemId }]
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.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.discounts.delete(discount_id)
|
||||
medusa.admin.discounts.delete(discountId)
|
||||
.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.discounts.retrieve(discount_id)
|
||||
medusa.admin.discounts.retrieve(discountId)
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.update(discount_id, {
|
||||
code: 'TEST'
|
||||
medusa.admin.discounts.update(discountId, {
|
||||
code: "TEST"
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.createDynamicCode(discount_id, {
|
||||
code: 'TEST',
|
||||
medusa.admin.discounts.createDynamicCode(discountId, {
|
||||
code: "TEST",
|
||||
usage_limit: 1
|
||||
})
|
||||
.then(({ discount }) => {
|
||||
|
||||
@@ -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.discounts.deleteDynamicCode(discount_id, code)
|
||||
medusa.admin.discounts.deleteDynamicCode(discountId, code)
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.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.discounts.removeRegion(discount_id, region_id)
|
||||
medusa.admin.discounts.removeRegion(discountId, regionId)
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.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.discounts.addRegion(discount_id, region_id)
|
||||
medusa.admin.discounts.addRegion(discountId, regionId)
|
||||
.then(({ discount }) => {
|
||||
console.log(discount.id);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,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.draftOrders.create({
|
||||
email: 'user@example.com',
|
||||
email: "user@example.com",
|
||||
region_id,
|
||||
items: [
|
||||
{
|
||||
|
||||
@@ -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.draftOrders.delete(draft_order_id)
|
||||
medusa.admin.draftOrders.delete(draftOrderId)
|
||||
.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.draftOrders.retrieve(draft_order_id)
|
||||
medusa.admin.draftOrders.retrieve(draftOrderId)
|
||||
.then(({ draft_order }) => {
|
||||
console.log(draft_order.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.draftOrders.update(draft_order_id, {
|
||||
medusa.admin.draftOrders.update(draftOrderId, {
|
||||
email: "user@example.com"
|
||||
})
|
||||
.then(({ draft_order }) => {
|
||||
|
||||
@@ -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.draftOrders.addLineItem(draft_order_id, {
|
||||
medusa.admin.draftOrders.addLineItem(draftOrderId, {
|
||||
quantity: 1
|
||||
})
|
||||
.then(({ draft_order }) => {
|
||||
|
||||
@@ -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.draftOrders.removeLineItem(draft_order_id, item_id)
|
||||
medusa.admin.draftOrders.removeLineItem(draftOrderId, itemId)
|
||||
.then(({ draft_order }) => {
|
||||
console.log(draft_order.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.draftOrders.updateLineItem(draft_order_id, line_id, {
|
||||
medusa.admin.draftOrders.updateLineItem(draftOrderId, lineId, {
|
||||
quantity: 1
|
||||
})
|
||||
.then(({ draft_order }) => {
|
||||
|
||||
@@ -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.draftOrders.markPaid(draft_order_id)
|
||||
medusa.admin.draftOrders.markPaid(draftOrderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.giftCards.delete(gift_card_id)
|
||||
medusa.admin.giftCards.delete(giftCardId)
|
||||
.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.giftCards.retrieve(gift_card_id)
|
||||
medusa.admin.giftCards.retrieve(giftCardId)
|
||||
.then(({ gift_card }) => {
|
||||
console.log(gift_card.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.giftCards.update(gift_card_id, {
|
||||
medusa.admin.giftCards.update(giftCardId, {
|
||||
region_id
|
||||
})
|
||||
.then(({ gift_card }) => {
|
||||
|
||||
@@ -2,7 +2,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.inventoryItems.create({
|
||||
variant_id: 'variant_123',
|
||||
variant_id: "variant_123",
|
||||
})
|
||||
.then(({ inventory_item }) => {
|
||||
console.log(inventory_item.id);
|
||||
|
||||
@@ -2,7 +2,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.inventoryItems.createLocationLevel(inventoryItemId, {
|
||||
location_id: 'sloc_123',
|
||||
location_id: "sloc_123",
|
||||
stocked_quantity: 10,
|
||||
})
|
||||
.then(({ inventory_item }) => {
|
||||
|
||||
@@ -4,9 +4,9 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.admin.invites.accept({
|
||||
token,
|
||||
user: {
|
||||
first_name: 'Brigitte',
|
||||
last_name: 'Collier',
|
||||
password: 'supersecret'
|
||||
first_name: "Brigitte",
|
||||
last_name: "Collier",
|
||||
password: "supersecret"
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
@@ -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.invites.delete(invite_id)
|
||||
medusa.admin.invites.delete(inviteId)
|
||||
.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.invites.resend(invite_id)
|
||||
medusa.admin.invites.resend(inviteId)
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
|
||||
@@ -3,8 +3,8 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.notes.create({
|
||||
resource_id,
|
||||
resource_type: 'order',
|
||||
value: 'We delivered this order'
|
||||
resource_type: "order",
|
||||
value: "We delivered this order"
|
||||
})
|
||||
.then(({ note }) => {
|
||||
console.log(note.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.notes.delete(note_id)
|
||||
medusa.admin.notes.delete(noteId)
|
||||
.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.notes.retrieve(note_id)
|
||||
medusa.admin.notes.retrieve(noteId)
|
||||
.then(({ note }) => {
|
||||
console.log(note.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.notes.update(note_id, {
|
||||
value: 'We delivered this order'
|
||||
medusa.admin.notes.update(noteId, {
|
||||
value: "We delivered this order"
|
||||
})
|
||||
.then(({ note }) => {
|
||||
console.log(note.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.notifications.resend(notification_id)
|
||||
medusa.admin.notifications.resend(notificationId)
|
||||
.then(({ notification }) => {
|
||||
console.log(notification.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.create({ order_id })
|
||||
medusa.admin.orderEdits.create({ orderId })
|
||||
.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(order_edit_id)
|
||||
medusa.admin.orderEdits.delete(orderEditId)
|
||||
.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.orderEdits.update(order_edit_id, {
|
||||
medusa.admin.orderEdits.update(orderEditId, {
|
||||
internal_note: "internal reason XY"
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
|
||||
@@ -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.cancel(order_edit_id)
|
||||
medusa.admin.orderEdits.cancel(orderEditId)
|
||||
.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(order_edit_id, item_change_id)
|
||||
medusa.admin.orderEdits.deleteItemChange(orderEdit_id, itemChangeId)
|
||||
.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.orderEdits.confirm(order_edit_id)
|
||||
medusa.admin.orderEdits.confirm(orderEditId)
|
||||
.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.addLineItem(order_edit_id, {
|
||||
medusa.admin.orderEdits.addLineItem(orderEditId, {
|
||||
variant_id,
|
||||
quantity
|
||||
})
|
||||
|
||||
@@ -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.removeLineItem(order_edit_id, line_item_id)
|
||||
medusa.admin.orderEdits.removeLineItem(orderEditId, lineItemId)
|
||||
.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.updateLineItem(order_edit_id, line_item_id, {
|
||||
medusa.admin.orderEdits.updateLineItem(orderEditId, lineItemId, {
|
||||
quantity: 5
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
|
||||
@@ -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(order_edit_id)
|
||||
medusa.admin.orderEdits.requestConfirmation(orderEditId)
|
||||
.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.orders.retrieve(order_id)
|
||||
medusa.admin.orders.retrieve(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.orders.update(order_id, {
|
||||
email: 'user@example.com'
|
||||
medusa.admin.orders.update(orderId, {
|
||||
email: "user@example.com"
|
||||
})
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.archive(order_id)
|
||||
medusa.admin.orders.archive(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.cancel(order_id)
|
||||
medusa.admin.orders.cancel(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.capturePayment(order_id)
|
||||
medusa.admin.orders.capturePayment(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.createClaim(order_id, {
|
||||
medusa.admin.orders.createClaim(orderId, {
|
||||
type: 'refund',
|
||||
claim_items: [
|
||||
{
|
||||
|
||||
@@ -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.orders.updateClaim(order_id, claim_id, {
|
||||
medusa.admin.orders.updateClaim(orderId, claimId, {
|
||||
no_notification: true
|
||||
})
|
||||
.then(({ order }) => {
|
||||
|
||||
@@ -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.orders.cancelClaim(order_id, claim_id)
|
||||
medusa.admin.orders.cancelClaim(orderId, claimId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.fulfillClaim(order_id, claim_id, {
|
||||
medusa.admin.orders.fulfillClaim(orderId, claimId, {
|
||||
})
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.cancelClaimFulfillment(order_id, claim_id, fulfillment_id)
|
||||
medusa.admin.orders.cancelClaimFulfillment(orderId, claimId, fulfillmentId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.createClaimShipment(order_id, claim_id, {
|
||||
medusa.admin.orders.createClaimShipment(orderId, claimId, {
|
||||
fulfillment_id
|
||||
})
|
||||
.then(({ order }) => {
|
||||
|
||||
@@ -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.orders.complete(order_id)
|
||||
medusa.admin.orders.complete(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.createFulfillment(order_id, {
|
||||
medusa.admin.orders.createFulfillment(orderId, {
|
||||
items: [
|
||||
{
|
||||
item_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.orders.cancelFulfillment(order_id, fulfillment_id)
|
||||
medusa.admin.orders.cancelFulfillment(orderId, fulfillmentId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.id);
|
||||
});
|
||||
|
||||
@@ -1,9 +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.orders.refundPayment(order_id, {
|
||||
medusa.admin.orders.refundPayment(orderId, {
|
||||
amount: 1000,
|
||||
reason: 'Do not like it'
|
||||
reason: "Do not like it"
|
||||
})
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.requestReturn(order_id, {
|
||||
medusa.admin.orders.requestReturn(orderId, {
|
||||
items: [
|
||||
{
|
||||
item_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.orders.addShippingMethod(order_id, {
|
||||
medusa.admin.orders.addShippingMethod(orderId, {
|
||||
price: 1000,
|
||||
option_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.orders.createSwap(order_id, {
|
||||
medusa.admin.orders.createSwap(orderId, {
|
||||
return_items: [
|
||||
{
|
||||
item_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.orders.cancelSwap(order_id, swap_id)
|
||||
medusa.admin.orders.cancelSwap(orderId, swapId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.fulfillSwap(order_id, swap_id, {
|
||||
medusa.admin.orders.fulfillSwap(orderId, swapId, {
|
||||
|
||||
})
|
||||
.then(({ order }) => {
|
||||
|
||||
@@ -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.orders.cancelSwapFulfillment(order_id, swap_id, fulfillment_id)
|
||||
medusa.admin.orders.cancelSwapFulfillment(orderId, swapId, fulfillmentId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.processSwapPayment(order_id, swap_id)
|
||||
medusa.admin.orders.processSwapPayment(orderId, swapId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.paymentCollections.delete(payment_collection_id)
|
||||
medusa.admin.paymentCollections.delete(paymentCollectionId)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id)
|
||||
})
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.paymentCollections.update(payment_collection_id, {
|
||||
description: "Description of payCol"
|
||||
medusa.admin.paymentCollections.update(paymentCollectionId, {
|
||||
description
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.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.paymentCollections.markAsAuthorized(payment_collection_id)
|
||||
medusa.admin.paymentCollections.markAsAuthorized(paymentCollectionId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.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.payments.retrieve(payment_id)
|
||||
medusa.admin.payments.retrieve(paymentId)
|
||||
.then(({ payment }) => {
|
||||
console.log(payment.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.payments.capturePayment(payment_id)
|
||||
medusa.admin.payments.capturePayment(paymentId)
|
||||
.then(({ payment }) => {
|
||||
console.log(payment.id);
|
||||
});
|
||||
|
||||
@@ -1,10 +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.payments.refundPayment(payment_id, {
|
||||
medusa.admin.payments.refundPayment(paymentId, {
|
||||
amount: 1000,
|
||||
reason: 'return',
|
||||
note: 'Do not like it',
|
||||
reason: "return",
|
||||
note: "Do not like it",
|
||||
})
|
||||
.then(({ payment }) => {
|
||||
console.log(payment.id);
|
||||
|
||||
@@ -3,14 +3,14 @@ import { PriceListType } from "@medusajs/medusa"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.priceLists.create({
|
||||
name: 'New Price List',
|
||||
description: 'A new price list',
|
||||
name: "New Price List",
|
||||
description: "A new price list",
|
||||
type: PriceListType.SALE,
|
||||
prices: [
|
||||
{
|
||||
amount: 1000,
|
||||
variant_id,
|
||||
currency_code: 'eur'
|
||||
currency_code: "eur"
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -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.priceLists.delete(price_list_id)
|
||||
medusa.admin.priceLists.delete(priceListId)
|
||||
.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.priceLists.retrieve(price_list_id)
|
||||
medusa.admin.priceLists.retrieve(priceListId)
|
||||
.then(({ price_list }) => {
|
||||
console.log(price_list.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.priceLists.update(price_list_id, {
|
||||
name: 'New Price List'
|
||||
medusa.admin.priceLists.update(priceListId, {
|
||||
name: "New Price List"
|
||||
})
|
||||
.then(({ price_list }) => {
|
||||
console.log(price_list.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.priceLists.deletePrices(price_list_id, {
|
||||
medusa.admin.priceLists.deletePrices(priceListId, {
|
||||
price_ids: [
|
||||
price_id
|
||||
]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user