Merge branch 'master' into develop
This commit is contained in:
@@ -15,9 +15,25 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators
|
||||
* parameters:
|
||||
* - (query) code {string} Code of the currency to search for.
|
||||
* - (query) includes_tax {boolean} Search for tax inclusive currencies.
|
||||
* - (query) order {string} to retrieve products in.
|
||||
* - (query) offset {string} How many products to skip in the result.
|
||||
* - (query) limit {string} Limit the number of products returned.
|
||||
* - (query) order {string} order to retrieve products in.
|
||||
* - (query) offset=0 {number} How many products to skip in the result.
|
||||
* - (query) limit=20 {number} Limit the number of products returned.
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
* source: |
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.currencies.list()
|
||||
* .then(({ currencies, count, offset, limit }) => {
|
||||
* console.log(currencies.length);
|
||||
* });
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/currencies' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* tags:
|
||||
* - Currency
|
||||
* responses:
|
||||
@@ -27,19 +43,19 @@ import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* count:
|
||||
* description: The number of Currency.
|
||||
* type: integer
|
||||
* offset:
|
||||
* description: The offset of the Currency query.
|
||||
* type: integer
|
||||
* limit:
|
||||
* description: The limit of the currency query.
|
||||
* type: integer
|
||||
* currencies:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/currency"
|
||||
* count:
|
||||
* type: integer
|
||||
* description: The total number of items available
|
||||
* offset:
|
||||
* type: integer
|
||||
* description: The number of items skipped before these items
|
||||
* limit:
|
||||
* type: integer
|
||||
* description: The number of items per page
|
||||
*/
|
||||
export default async (req: ExtendedRequest<Currency>, res) => {
|
||||
const currencyService: CurrencyService = req.scope.resolve("currencyService")
|
||||
|
||||
@@ -21,6 +21,28 @@ import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/ta
|
||||
* includes_tax:
|
||||
* type: boolean
|
||||
* description: "[EXPERIMENTAL] Tax included in prices of currency."
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
* source: |
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.currencies.update(code, {
|
||||
* includes_tax: true
|
||||
* })
|
||||
* .then(({ currency }) => {
|
||||
* console.log(currency.id);
|
||||
* });
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/currencies/{code}' \
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
* "includes_tax": true
|
||||
* }'
|
||||
* tags:
|
||||
* - Currency
|
||||
* responses:
|
||||
|
||||
@@ -15,6 +15,23 @@ import {
|
||||
* description: "Create an OrderEdit LineItem."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Order Edit.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* required:
|
||||
* - variant_id
|
||||
* - quantity
|
||||
* properties:
|
||||
* variant_id:
|
||||
* description: The ID of the variant ID to add
|
||||
* type: string
|
||||
* quantity:
|
||||
* description: The quantity to add
|
||||
* type: number
|
||||
* metadata:
|
||||
* description: An optional set of key-value pairs to hold additional information.
|
||||
* type: object
|
||||
* x-authenticated: true
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
@@ -23,16 +40,20 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.addLineItem(order_edit_id, { variant_id, quantity })
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
* medusa.admin.orderEdits.addLineItem(order_edit_id, {
|
||||
* variant_id,
|
||||
* quantity
|
||||
* })
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "variant_id": "some_variant_id", "quantity": 3 }'
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6", "quantity": 3 }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -21,14 +21,14 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.cancel(orderEditId)
|
||||
* medusa.admin.orderEdits.cancel(order_edit_id)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/cancel' \
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/cancel' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* security:
|
||||
* - api_token: []
|
||||
|
||||
@@ -21,14 +21,14 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.confirm(orderEditId)
|
||||
* medusa.admin.orderEdits.confirm(order_edit_id)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/:id/confirm' \
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/confirm' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* security:
|
||||
* - api_token: []
|
||||
|
||||
@@ -12,6 +12,19 @@ import {
|
||||
* operationId: "PostOrderEdits"
|
||||
* summary: "Create an OrderEdit"
|
||||
* description: "Creates an OrderEdit."
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* required:
|
||||
* - order_id
|
||||
* properties:
|
||||
* order_id:
|
||||
* description: The ID of the order to create the edit for.
|
||||
* type: string
|
||||
* internal_note:
|
||||
* description: An optional note to create for the order edit.
|
||||
* type: string
|
||||
* x-authenticated: true
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
@@ -20,7 +33,7 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.create({ order_id, internal_note })
|
||||
* medusa.admin.orderEdits.create({ order_id })
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
@@ -28,8 +41,9 @@ import {
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }'
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{ "order_id": "my_order_id", "internal_note": "my_optional_note" }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -17,7 +17,7 @@ import { OrderEditService } from "../../../../services"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdits.deleteItemChange(item_change_id, order_edit_id)
|
||||
* medusa.admin.orderEdits.deleteItemChange(order_edit_id, item_change_id)
|
||||
* .then(({ id, object, deleted }) => {
|
||||
* console.log(id)
|
||||
* })
|
||||
|
||||
@@ -16,7 +16,7 @@ import { OrderEditService } from "../../../../services"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdits.delete(edit_id)
|
||||
* medusa.admin.orderEdits.delete(order_edit_id)
|
||||
* .then(({ id, object, deleted }) => {
|
||||
* console.log(id)
|
||||
* })
|
||||
|
||||
@@ -19,7 +19,7 @@ import { FindParams } from "../../../../types/common"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.retrieve(orderEditId)
|
||||
* medusa.admin.orderEdits.retrieve(orderEditId)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
|
||||
@@ -23,9 +23,9 @@ import { IsOptional, IsString } from "class-validator"
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdit.list()
|
||||
* .then(({ order_edits }) => {
|
||||
* console.log(order_edits)
|
||||
* medusa.admin.orderEdits.list()
|
||||
* .then(({ order_edits, count, limit, offset }) => {
|
||||
* console.log(order_edits.length)
|
||||
* })
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
@@ -47,6 +47,15 @@ import { IsOptional, IsString } from "class-validator"
|
||||
* order_edits:
|
||||
* type: array
|
||||
* $ref: "#/components/schemas/order_edit"
|
||||
* count:
|
||||
* type: integer
|
||||
* description: The total number of items available
|
||||
* offset:
|
||||
* type: integer
|
||||
* description: The number of items skipped before these items
|
||||
* limit:
|
||||
* type: integer
|
||||
* description: The number of items per page
|
||||
* "400":
|
||||
* $ref: "#/components/responses/400_error"
|
||||
* "401":
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdits.requestConfirmation(edit_id)
|
||||
* medusa.admin.orderEdits.requestConfirmation(order_edit_id)
|
||||
* .then({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
|
||||
@@ -16,6 +16,16 @@ import {
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the Order Edit to update.
|
||||
* - (path) item_id=* {string} The ID of the order edit item to update.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* required:
|
||||
* - quantity
|
||||
* properties:
|
||||
* quantity:
|
||||
* description: The quantity to update
|
||||
* type: number
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -23,7 +33,9 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id)
|
||||
* medusa.admin.orderEdits.updateLineItem(order_edit_id, line_item_id, {
|
||||
* quantity: 5
|
||||
* })
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
@@ -31,8 +43,9 @@ import {
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* -d '{ "quantity": 5 }'
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{ "quantity": 5 }'
|
||||
* security:
|
||||
* - api_token: []
|
||||
* - cookie_auth: []
|
||||
|
||||
@@ -16,6 +16,14 @@ import {
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (path) id=* {string} The ID of the OrderEdit.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* internal_note:
|
||||
* description: An optional note to create or update for the order edit.
|
||||
* type: string
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
@@ -23,8 +31,9 @@ import {
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* // must be previously logged in or use api token
|
||||
* const params = {internal_note: "internal reason XY"}
|
||||
* medusa.admin.orderEdit.update(orderEditId, params)
|
||||
* medusa.admin.orderEdits.update(order_edit_id, {
|
||||
* internal_note: "internal reason XY"
|
||||
* })
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
@@ -32,7 +41,7 @@ import {
|
||||
* label: cURL
|
||||
* source: |
|
||||
* curl --location --request POST 'https://medusa-url.com/admin/order-edits/{id}' \
|
||||
* --header 'Authorization: Bearer {api_token}'
|
||||
* --header 'Authorization: Bearer {api_token}' \
|
||||
* --header 'Content-Type: application/json' \
|
||||
* --data-raw '{
|
||||
* "internal_note": "internal reason XY"
|
||||
|
||||
@@ -58,8 +58,8 @@ import { isDefined } from "../../../../utils"
|
||||
* }
|
||||
* ]
|
||||
* })
|
||||
* .then(({ return }) => {
|
||||
* console.log(return.id);
|
||||
* .then((data) => {
|
||||
* console.log(data.return.id);
|
||||
* });
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -21,7 +21,7 @@ import { MedusaError } from "medusa-core-utils"
|
||||
* source: |
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* medusa.orderEdit.complete(orderEditId)
|
||||
* medusa.orderEdits.complete(order_edit_id)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id)
|
||||
* })
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
* source: |
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* medusa.orderEdit.decline(orderEditId)
|
||||
* medusa.orderEdits.decline(order_edit_id)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id);
|
||||
* })
|
||||
|
||||
@@ -14,7 +14,7 @@ import { OrderEditService } from "../../../../services"
|
||||
* source: |
|
||||
* import Medusa from "@medusajs/medusa-js"
|
||||
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
||||
* medusa.orderEdit.retrieve(orderEditId)
|
||||
* medusa.orderEdits.retrieve(order_edit_id)
|
||||
* .then(({ order_edit }) => {
|
||||
* console.log(order_edit.id);
|
||||
* });
|
||||
|
||||
@@ -45,6 +45,15 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* items:
|
||||
* type: string
|
||||
* - in: query
|
||||
* name: sales_channel_id
|
||||
* style: form
|
||||
* explode: false
|
||||
* description: an array of sales channel IDs to filter the retrieved products by.
|
||||
* schema:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* - in: query
|
||||
* name: collection_id
|
||||
* style: form
|
||||
* explode: false
|
||||
|
||||
@@ -76,8 +76,8 @@ import { validator } from "../../../../utils/validator"
|
||||
* }
|
||||
* ]
|
||||
* })
|
||||
* .then(({ return }) => {
|
||||
* console.log(return.id);
|
||||
* .then((data) => {
|
||||
* console.log(data.return.id);
|
||||
* });
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
Reference in New Issue
Block a user