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
@@ -5,6 +5,27 @@
* description: Deletes the cookie session ID previously set for authentication.
* x-authenticated: true
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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
* - lang: Shell
* label: cURL
* source: |-
@@ -42,6 +42,30 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -65,6 +65,11 @@
* "500":
* $ref: "#/components/responses/500_error"
* x-workflow: updateCartPromotionsWorkflow
* requestBody:
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/StoreCartRemovePromotion"
*
*/
@@ -39,6 +39,27 @@
* - cookie_auth: []
* - jwt_token: []
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -32,6 +32,27 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -575,6 +575,27 @@
* type: object
* title: $or
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -35,6 +35,27 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -33,6 +33,27 @@
* - cookie_auth: []
* - jwt_token: []
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -114,6 +114,27 @@
* - cookie_auth: []
* - jwt_token: []
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -36,6 +36,29 @@
* - cookie_auth: []
* - jwt_token: []
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -122,6 +122,27 @@
* - draft
* - archived
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -32,6 +32,27 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -65,6 +65,29 @@
* title: region_id
* description: Filter by a region ID.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -637,6 +637,27 @@
* title: name
* description: A product category name.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -57,6 +57,27 @@
* pass `*category_children` to retreieve the fields of all child categories, 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: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -729,6 +729,27 @@
* title: cart_id
* description: The product's cart id.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -100,6 +100,27 @@
* externalDocs:
* url: "#pagination"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -127,6 +127,27 @@
* type: object
* title: $or
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -32,6 +32,27 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: curl '{backend_url}/store/regions/{id}'
@@ -96,6 +96,29 @@
* title: is_return
* description: Whether the shipping option can be used for returns.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -33,15 +33,42 @@
*
* For the Google and GitHub authentication providers, you can pass `callback_url` to indicate the URL in the frontend that the customer should be redirected to after completing their authentication. This will override the provider's `callbackUrl` configurations in `medusa-config.ts`.
* x-codeSamples:
* - lang: Shell
* label: EmailPass Provider
* source: |-
* curl -X POST '{backend_url}/auth/customer/emailpass' \
* -H 'Content-Type: application/json' \
* --data-raw '{
* "email": "customer@gmail.com",
* "password": "supersecret"
* }'
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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()
* - lang: Bash
* label: Google Provider
* source: |-
@@ -21,12 +21,68 @@
* type: string
* example: "google"
* x-codeSamples:
* - lang: Shell
* - lang: JavaScript
* label: Google Provider
* source: curl -X POST '{backend_url}/auth/customer/google/callback?code=123'
* - lang: Bash
* source: |-
* 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"
* })
* - lang: TypeScript
* label: GitHub Provider
* source: curl -X POST '{backend_url}/auth/customer/github/callback?code=123'
* source: |-
* 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"
* })
* tags:
* - Auth
* responses:
@@ -26,6 +26,37 @@
* email: "customer@gmail.com"
* password: "supersecret"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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"
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -32,6 +32,33 @@
* description: The customer's identifier for the selected auth provider. For example, for the `emailpass` auth provider, the value is the customer's email.
* example: "customer@gmail.com"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -27,6 +27,34 @@
* email: "customer@gmail.com"
* password: "supersecret"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -8,6 +8,27 @@
* description: "Storefront development: Implement third-party (social) login."
* x-authenticated: true
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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()
* - lang: Shell
* label: cURL
* source: |-
@@ -39,6 +39,29 @@
* description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
* description: The cart's details.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -47,6 +47,29 @@
* description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
* description: The properties to update in the cart item.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -35,6 +35,33 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* }
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -38,6 +38,27 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -41,6 +41,30 @@
* schema:
* $ref: "#/components/schemas/StoreAddCartLineItem"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -47,6 +47,33 @@
* schema:
* $ref: "#/components/schemas/StoreUpdateCartLineItem"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -55,6 +55,32 @@
* url: 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: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -34,6 +34,40 @@
* schema:
* $ref: "#/components/schemas/StoreCreateCustomer"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -37,6 +37,29 @@
* schema:
* $ref: "#/components/schemas/StoreUpdateCustomer"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -95,6 +95,29 @@
* type: object
* description: Holds custom key-value pairs.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -101,6 +101,32 @@
* type: object
* description: Holds custom key-value pairs.
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -42,6 +42,35 @@
* schema:
* $ref: "#/components/schemas/StoreAcceptOrderTransfer"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -35,6 +35,33 @@
* externalDocs:
* url: "#select-fields-and-relations"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -40,6 +40,35 @@
* schema:
* $ref: "#/components/schemas/StoreDeclineOrderTransferRequest"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -41,6 +41,36 @@
* schema:
* $ref: "#/components/schemas/StoreRequestOrderTransfer"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -34,6 +34,35 @@
* schema:
* $ref: "#/components/schemas/StoreCreatePaymentCollection"
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-
@@ -52,6 +52,29 @@
* externalDocs:
* url: https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property
* x-codeSamples:
* - lang: JavaScript
* label: JS SDK
* source: |-
* 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)
* })
* - lang: Shell
* label: cURL
* source: |-