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

zio.http.endpoint.grpc.GRPC.scala Maven / Gradle / Ivy

The newest version!
package zio.http.endpoint.grpc

import scala.collection.immutable.ListMap

import zio.schema.Schema
import zio.schema.codec.ProtobufCodec

import zio.http.MediaType
import zio.http.codec.{BinaryCodecWithSchema, HttpContentCodec}

object GRPC {

  implicit def fromSchema[A](implicit schema: Schema[A]): HttpContentCodec[A] =
    HttpContentCodec(
      ListMap(
        MediaType.parseCustomMediaType("application/grpc").get ->
          BinaryCodecWithSchema(ProtobufCodec.protobufCodec[A], schema),
      ),
    )

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy