docs: update api-reference project for v2 (#7307)
* remove everything v1 and make v2 default * move main v2 rewrites to book * move rewrites to book + other fixes
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.deleteSession()
|
||||
.then(() => {
|
||||
// customer logged out successfully
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.getToken({
|
||||
email: 'user@example.com',
|
||||
password: 'supersecret'
|
||||
})
|
||||
.then(({ access_token }) => {
|
||||
console.log(access_token);
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.exists("user@example.com")
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,10 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,11 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,19 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,10 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,11 +0,0 @@
|
||||
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
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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)
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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)
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,8 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.regions.list()
|
||||
.then(({ regions, count, limit, offset }) => {
|
||||
console.log(regions.length);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,14 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,20 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
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);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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.product.variants.list()
|
||||
.then(({ variants }) => {
|
||||
console.log(variants.length);
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
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.product.variants.retrieve(productVariantId)
|
||||
.then(({ variant }) => {
|
||||
console.log(variant.id);
|
||||
})
|
||||
@@ -1,2 +0,0 @@
|
||||
curl -X DELETE '{backend_url}/store/auth' \
|
||||
-H 'Authorization: Bearer {access_token}'
|
||||
@@ -1,2 +0,0 @@
|
||||
curl '{backend_url}/store/auth' \
|
||||
-H 'Authorization: Bearer {access_token}'
|
||||
@@ -1,6 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/auth' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret"
|
||||
}'
|
||||
@@ -1,6 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/auth/token' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com",
|
||||
"password": "supersecret"
|
||||
}'
|
||||
@@ -1 +0,0 @@
|
||||
curl '{backend_url}/store/auth/user@example.com'
|
||||
@@ -1 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts'
|
||||
curl -X POST '{backend_url}/store/carts'
|
||||
@@ -1 +1 @@
|
||||
curl '{backend_url}/store/carts/{id}'
|
||||
curl '{backend_url}/store/carts/{id}'
|
||||
@@ -1,5 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"email": "user@example.com"
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/carts/{id}'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/complete'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/discounts/{code}'
|
||||
@@ -1,6 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"variant_id": "{variant_id}",
|
||||
"quantity": 1
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items'
|
||||
@@ -1 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/line-items/{line_id}'
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/line-items/{line_id}'
|
||||
@@ -1,5 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"quantity": 1
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/carts/{id}/line-items/{line_id}'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-collections'
|
||||
@@ -1,5 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"provider_id": "manual"
|
||||
}'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/payment-sessions/{provider_id}'
|
||||
@@ -1,5 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions/manual' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"data": {}
|
||||
}'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/payment-sessions/{provider_id}/refresh'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/carts/{id}/promotions'
|
||||
@@ -0,0 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/promotions'
|
||||
@@ -1,5 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/shipping-methods' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"option_id": "{option_id}",
|
||||
}'
|
||||
@@ -1 +1 @@
|
||||
curl -X POST '{backend_url}/store/carts/{id}/taxes'
|
||||
curl -X POST '{backend_url}/store/carts/{id}/taxes'
|
||||
@@ -1 +0,0 @@
|
||||
curl '{backend_url}/store/collections'
|
||||
@@ -1 +0,0 @@
|
||||
curl '{backend_url}/store/collections/{id}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/currencies'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/currencies/{code}'
|
||||
@@ -1,8 +1 @@
|
||||
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"
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/customers'
|
||||
@@ -1,2 +1 @@
|
||||
curl '{backend_url}/store/customers/me' \
|
||||
-H 'Authorization: Bearer {access_token}'
|
||||
curl '{backend_url}/store/customers/me'
|
||||
@@ -1,6 +0,0 @@
|
||||
curl -X POST '{backend_url}/store/customers/me' \
|
||||
-H 'Authorization: Bearer {access_token}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"first_name": "Laury"
|
||||
}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/customers/me/addresses'
|
||||
@@ -1,13 +1 @@
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses' \
|
||||
-H 'Authorization: Bearer {access_token}' \
|
||||
-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"
|
||||
}
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses'
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||
-H 'Authorization: Bearer {access_token}'
|
||||
curl -X DELETE '{backend_url}/store/customers/me/addresses/{address_id}'
|
||||
@@ -0,0 +1 @@
|
||||
curl '{backend_url}/store/customers/me/addresses/{address_id}'
|
||||
@@ -1,6 +1 @@
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}' \
|
||||
-H 'Authorization: Bearer {access_token}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"first_name": "Gina"
|
||||
}'
|
||||
curl -X POST '{backend_url}/store/customers/me/addresses/{address_id}'
|
||||
@@ -1,2 +0,0 @@
|
||||
curl '{backend_url}/store/customers/me/orders' \
|
||||
-H 'Authorization: Bearer {access_token}'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user