chore(docs): Generated API Reference (#5601)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
02e2ee4e8a
commit
01d4047976
@@ -0,0 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.deleteSession()
|
||||
.then(() => {
|
||||
// customer logged out successfully
|
||||
})
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.auth.getSession()
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.auth.authenticate({
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.auth.getToken({
|
||||
})
|
||||
.then(({ access_token }) => {
|
||||
console.log(access_token);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.create()
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.retrieve(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -5,4 +5,4 @@ medusa.carts.update(cartId, {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.complete(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.deleteDiscount(cartId, code)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.carts.lineItems.create(cart_id, {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.lineItems.delete(cartId, lineId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -5,4 +5,4 @@ medusa.carts.lineItems.update(cartId, lineId, {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -5,4 +5,4 @@ medusa.carts.setPaymentSession(cartId, {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.createPaymentSessions(cartId)
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.deletePaymentSession(cartId, "manual")
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -7,4 +7,4 @@ medusa.carts.updatePaymentSession(cartId, "manual", {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.carts.refreshPaymentSession(cartId, "manual")
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -5,4 +5,4 @@ medusa.carts.addShippingMethod(cartId, {
|
||||
})
|
||||
.then(({ cart }) => {
|
||||
console.log(cart.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.collections.list()
|
||||
.then(({ collections, limit, offset, count }) => {
|
||||
console.log(collections.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.collections.retrieve(collectionId)
|
||||
.then(({ collection }) => {
|
||||
console.log(collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -8,4 +8,4 @@ medusa.customers.create({
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.retrieve()
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.customers.update({
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -16,4 +16,4 @@ medusa.customers.addresses.addAddress({
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.addresses.deleteAddress(addressId)
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.customers.addresses.updateAddress(addressId, {
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.listOrders()
|
||||
.then(({ orders, limit, offset, count }) => {
|
||||
console.log(orders);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.customers.paymentMethods.list()
|
||||
.then(({ payment_methods }) => {
|
||||
console.log(payment_methods.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -7,4 +7,4 @@ medusa.customers.resetPassword({
|
||||
})
|
||||
.then(({ customer }) => {
|
||||
console.log(customer.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.giftCards.retrieve(code)
|
||||
.then(({ gift_card }) => {
|
||||
console.log(gift_card.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orderEdits.retrieve(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,6 +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)
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
|
||||
@@ -1,6 +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);
|
||||
})
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id);
|
||||
})
|
||||
|
||||
@@ -6,4 +6,4 @@ medusa.orders.lookupOrder({
|
||||
})
|
||||
.then(({ order }) => {
|
||||
console.log(order.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -9,4 +9,4 @@ medusa.orders.requestCustomerOrders({
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orders.retrieveByCartId(cartId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -9,4 +9,4 @@ medusa.orders.confirmRequest(
|
||||
})
|
||||
.catch(() => {
|
||||
// an error occurred
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.orders.retrieve(orderId)
|
||||
.then(({ order }) => {
|
||||
console.log(order.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -2,6 +2,6 @@ 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)
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id)
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.managePaymentSession(payment_id, { provider_id: "stripe" })
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ medusa.paymentCollections.managePaymentSessionsBatch(paymentId, {
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
// Example 2: Updating one session and removing the other
|
||||
medusa.paymentCollections.managePaymentSessionsBatch(paymentId, {
|
||||
@@ -33,4 +33,4 @@ medusa.paymentCollections.managePaymentSessionsBatch(paymentId, {
|
||||
})
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.authorize(paymentId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.refreshPaymentSession(paymentCollectionId, sessionId)
|
||||
.then(({ payment_session }) => {
|
||||
console.log(payment_session.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.paymentCollections.authorize(paymentId, sessionId)
|
||||
.then(({ payment_collection }) => {
|
||||
console.log(payment_collection.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.productCategories.list()
|
||||
.then(({ product_categories, limit, offset, count }) => {
|
||||
console.log(product_categories.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -2,6 +2,6 @@ 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);
|
||||
});
|
||||
.then(({ product_category }) => {
|
||||
console.log(product_category.id);
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.productTags.list()
|
||||
.then(({ product_tags }) => {
|
||||
console.log(product_tags.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.productTypes.list()
|
||||
.then(({ product_types }) => {
|
||||
console.log(product_types.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.products.list()
|
||||
.then(({ products, limit, offset, count }) => {
|
||||
console.log(products.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -5,4 +5,4 @@ medusa.products.search({
|
||||
})
|
||||
.then(({ hits }) => {
|
||||
console.log(hits.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.products.retrieve(productId)
|
||||
.then(({ product }) => {
|
||||
console.log(product.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Medusa from "@medusajs/medusa-js"
|
||||
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.regions.list()
|
||||
.then(({ regions }) => {
|
||||
.then(({ regions, count, limit, offset }) => {
|
||||
console.log(regions.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.regions.retrieve(regionId)
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.returnReasons.list()
|
||||
.then(({ return_reasons }) => {
|
||||
console.log(return_reasons.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.returnReasons.retrieve(reasonId)
|
||||
.then(({ return_reason }) => {
|
||||
console.log(return_reason.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -11,4 +11,4 @@ medusa.returns.create({
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(data.return.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.shippingOptions.list()
|
||||
.then(({ shipping_options }) => {
|
||||
console.log(shipping_options.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.shippingOptions.listCartOptions(cartId)
|
||||
.then(({ shipping_options }) => {
|
||||
console.log(shipping_options.length);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -17,4 +17,4 @@ medusa.swaps.create({
|
||||
})
|
||||
.then(({ swap }) => {
|
||||
console.log(swap.id);
|
||||
});
|
||||
})
|
||||
|
||||
@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
medusa.swaps.retrieveByCartId(cartId)
|
||||
.then(({ swap }) => {
|
||||
console.log(swap.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.product.variants.list()
|
||||
.then(({ variants }) => {
|
||||
console.log(variants.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.product.variants.retrieve(productVariantId)
|
||||
.then(({ variant }) => {
|
||||
console.log(variant.id);
|
||||
})
|
||||
Reference in New Issue
Block a user