chore(docs): Generated API Reference (#5601)

Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-11-10 14:27:17 +02:00
committed by GitHub
parent 02e2ee4e8a
commit 01d4047976
496 changed files with 1456 additions and 867 deletions

View File

@@ -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
})

View File

@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.auth.getSession()
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -6,4 +6,4 @@ medusa.auth.authenticate({
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -6,4 +6,4 @@ medusa.auth.getToken({
})
.then(({ access_token }) => {
console.log(access_token);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.create()
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.retrieve(cartId)
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -5,4 +5,4 @@ medusa.carts.update(cartId, {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.complete(cartId)
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -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);
});
})

View File

@@ -6,4 +6,4 @@ medusa.carts.lineItems.create(cart_id, {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -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);
});
})

View File

@@ -5,4 +5,4 @@ medusa.carts.lineItems.update(cartId, lineId, {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -5,4 +5,4 @@ medusa.carts.setPaymentSession(cartId, {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.createPaymentSessions(cartId)
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -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);
});
})

View File

@@ -7,4 +7,4 @@ medusa.carts.updatePaymentSession(cartId, "manual", {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -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);
});
})

View File

@@ -5,4 +5,4 @@ medusa.carts.addShippingMethod(cartId, {
})
.then(({ cart }) => {
console.log(cart.id);
});
})

View File

@@ -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);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.collections.retrieve(collectionId)
.then(({ collection }) => {
console.log(collection.id);
});
})

View File

@@ -8,4 +8,4 @@ medusa.customers.create({
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -4,4 +4,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.customers.retrieve()
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -6,4 +6,4 @@ medusa.customers.update({
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -16,4 +16,4 @@ medusa.customers.addresses.addAddress({
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -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);
});
})

View File

@@ -6,4 +6,4 @@ medusa.customers.addresses.updateAddress(addressId, {
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -7,4 +7,4 @@ medusa.customers.resetPassword({
})
.then(({ customer }) => {
console.log(customer.id);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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)
})

View File

@@ -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);
})

View File

@@ -6,4 +6,4 @@ medusa.orders.lookupOrder({
})
.then(({ order }) => {
console.log(order.id);
});
})

View File

@@ -9,4 +9,4 @@ medusa.orders.requestCustomerOrders({
})
.catch(() => {
// an error occurred
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orders.retrieveByCartId(cartId)
.then(({ order }) => {
console.log(order.id);
});
})

View File

@@ -9,4 +9,4 @@ medusa.orders.confirmRequest(
})
.catch(() => {
// an error occurred
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orders.retrieve(orderId)
.then(({ order }) => {
console.log(order.id);
});
})

View File

@@ -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)
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -5,4 +5,4 @@ medusa.products.search({
})
.then(({ hits }) => {
console.log(hits.length);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.products.retrieve(productId)
.then(({ product }) => {
console.log(product.id);
});
})

View File

@@ -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);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.regions.retrieve(regionId)
.then(({ region }) => {
console.log(region.id);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -11,4 +11,4 @@ medusa.returns.create({
})
.then((data) => {
console.log(data.return.id);
});
})

View File

@@ -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);
});
})

View File

@@ -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);
});
})

View File

@@ -17,4 +17,4 @@ medusa.swaps.create({
})
.then(({ swap }) => {
console.log(swap.id);
});
})

View File

@@ -3,4 +3,4 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.swaps.retrieveByCartId(cartId)
.then(({ swap }) => {
console.log(swap.id);
});
})

View File

@@ -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);
})

View File

@@ -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);
})