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

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

The newest version!
package io.finch.petstore

import _root_.argonaut._
import argonaut.Argonaut._

/**
 * Represents Pets in the Petstore. Each Pet has a unique ID that should not be known by
 * the user at the time of its creation.
 * @param id The pet's auto-generated, unique ID.
 * @param name (Required) The pet's name.
 * @param photoUrls (Required) A sequence of URLs that lead to uploaded photos of the pet.
 * @param category The type of pet (cat, dragon, fish, etc.)
 * @param tags Tags that describe this pet.
 * @param status (Available, Pending, or Adopted)
 */
case class Pet(
    id: Option[Long],
    name: String,
    photoUrls: Seq[String],
    category: Option[Category],
    tags: Option[Seq[Tag]],
    status: Option[Status] //available, pending, adopted
    )

/**
 * Provides a codec for decoding and encoding Pet objects.
 */
object Pet {
  implicit val petCodec: CodecJson[Pet] = //instance of a type class
    casecodec6(Pet.apply, Pet.unapply)("id", "name", "photoUrls", "category", "tags", "status")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy