chore: generate API reference (#2410)
This commit is contained in:
@@ -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.admin.orderEdit.create({ order_id, internal_note })
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdits.delete(edit_id)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(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.admin.orderEdit.retrieve(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
@@ -0,0 +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
|
||||
const params = {internal_note: "internal reason XY"}
|
||||
medusa.admin.orderEdit.update(orderEditId, params)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdit.cancel(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdits.deleteItemChange(item_change_id, order_edit_id)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(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.admin.orderEdit.confirm(orderEditId)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdit.addLineItem(order_edit_id, { variant_id, quantity })
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdits.removeLineItem(order_edit_id, line_item_id)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdits.updateLineItem(order_edit_id, line_item_id)
|
||||
.then(({ order_edit }) => {
|
||||
console.log(order_edit.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.admin.orderEdits.requestConfirmation(edit_id)
|
||||
.then({ order_edit }) => {
|
||||
console.log(order_edit.id)
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
-d '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request DELETE 'https://medusa-url.com/admin/order-edits/{id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request GET 'https://medusa-url.com/admin/order-edits/{id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,6 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"internal_note": "internal reason XY"
|
||||
}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/cancel' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request DELETE 'https://medusa-url.com/admin/order-edits/{id}/changes/{change_id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/confirm' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,3 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
-d '{ "variant_id": "some_variant_id", "quantity": 3 }'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request DELETE 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
@@ -0,0 +1,3 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
-d '{ "quantity": 5 }'
|
||||
@@ -0,0 +1,2 @@
|
||||
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/request' \
|
||||
--header 'Authorization: Bearer {api_token}'
|
||||
Reference in New Issue
Block a user