Content of Orders.yaml

openapi: 3.0.0
info:
  title: Marketplace API - Orders
  version: 1.0.0
paths:
  /orders:
    get:
      summary: Get orders
      description: Retrieve a list of orders in the marketplace.
      parameters:
        - name: page
          in: query
          description: Page number
          required: false
          schema:
            type: integer
            default: 1
        - name: pageSize
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 10
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example: 
                - orderId: 1
                  buyerId: 101
                  products:
                    - productId: 201
                      quantity: 2
                      price: 50.0
                      categoryId: 1
                      companyId: 1
                  totalAmount: 130.0
                  status: "Pending"
                  paymentMethod: "Credit Card"
                  shippingMethod: "Standard Shipping"
                - orderId: 2
                  buyerId: 102
                  products:
                    - productId: 203
                      quantity: 3
                      price: 20.0
                      categoryId: 1
                      companyId: 1
                  totalAmount: 95.0
                  status: "Shipped"
                  paymentMethod: "PayPal"
                  shippingMethod: "Express Shipping"

    post:
      summary: Create a new order
      description: Place a new order in the marketplace.
      requestBody:
        required: true
        content:
          application/json:
            example: 
              buyerId: 103
              products:
                - productId: 205
                  quantity: 1
                  price: 40.0
                  categoryId: 1
                  companyId: 3
              totalAmount: 90.0
              status: "Pending"
              paymentMethod: "Credit Card"
              shippingMethod: "Standard Shipping"
              shippingAddress:
                addressLine1: "789 Shipping Street"
                city: "Shipping City"
                postalCode: "54321"
                country: "Shipping Country"
              billingAddress:
                addressLine1: "789 Billing Street"
                city: "Billing City"
                postalCode: "54321"
                country: "Billing Country"
      responses:
        '201':
          description: Order created successfully
          content:
            application/json:
              example: 
                orderId: 3
                buyerId: 103
                products:
                  - productId: 205
                    quantity: 1
                    price: 40.0
                    categoryId: 1
                    companyId: 3
                totalAmount: 90.0
                status: "Pending"
                paymentMethod: "Credit Card"
                shippingMethod: "Standard Shipping"

  /orders/{orderId}:
    get:
      summary: Get a specific order
      description: Retrieve details of a specific order by ID.
      parameters:
        - name: orderId
          in: path
          required: true
          description: ID of the order
          schema:
            type: integer
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example: 
                orderId: 1
                buyerId: 101
                products:
                  - productId: 201
                    quantity: 2
                    price: 50.0
                    categoryId: 1
                    companyId: 1
                totalAmount: 130.0
                status: "Pending"
                paymentMethod: "Credit Card"
                shippingMethod: "Standard Shipping"

    put:
      summary: Update an order
      description: Update the details of a specific order by ID.
      parameters:
        - name: orderId
          in: path
          required: true
          description: ID of the order
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            example: 
              buyerId: 101
              products:
                - productId: 201
                  quantity: 2
                  price: 50.0
                  categoryId: 1
                  companyId: 1
              totalAmount: 130.0
              status: "Shipped"
              paymentMethod: "Credit Card"
              shippingMethod: "Standard Shipping"
              shippingAddress:
                addressLine1: "789 Updated Shipping Street"
                city: "Updated Shipping City"
                postalCode: "54321"
                country: "Updated Shipping Country"
              billingAddress:
                addressLine1: "789 Updated Billing Street"
                city: "Updated Billing City"
                postalCode: "54321"
                country: "Updated Billing Country"
      responses:
        '200':
          description: Order updated successfully
          content:
            application/json:
              example: 
                orderId: 1
                buyerId: 101
                products:
                  - productId: 201
                    quantity: 2
                    price: 50.0
                    categoryId: 1
                    companyId: 1
                totalAmount: 130.0
                status: "Shipped"
                paymentMethod: "Credit Card"
                shippingMethod: "Standard Shipping"
                shippingAddress:
                  addressLine1: "789 Updated Shipping Street"
                  city: "Updated Shipping City"
                  postalCode: "54321"
                  country: "Updated Shipping Country"
                billingAddress:
                  addressLine1: "789 Updated Billing Street"
                  city: "Updated Billing City"
                  postalCode: "54321"
                  country: "Updated Billing Country"