package jsonapi
- Alphabetic
- By Inheritance
- jsonapi
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- trait ApiEndpoint extends AnyRef
- sealed trait ApiError extends Throwable
- final case class ApiRoot(apiRoot: Option[Uri]) extends Product with Serializable
- trait HasId extends AnyRef
- trait Identifiable[A] extends AnyRef
- trait Includes[+A] extends AnyRef
- trait JsonApiClient extends AnyRef
-
trait
JsonApiFormat[T] extends JsonApiReader[T] with JsonApiWriter[T] with RootJsonFormat[T]
- Annotations
- @implicitNotFound( ... )
-
case class
JsonApiPagination(originalUri: Uri, firstParams: Map[String, String] = Map.empty, lastParams: Map[String, String] = Map.empty, prevParams: Map[String, String] = Map.empty, nextParams: Map[String, String] = Map.empty) extends Product with Serializable
Case class for handling the top level pagination links in collection responses
Case class for handling the top level pagination links in collection responses
- originalUri
The URI (relative or absolute) of the original incoming request, complete with all query parameters
-
trait
JsonApiReader[T] extends RootJsonReader[T]
- Annotations
- @implicitNotFound( ... )
-
final
class
JsonApiResourceMacro extends JsonApiCommon
- Annotations
- @compileTimeOnly( ... )
-
sealed
trait
JsonApiSorting extends AnyRef
Very crude sorting used by JsonApiSupport marshalling bits works on raw json objects so performance won't be good
-
trait
JsonApiWriter[T] extends RootJsonWriter[T]
- Annotations
- @implicitNotFound( ... )
- sealed trait JsonEmpty extends JsonOption[Nothing]
-
sealed abstract
class
JsonOption[+A] extends AnyRef
Represents optional value with a special case for null.
Represents optional value with a special case for null. Used for parsing data out of json where null and value not being present at all are different things (for example in the case of wanting to unset a value)
- Note
For the most part tries to implement scala options api. Also provides .toOption to turn the maybe into a scala Option
-
final
case class
JsonSome[+A](x: A) extends JsonOption[A] with Product with Serializable
Class
Some[A]
represents existing values of typeA
. -
final
class
Macros extends JsonApiWriters with JsonApiReaders
Contains macros used to automatically create JsonApiWriter and JsonApiFormat instances from a case class for http://jsonapi.org format.
Contains macros used to automatically create JsonApiWriter and JsonApiFormat instances from a case class for http://jsonapi.org format.
The JsonApiFormat it self is not yet complete. The read side returns Nothing (???) and thus will crash with scala.NotImplementedError
In the case class you have to provide 2 implicits after of which you can create an instance of the JsonApiFormat or JsonApiWriter. Example for a case class called Individual.
implicit val individualResourceType: ResourceType[Individual] = "individuals" implicit val individualPathTo: PathTo[Individual] = new PathTo[Individual] { private[this] val root = Path("/individuals") override final def self(id: String): Uri = root / id } // After these you can generate the format like this implicit val individualJsonFormat: JsonApiFormat[Individual] = jsonApiFormat[Individual]
- Annotations
- @compileTimeOnly( ... )
- trait Meta extends AnyRef
- trait MetaProfile extends AnyRef
- type NameMangler = (String) ⇒ String
- trait PathTo[A] extends AnyRef
- abstract class PathToId[A] extends PathTo[A]
- trait PolyIdentifiable[A <: Coproduct] extends Identifiable[A]
- sealed trait PolyToMany[A <: Coproduct] extends AnyRef
- sealed trait PolyToOne[A <: Coproduct] extends AnyRef
-
sealed
trait
RelatedResponse[A] extends AnyRef
Used to render proper related link response as specified by jsonapi spec found at http://jsonapi.org/format/1.0/#fetching-resources Depending on if the related relation is a to-one or a to-many this class will generate the correct JSON structure
Used to render proper related link response as specified by jsonapi spec found at http://jsonapi.org/format/1.0/#fetching-resources Depending on if the related relation is a to-one or a to-many this class will generate the correct JSON structure
- A
Type of the object that the RelatedResponse points to
- trait ResourceType[A] extends AnyRef
-
sealed
trait
ToMany[A] extends AnyRef
Represents a relationship to zero or more objects of type A com.qvantel.jsonapi.ToMany.IdsReference case class is used to represent a ToMany relationship where the objects have not been loaded com.qvantel.jsonapi.ToMany.Loaded case class is used to represent a ToMany relationship where the objects have been loaded
Represents a relationship to zero or more objects of type A com.qvantel.jsonapi.ToMany.IdsReference case class is used to represent a ToMany relationship where the objects have not been loaded com.qvantel.jsonapi.ToMany.Loaded case class is used to represent a ToMany relationship where the objects have been loaded
- A
Type of the object the relationships point to
-
sealed
trait
ToOne[A] extends AnyRef
Represents a relationship to object A com.qvantel.jsonapi.ToOne.Reference case class is used when A is not loaded but we know it's id.
Represents a relationship to object A com.qvantel.jsonapi.ToOne.Reference case class is used when A is not loaded but we know it's id. In case we do not know the id of the other end of the relationship wrap the relation in option and fill it with None com.qvantel.jsonapi.ToOne.Loaded case class is used when A is loaded
- A
Type of the object the relationship points to
- final case class UntypedMeta(asJson: JsValue) extends Meta with Product with Serializable
-
final macro
class
jsonApiResource extends Annotation with StaticAnnotation
macro annotation used to generate JsonApiFormat and related things for a case class
macro annotation used to generate JsonApiFormat and related things for a case class
- Annotations
- @compileTimeOnly( ... )
Value Members
- implicit def coproductJsonApiWriter0[L](implicit wl: JsonApiWriter[L]): JsonApiWriter[:+:[L, CNil]]
- implicit def coproductJsonApiWriter1[L, R <: Coproduct](implicit wl: JsonApiWriter[L], wr: JsonApiWriter[R]): JsonApiWriter[:+:[L, R]]
-
macro
def
includes[A]: Includes[A]
- Annotations
- @compileTimeOnly( ... )
-
macro
def
jsonApiFormat[A]: JsonApiFormat[A]
- Annotations
- @compileTimeOnly( ... )
-
macro
def
jsonApiWriter[A]: JsonApiFormat[A]
- Annotations
- @compileTimeOnly( ... )
- def rawCollection[T](entities: Iterable[T])(implicit writer: JsonApiWriter[T], metaProfiles: Set[MetaProfile] = Set.empty, sorting: JsonApiSorting = JsonApiSorting.Unsorted, sparseFields: Map[String, List[String]] = Map.empty, pagination: PaginationFunc = JsonApiPagination.EmptyFunc): JsObject
- def rawOne[T](entity: T)(implicit writer: JsonApiWriter[T], metaProfiles: Set[MetaProfile] = Set.empty, sorting: JsonApiSorting = JsonApiSorting.Unsorted, sparseFields: Map[String, List[String]] = Map.empty): JsObject
-
def
readCollection[T](json: JsObject, includes: Set[String])(implicit reader: JsonApiReader[T]): Iterable[T]
Reads a collection of jsonapi entities.
Reads a collection of jsonapi entities. Due to include paths being provided includes will be handled.
-
def
readCollection[T](json: JsObject)(implicit reader: JsonApiReader[T]): Iterable[T]
Reads a collection of jsonapi entities.
Reads a collection of jsonapi entities. Due to no includes path being provided includes are ignored.
-
def
readOne[T](json: JsObject, includes: Set[String])(implicit reader: JsonApiReader[T]): T
Reads one jsonapi entity.
Reads one jsonapi entity. Due to include paths being provided includes will be handled.
-
def
readOne[T](json: JsObject)(implicit reader: JsonApiReader[T]): T
Reads one jsonapi entity.
Reads one jsonapi entity. Due to no includes path being provided includes are ignored.
- val uriConfig: UriConfig
- object ApiEndpoint
- object ApiError extends Serializable
- object ApiRoot extends Serializable
- object HasId
- object Identifiable
- object Includes
-
object
JsonAbsent extends JsonOption[Nothing] with JsonEmpty with Product with Serializable
This case object represents non-existent values.
- object JsonApiClient
- object JsonApiPagination extends Serializable
- object JsonApiResourceMacro
- object JsonApiSorting
-
object
JsonNull extends JsonOption[Nothing] with JsonEmpty with Product with Serializable
This case object represents null values.
- object JsonOption
- object Link
- object NameManglers
- implicit object PathJsonFormat extends JsonFormat[Uri]
- object PathTo
- object PathToId
- object PolyIdentifiable
- object PolyToMany
- object PolyToOne
- object RelatedResponse
- object ResourceType
- object ToMany
- object ToOne