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

Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2022-09-05 10:23:46 +03:00
committed by GitHub
parent 4961aece1c
commit a1350bfaec
662 changed files with 51365 additions and 29004 deletions

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
medusa.auth.getSession()
.then(({ customer }) => {
console.log(customer.id);
});

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.retrieve(cart_id)
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,8 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.update(cart_id, {
email: 'user@example.com'
})
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.complete(cart_id)
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.deleteDiscount(cart_id, code)
.then(({ cart }) => {
console.log(cart.id);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.lineItems.delete(cart_id, line_id)
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,8 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.lineItems.update(cart_id, line_id, {
quantity: 1
})
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,8 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.setPaymentSession(cart_id, {
provider_id: 'manual'
})
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.createPaymentSessions(cart_id)
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.deletePaymentSession(cart_id, 'manual')
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,9 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.updatePaymentSession(cart_id, 'manual', {
data: {
}
})
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.refreshPaymentSession(cart_id, 'manual')
.then(({ cart }) => {
console.log(cart.id);
});

View File

@@ -0,0 +1,8 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.carts.addShippingMethod(cart_id, {
option_id
})
.then(({ cart }) => {
console.log(cart.id);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.collections.retrieve(collection_id)
.then(({ collection }) => {
console.log(collection.id);
});

View File

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

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
medusa.customers.retrieve()
.then(({ customer }) => {
console.log(customer.id);
});

View File

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

View File

@@ -0,0 +1,21 @@
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',
address_2: '',
province: 'Georgia',
metadata: {}
}
})
.then(({ customer }) => {
console.log(customer.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
medusa.customers.addresses.deleteAddress(address_id)
.then(({ customer }) => {
console.log(customer.id);
});

View File

@@ -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(address_id, {
first_name: 'Gina'
})
.then(({ customer }) => {
console.log(customer.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
medusa.customers.listOrders()
.then(({ orders, limit, offset, count }) => {
console.log(orders);
});

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
medusa.customers.paymentMethods.list()
.then(({ payment_methods }) => {
console.log(payment_methods.length);
});

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orders.retrieveByCartId(cart_id)
.then(({ order }) => {
console.log(order.id);
});

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.orders.retrieve(order_id)
.then(({ order }) => {
console.log(order.id);
});

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.products.retrieve(product_id)
.then(({ product }) => {
console.log(product.id);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.regions.retrieve(region_id)
.then(({ region }) => {
console.log(region.id);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.returnReasons.retrieve(reason_id)
.then(({ return_reason }) => {
console.log(return_reason.id);
});

View File

@@ -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(({ return }) => {
console.log(return.id);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.shippingOptions.listCartOptions(cart_id)
.then(({ shipping_options }) => {
console.log(shipping_options.length);
});

View File

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

View File

@@ -0,0 +1,6 @@
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.swaps.retrieveByCartId(cart_id)
.then(({ swap }) => {
console.log(swap.id);
});

View File

@@ -0,0 +1,2 @@
curl --location --request DELETE 'https://medusa-url.com/store/auth' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/store/auth' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/store/auth' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "supersecret"
}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/store/auth/user@example.com' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/carts'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/carts/{id}'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/complete'

View File

@@ -0,0 +1 @@
curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/discounts/{code}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items' \
--header 'Content-Type: application/json' \
--data-raw '{
"variant_id": "{variant_id}",
"quantity": 1
}'

View File

@@ -0,0 +1 @@
curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/line-items/{line_id}' \
--header 'Content-Type: application/json' \
--data-raw '{
"quantity": 1
}'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider_id": "manual"
}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions'

View File

@@ -0,0 +1 @@
curl --location --request DELETE 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {}
}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/payment-sessions/manual/refresh'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/shipping-methods' \
--header 'Content-Type: application/json' \
--data-raw '{
"option_id": "{option_id}",
}'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/carts/{id}/taxes'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/collections'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/collections/{id}'

View File

@@ -0,0 +1,8 @@
curl --location --request POST 'https://medusa-url.com/store/customers' \
--header 'Content-Type: application/json' \
--data-raw '{
"first_name": "Alec",
"last_name": "Reynolds",
"email": "user@example.com",
"password": "supersecret"
}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/store/customers/me' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/store/customers/me' \
--header 'Cookie: connect.sid={sid}' \
--header 'Content-Type: application/json' \
--data-raw '{
"first_name": "Laury"
}'

View File

@@ -0,0 +1,13 @@
curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses' \
--header 'Cookie: connect.sid={sid}' \
--header '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"
}
}'

View File

@@ -0,0 +1,2 @@
curl --location --request DELETE 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/store/customers/me/addresses/{address_id}' \
--header 'Cookie: connect.sid={sid}' \
--header 'Content-Type: application/json' \
--data-raw '{
"first_name": "Gina"
}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/store/customers/me/orders' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/store/customers/me/payment-methods' \
--header 'Cookie: connect.sid={sid}'

View File

@@ -0,0 +1,7 @@
curl --location --request POST 'https://medusa-url.com/store/customers/password-reset' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "supersecret",
"token": "supersecrettoken"
}'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/store/customers/password-token' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/gift-cards/{code}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/orders?display_id=1&email=user@example.com'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/orders/cart/{id}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/orders/{id}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/products'

View File

@@ -0,0 +1 @@
curl --location --request POST 'https://medusa-url.com/store/products/search?q=Shirt'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/products/{id}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/regions'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/regions/{id}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/return-reasons'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/return-reasons/{id}'

View File

@@ -0,0 +1,11 @@
curl --location --request POST 'https://medusa-url.com/store/returns' \
--header 'Content-Type: application/json' \
--data-raw '{
"order_id": "asfasf",
"items": [
{
"item_id": "assfasf",
"quantity": 1
}
]
}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/shipping-options'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/shipping-options/{cart_id}'

View File

@@ -0,0 +1,17 @@
curl --location --request POST 'https://medusa-url.com/store/swaps' \
--header 'Content-Type: application/json' \
--data-raw '{
"order_id": "asfasf",
"return_items": [
{
"item_id": "asfas",
"quantity": 1
}
],
"additional_items": [
{
"variant_id": "asfas",
"quantity": 1
}
]
}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/swaps/{cart_id}'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/variants'

View File

@@ -0,0 +1 @@
curl --location --request GET 'https://medusa-url.com/store/variants/{id}'