docs: create docs workspace (#5174)
* docs: migrate ui docs to docs universe * created yarn workspace * added eslint and tsconfig configurations * fix eslint configurations * fixed eslint configurations * shared tailwind configurations * added shared ui package * added more shared components * migrating more components * made details components shared * move InlineCode component * moved InputText * moved Loading component * Moved Modal component * moved Select components * Moved Tooltip component * moved Search components * moved ColorMode provider * Moved Notification components and providers * used icons package * use UI colors in api-reference * moved Navbar component * used Navbar and Search in UI docs * added Feedback to UI docs * general enhancements * fix color mode * added copy colors file from ui-preset * added features and enhancements to UI docs * move Sidebar component and provider * general fixes and preparations for deployment * update docusaurus version * adjusted versions * fix output directory * remove rootDirectory property * fix yarn.lock * moved code component * added vale for all docs MD and MDX * fix tests * fix vale error * fix deployment errors * change ignore commands * add output directory * fix docs test * general fixes * content fixes * fix announcement script * added changeset * fix vale checks * added nofilter option * fix vale error
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged
|
||||
medusa.auth.getSession()
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.authenticate({
|
||||
email: "user@example.com",
|
||||
password: "user@example.com"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.exists("user@example.com")
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.create()
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.retrieve(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.update(cartId, {
|
||||
email: "user@example.com"
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.complete(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.deleteDiscount(cartId, code)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.lineItems.create(cart_id, {
|
||||
variant_id,
|
||||
quantity: 1
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.lineItems.delete(cartId, lineId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.lineItems.update(cartId, lineId, {
|
||||
quantity: 1
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.setPaymentSession(cartId, {
|
||||
provider_id: "manual"
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.createPaymentSessions(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.deletePaymentSession(cartId, "manual")
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.updatePaymentSession(cartId, "manual", {
|
||||
data: {
|
||||
|
||||
}
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.refreshPaymentSession(cartId, "manual")
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.addShippingMethod(cartId, {
|
||||
option_id
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.collections.list()
|
||||
.then(({ collections, limit, offset, count }) => {
|
||||
console.log(collections.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.collections.retrieve(collectionId)
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.id);
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.create({
|
||||
first_name: "Alec",
|
||||
last_name: "Reynolds",
|
||||
email: "user@example.com",
|
||||
password: "supersecret"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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
|
||||
medusa.customers.retrieve()
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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
|
||||
medusa.customers.update({
|
||||
first_name: "Laury"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged
|
||||
medusa.customers.addresses.addAddress({
|
||||
address: {
|
||||
first_name: "Celia",
|
||||
last_name: "Schumm",
|
||||
address_1: "225 Bednar Curve",
|
||||
city: "Danielville",
|
||||
country_code: "US",
|
||||
postal_code: "85137",
|
||||
phone: "981-596-6748 x90188",
|
||||
company: "Wyman LLC",
|
||||
province: "Georgia",
|
||||
}
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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
|
||||
medusa.customers.addresses.deleteAddress(addressId)
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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
|
||||
medusa.customers.addresses.updateAddress(addressId, {
|
||||
first_name: "Gina"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.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
|
||||
medusa.customers.listOrders()
|
||||
.then(({ orders, limit, offset, count }) => {
|
||||
console.log(orders);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged
|
||||
medusa.customers.paymentMethods.list()
|
||||
.then(({ payment_methods }) => {
|
||||
console.log(payment_methods.length);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.resetPassword({
|
||||
email: "user@example.com",
|
||||
password: "supersecret",
|
||||
token: "supersecrettoken"
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.generatePasswordToken({
|
||||
email: "user@example.com"
|
||||
})
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
.catch(() => {
|
||||
// failed
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.giftCards.retrieve(code)
|
||||
.then(({ gift_card }) => {
|
||||
console.log(gift_card.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orderEdits.retrieve(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orderEdits.complete(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orderEdits.decline(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id);
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orders.lookupOrder({
|
||||
display_id: 1,
|
||||
email: "user@example.com"
|
||||
})
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.requestCustomerOrders({
|
||||
order_ids,
|
||||
})
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orders.retrieveByCartId(cartId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.orders.confirmRequest(
|
||||
token,
|
||||
)
|
||||
.then(() => {
|
||||
// successful
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orders.retrieve(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.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.paymentCollections.retrieve(paymentCollectionId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.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.paymentCollections.managePaymentSession(payment_id, { provider_id: "stripe" })
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
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
|
||||
|
||||
// Total amount = 10000
|
||||
|
||||
// Example 1: Adding two new sessions
|
||||
medusa.paymentCollections.managePaymentSessionsBatch(paymentId, {
|
||||
sessions: [
|
||||
{
|
||||
provider_id: "stripe",
|
||||
amount: 5000,
|
||||
},
|
||||
{
|
||||
provider_id: "manual",
|
||||
amount: 5000,
|
||||
},
|
||||
]
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
|
||||
// Example 2: Updating one session and removing the other
|
||||
medusa.paymentCollections.managePaymentSessionsBatch(paymentId, {
|
||||
sessions: [
|
||||
{
|
||||
provider_id: "stripe",
|
||||
amount: 10000,
|
||||
session_id: "ps_123456"
|
||||
},
|
||||
]
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.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.paymentCollections.authorize(paymentId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.refreshPaymentSession(paymentCollectionId, sessionId)
|
||||
.then(({ payment_session }) => {
|
||||
console.log(payment_session.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.paymentCollections.authorize(paymentId, sessionId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.productCategories.list()
|
||||
.then(({ product_categories, limit, offset, count }) => {
|
||||
console.log(product_categories.length);
|
||||
});
|
||||
@@ -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.productCategories.retrieve(productCategoryId)
|
||||
.then(({ product_category }) => {
|
||||
console.log(product_category.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.productTags.list()
|
||||
.then(({ product_tags }) => {
|
||||
console.log(product_tags.length);
|
||||
});
|
||||
@@ -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.productTypes.list()
|
||||
.then(({ product_types }) => {
|
||||
console.log(product_types.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.products.list()
|
||||
.then(({ products, limit, offset, count }) => {
|
||||
console.log(products.length);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.products.search({
|
||||
q: "Shirt"
|
||||
})
|
||||
.then(({ hits }) => {
|
||||
console.log(hits.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.products.retrieve(productId)
|
||||
.then(({ product }) => {
|
||||
console.log(product.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.regions.list()
|
||||
.then(({ regions }) => {
|
||||
console.log(regions.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.regions.retrieve(regionId)
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.returnReasons.list()
|
||||
.then(({ return_reasons }) => {
|
||||
console.log(return_reasons.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.returnReasons.retrieve(reasonId)
|
||||
.then(({ return_reason }) => {
|
||||
console.log(return_reason.id);
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.returns.create({
|
||||
order_id,
|
||||
items: [
|
||||
{
|
||||
item_id,
|
||||
quantity: 1
|
||||
}
|
||||
]
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(data.return.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.shippingOptions.list()
|
||||
.then(({ shipping_options }) => {
|
||||
console.log(shipping_options.length);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.shippingOptions.listCartOptions(cartId)
|
||||
.then(({ shipping_options }) => {
|
||||
console.log(shipping_options.length);
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.swaps.create({
|
||||
order_id,
|
||||
return_items: [
|
||||
{
|
||||
item_id,
|
||||
quantity: 1
|
||||
}
|
||||
],
|
||||
additional_items: [
|
||||
{
|
||||
variant_id,
|
||||
quantity: 1
|
||||
}
|
||||
]
|
||||
})
|
||||
.then(({ swap }) => {
|
||||
console.log(swap.id);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.swaps.retrieveByCartId(cartId)
|
||||
.then(({ swap }) => {
|
||||
console.log(swap.id);
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
curl -X DELETE '{backend_url}/store/auth' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl '{backend_url}/store/auth' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl -X POST '{backend_url}/store/auth' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret"
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/auth/user@example.com'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/carts/{id}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com"
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/complete'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/discounts/{code}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"variant_id": "{variant_id}",
|
||||
"quantity": 1
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/line-items/{line_id}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"quantity": 1
|
||||
}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"provider_id": "manual"
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/payment-sessions/{provider_id}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions/manual' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"data": {}
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions/{provider_id}/refresh'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/shipping-methods' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"option_id": "{option_id}",
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/taxes'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/collections'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/collections/{id}'
|
||||
@@ -0,0 +1,8 @@
|
||||
curl -X POST '{backend_url}/store/customers' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"first_name": "Alec",
|
||||
"last_name": "Reynolds",
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret"
|
||||
}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl '{backend_url}/store/customers/me' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl -X POST '{backend_url}/store/customers/me' \
|
||||
-H 'Cookie: connect.sid={sid}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"first_name": "Laury"
|
||||
}'
|
||||
@@ -0,0 +1,13 @@
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses' \
|
||||
-H 'Cookie: connect.sid={sid}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"address": {
|
||||
"first_name": "Celia",
|
||||
"last_name": "Schumm",
|
||||
"address_1": "225 Bednar Curve",
|
||||
"city": "Danielville",
|
||||
"country_code": "US",
|
||||
"postal_code": "85137"
|
||||
}
|
||||
}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||
-H 'Cookie: connect.sid={sid}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"first_name": "Gina"
|
||||
}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl '{backend_url}/store/customers/me/orders' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl '{backend_url}/store/customers/me/payment-methods' \
|
||||
-H 'Cookie: connect.sid={sid}'
|
||||
@@ -0,0 +1,7 @@
|
||||
curl -X POST '{backend_url}/store/customers/password-reset' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret",
|
||||
"token": "supersecrettoken"
|
||||
}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/customers/password-token' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com"
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/gift-cards/{code}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/order-edits/{id}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/order-edits/{id}/complete'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/order-edits/{id}/decline'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/orders?display_id=1&email=user@example.com'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/batch/customer/token' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"order_ids": ["id"],
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/orders/cart/{cart_id}'
|
||||
@@ -0,0 +1,5 @@
|
||||
curl -X POST '{backend_url}/store/orders/customer/confirm' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"token": "{token}",
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/orders/{id}'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user