docs: generate OAS manually for 2.7.0 (#12158)

* original changes

* changes

* fixes for delete operations

* generate oas
This commit is contained in:
Shahed Nasser
2025-04-11 16:41:39 +03:00
committed by GitHub
parent f8023f419e
commit cd66cdd2bb
1028 changed files with 29859 additions and 286 deletions

View File

@@ -1 +0,0 @@
curl -X POST '{backend_url}/auth/customer/github/callback?code=123'

View File

@@ -0,0 +1,33 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
const result = await sdk.auth.login(
"customer",
"emailpass",
{
email: "customer@gmail.com",
password: "supersecret"
}
)
if (typeof result !== "string") {
alert("Authentication requires additional steps")
// replace with the redirect logic of your application
window.location.href = result.location
return
}
// customer is now authenticated
// all subsequent requests will use the token in the header
const { customer } = await sdk.store.customer.retrieve()

View File

@@ -0,0 +1,28 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
await sdk.auth.callback(
"customer",
"google",
{
code: "123",
state: "456"
}
)
// all subsequent requests will use the token in the header
const { customer } = await sdk.store.customer.create({
email: "customer@gmail.com",
password: "supersecret"
})

View File

@@ -0,0 +1,28 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
await sdk.auth.register(
"customer",
"emailpass",
{
email: "customer@gmail.com",
password: "supersecret"
}
)
// all subsequent requests will use the token in the header
const { customer } = await sdk.store.customer.create({
email: "customer@gmail.com",
password: "supersecret"
})

View File

@@ -0,0 +1,24 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.auth.resetPassword(
"customer",
"emailpass",
{
identifier: "customer@gmail.com"
}
)
.then(() => {
// user receives token
})

View File

@@ -0,0 +1,25 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.auth.updateProvider(
"customer",
"emailpass",
{
password: "supersecret"
},
token
)
.then(() => {
// password updated
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
await sdk.auth.logout()
// customer is now logged out
// you can't send any requests that require authentication

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
const token = await sdk.auth.refresh()
// all subsequent requests will use the token in the header
const { customer } = await sdk.store.customer.retrieve()

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.create({
region_id: "reg_123"
})
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.retrieve("cart_123")
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.update("cart_123", {
region_id: "reg_123"
})
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,24 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.complete("cart_123")
.then((data) => {
if(data.type === "cart") {
// an error occurred
console.log(data.error, data.cart)
} else {
// order placed successfully
console.log(data.order)
}
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.transferCart("cart_123")
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,21 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.createLineItem("cart_123", {
variant_id: "variant_123",
quantity: 1
})
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,21 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.deleteLineItem(
"cart_123",
"li_123"
)
.then(({ deleted, parent: cart }) => {
console.log(deleted, cart)
})

View File

@@ -0,0 +1,24 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.updateLineItem(
"cart_123",
"li_123",
{
quantity: 1
}
)
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,23 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.cart.addShippingMethod("cart_123", {
option_id: "so_123",
data: {
// custom data for fulfillment provider.
}
})
.then(({ cart }) => {
console.log(cart)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.collection.list()
.then(({ collections, count, limit, offset }) => {
console.log(collections)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.collection.retrieve("pcol_123")
.then(({ collection }) => {
console.log(collection)
})

View File

@@ -0,0 +1,31 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
const token = await sdk.auth.register("customer", "emailpass", {
"email": "customer@gmail.com",
"password": "supersecret"
})
sdk.store.customer.create(
{
"email": "customer@gmail.com"
},
{},
{
Authorization: `Bearer ${token}`
}
)
.then(({ customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.retrieve()
.then(({ customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.update({
first_name: "John"
})
.then(({ customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.listAddress()
.then(({ addresses, count, offset, limit }) => {
console.log(addresses)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.createAddress({
country_code: "us"
})
.then(({ customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.deleteAddress("caddr_123")
.then(({ deleted, parent: customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.retrieveAddress(
"caddr_123"
)
.then(({ address }) => {
console.log(address)
})

View File

@@ -0,0 +1,23 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.customer.updateAddress(
"caddr_123",
{
country_code: "us"
}
)
.then(({ customer }) => {
console.log(customer)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.list()
.then(({ orders, count, offset, limit }) => {
console.log(orders)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.retrieve("order_123")
.then(({ order }) => {
console.log(order)
})

View File

@@ -0,0 +1,26 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.acceptTransfer(
"order_123",
{
token: "transfer_token"
},
{
Authorization: `Bearer ${token}`
}
)
.then(({ order }) => {
console.log(order)
})

View File

@@ -0,0 +1,24 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.cancelTransfer(
"order_123",
{},
{
Authorization: `Bearer ${token}`
}
)
.then(({ order }) => {
console.log(order)
})

View File

@@ -0,0 +1,26 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.declineTransfer(
"order_123",
{
token: "transfer_token"
},
{
Authorization: `Bearer ${token}`
}
)
.then(({ order }) => {
console.log(order)
})

View File

@@ -0,0 +1,27 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.order.requestTransfer(
"order_123",
{
description: "I want to transfer this order to my friend."
},
{},
{
Authorization: `Bearer ${token}`
}
)
.then(({ order }) => {
console.log(order)
})

View File

@@ -0,0 +1,26 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.payment.initiatePaymentSession(
cart, // assuming you already have the cart object.
{
provider_id: "pp_stripe_stripe",
data: {
// any data relevant for the provider.
}
}
)
.then(({ payment_collection }) => {
console.log(payment_collection)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.payment.listPaymentProviders({
region_id: "reg_123"
})
.then(({ payment_providers, count, offset, limit }) => {
console.log(payment_providers)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.category.list()
.then(({ product_categories, count, offset, limit }) => {
console.log(product_categories)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.category.retrieve("pcat_123")
.then(({ product_category }) => {
console.log(product_category)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.product.list()
.then(({ products, count, offset, limit }) => {
console.log(products)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.product.retrieve("prod_123")
.then(({ product }) => {
console.log(product)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.region.list()
.then(({ regions, count, limit, offset }) => {
console.log(regions)
})

View File

@@ -0,0 +1,18 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.region.retrieve("reg_123")
.then(({ region }) => {
console.log(region)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.fulfillment.listCartOptions({
cart_id: "cart_123"
})
.then(({ shipping_options }) => {
console.log(shipping_options)
})

View File

@@ -0,0 +1,20 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
sdk.store.fulfillment.calculate("so_123", {
cart_id: "cart_123"
})
.then(({ shipping_option }) => {
console.log(shipping_option)
})

View File

@@ -1,6 +0,0 @@
curl -X POST '{backend_url}/auth/customer/emailpass' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "customer@gmail.com",
"password": "supersecret"
}'

View File

@@ -1 +0,0 @@
curl -X POST '{backend_url}/auth/customer/google/callback?code=123'

View File

@@ -0,0 +1,28 @@
import Medusa from "@medusajs/js-sdk"
let MEDUSA_BACKEND_URL = "http://localhost:9000"
if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}
export const sdk = new Medusa({
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
await sdk.auth.callback(
"customer",
"github",
{
code: "123",
state: "456"
}
)
// all subsequent requests will use the token in the header
const { customer } = await sdk.store.customer.create({
email: "customer@gmail.com",
password: "supersecret"
})

View File

@@ -0,0 +1,44 @@
type: object
description: The details of the items to add to a draft order.
x-schemaName: AdminAddDraftOrderItems
properties:
items:
type: array
description: The items to add to the draft order.
items:
type: object
description: The item's details
required:
- quantity
properties:
quantity:
type: number
title: quantity
description: The item's quantity.
variant_id:
type: string
title: variant_id
description: The ID of the variant to add to the draft order.
title:
type: string
title: title
description: The item's title.
unit_price:
type: number
title: unit_price
description: The item's unit price.
compare_at_unit_price:
type: number
title: compare_at_unit_price
description: The original price of the item before a promotion or sale.
internal_note:
type: string
title: internal_note
description: A note viewed only by admin users about the item.
allow_backorder:
type: boolean
title: allow_backorder
description: Whether the item can be purchased if it's out of stock.
metadata:
type: object
description: The item's metadata, can hold custom key-value pairs.

View File

@@ -0,0 +1,13 @@
type: object
description: The details of the promotions to add to a draft order.
x-schemaName: AdminAddDraftOrderPromotions
required:
- promo_codes
properties:
promo_codes:
type: array
description: The list promotion codes to add to the draft order.
items:
type: string
title: promo_codes
description: A promotion's code.

View File

@@ -0,0 +1,27 @@
type: object
description: The details of the shipping method to add to a draft order.
x-schemaName: AdminAddDraftOrderShippingMethod
required:
- shipping_option_id
properties:
shipping_option_id:
type: string
title: shipping_option_id
description: The ID of the shipping option that this method is created from.
custom_amount:
type: number
title: custom_amount
description: >-
A custom amount to be charged for this shipping method. If not provided,
the shipping option's amount will be used.
description:
type: string
title: description
description: The shipping method's description.
internal_note:
type: string
title: internal_note
description: A note viewed only by admin users about the shipping method.
metadata:
type: object
description: The shipping method's metadata, can hold custom key-value pairs.

View File

@@ -0,0 +1,26 @@
type: object
description: The details of a credit line to add to an order.
x-schemaName: AdminCreateOrderCreditLines
required:
- amount
- reference
- reference_id
properties:
amount:
type: number
title: amount
description: The amount of the credit line.
example: 100
reference:
type: string
title: reference
description: The name of the table that the credit line is referencing.
example: order
reference_id:
type: string
title: reference_id
description: The ID of a record in the table that the credit line is referencing.
example: order_123
metadata:
type: object
description: The credit line's metadata, can hold custom key-value pairs.

View File

@@ -247,3 +247,10 @@ properties:
type: number
title: original_shipping_tax_total
description: The tax total of the draft order's shipping excluding promotions.
region:
$ref: ./AdminRegion.yaml
credit_lines:
type: array
description: The draft order's credit lines.
items:
$ref: ./OrderCreditLine.yaml

View File

@@ -0,0 +1,655 @@
type: object
description: The draft order preview's details.
x-schemaName: AdminDraftOrderPreview
required:
- return_requested_total
- order_change
- status
- currency_code
- id
- version
- region_id
- customer_id
- sales_channel_id
- email
- payment_collections
- payment_status
- fulfillment_status
- summary
- created_at
- updated_at
- original_item_total
- original_item_subtotal
- original_item_tax_total
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- gift_card_total
- gift_card_tax_total
- shipping_total
- shipping_subtotal
- shipping_tax_total
- original_shipping_total
- original_shipping_subtotal
- original_shipping_tax_total
properties:
return_requested_total:
type: number
title: return_requested_total
description: The total of the requested return.
order_change:
$ref: ./AdminOrderChange.yaml
items:
type: array
description: The order's items.
items:
allOf:
- type: object
description: An order's item.
x-schemaName: BaseOrderLineItem
required:
- id
- title
- subtitle
- thumbnail
- variant_id
- product_id
- product_title
- product_description
- product_subtitle
- product_type
- product_collection
- product_handle
- variant_sku
- variant_barcode
- variant_title
- variant_option_values
- requires_shipping
- is_discountable
- is_tax_inclusive
- unit_price
- quantity
- detail
- created_at
- updated_at
- metadata
- original_total
- original_subtotal
- original_tax_total
- item_total
- item_subtotal
- item_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- refundable_total
- refundable_total_per_unit
properties:
id:
type: string
title: id
description: The item's ID.
title:
type: string
title: title
description: The item's title.
subtitle:
type: string
title: subtitle
description: The item's subtitle.
thumbnail:
type: string
title: thumbnail
description: The URL of the item's thumbnail.
variant:
$ref: ./BaseProductVariant.yaml
variant_id:
type: string
title: variant_id
description: The ID of the associated variant.
product:
$ref: ./AdminProduct.yaml
product_id:
type: string
title: product_id
description: The ID of the associated product.
product_title:
type: string
title: product_title
description: The title of the item's product.
product_description:
type: string
title: product_description
description: The description of the item's product.
product_subtitle:
type: string
title: product_subtitle
description: The subtitle of the item's product.
product_type:
type: string
title: product_type
description: The ID of type of the item's product.
product_collection:
type: string
title: product_collection
description: The ID of collection of the item's product.
product_handle:
type: string
title: product_handle
description: The handle of the item's product.
variant_sku:
type: string
title: variant_sku
description: The SKU of the item's variant.
variant_barcode:
type: string
title: variant_barcode
description: The barcode of the item's variant.
variant_title:
type: string
title: variant_title
description: The title of the item's variant.
variant_option_values:
type: object
description: >-
The option values of the item's variant as key-value pairs. The
key is the title of an option, and the value is the option's
value.
requires_shipping:
type: boolean
title: requires_shipping
description: Whether the item requires shipping.
is_discountable:
type: boolean
title: is_discountable
description: Whether the item is discountable.
is_tax_inclusive:
type: boolean
title: is_tax_inclusive
description: Whether the item's price includes taxes.
compare_at_unit_price:
type: number
title: compare_at_unit_price
description: The original price of the item before a promotion or sale.
unit_price:
type: number
title: unit_price
description: The item's unit price.
quantity:
type: number
title: quantity
description: The item's quantity.
tax_lines:
type: array
description: The item's tax lines.
items:
$ref: ./BaseOrderLineItemTaxLine.yaml
adjustments:
type: array
description: The item's adjustments.
items:
$ref: ./BaseOrderLineItemAdjustment.yaml
detail:
$ref: ./BaseOrderItemDetail.yaml
created_at:
type: string
format: date-time
title: created_at
description: The date the item was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the item was updated.
metadata:
type: object
description: The item's metadata, can hold custom key-value pairs.
original_total:
type: number
title: original_total
description: The item's total including taxes, excluding promotions.
original_subtotal:
type: number
title: original_subtotal
description: The item's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The tax total of the item excluding promotions.
item_total:
type: number
title: item_total
description: >-
The item's total for a single unit including taxes and
promotions.
item_subtotal:
type: number
title: item_subtotal
description: >-
The item's total for a single unit excluding taxes, including
promotions.
item_tax_total:
type: number
title: item_tax_total
description: >-
The tax total for a single unit of the item including
promotions.
total:
type: number
title: total
description: The item's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The item's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The tax total of the item including promotions.
discount_total:
type: number
title: discount_total
description: The total of the item's discount / promotion.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of the item's discount / promotion
refundable_total:
type: number
title: refundable_total
description: The total refundable amount of the item's total.
refundable_total_per_unit:
type: number
title: refundable_total_per_unit
description: >-
The total refundable amount of the item's total for a single
unit.
- type: object
description: An order's item.
properties:
actions:
type: array
description: The actions applied on an item.
items:
type: object
description: The action's details.
x-schemaName: BaseOrderChangeAction
shipping_methods:
type: array
description: The order's shipping methods.
items:
allOf:
- type: object
description: The shipping method's details.
x-schemaName: BaseOrderShippingMethod
required:
- id
- order_id
- name
- amount
- is_tax_inclusive
- shipping_option_id
- data
- metadata
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- created_at
- updated_at
properties:
id:
type: string
title: id
description: The shipping method's ID.
order_id:
type: string
title: order_id
description: The ID of the order this shipping method belongs to.
name:
type: string
title: name
description: The shipping method's name.
description:
type: string
title: description
description: The shipping method's description.
amount:
type: number
title: amount
description: The shipping method's amount.
is_tax_inclusive:
type: boolean
title: is_tax_inclusive
description: Whether the shipping method's amount is tax inclusive.
shipping_option_id:
type: string
title: shipping_option_id
description: The ID of the shipping option this method was created from.
data:
type: object
description: >-
The data relevant for the fulfillment provider to process this
shipment.
externalDocs:
url: >-
https://docs.medusajs.com/v2/resources/commerce-modules/order/concepts#data-property
metadata:
type: object
description: The shipping method's metadata, can hold custom key-value pairs.
tax_lines:
type: array
description: The shipping method's tax lines.
items:
$ref: ./BaseOrderShippingMethodTaxLine.yaml
adjustments:
type: array
description: The shipping method's adjustments.
items:
$ref: ./BaseOrderShippingMethodAdjustment.yaml
original_total:
oneOf:
- type: string
title: original_total
description: >-
The shipping method's total including taxes, excluding
promotions.
- type: number
title: original_total
description: >-
The shipping method's total including taxes, excluding
promotions.
original_subtotal:
oneOf:
- type: string
title: original_subtotal
description: >-
The shipping method's total excluding taxes, including
promotions.
- type: number
title: original_subtotal
description: >-
The shipping method's total excluding taxes, including
promotions.
original_tax_total:
oneOf:
- type: string
title: original_tax_total
description: The tax total of the shipping method excluding promotions.
- type: number
title: original_tax_total
description: The tax total of the shipping method excluding promotions.
total:
oneOf:
- type: string
title: total
description: The shipping method's total including taxes and promotions.
- type: number
title: total
description: The shipping method's total including taxes and promotions.
subtotal:
oneOf:
- type: string
title: subtotal
description: >-
The shipping method's total excluding taxes, including
promotions.
- type: number
title: subtotal
description: >-
The shipping method's total excluding taxes, including
promotions.
tax_total:
oneOf:
- type: string
title: tax_total
description: The tax total of the shipping method including promotions.
- type: number
title: tax_total
description: The tax total of the shipping method including promotions.
discount_total:
oneOf:
- type: string
title: discount_total
description: The total of the shipping method's promotion.
- type: number
title: discount_total
description: The total of the shipping method's promotion.
discount_tax_total:
oneOf:
- type: string
title: discount_tax_total
description: The tax total of the shipping method's promotion.
- type: number
title: discount_tax_total
description: The shipping method's discount tax total.
created_at:
type: string
format: date-time
title: created_at
description: The date the shipping method was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the shipping method was updated.
- type: object
description: The shipping method's details.
properties:
actions:
type: array
description: The actions applied on the shipping method.
items:
type: object
description: The action's details.
x-schemaName: BaseOrderChangeAction
currency_code:
type: string
title: currency_code
description: The order's currency code.
version:
type: number
title: version
description: The order's version when this preview is applied.
id:
type: string
title: id
description: The order's ID.
region_id:
type: string
title: region_id
description: The ID of the order's associated region.
customer_id:
type: string
title: customer_id
description: The ID of the customer that placed the order.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel that the order was placed in.
email:
type: string
title: email
description: The email of the customer that placed the order.
format: email
display_id:
type: number
title: display_id
description: The order's display ID.
shipping_address:
$ref: ./AdminOrderAddress.yaml
billing_address:
$ref: ./AdminOrderAddress.yaml
payment_collections:
type: array
description: The order's payment collections.
items:
$ref: ./AdminPaymentCollection.yaml
payment_status:
type: string
description: The order's payment status.
enum:
- canceled
- not_paid
- awaiting
- authorized
- partially_authorized
- captured
- partially_captured
- partially_refunded
- refunded
- requires_action
fulfillments:
type: array
description: The order's fulfillments.
items:
$ref: ./AdminOrderFulfillment.yaml
fulfillment_status:
type: string
description: The order's fulfillment status.
enum:
- canceled
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_delivered
- delivered
transactions:
type: array
description: The order's transactions.
items:
$ref: ./BaseOrderTransaction.yaml
summary:
$ref: ./BaseOrderSummary.yaml
metadata:
type: object
description: The order's metadata, can hold custom key-value pairs.
created_at:
type: string
format: date-time
title: created_at
description: The date the order was created.
updated_at:
type: string
format: date-time
title: updated_at
description: The date the order was updated.
original_item_total:
type: number
title: original_item_total
description: The total of the order's items including taxes, excluding promotions.
original_item_subtotal:
type: number
title: original_item_subtotal
description: The total of the order's items excluding taxes, including promotions.
original_item_tax_total:
type: number
title: original_item_tax_total
description: The tax total of the order's items excluding promotions.
item_total:
type: number
title: item_total
description: The total of the order's items including taxes and promotions.
item_subtotal:
type: number
title: item_subtotal
description: The total of the order's items excluding taxes, including promotions.
item_tax_total:
type: number
title: item_tax_total
description: The tax total of the order's items including promotions.
original_total:
type: number
title: original_total
description: The order's total excluding promotions, including taxes.
original_subtotal:
type: number
title: original_subtotal
description: The order's total excluding taxes, including promotions.
original_tax_total:
type: number
title: original_tax_total
description: The order's tax total, excluding promotions.
total:
type: number
title: total
description: The order's total including taxes and promotions.
subtotal:
type: number
title: subtotal
description: The order's total excluding taxes, including promotions.
tax_total:
type: number
title: tax_total
description: The order's tax total including promotions.
discount_total:
type: number
title: discount_total
description: The order's discount or promotions total.
discount_tax_total:
type: number
title: discount_tax_total
description: The tax total of order's discount or promotion.
gift_card_total:
type: number
title: gift_card_total
description: The order's gift card total.
gift_card_tax_total:
type: number
title: gift_card_tax_total
description: The tax total of the order's gift card.
shipping_total:
type: number
title: shipping_total
description: The order's shipping total including taxes and promotions.
shipping_subtotal:
type: number
title: shipping_subtotal
description: The order's shipping total excluding taxes, including promotions.
shipping_tax_total:
type: number
title: shipping_tax_total
description: The tax total of the order's shipping.
original_shipping_total:
type: number
title: original_shipping_total
description: The order's shipping total including taxes, excluding promotions.
original_shipping_subtotal:
type: number
title: original_shipping_subtotal
description: The order's shipping total excluding taxes, including promotions.
original_shipping_tax_total:
type: number
title: original_shipping_tax_total
description: The tax total of the order's shipping excluding promotions.
customer:
$ref: ./AdminCustomer.yaml
sales_channel:
$ref: ./AdminSalesChannel.yaml
status:
type: string
title: status
description: The order's status.
region:
$ref: ./AdminRegion.yaml
credit_lines:
type: array
description: The order preview's credit lines.
items:
$ref: ./OrderCreditLine.yaml

View File

@@ -0,0 +1,8 @@
type: object
description: The details of the preview on the draft order.
x-schemaName: AdminDraftOrderPreviewResponse
required:
- draft_order_preview
properties:
draft_order_preview:
$ref: ./AdminDraftOrderPreview.yaml

View File

@@ -240,3 +240,10 @@ properties:
type: string
title: status
description: The order's status.
region:
$ref: ./AdminRegion.yaml
credit_lines:
type: array
description: The order's credit lines.
items:
$ref: ./OrderCreditLine.yaml

View File

@@ -648,3 +648,10 @@ properties:
type: string
title: status
description: The order's status.
region:
$ref: ./AdminRegion.yaml
credit_lines:
type: array
description: The order preview's credit lines.
items:
$ref: ./OrderCreditLine.yaml

View File

@@ -0,0 +1,10 @@
type: object
description: The plugin's details.
x-schemaName: AdminPlugin
required:
- name
properties:
name:
type: string
title: name
description: The plugin's name.

View File

@@ -0,0 +1,11 @@
type: object
description: The list of plugins.
x-schemaName: AdminPluginsListResponse
required:
- plugins
properties:
plugins:
type: array
description: The list of plugins.
items:
$ref: ./AdminPlugin.yaml

View File

@@ -0,0 +1,13 @@
type: object
description: The promotion codes to remove from the draft order.
x-schemaName: AdminRemoveDraftOrderPromotions
required:
- promo_codes
properties:
promo_codes:
type: array
description: The promotion codes to remove from the draft order.
items:
type: string
title: promo_codes
description: A promotion code to remove from the draft order.

View File

@@ -106,3 +106,11 @@ properties:
metadata:
type: object
description: The draft order's metadata, can hold custom key-value pairs.
customer_id:
type: string
title: customer_id
description: The ID of the customer associated with the draft order.
sales_channel_id:
type: string
title: sales_channel_id
description: The ID of the sales channel associated with the draft order.

View File

@@ -0,0 +1,27 @@
type: object
description: The updates to make on a changed shipping method.
x-schemaName: AdminUpdateDraftOrderActionShippingMethod
required:
- shipping_option_id
properties:
shipping_option_id:
type: string
title: shipping_option_id
description: The ID of the associated shipping option.
custom_amount:
type: number
title: custom_amount
description: >-
The custom amount of the shipping method. If not provided, the shipping
option's amount will be used.
description:
type: string
title: description
description: The shipping method's description.
internal_note:
type: string
title: internal_note
description: A note viewed only by admin users about the shipping method.
metadata:
type: object
description: The shipping method's metadata, can hold custom key-value pairs.

View File

@@ -0,0 +1,22 @@
type: object
description: The updates to make on a draft order's item.
x-schemaName: AdminUpdateDraftOrderItem
required:
- quantity
properties:
quantity:
type: number
title: quantity
description: The item's quantity.
unit_price:
type: number
title: unit_price
description: The item's unit price.
compare_at_unit_price:
type: number
title: compare_at_unit_price
description: The original price of the item before a promotion or sale.
internal_note:
type: string
title: internal_note
description: A note viewed only by admin users about the item.

View File

@@ -0,0 +1,18 @@
type: object
description: The updates to make on a draft order's shipping method.
x-schemaName: AdminUpdateDraftOrderShippingMethod
properties:
shipping_option_id:
type: string
title: shipping_option_id
description: The ID of the associated shipping option.
custom_amount:
type: number
title: custom_amount
description: >-
The custom amount of the shipping method. If not provided, the shipping
option's amount will be used.
internal_note:
type: string
title: internal_note
description: A note viewed only by admin users about the shipping method.

View File

@@ -97,6 +97,82 @@ properties:
summary:
type: object
description: The order's summary.
properties:
pending_difference:
type: number
title: pending_difference
description: The remaining amount to be paid or refunded.
current_order_total:
type: number
title: current_order_total
description: The order's current total.
original_order_total:
type: number
title: original_order_total
description: The order's total before any changes.
transaction_total:
type: number
title: transaction_total
description: >-
The total of the transactions (payments and refunds) made on the
order.
paid_total:
type: number
title: paid_total
description: The total paid amount.
refunded_total:
type: number
title: refunded_total
description: The total refunded amount.
credit_line_total:
type: number
title: credit_line_total
description: The total credit line amount.
accounting_total:
type: number
title: accounting_total
description: The total amount for accounting purposes.
raw_pending_difference:
type: object
description: The summary's raw pending difference.
raw_current_order_total:
type: object
description: The summary's raw current order total.
raw_original_order_total:
type: object
description: The summary's raw original order total.
raw_transaction_total:
type: object
description: The summary's raw transaction total.
raw_paid_total:
type: object
description: The summary's raw paid total.
raw_refunded_total:
type: object
description: The summary's raw refunded total.
raw_credit_line_total:
type: object
description: The summary's raw credit line total.
raw_accounting_total:
type: object
description: The summary's raw accounting total.
required:
- pending_difference
- current_order_total
- original_order_total
- transaction_total
- paid_total
- refunded_total
- credit_line_total
- accounting_total
- raw_pending_difference
- raw_current_order_total
- raw_original_order_total
- raw_transaction_total
- raw_paid_total
- raw_refunded_total
- raw_credit_line_total
- raw_accounting_total
metadata:
type: object
description: The order's metadata, can hold custom key-value pairs.
@@ -218,3 +294,7 @@ properties:
order.
items:
$ref: ./OrderCreditLine.yaml
is_draft_order:
type: boolean
title: is_draft_order
description: Whether the order is a draft order.

View File

@@ -6,6 +6,7 @@ required:
- title
- requires_shipping
- is_discountable
- is_giftcard
- is_tax_inclusive
- unit_price
- quantity
@@ -198,3 +199,7 @@ properties:
type: string
title: product_type_id
description: The ID of the associated product's type.
is_giftcard:
type: boolean
title: is_giftcard
description: Whether the item is a gift card.

View File

@@ -0,0 +1,13 @@
type: object
description: The promotion code to remove from the cart.
x-schemaName: StoreCartRemovePromotion
required:
- promo_codes
properties:
promo_codes:
type: array
description: The promotion code to remove from the cart.
items:
type: string
title: promo_codes
description: A promotion code to remove from the cart.

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ tags:
place an order.
externalDocs:
description: How to implement cart functionality in a storefront.
url: https://docs.medusajs.com/v2/resources/storefront-development/cart
url: https://docs.medusajs.com/resources/storefront-development/cart
x-associatedSchema:
$ref: ./components/schemas/StoreCart.yaml
- name: Collections
@@ -38,7 +38,7 @@ tags:
externalDocs:
description: How to list product collections in a storefront.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/products/collections/list
https://docs.medusajs.com/resources/storefront-development/products/collections/list
x-associatedSchema:
$ref: ./components/schemas/StoreCollection.yaml
- name: Currencies
@@ -55,7 +55,7 @@ tags:
externalDocs:
description: How to retrieve product variant prices in a storefront.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/products/price
https://docs.medusajs.com/resources/storefront-development/products/price
x-associatedSchema:
$ref: ./components/schemas/StoreCurrency.yaml
- name: Customers
@@ -70,7 +70,7 @@ tags:
These API routes allow customers to create and manage their accounts.
externalDocs:
description: How to implement customer account functionalities in a storefront.
url: https://docs.medusajs.com/v2/resources/storefront-development/customers
url: https://docs.medusajs.com/resources/storefront-development/customers
x-associatedSchema:
$ref: ./components/schemas/StoreCustomer.yaml
- name: Orders
@@ -90,7 +90,7 @@ tags:
externalDocs:
description: How to implement payment during checkout.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/checkout/payment
https://docs.medusajs.com/resources/storefront-development/checkout/payment
x-associatedSchema:
$ref: ./components/schemas/StorePaymentCollection.yaml
- name: Payment Providers
@@ -108,7 +108,7 @@ tags:
externalDocs:
description: How to implement payment during checkout.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/checkout/payment
https://docs.medusajs.com/resources/storefront-development/checkout/payment
x-associatedSchema:
$ref: ./components/schemas/StorePaymentProvider.yaml
- name: Product Categories
@@ -119,7 +119,7 @@ tags:
externalDocs:
description: How to list product categories in a storefront.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/products/categories/list
https://docs.medusajs.com/resources/storefront-development/products/categories/list
x-associatedSchema:
$ref: ./components/schemas/StoreProductCategory.yaml
- name: Product Tags
@@ -140,7 +140,7 @@ tags:
These API routes allow customers to browse products.
externalDocs:
description: How to list products, get their prices, and more in a storefront.
url: https://docs.medusajs.com/v2/resources/storefront-development/products
url: https://docs.medusajs.com/resources/storefront-development/products
x-associatedSchema:
$ref: ./components/schemas/StoreProduct.yaml
- name: Regions
@@ -156,7 +156,7 @@ tags:
Use these API routes to retrieve available regions in the store.
externalDocs:
description: How to retrieve and store selected region in a storefront.
url: https://docs.medusajs.com/v2/resources/storefront-development/regions
url: https://docs.medusajs.com/resources/storefront-development/regions
x-associatedSchema:
$ref: ./components/schemas/StoreRegion.yaml
- name: Return
@@ -191,7 +191,7 @@ tags:
externalDocs:
description: How to implement shipping during checkout.
url: >-
https://docs.medusajs.com/v2/resources/storefront-development/checkout/shipping
https://docs.medusajs.com/resources/storefront-development/checkout/shipping
x-associatedSchema:
$ref: ./components/schemas/StoreShippingOption.yaml
paths:

View File

@@ -40,10 +40,10 @@ post:
will override the provider's `callbackUrl` configurations in
`medusa-config.ts`.
x-codeSamples:
- lang: Shell
label: EmailPass Provider
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/Shell/auth_customer_{auth_provider}/post.sh
$ref: ../code_samples/JavaScript/auth_customer_{auth_provider}/post.js
- lang: Bash
label: Google Provider
source:

View File

@@ -28,14 +28,16 @@ post:
type: string
example: google
x-codeSamples:
- lang: Shell
- lang: JavaScript
label: Google Provider
source:
$ref: ../code_samples/Shell/auth_customer_{auth_provider}_callback/post.sh
- lang: Bash
$ref: >-
../code_samples/JavaScript/auth_customer_{auth_provider}_callback/post.js
- lang: TypeScript
label: GitHub Provider
source:
$ref: ../code_samples/Bash/auth_customer_{auth_provider}_callback/post.sh
$ref: >-
../code_samples/TypeScript/auth_customer_{auth_provider}_callback/post.ts
tags:
- Auth
responses:

View File

@@ -30,6 +30,11 @@ post:
email: customer@gmail.com
password: supersecret
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/auth_customer_{auth_provider}_register/post.js
- lang: Shell
label: cURL
source:

View File

@@ -44,6 +44,11 @@ post:
customer's email.
example: customer@gmail.com
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/auth_customer_{auth_provider}_reset-password/post.js
- lang: Shell
label: cURL
source:

View File

@@ -34,6 +34,11 @@ post:
email: customer@gmail.com
password: supersecret
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/auth_customer_{auth_provider}_update/post.js
- lang: Shell
label: cURL
source:

View File

@@ -42,6 +42,10 @@ delete:
description: Deletes the cookie session ID previously set for authentication.
x-authenticated: true
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/auth_session/delete.js
- lang: Shell
label: cURL
source:

View File

@@ -12,6 +12,10 @@ post:
description: 'Storefront development: Implement third-party (social) login.'
x-authenticated: true
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/auth_token_refresh/post.js
- lang: Shell
label: cURL
source:

View File

@@ -47,6 +47,10 @@ post:
`additional_data` parameter.
description: The cart's details.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts/post.js
- lang: Shell
label: cURL
source:

View File

@@ -39,6 +39,10 @@ get:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}/get.js
- lang: Shell
label: cURL
source:
@@ -125,6 +129,10 @@ post:
`additional_data` parameter.
description: The properties to update in the cart item.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}/post.js
- lang: Shell
label: cURL
source:

View File

@@ -41,6 +41,10 @@ post:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}_complete/post.js
- lang: Shell
label: cURL
source:

View File

@@ -46,6 +46,10 @@ post:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}_customer/post.js
- lang: Shell
label: cURL
source:

View File

@@ -47,6 +47,10 @@ post:
schema:
$ref: ../components/schemas/StoreAddCartLineItem.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}_line-items/post.js
- lang: Shell
label: cURL
source:

View File

@@ -53,6 +53,11 @@ post:
schema:
$ref: ../components/schemas/StoreUpdateCartLineItem.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/store_carts_{id}_line-items_{line_id}/post.js
- lang: Shell
label: cURL
source:
@@ -129,6 +134,11 @@ delete:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/store_carts_{id}_line-items_{line_id}/delete.js
- lang: Shell
label: cURL
source:

View File

@@ -140,3 +140,8 @@ delete:
'500':
$ref: ../components/responses/500_error.yaml
x-workflow: updateCartPromotionsWorkflow
requestBody:
content:
application/json:
schema:
$ref: ../components/schemas/StoreCartRemovePromotion.yaml

View File

@@ -66,6 +66,10 @@ post:
https://docs.medusajs.com/v2/resources/storefront-development/checkout/shipping#data-request-body-parameter
description: Learn more about the data parameter.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_carts_{id}_shipping-methods/post.js
- lang: Shell
label: cURL
source:

View File

@@ -672,6 +672,10 @@ get:
type: object
title: $or
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_collections/get.js
- lang: Shell
label: cURL
source:

View File

@@ -43,6 +43,10 @@ get:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_collections_{id}/get.js
- lang: Shell
label: cURL
source:

View File

@@ -43,6 +43,10 @@ post:
schema:
$ref: ../components/schemas/StoreCreateCustomer.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_customers/post.js
- lang: Shell
label: cURL
source:

View File

@@ -41,6 +41,10 @@ get:
- cookie_auth: []
- jwt_token: []
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_customers_me/get.js
- lang: Shell
label: cURL
source:
@@ -111,6 +115,10 @@ post:
schema:
$ref: ../components/schemas/StoreUpdateCustomer.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_customers_me/post.js
- lang: Shell
label: cURL
source:

View File

@@ -128,6 +128,10 @@ get:
- cookie_auth: []
- jwt_token: []
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_customers_me_addresses/get.js
- lang: Shell
label: cURL
source:
@@ -260,6 +264,10 @@ post:
type: object
description: Holds custom key-value pairs.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_customers_me_addresses/post.js
- lang: Shell
label: cURL
source:

View File

@@ -43,6 +43,11 @@ get:
- cookie_auth: []
- jwt_token: []
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/store_customers_me_addresses_{address_id}/get.js
- lang: Shell
label: cURL
source:
@@ -181,6 +186,11 @@ post:
type: object
description: Holds custom key-value pairs.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/store_customers_me_addresses_{address_id}/post.js
- lang: Shell
label: cURL
source:
@@ -255,6 +265,11 @@ delete:
- cookie_auth: []
- jwt_token: []
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: >-
../code_samples/JavaScript/store_customers_me_addresses_{address_id}/delete.js
- lang: Shell
label: cURL
source:

View File

@@ -134,6 +134,10 @@ get:
- draft
- archived
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders/get.js
- lang: Shell
label: cURL
source:

View File

@@ -39,6 +39,10 @@ get:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders_{id}/get.js
- lang: Shell
label: cURL
source:

View File

@@ -52,6 +52,10 @@ post:
schema:
$ref: ../components/schemas/StoreAcceptOrderTransfer.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders_{id}_transfer_accept/post.js
- lang: Shell
label: cURL
source:

View File

@@ -44,6 +44,10 @@ post:
externalDocs:
url: '#select-fields-and-relations'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders_{id}_transfer_cancel/post.js
- lang: Shell
label: cURL
source:

View File

@@ -48,6 +48,10 @@ post:
schema:
$ref: ../components/schemas/StoreDeclineOrderTransferRequest.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders_{id}_transfer_decline/post.js
- lang: Shell
label: cURL
source:

View File

@@ -49,6 +49,10 @@ post:
schema:
$ref: ../components/schemas/StoreRequestOrderTransfer.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_orders_{id}_transfer_request/post.js
- lang: Shell
label: cURL
source:

View File

@@ -42,6 +42,10 @@ post:
schema:
$ref: ../components/schemas/StoreCreatePaymentCollection.yaml
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_payment-collections/post.js
- lang: Shell
label: cURL
source:

View File

@@ -80,6 +80,10 @@ get:
title: region_id
description: Filter by a region ID.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_payment-providers/get.js
- lang: Shell
label: cURL
source:

View File

@@ -753,6 +753,10 @@ get:
title: name
description: A product category name.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_product-categories/get.js
- lang: Shell
label: cURL
source:

View File

@@ -83,6 +83,10 @@ get:
or select specific fields to make the response size smaller. For
example, `fields=category_children.id,category_children.name`.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_product-categories_{id}/get.js
- lang: Shell
label: cURL
source:

View File

@@ -838,6 +838,10 @@ get:
title: cart_id
description: The product's cart id.
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_products/get.js
- lang: Shell
label: cURL
source:

View File

@@ -133,6 +133,10 @@ get:
externalDocs:
url: '#pagination'
x-codeSamples:
- lang: JavaScript
label: JS SDK
source:
$ref: ../code_samples/JavaScript/store_products_{id}/get.js
- lang: Shell
label: cURL
source:

Some files were not shown because too many files have changed in this diff Show More