Skip to content

Commit

Permalink
chore(docs): Generated API Reference (#5319)
Browse files Browse the repository at this point in the history
Co-authored-by: shahednasser <[email protected]>
  • Loading branch information
2 people authored and pKorsholm committed Oct 11, 2023
1 parent 6048fd5 commit 3dc0619
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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.priceLists.deleteProductsPrices(priceListId, {
product_ids: [
productId1,
productId2,
]
})
.then(({ ids, object, deleted }) => {
console.log(ids.length);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
curl -X DELETE '{backend_url}/admin/price-lists/{id}/products/prices/batch' \
-H 'x-medusa-access-token: {api_token}' \
-H 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
"prod_1",
"prod_2"
]
}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: object
properties:
product_ids:
description: The IDs of the products to delete their associated prices.
type: array
items:
type: string
2 changes: 2 additions & 0 deletions www/apps/api-reference/specs/admin/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ paths:
$ref: paths/admin_price-lists_{id}_prices_batch.yaml
/admin/price-lists/{id}/products:
$ref: paths/admin_price-lists_{id}_products.yaml
/admin/price-lists/{id}/products/prices/batch:
$ref: paths/admin_price-lists_{id}_products_prices_batch.yaml
/admin/price-lists/{id}/products/{product_id}/prices:
$ref: paths/admin_price-lists_{id}_products_{product_id}_prices.yaml
/admin/price-lists/{id}/variants/{variant_id}/prices:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
delete:
operationId: DeletePriceListsPriceListProductsPricesBatch
summary: Delete Product Prices
description: Delete all the prices associated with multiple products in a price list.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Price List
schema:
type: string
x-codegen:
method: deleteProductsPrices
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: >-
../code_samples/JavaScript/admin_price-lists_{id}_products_prices_batch/delete.js
- lang: Shell
label: cURL
source:
$ref: >-
../code_samples/Shell/admin_price-lists_{id}_products_prices_batch/delete.sh
security:
- api_token: []
- cookie_auth: []
- jwt_token: []
tags:
- Price Lists
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../components/schemas/AdminPriceListDeleteProductPricesRes.yaml
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml

0 comments on commit 3dc0619

Please sign in to comment.