From c13573083878414b7464197673095d99fd4ec14f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:24:39 +0300 Subject: [PATCH] chore(docs): Generated API Reference (#5319) Co-authored-by: shahednasser --- .../delete.js | 12 +++++ .../delete.sh | 9 ++++ ...eListsPriceListProductsPricesBatchReq.yaml | 7 +++ .../api-reference/specs/admin/openapi.yaml | 2 + ...rice-lists_{id}_products_prices_batch.yaml | 50 +++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 www/apps/api-reference/specs/admin/code_samples/JavaScript/admin_price-lists_{id}_products_prices_batch/delete.js create mode 100644 www/apps/api-reference/specs/admin/code_samples/Shell/admin_price-lists_{id}_products_prices_batch/delete.sh create mode 100644 www/apps/api-reference/specs/admin/components/schemas/AdminDeletePriceListsPriceListProductsPricesBatchReq.yaml create mode 100644 www/apps/api-reference/specs/admin/paths/admin_price-lists_{id}_products_prices_batch.yaml diff --git a/www/apps/api-reference/specs/admin/code_samples/JavaScript/admin_price-lists_{id}_products_prices_batch/delete.js b/www/apps/api-reference/specs/admin/code_samples/JavaScript/admin_price-lists_{id}_products_prices_batch/delete.js new file mode 100644 index 0000000000..869d581a12 --- /dev/null +++ b/www/apps/api-reference/specs/admin/code_samples/JavaScript/admin_price-lists_{id}_products_prices_batch/delete.js @@ -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); +}); diff --git a/www/apps/api-reference/specs/admin/code_samples/Shell/admin_price-lists_{id}_products_prices_batch/delete.sh b/www/apps/api-reference/specs/admin/code_samples/Shell/admin_price-lists_{id}_products_prices_batch/delete.sh new file mode 100644 index 0000000000..69ebf12650 --- /dev/null +++ b/www/apps/api-reference/specs/admin/code_samples/Shell/admin_price-lists_{id}_products_prices_batch/delete.sh @@ -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" + ] +}' diff --git a/www/apps/api-reference/specs/admin/components/schemas/AdminDeletePriceListsPriceListProductsPricesBatchReq.yaml b/www/apps/api-reference/specs/admin/components/schemas/AdminDeletePriceListsPriceListProductsPricesBatchReq.yaml new file mode 100644 index 0000000000..4d0d099565 --- /dev/null +++ b/www/apps/api-reference/specs/admin/components/schemas/AdminDeletePriceListsPriceListProductsPricesBatchReq.yaml @@ -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 diff --git a/www/apps/api-reference/specs/admin/openapi.yaml b/www/apps/api-reference/specs/admin/openapi.yaml index 77cdab75c2..a04a18b846 100644 --- a/www/apps/api-reference/specs/admin/openapi.yaml +++ b/www/apps/api-reference/specs/admin/openapi.yaml @@ -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: diff --git a/www/apps/api-reference/specs/admin/paths/admin_price-lists_{id}_products_prices_batch.yaml b/www/apps/api-reference/specs/admin/paths/admin_price-lists_{id}_products_prices_batch.yaml new file mode 100644 index 0000000000..fd1187b069 --- /dev/null +++ b/www/apps/api-reference/specs/admin/paths/admin_price-lists_{id}_products_prices_batch.yaml @@ -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