chore(docs): merge changes from master (#3780)
* chore(docs): Generated API Reference (#3761) Co-authored-by: shahednasser <shahednasser@users.noreply.github.com> * docs: fix typo (#3771) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: shahednasser <shahednasser@users.noreply.github.com> Co-authored-by: Andre Schweighofer <fidrelity@users.noreply.github.com>
This commit is contained in:
@@ -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.admin.inventoryItems.list()
|
||||
.then(({ inventory_items }) => {
|
||||
.then(({ inventory_items, count, offset, limit }) => {
|
||||
console.log(inventory_items.length);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
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.admin.inventoryItems.create(inventoryItemId, {
|
||||
medusa.admin.inventoryItems.create({
|
||||
variant_id: 'variant_123',
|
||||
sku: "sku-123",
|
||||
})
|
||||
.then(({ inventory_item }) => {
|
||||
console.log(inventory_item.id);
|
||||
|
||||
@@ -2,7 +2,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.admin.inventoryItems.createLocationLevel(inventoryItemId, {
|
||||
location_id: 'sloc',
|
||||
location_id: 'sloc_123',
|
||||
stocked_quantity: 10,
|
||||
})
|
||||
.then(({ inventory_item }) => {
|
||||
|
||||
@@ -1,9 +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.admin.orders.createReservation(order_id, line_item_id, {
|
||||
location_id
|
||||
})
|
||||
.then(({ reservation }) => {
|
||||
console.log(reservation.id);
|
||||
});
|
||||
@@ -1,7 +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.admin.productCategories.delete(product_category_id)
|
||||
medusa.admin.productCategories.delete(productCategoryId)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id);
|
||||
});
|
||||
|
||||
@@ -1,7 +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.admin.productCategories.retrieve(product_category_id)
|
||||
medusa.admin.productCategories.retrieve(productCategoryId)
|
||||
.then(({ product_category }) => {
|
||||
console.log(product_category.id);
|
||||
});
|
||||
|
||||
@@ -1,7 +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.admin.productCategories.update(product_category_id, {
|
||||
medusa.admin.productCategories.update(productCategoryId, {
|
||||
name: "Skinny Jeans"
|
||||
})
|
||||
.then(({ product_category }) => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
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.admin.productCategories.removeProducts(product_category_id, {
|
||||
medusa.admin.productCategories.removeProducts(productCategoryId, {
|
||||
product_ids: [
|
||||
{
|
||||
id: product_id
|
||||
id: productId
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
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.admin.productCategories.addProducts(product_category_id, {
|
||||
medusa.admin.productCategories.addProducts(productCategoryId, {
|
||||
product_ids: [
|
||||
{
|
||||
id: product_id
|
||||
id: productId
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,7 +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.admin.orders.retrieveReservations(order_id)
|
||||
.then(({ reservations }) => {
|
||||
console.log(reservations[0].id);
|
||||
});
|
||||
medusa.admin.reservations.list()
|
||||
.then(({ reservations, count, limit, offset }) => {
|
||||
console.log(reservations.length)
|
||||
})
|
||||
@@ -2,7 +2,11 @@ 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.admin.reservations.create({
|
||||
line_item_id: 'item_123',
|
||||
location_id: 'loc_123',
|
||||
inventory_item_id: 'iitem_123',
|
||||
quantity: 1
|
||||
})
|
||||
.then(({ reservations }) => {
|
||||
console.log(reservations.id);
|
||||
.then(({ reservation }) => {
|
||||
console.log(reservation.id);
|
||||
});
|
||||
|
||||
@@ -1,7 +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.admin.reservations.delete(reservation.id)
|
||||
medusa.admin.reservations.delete(reservationId)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id);
|
||||
});
|
||||
|
||||
@@ -1,7 +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.admin.reservations.retrieve(reservation_id)
|
||||
medusa.admin.reservations.retrieve(reservationId)
|
||||
.then(({ reservation }) => {
|
||||
console.log(reservation.id);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
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.admin.reservations.update(reservation.id, {
|
||||
medusa.admin.reservations.update(reservationId, {
|
||||
quantity: 3
|
||||
})
|
||||
.then(({ reservations }) => {
|
||||
console.log(reservations.id);
|
||||
.then(({ reservation }) => {
|
||||
console.log(reservation.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.admin.salesChannels.removeLocation(sales_channel_id, {
|
||||
location_id: 'App'
|
||||
medusa.admin.salesChannels.removeLocation(salesChannelId, {
|
||||
location_id: 'loc_id'
|
||||
})
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel.id);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.admin.salesChannels.addLocation(sales_channel_id, {
|
||||
location_id: 'App'
|
||||
medusa.admin.salesChannels.addLocation(salesChannelId, {
|
||||
location_id: 'loc_123'
|
||||
})
|
||||
.then(({ sales_channel }) => {
|
||||
console.log(sales_channel.id);
|
||||
|
||||
@@ -3,7 +3,6 @@ const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
// must be previously logged in or use api token
|
||||
medusa.admin.stockLocations.create({
|
||||
name: 'Main Warehouse',
|
||||
location_id: 'sloc'
|
||||
})
|
||||
.then(({ stock_location }) => {
|
||||
console.log(stock_location.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.admin.stockLocations.delete(stock_location_id)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id)
|
||||
})
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id)
|
||||
})
|
||||
|
||||
@@ -1,7 +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.admin.stockLocations.retrieve(stock_location_id)
|
||||
medusa.admin.stockLocations.retrieve(stockLocationId)
|
||||
.then(({ stock_location }) => {
|
||||
console.log(stock_location.id);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.admin.stockLocations.update(stock_location_id, {
|
||||
name: 'App'
|
||||
medusa.admin.stockLocations.update(stockLocationId, {
|
||||
name: 'Main Warehouse'
|
||||
})
|
||||
.then(({ stock_location }) => {
|
||||
console.log(stock_location.id);
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
curl --location --request GET 'https://medusa-url.com/admin/inventory-items' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json'
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
|
||||
@@ -3,5 +3,4 @@ curl --location --request POST 'https://medusa-url.com/admin/inventory-items' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"variant_id": "variant_123",
|
||||
"sku": "sku-123",
|
||||
}'
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
curl --location --request GET 'https://medusa-url.com/admin/inventory-items/{id}' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json'
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
curl --location --request GET 'https://medusa-url.com/admin/inventory-items/{id}/location-levels' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json'
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
|
||||
@@ -2,6 +2,6 @@ curl --location --request POST 'https://medusa-url.com/admin/inventory-items/{id
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"location_id": "sloc",
|
||||
"location_id": "sloc_123",
|
||||
"stocked_quantity": 10
|
||||
}'
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
curl --location --request DELETE 'https://medusa-url.com/admin/inventory-items/{id}/location-levels/{location_id}' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json'
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reservations' \
|
||||
curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reserve' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
curl --location \
|
||||
--request POST 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' \
|
||||
--request POST 'https://medusa-url.com/admin/product-categories/{id}/products/batch' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
||||
@@ -2,7 +2,8 @@ curl --location --request POST 'https://medusa-url.com/admin/reservations' \
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"resource_id": "{resource_id}",
|
||||
"resource_type": "order",
|
||||
"value": "We delivered this order"
|
||||
"line_item_id": "item_123",
|
||||
"location_id": "loc_123",
|
||||
"inventory_item_id": "iitem_123",
|
||||
"quantity": 1
|
||||
}'
|
||||
|
||||
@@ -2,5 +2,5 @@ curl --location --request DELETE 'https://medusa-url.com/admin/sales-channels/{i
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"locaton_id": "stock_location_id"
|
||||
"locaton_id": "loc_id"
|
||||
}'
|
||||
|
||||
@@ -2,5 +2,5 @@ curl --location --request POST 'https://medusa-url.com/admin/sales-channels/{id}
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"locaton_id": "stock_location_id"
|
||||
"locaton_id": "loc_123"
|
||||
}'
|
||||
|
||||
@@ -2,5 +2,5 @@ curl --location --request POST 'https://medusa-url.com/admin/stock-locations/{id
|
||||
--header 'Authorization: Bearer {api_token}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"name": "App"
|
||||
"name": "Main Warehouse"
|
||||
}'
|
||||
|
||||
Reference in New Issue
Block a user