@@ -225,6 +225,23 @@ final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType](
225
225
): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
226
226
copy(input = self.input ++ codec)
227
227
228
+ /**
229
+ * Returns a new endpoint that requires the specified headers to be present.
230
+ */
231
+ def header [A ](
232
+ name : String ,
233
+ )(implicit schema : Schema [A ], combiner : Combiner [Input , A ]): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
234
+ header(HeaderCodec .headerAs[A ](name))
235
+
236
+ /**
237
+ * Returns a new endpoint that requires the specified headers to be present.
238
+ */
239
+ def header [A ](implicit
240
+ schema : Schema [A ],
241
+ combiner : Combiner [Input , A ],
242
+ ): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
243
+ header(HeaderCodec .headers[A ])
244
+
228
245
def implement [Env ](f : Input => ZIO [Env , Err , Output ])(implicit
229
246
trace : Trace ,
230
247
): Route [Env , Nothing ] =
@@ -671,6 +688,25 @@ final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType](
671
688
): Endpoint [PathInput , Input , Err , combiner.Out , Auth ] =
672
689
copy(output = self.output ++ codec)
673
690
691
+ /**
692
+ * Returns a new endpoint that requires the specified headers to be part of
693
+ * the response.
694
+ */
695
+ def outHeader [A ](
696
+ name : String ,
697
+ )(implicit schema : Schema [A ], combiner : Combiner [Output , A ]): Endpoint [PathInput , Input , Err , combiner.Out , Auth ] =
698
+ outHeader(HeaderCodec .headerAs[A ](name))
699
+
700
+ /**
701
+ * Returns a new endpoint that requires the specified headers to be part of
702
+ * the response.
703
+ */
704
+ def outHeader [A ](implicit
705
+ schema : Schema [A ],
706
+ combiner : Combiner [Output , A ],
707
+ ): Endpoint [PathInput , Input , Err , combiner.Out , Auth ] =
708
+ outHeader(HeaderCodec .headers[A ])
709
+
674
710
/**
675
711
* Returns a new endpoint derived from this one, whose output type is a stream
676
712
* of the specified type for the ok status code.
@@ -805,6 +841,23 @@ final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType](
805
841
): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
806
842
copy(input = self.input ++ codec)
807
843
844
+ /**
845
+ * Returns a new endpoint that requires the specified query.
846
+ */
847
+ def query [A ](
848
+ name : String ,
849
+ )(implicit schema : Schema [A ], combiner : Combiner [Input , A ]): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
850
+ copy(input = self.input ++ QueryCodec .query[A ](name))
851
+
852
+ /**
853
+ * Returns a new endpoint that requires the specified query.
854
+ */
855
+ def query [A ](implicit
856
+ schema : Schema [A ],
857
+ combiner : Combiner [Input , A ],
858
+ ): Endpoint [PathInput , combiner.Out , Err , Output , Auth ] =
859
+ copy(input = self.input ++ QueryCodec .query[A ])
860
+
808
861
/**
809
862
* Adds tags to the endpoint. They are used for documentation generation. For
810
863
* example to group endpoints for OpenAPI.
0 commit comments