docs: add new endpoints

This commit is contained in:
Sebastian Rindom
2021-03-11 08:39:44 +01:00
parent 0601b34765
commit ca74226d4a
7 changed files with 1456 additions and 1146 deletions
@@ -6,7 +6,7 @@ import { defaultRelations, defaultFields } from "./"
* summary: "Retrieve Gift Card by Code"
* description: "Retrieves a Gift Card by its associated unqiue code."
* tags:
* - Region
* - Gift Card
* responses:
* 200:
* description: OK
@@ -1,6 +1,26 @@
import { Validator, MedusaError } from "medusa-core-utils"
import { defaultRelations, defaultFields } from "./index"
/**
* @oas [get] /orders
* operationId: "GetOrders"
* summary: "Look Up an Order"
* description: "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned."
* parameters:
* - (query) display_id=* {number} The display id given to the Order.
* - (query) email=* {string} The email of the Order with the given display_id.
* tags:
* - Order
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* properties:
* order:
* $ref: "#/components/schemas/order"
*/
export default async (req, res) => {
const schema = Validator.object().keys({
display_id: Validator.number().required(),
@@ -1,6 +1,48 @@
import { MedusaError, Validator } from "medusa-core-utils"
import { defaultRelations, defaultFields } from "./"
/**
* @oas [post] /returns
* operationId: "PostReturns"
* summary: "Create Return"
* description: "Creates a Return for an Order."
* requestBody:
* content:
* application/json:
* schema:
* properties:
* order_id:
* type: string
* description: The id of the Order to create the Return from.
* items:
* description: "The items to include in the Return."
* type: array
* items:
* properties:
* item_id:
* description: The id of the Line Item from the Order.
* type: string
* quantity:
* description: The quantity to return.
* type: integer
* return_shipping:
* description: If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.
* type: object
* properties:
* option_id:
* type: string
* description: The id of the Shipping Option to create the Shipping Method from.
* tags:
* - Return
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* properties:
* return:
* $ref: "#/components/schemas/return"
*/
export default async (req, res) => {
const schema = Validator.object().keys({
order_id: Validator.string().required(),