chore(docs): Generated API reference (#2788)

This commit is contained in:
Shahed Nasser
2022-12-13 12:52:58 +02:00
committed by GitHub
parent a77b4a1b7e
commit 52a8e90aac
413 changed files with 11540 additions and 4501 deletions

View File

@@ -9,6 +9,7 @@ medusa.admin.discounts.create({
value: 10,
allocation: AllocationType.ITEM
},
regions: ['reg_XXXXXXXX'],
is_dynamic: false,
is_disabled: false
})

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.paymentCollections.delete(payment_collection_id)
.then(({ id, object, deleted }) => {
console.log(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.paymentCollections.retrieve(paymentCollectionId)
.then(({ payment_collection }) => {
console.log(payment_collection.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.paymentCollections.update(payment_collection_id, {
description: "Description of payCol"
})
.then(({ payment_collection }) => {
console.log(payment_collection.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.paymentCollections.markAsAuthorized(payment_collection_id)
.then(({ payment_collection }) => {
console.log(payment_collection.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.payments.retrieve(payment_id)
.then(({ payment }) => {
console.log(payment.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.payments.capturePayment(payment_id)
.then(({ payment }) => {
console.log(payment.id);
});

View File

@@ -0,0 +1,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.payments.refundPayment(payment_id, {
amount: 1000,
reason: 'return',
note: 'Do not like it',
})
.then(({ payment }) => {
console.log(payment.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.publishableApiKey.update(publishable_key_id, {
title: "new title"
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.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.publishableApiKeys.list()
.then(({ publishable_api_keys }) => {
console.log(publishable_api_keys)
})

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.publishableApiKey.create()
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.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.publishableApiKeys.listSalesChannels()
.then(({ sales_channels, limit, offset, count }) => {
console.log(sales_channels)
})

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.publishableApiKey.delete(key_id)
.then(({ id, object, deleted }) => {
console.log(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.publishableApiKey.retrieve(pubKeyId)
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.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.publishableApiKey.revoke()
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id)
})

View File

@@ -0,0 +1,13 @@
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.publishableApiKeys.removeSalesChannels(publishableApiKeyId, {
sales_channel_ids: [
{
id: channel_id
}
]
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id);
});

View File

@@ -0,0 +1,13 @@
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.publishableApiKeys.addSalesChannels(publishableApiKeyId, {
sales_channel_ids: [
{
id: channel_id
}
]
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id);
});