From f04f5c34987a051b6c6ea2bd74c8c0278e09bdea Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 6 Apr 2023 18:28:27 +0300 Subject: [PATCH] docs(oas): fixed OAS comments for 1.8 endpoints (#3751) * docs(oas): fixed oas comments for 1.8 endpoints * generated changes --- ...tInventoryItemsItemLocationLevelsParams.ts | 8 -------- .../inventory-items/create-inventory-item.ts | 6 ++---- .../inventory-items/create-location-level.ts | 8 ++++---- .../inventory-items/delete-location-level.ts | 5 ++--- .../inventory-items/get-inventory-item.ts | 7 +++---- .../inventory-items/list-inventory-items.ts | 9 ++++----- .../inventory-items/list-location-levels.ts | 9 +++------ .../inventory-items/update-inventory-item.ts | 2 +- .../inventory-items/update-location-level.ts | 4 ++-- .../create-reservation-for-line-item.ts | 14 +------------- .../routes/admin/orders/get-reservations.ts | 14 ++------------ .../product-categories/add-products-batch.ts | 8 ++++---- .../delete-product-category.ts | 4 ++-- .../delete-products-batch.ts | 6 +++--- .../get-product-category.ts | 2 +- .../update-product-category.ts | 2 +- .../admin/reservations/create-reservation.ts | 19 ++++++++++++------- .../admin/reservations/delete-reservation.ts | 2 +- .../admin/reservations/get-reservation.ts | 4 ++-- .../admin/reservations/list-reservations.ts | 10 ++++++++++ .../admin/reservations/update-reservation.ts | 8 ++++---- .../associate-stock-location.ts | 10 +++++----- .../sales-channels/remove-stock-location.ts | 8 ++++---- .../stock-locations/create-stock-location.ts | 1 - .../stock-locations/delete-stock-location.ts | 6 +++--- .../stock-locations/get-stock-location.ts | 2 +- .../stock-locations/update-stock-location.ts | 6 +++--- 27 files changed, 80 insertions(+), 104 deletions(-) diff --git a/packages/generated/client-types/src/lib/models/AdminGetInventoryItemsItemLocationLevelsParams.ts b/packages/generated/client-types/src/lib/models/AdminGetInventoryItemsItemLocationLevelsParams.ts index b34dafab41..72078082ec 100644 --- a/packages/generated/client-types/src/lib/models/AdminGetInventoryItemsItemLocationLevelsParams.ts +++ b/packages/generated/client-types/src/lib/models/AdminGetInventoryItemsItemLocationLevelsParams.ts @@ -4,14 +4,6 @@ import { SetRelation, Merge } from "../core/ModelUtils" export interface AdminGetInventoryItemsItemLocationLevelsParams { - /** - * How many stock locations levels to skip in the result. - */ - offset?: number - /** - * Limit the number of stock locations levels returned. - */ - limit?: number /** * Comma separated list of relations to include in the results. */ diff --git a/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts b/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts index a11920692b..dcbcf8c43f 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/create-inventory-item.ts @@ -13,7 +13,7 @@ import { createInventoryItemTransaction } from "./transaction/create-inventory-i /** * @oas [post] /admin/inventory-items * operationId: "PostInventoryItems" - * summary: "Create an Inventory Item." + * summary: "Create an Inventory Item" * description: "Creates an Inventory Item." * x-authenticated: true * parameters: @@ -34,9 +34,8 @@ import { createInventoryItemTransaction } from "./transaction/create-inventory-i * 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.inventoryItems.create(inventoryItemId, { + * medusa.admin.inventoryItems.create({ * variant_id: 'variant_123', - * sku: "sku-123", * }) * .then(({ inventory_item }) => { * console.log(inventory_item.id); @@ -49,7 +48,6 @@ import { createInventoryItemTransaction } from "./transaction/create-inventory-i * --header 'Content-Type: application/json' \ * --data-raw '{ * "variant_id": "variant_123", - * "sku": "sku-123", * }' * security: * - api_token: [] diff --git a/packages/medusa/src/api/routes/admin/inventory-items/create-location-level.ts b/packages/medusa/src/api/routes/admin/inventory-items/create-location-level.ts index 3bdbce204d..2748da4344 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/create-location-level.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/create-location-level.ts @@ -6,8 +6,8 @@ import { FindParams } from "../../../../types/common" /** * @oas [post] /admin/inventory-items/{id}/location-levels * operationId: "PostInventoryItemsInventoryItemLocationLevels" - * summary: "Create an Inventory Location Level for a given Inventory Item." - * description: "Creates an Inventory Location Level for a given Inventory Item." + * summary: "Create an Inventory Level" + * description: "Creates an Inventory Level for a given Inventory Item." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Inventory Item. @@ -29,7 +29,7 @@ import { FindParams } from "../../../../types/common" * const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) * // must be previously logged in or use api token * medusa.admin.inventoryItems.createLocationLevel(inventoryItemId, { - * location_id: 'sloc', + * location_id: 'sloc_123', * stocked_quantity: 10, * }) * .then(({ inventory_item }) => { @@ -42,7 +42,7 @@ import { FindParams } from "../../../../types/common" * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ - * "location_id": "sloc", + * "location_id": "sloc_123", * "stocked_quantity": 10 * }' * security: diff --git a/packages/medusa/src/api/routes/admin/inventory-items/delete-location-level.ts b/packages/medusa/src/api/routes/admin/inventory-items/delete-location-level.ts index 3efbf92817..59951aa23c 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/delete-location-level.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/delete-location-level.ts @@ -6,7 +6,7 @@ import { EntityManager } from "typeorm" /** * @oas [delete] /admin/inventory-items/{id}/location-levels/{location_id} * operationId: "DeleteInventoryItemsInventoryIteLocationLevelsLocation" - * summary: "Delete a location level of an Inventory Item." + * summary: "Delete a Location Level" * description: "Delete a location level of an Inventory Item." * x-authenticated: true * parameters: @@ -29,8 +29,7 @@ import { EntityManager } from "typeorm" * label: cURL * source: | * curl --location --request DELETE 'https://medusa-url.com/admin/inventory-items/{id}/location-levels/{location_id}' \ - * --header 'Authorization: Bearer {api_token}' \ - * --header 'Content-Type: application/json' + * --header 'Authorization: Bearer {api_token}' * security: * - api_token: [] * - cookie_auth: [] diff --git a/packages/medusa/src/api/routes/admin/inventory-items/get-inventory-item.ts b/packages/medusa/src/api/routes/admin/inventory-items/get-inventory-item.ts index 14845e8c03..8371677560 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/get-inventory-item.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/get-inventory-item.ts @@ -6,8 +6,8 @@ import { joinLevels } from "./utils/join-levels" /** * @oas [get] /admin/inventory-items/{id} * operationId: "GetInventoryItemsInventoryItem" - * summary: "Retrive an Inventory Item." - * description: "Retrives an Inventory Item." + * summary: "Get an Inventory Item" + * description: "Retrieves an Inventory Item." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Inventory Item. @@ -31,8 +31,7 @@ import { joinLevels } from "./utils/join-levels" * label: cURL * source: | * curl --location --request GET 'https://medusa-url.com/admin/inventory-items/{id}' \ - * --header 'Authorization: Bearer {api_token}' \ - * --header 'Content-Type: application/json' + * --header 'Authorization: Bearer {api_token}' * security: * - api_token: [] * - cookie_auth: [] diff --git a/packages/medusa/src/api/routes/admin/inventory-items/list-inventory-items.ts b/packages/medusa/src/api/routes/admin/inventory-items/list-inventory-items.ts index 1cc0000fd0..513413df0e 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/list-inventory-items.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/list-inventory-items.ts @@ -18,8 +18,8 @@ import { getVariantsByInventoryItemId } from "./utils/join-variants" /** * @oas [get] /admin/inventory-items * operationId: "GetInventoryItems" - * summary: "List inventory items." - * description: "Lists inventory items." + * summary: "List Inventory Items" + * description: "Lists inventory items with the ability to apply filters or search queries on them." * x-authenticated: true * parameters: * - (query) offset=0 {integer} How many inventory items to skip in the result. @@ -58,15 +58,14 @@ import { getVariantsByInventoryItemId } from "./utils/join-variants" * const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) * // must be previously logged in or use api token * medusa.admin.inventoryItems.list() - * .then(({ inventory_items }) => { + * .then(({ inventory_items, count, offset, limit }) => { * console.log(inventory_items.length); * }); * - lang: Shell * label: cURL * source: | * curl --location --request GET 'https://medusa-url.com/admin/inventory-items' \ - * --header 'Authorization: Bearer {api_token}' \ - * --header 'Content-Type: application/json' + * --header 'Authorization: Bearer {api_token}' * security: * - api_token: [] * - cookie_auth: [] diff --git a/packages/medusa/src/api/routes/admin/inventory-items/list-location-levels.ts b/packages/medusa/src/api/routes/admin/inventory-items/list-location-levels.ts index 6c3c557b13..2037eb3ad7 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/list-location-levels.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/list-location-levels.ts @@ -5,13 +5,11 @@ import { FindParams } from "../../../../types/common" /** * @oas [get] /admin/inventory-items/{id}/location-levels * operationId: "GetInventoryItemsInventoryItemLocationLevels" - * summary: "List stock levels of a given location." - * description: "Lists stock levels of a given location." + * summary: "List Inventory Levels" + * description: "Lists inventory levels of an inventory item." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Inventory Item. - * - (query) offset=0 {integer} How many stock locations levels to skip in the result. - * - (query) limit=20 {integer} Limit the number of stock locations levels returned. * - (query) expand {string} Comma separated list of relations to include in the results. * - (query) fields {string} Comma separated list of fields to include in the results. * x-codegen: @@ -32,8 +30,7 @@ import { FindParams } from "../../../../types/common" * label: cURL * source: | * curl --location --request GET 'https://medusa-url.com/admin/inventory-items/{id}/location-levels' \ - * --header 'Authorization: Bearer {api_token}' \ - * --header 'Content-Type: application/json' + * --header 'Authorization: Bearer {api_token}' * security: * - api_token: [] * - cookie_auth: [] diff --git a/packages/medusa/src/api/routes/admin/inventory-items/update-inventory-item.ts b/packages/medusa/src/api/routes/admin/inventory-items/update-inventory-item.ts index 95a431bd92..807226cfd7 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/update-inventory-item.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/update-inventory-item.ts @@ -7,7 +7,7 @@ import { FindParams } from "../../../../types/common" /** * @oas [post] /admin/inventory-items/{id} * operationId: "PostInventoryItemsInventoryItem" - * summary: "Update an Inventory Item." + * summary: "Update an Inventory Item" * description: "Updates an Inventory Item." * x-authenticated: true * parameters: diff --git a/packages/medusa/src/api/routes/admin/inventory-items/update-location-level.ts b/packages/medusa/src/api/routes/admin/inventory-items/update-location-level.ts index 00e44f68b0..b61264b2a5 100644 --- a/packages/medusa/src/api/routes/admin/inventory-items/update-location-level.ts +++ b/packages/medusa/src/api/routes/admin/inventory-items/update-location-level.ts @@ -7,8 +7,8 @@ import { FindParams } from "../../../../types/common" /** * @oas [post] /admin/inventory-items/{id}/location-levels/{location_id} * operationId: "PostInventoryItemsInventoryItemLocationLevelsLocationLevel" - * summary: "Update an Inventory Location Level for a given Inventory Item." - * description: "Updates an Inventory Location Level for a given Inventory Item." + * summary: "Update an Inventory Level" + * description: "Updates an Inventory Level for a given Inventory Item." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Inventory Item. diff --git a/packages/medusa/src/api/routes/admin/orders/create-reservation-for-line-item.ts b/packages/medusa/src/api/routes/admin/orders/create-reservation-for-line-item.ts index faa6e7164e..1e8b51ec99 100644 --- a/packages/medusa/src/api/routes/admin/orders/create-reservation-for-line-item.ts +++ b/packages/medusa/src/api/routes/admin/orders/create-reservation-for-line-item.ts @@ -20,22 +20,10 @@ import { * schema: * $ref: "#/components/schemas/AdminOrdersOrderLineItemReservationReq" * 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.orders.createReservation(order_id, line_item_id, { - * location_id - * }) - * .then(({ reservation }) => { - * console.log(reservation.id); - * }); * - lang: Shell * label: cURL * source: | - * curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reservations' \ + * curl --location --request POST 'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reserve' \ * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ diff --git a/packages/medusa/src/api/routes/admin/orders/get-reservations.ts b/packages/medusa/src/api/routes/admin/orders/get-reservations.ts index b3f4bef6f0..3ab0d165a2 100644 --- a/packages/medusa/src/api/routes/admin/orders/get-reservations.ts +++ b/packages/medusa/src/api/routes/admin/orders/get-reservations.ts @@ -6,24 +6,14 @@ import { extendedFindParamsMixin } from "../../../../types/common" /** * @oas [get] /admin/orders/{id}/reservations * operationId: "GetOrdersOrderReservations" - * summary: "Get reservations for an Order" - * description: "Retrieves reservations for an Order" + * summary: "Get reservations of an Order" + * description: "Retrieves reservations of an Order" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Order. * - (query) offset=0 {integer} How many reservations to skip before the results. * - (query) limit=20 {integer} Limit the number of reservations 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.orders.retrieveReservations(order_id) - * .then(({ reservations }) => { - * console.log(reservations[0].id); - * }); * - lang: Shell * label: cURL * source: | diff --git a/packages/medusa/src/api/routes/admin/product-categories/add-products-batch.ts b/packages/medusa/src/api/routes/admin/product-categories/add-products-batch.ts index 02c27a088e..cfd21e4ced 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/add-products-batch.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/add-products-batch.ts @@ -10,7 +10,7 @@ import { FindParams } from "../../../../types/common" /** * @oas [post] /admin/product-categories/{id}/products/batch * operationId: "PostProductCategoriesCategoryProductsBatch" - * summary: "Add Products to a category" + * summary: "Add Products to a Category" * description: "Assign a batch of products to a product category." * x-authenticated: true * parameters: @@ -32,10 +32,10 @@ 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.productCategories.addProducts(product_category_id, { + * medusa.admin.productCategories.addProducts(productCategoryId, { * product_ids: [ * { - * id: product_id + * id: productId * } * ] * }) @@ -46,7 +46,7 @@ import { FindParams } from "../../../../types/common" * label: cURL * source: | * curl --location \ - * --request POST 'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch' \ + * --request POST 'https://medusa-url.com/admin/product-categories/{id}/products/batch' \ * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ diff --git a/packages/medusa/src/api/routes/admin/product-categories/delete-product-category.ts b/packages/medusa/src/api/routes/admin/product-categories/delete-product-category.ts index 43d3889219..b3d2191266 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/delete-product-category.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/delete-product-category.ts @@ -7,7 +7,7 @@ import { ProductCategoryService } from "../../../../services" * @oas [delete] /admin/product-categories/{id} * operationId: "DeleteProductCategoriesCategory" * summary: "Delete a Product Category" - * description: "Deletes a ProductCategory." + * description: "Deletes a Product Category." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Product Category @@ -20,7 +20,7 @@ import { ProductCategoryService } 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.productCategories.delete(product_category_id) + * medusa.admin.productCategories.delete(productCategoryId) * .then(({ id, object, deleted }) => { * console.log(id); * }); diff --git a/packages/medusa/src/api/routes/admin/product-categories/delete-products-batch.ts b/packages/medusa/src/api/routes/admin/product-categories/delete-products-batch.ts index 4f4e029007..45cb3765b3 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/delete-products-batch.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/delete-products-batch.ts @@ -10,7 +10,7 @@ import { FindParams } from "../../../../types/common" /** * @oas [delete] /admin/product-categories/{id}/products/batch * operationId: "DeleteProductCategoriesCategoryProductsBatch" - * summary: "Delete Products" + * summary: "Remove Products from Category" * description: "Remove a list of products from a product category." * x-authenticated: true * parameters: @@ -32,10 +32,10 @@ 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.productCategories.removeProducts(product_category_id, { + * medusa.admin.productCategories.removeProducts(productCategoryId, { * product_ids: [ * { - * id: product_id + * id: productId * } * ] * }) diff --git a/packages/medusa/src/api/routes/admin/product-categories/get-product-category.ts b/packages/medusa/src/api/routes/admin/product-categories/get-product-category.ts index 1dad16494b..28ea56824c 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/get-product-category.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/get-product-category.ts @@ -24,7 +24,7 @@ import { defaultAdminProductCategoryRelations } from "." * 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.productCategories.retrieve(product_category_id) + * medusa.admin.productCategories.retrieve(productCategoryId) * .then(({ product_category }) => { * console.log(product_category.id); * }); diff --git a/packages/medusa/src/api/routes/admin/product-categories/update-product-category.ts b/packages/medusa/src/api/routes/admin/product-categories/update-product-category.ts index e4ae558908..7ee6ef7372 100644 --- a/packages/medusa/src/api/routes/admin/product-categories/update-product-category.ts +++ b/packages/medusa/src/api/routes/admin/product-categories/update-product-category.ts @@ -31,7 +31,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.productCategories.update(product_category_id, { + * medusa.admin.productCategories.update(productCategoryId, { * name: "Skinny Jeans" * }) * .then(({ product_category }) => { diff --git a/packages/medusa/src/api/routes/admin/reservations/create-reservation.ts b/packages/medusa/src/api/routes/admin/reservations/create-reservation.ts index 96273c5331..e069d55eed 100644 --- a/packages/medusa/src/api/routes/admin/reservations/create-reservation.ts +++ b/packages/medusa/src/api/routes/admin/reservations/create-reservation.ts @@ -6,8 +6,8 @@ import { validateUpdateReservationQuantity } from "./utils/validate-reservation- /** * @oas [post] /admin/reservations * operationId: "PostReservations" - * summary: "Creates a Reservation" - * description: "Creates a Reservation which can be associated with any resource as required." + * summary: "Create a Reservation" + * description: "Create a Reservation which can be associated with any resource as required." * x-authenticated: true * requestBody: * content: @@ -22,9 +22,13 @@ import { validateUpdateReservationQuantity } from "./utils/validate-reservation- * const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) * // must be previously logged in or use api token * medusa.admin.reservations.create({ + * line_item_id: 'item_123', + * location_id: 'loc_123', + * inventory_item_id: 'iitem_123', + * quantity: 1 * }) - * .then(({ reservations }) => { - * console.log(reservations.id); + * .then(({ reservation }) => { + * console.log(reservation.id); * }); * - lang: Shell * label: cURL @@ -33,9 +37,10 @@ import { validateUpdateReservationQuantity } from "./utils/validate-reservation- * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ - * "resource_id": "{resource_id}", - * "resource_type": "order", - * "value": "We delivered this order" + * "line_item_id": "item_123", + * "location_id": "loc_123", + * "inventory_item_id": "iitem_123", + * "quantity": 1 * }' * security: * - api_token: [] diff --git a/packages/medusa/src/api/routes/admin/reservations/delete-reservation.ts b/packages/medusa/src/api/routes/admin/reservations/delete-reservation.ts index d9c2f6062e..76ff8cf1f0 100644 --- a/packages/medusa/src/api/routes/admin/reservations/delete-reservation.ts +++ b/packages/medusa/src/api/routes/admin/reservations/delete-reservation.ts @@ -18,7 +18,7 @@ import { EntityManager } from "typeorm" * 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.reservations.delete(reservation.id) + * medusa.admin.reservations.delete(reservationId) * .then(({ id, object, deleted }) => { * console.log(id); * }); diff --git a/packages/medusa/src/api/routes/admin/reservations/get-reservation.ts b/packages/medusa/src/api/routes/admin/reservations/get-reservation.ts index d291ac91e7..5f158f91ab 100644 --- a/packages/medusa/src/api/routes/admin/reservations/get-reservation.ts +++ b/packages/medusa/src/api/routes/admin/reservations/get-reservation.ts @@ -5,7 +5,7 @@ import { MedusaError } from "@medusajs/utils" * @oas [get] /admin/reservations/{id} * operationId: "GetReservationsReservation" * summary: "Get a Reservation" - * description: "Retrieves a single reservation using its id" + * description: "Retrieves a single reservation using its ID" * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the reservation to retrieve. @@ -16,7 +16,7 @@ import { MedusaError } from "@medusajs/utils" * 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.reservations.retrieve(reservation_id) + * medusa.admin.reservations.retrieve(reservationId) * .then(({ reservation }) => { * console.log(reservation.id); * }); diff --git a/packages/medusa/src/api/routes/admin/reservations/list-reservations.ts b/packages/medusa/src/api/routes/admin/reservations/list-reservations.ts index 4cd0e5e5b3..45e8ed8af8 100644 --- a/packages/medusa/src/api/routes/admin/reservations/list-reservations.ts +++ b/packages/medusa/src/api/routes/admin/reservations/list-reservations.ts @@ -67,6 +67,16 @@ import { * method: list * queryParams: AdminGetReservationsParams * 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.reservations.list() + * .then(({ reservations, count, limit, offset }) => { + * console.log(reservations.length) + * }) * - lang: Shell * label: cURL * source: | diff --git a/packages/medusa/src/api/routes/admin/reservations/update-reservation.ts b/packages/medusa/src/api/routes/admin/reservations/update-reservation.ts index b010e15f28..61d7b669a7 100644 --- a/packages/medusa/src/api/routes/admin/reservations/update-reservation.ts +++ b/packages/medusa/src/api/routes/admin/reservations/update-reservation.ts @@ -8,7 +8,7 @@ import { validateUpdateReservationQuantity } from "./utils/validate-reservation- /** * @oas [post] /admin/reservations/{id} * operationId: "PostReservationsReservation" - * summary: "Updates a Reservation" + * summary: "Update a Reservation" * description: "Updates a Reservation which can be associated with any resource as required." * x-authenticated: true * parameters: @@ -25,11 +25,11 @@ import { validateUpdateReservationQuantity } from "./utils/validate-reservation- * 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.reservations.update(reservation.id, { + * medusa.admin.reservations.update(reservationId, { * quantity: 3 * }) - * .then(({ reservations }) => { - * console.log(reservations.id); + * .then(({ reservation }) => { + * console.log(reservation.id); * }); * - lang: Shell * label: cURL diff --git a/packages/medusa/src/api/routes/admin/sales-channels/associate-stock-location.ts b/packages/medusa/src/api/routes/admin/sales-channels/associate-stock-location.ts index 64b5698460..2c6678894d 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/associate-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/associate-stock-location.ts @@ -10,8 +10,8 @@ import { /** * @oas [post] /admin/sales-channels/{id}/stock-locations * operationId: "PostSalesChannelsSalesChannelStockLocation" - * summary: "Associate a stock location to a Sales Channel" - * description: "Associates a stock location to a Sales Channel." + * summary: "Associate a Stock Location" + * description: "Associates a stock location with a Sales Channel." * x-authenticated: true * parameters: * - (path) id=* {string} The ID of the Sales Channel. @@ -29,8 +29,8 @@ 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.salesChannels.addLocation(sales_channel_id, { - * location_id: 'App' + * medusa.admin.salesChannels.addLocation(salesChannelId, { + * location_id: 'loc_123' * }) * .then(({ sales_channel }) => { * console.log(sales_channel.id); @@ -42,7 +42,7 @@ import { * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ - * "locaton_id": "stock_location_id" + * "locaton_id": "loc_123" * }' * security: * - api_token: [] diff --git a/packages/medusa/src/api/routes/admin/sales-channels/remove-stock-location.ts b/packages/medusa/src/api/routes/admin/sales-channels/remove-stock-location.ts index d2e2eaee75..50000d344f 100644 --- a/packages/medusa/src/api/routes/admin/sales-channels/remove-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/sales-channels/remove-stock-location.ts @@ -7,7 +7,7 @@ import { SalesChannelLocationService } from "../../../../services" /** * @oas [delete] /admin/sales-channels/{id}/stock-locations * operationId: "DeleteSalesChannelsSalesChannelStockLocation" - * summary: "Remove a stock location from a Sales Channel" + * summary: "Remove a Stock Location Association" * description: "Removes a stock location from a Sales Channel." * x-authenticated: true * parameters: @@ -26,8 +26,8 @@ import { SalesChannelLocationService } 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.salesChannels.removeLocation(sales_channel_id, { - * location_id: 'App' + * medusa.admin.salesChannels.removeLocation(salesChannelId, { + * location_id: 'loc_id' * }) * .then(({ sales_channel }) => { * console.log(sales_channel.id); @@ -39,7 +39,7 @@ import { SalesChannelLocationService } from "../../../../services" * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ - * "locaton_id": "stock_location_id" + * "locaton_id": "loc_id" * }' * security: * - api_token: [] diff --git a/packages/medusa/src/api/routes/admin/stock-locations/create-stock-location.ts b/packages/medusa/src/api/routes/admin/stock-locations/create-stock-location.ts index c3c8af1761..24b932a279 100644 --- a/packages/medusa/src/api/routes/admin/stock-locations/create-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/stock-locations/create-stock-location.ts @@ -36,7 +36,6 @@ import { IStockLocationService } from "@medusajs/types" * // must be previously logged in or use api token * medusa.admin.stockLocations.create({ * name: 'Main Warehouse', - * location_id: 'sloc' * }) * .then(({ stock_location }) => { * console.log(stock_location.id); diff --git a/packages/medusa/src/api/routes/admin/stock-locations/delete-stock-location.ts b/packages/medusa/src/api/routes/admin/stock-locations/delete-stock-location.ts index 0d0bdf4066..d9fbfabc66 100644 --- a/packages/medusa/src/api/routes/admin/stock-locations/delete-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/stock-locations/delete-stock-location.ts @@ -18,9 +18,9 @@ import { SalesChannelLocationService } from "../../../../services" * const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) * // must be previously logged in or use api token * medusa.admin.stockLocations.delete(stock_location_id) - * .then(({ id, object, deleted }) => { - * console.log(id) - * }) + * .then(({ id, object, deleted }) => { + * console.log(id) + * }) * - lang: Shell * label: cURL * source: | diff --git a/packages/medusa/src/api/routes/admin/stock-locations/get-stock-location.ts b/packages/medusa/src/api/routes/admin/stock-locations/get-stock-location.ts index 995af3e274..f4e83d3b11 100644 --- a/packages/medusa/src/api/routes/admin/stock-locations/get-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/stock-locations/get-stock-location.ts @@ -27,7 +27,7 @@ import { joinSalesChannels } from "./utils/join-sales-channels" * 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.stockLocations.retrieve(stock_location_id) + * medusa.admin.stockLocations.retrieve(stockLocationId) * .then(({ stock_location }) => { * console.log(stock_location.id); * }); diff --git a/packages/medusa/src/api/routes/admin/stock-locations/update-stock-location.ts b/packages/medusa/src/api/routes/admin/stock-locations/update-stock-location.ts index bc8716c356..fdb47c27e2 100644 --- a/packages/medusa/src/api/routes/admin/stock-locations/update-stock-location.ts +++ b/packages/medusa/src/api/routes/admin/stock-locations/update-stock-location.ts @@ -28,8 +28,8 @@ 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.stockLocations.update(stock_location_id, { - * name: 'App' + * medusa.admin.stockLocations.update(stockLocationId, { + * name: 'Main Warehouse' * }) * .then(({ stock_location }) => { * console.log(stock_location.id); @@ -41,7 +41,7 @@ import { FindParams } from "../../../../types/common" * --header 'Authorization: Bearer {api_token}' \ * --header 'Content-Type: application/json' \ * --data-raw '{ - * "name": "App" + * "name": "Main Warehouse" * }' * security: * - api_token: []