import { Request, Response } from "express"; import { FindParams } from "../../../../types/common"; /** * @oas [post] /admin/stock-locations * operationId: "PostStockLocations" * summary: "Create a Stock Location" * description: "Create a Stock Location." * x-authenticated: true * parameters: * - (query) expand {string} Comma-separated relations that should be expanded in the returned stock location. * - (query) fields {string} Comma-separated fields that should be included in the returned stock location. * requestBody: * content: * application/json: * schema: * $ref: "#/components/schemas/AdminPostStockLocationsReq" * x-codegen: * method: create * 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.stockLocations.create({ * name: "Main Warehouse", * }) * .then(({ stock_location }) => { * console.log(stock_location.id); * }); * - lang: Shell * label: cURL * source: | * curl -X POST '{backend_url}/admin/stock-locations' \ * -H 'Authorization: Bearer {api_token}' \ * -H 'Content-Type: application/json' \ * --data-raw '{ * "name": "App" * }' * security: * - api_token: [] * - cookie_auth: [] * tags: * - Stock Locations * responses: * 200: * description: OK * content: * application/json: * schema: * $ref: "#/components/schemas/AdminStockLocationsRes" * "400": * $ref: "#/components/responses/400_error" * "401": * $ref: "#/components/responses/unauthorized" * "404": * $ref: "#/components/responses/not_found_error" * "409": * $ref: "#/components/responses/invalid_state_error" * "422": * $ref: "#/components/responses/invalid_request_error" * "500": * $ref: "#/components/responses/500_error" */ declare const _default: (req: Request, res: Response) => Promise; export default _default; /** * @schema AdminPostStockLocationsReqAddress * type: object * required: * - address_1 * - country_code * properties: * address_1: * type: string * description: Stock location address * example: 35, Jhon Doe Ave * address_2: * type: string * description: Stock location address' complement * example: apartment 4432 * company: * type: string * description: Stock location address' company * city: * type: string * description: Stock location address' city * example: Mexico city * country_code: * description: "The 2 character ISO code for the country." * type: string * externalDocs: * url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements * description: See a list of codes. * phone: * type: string * description: Stock location address' phone number * example: +1 555 61646 * postal_code: * type: string * description: Stock location address' postal code * example: HD3-1G8 * province: * type: string * description: Stock location address' province * example: Sinaloa */ declare class StockLocationAddress { address_1: string; address_2?: string; company?: string; city?: string; country_code: string; phone?: string; postal_code?: string; province?: string; } /** * @schema AdminPostStockLocationsReq * type: object * required: * - name * properties: * name: * description: the name of the stock location * type: string * address_id: * description: the ID of an existing stock location address to associate with the stock location. Only required if `address` is not provided. * type: string * metadata: * type: object * description: An optional key-value map with additional details * example: {car: "white"} * externalDocs: * description: "Learn about the metadata attribute, and how to delete and update it." * url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute" * address: * description: A new stock location address to create and associate with the stock location. Only required if `address_id` is not provided. * $ref: "#/components/schemas/StockLocationAddressInput" */ export declare class AdminPostStockLocationsReq { name: string; address?: StockLocationAddress; address_id?: string; metadata?: Record; } export declare class AdminPostStockLocationsParams extends FindParams { }