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

Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2022-11-09 18:30:06 +02:00
committed by GitHub
parent 884322447e
commit 325b1e9017
63 changed files with 2971 additions and 248 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 in or use api token
medusa.admin.currencies.list()
.then(({ currencies, count, offset, limit }) => {
console.log(currencies.length);
});

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 in or use api token
medusa.admin.currencies.update(code, {
includes_tax: true
})
.then(({ currency }) => {
console.log(currency.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 in or use api token
medusa.admin.discounts.deleteConditionResourceBatch(discount_id, condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.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 in or use api token
medusa.admin.discounts.addConditionResourceBatch(discount_id, condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.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.admin.orderEdits.list()
.then(({ order_edits, count, limit, offset }) => {
console.log(order_edits.length)
})

View File

@@ -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.orderEdit.create({ order_id, internal_note })
medusa.admin.orderEdits.create({ order_id })
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -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.orderEdits.delete(edit_id)
medusa.admin.orderEdits.delete(order_edit_id)
.then(({ id, object, deleted }) => {
console.log(id)
})

View File

@@ -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.orderEdit.retrieve(orderEditId)
medusa.admin.orderEdits.retrieve(orderEditId)
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -1,8 +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
const params = {internal_note: "internal reason XY"}
medusa.admin.orderEdit.update(orderEditId, params)
medusa.admin.orderEdits.update(order_edit_id, {
internal_note: "internal reason XY"
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -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.orderEdit.cancel(orderEditId)
medusa.admin.orderEdits.cancel(order_edit_id)
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -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.orderEdits.deleteItemChange(item_change_id, order_edit_id)
medusa.admin.orderEdits.deleteItemChange(order_edit_id, item_change_id)
.then(({ id, object, deleted }) => {
console.log(id)
})

View File

@@ -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.orderEdit.confirm(orderEditId)
medusa.admin.orderEdits.confirm(order_edit_id)
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -1,7 +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.orderEdit.addLineItem(order_edit_id, { variant_id, quantity })
.then(({ order_edit }) => {
console.log(order_edit.id)
})
medusa.admin.orderEdits.addLineItem(order_edit_id, {
variant_id,
quantity
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -1,7 +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.orderEdits.updateLineItem(order_edit_id, line_item_id)
medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id, {
quantity: 5
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -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.orderEdits.requestConfirmation(edit_id)
medusa.admin.orderEdits.requestConfirmation(order_edit_id)
.then({ order_edit }) => {
console.log(order_edit.id)
})

View File

@@ -9,6 +9,6 @@ medusa.admin.returns.receive(return_id, {
}
]
})
.then(({ return }) => {
console.log(return.id);
.then((data) => {
console.log(data.return.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.admin.uploads.createProtected(file)
.then(({ uploads }) => {
console.log(uploads.length);
});

View File

@@ -0,0 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/currencies' \
--header 'Authorization: Bearer {api_token}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/admin/currencies/{code}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"includes_tax": true
}'

View File

@@ -0,0 +1,6 @@
curl --location --request DELETE 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resources": [{ "id": "item_id" }]
}'

View File

@@ -0,0 +1,6 @@
curl --location --request POST 'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resources": [{ "id": "item_id" }]
}'

View File

@@ -0,0 +1,2 @@
curl --location --request GET 'https://medusa-url.com/admin/order-edits' \
--header 'Authorization: Bearer {api_token}'

View File

@@ -1,3 +1,4 @@
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" }'
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }'

View File

@@ -1,5 +1,5 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}' \
--header 'Authorization: Bearer {api_token}'
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"internal_note": "internal reason XY"

View File

@@ -1,2 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/cancel' \
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/cancel' \
--header 'Authorization: Bearer {api_token}'

View File

@@ -1,2 +1,2 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/confirm' \
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/confirm' \
--header 'Authorization: Bearer {api_token}'

View File

@@ -1,3 +1,4 @@
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 }'
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6", "quantity": 3 }'

View File

@@ -1,3 +1,4 @@
curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
--header 'Authorization: Bearer {api_token}'
-d '{ "quantity": 5 }'
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "quantity": 5 }'

View File

@@ -0,0 +1,5 @@
curl --location --request POST 'https://medusa-url.com/admin/uploads/protected' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: image/jpeg' \
--form 'files=@"<FILE_PATH_1>"' \
--form 'files=@"<FILE_PATH_1>"'