All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.finch.petstore.order.scala Maven / Gradle / Ivy

The newest version!
package io.finch.petstore

import argonaut.Argonaut._
import argonaut.CodecJson

/**
 * Represents an order to the petstore.
 * @param id The unique, autogenerated ID of the order. The user should never give an ID during Order creation.
 * @param petId The ID of the pet being ordered.
 * @param quantity The number of pets being ordered.
 * @param shipDate The date the order will be shipped by.
 * @param status The status of the order.
 * @param complete Whether the order has been fulfilled.
 */
case class Order(
    id: Option[Long],
    petId: Option[Long],
    quantity: Option[Long],
    shipDate: Option[String],
    status: Option[OrderStatus], //placed, approved, delivered
    complete: Option[Boolean]
    )

/**
 * Provides a codec for encoding and decoding Order objects.
 */
object Order {
  implicit val orderCodec: CodecJson[Order] =
    casecodec6(Order.apply, Order.unapply)("id", "petId", "quantity", "shipDate", "status", "complete")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy