package http
- Alphabetic
- By Inheritance
- http
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- trait AllInstances extends MultipartInstances with EntityEncoderInstances with EntityDecoderInstances with MethodInstances
- trait AllSyntax extends MultipartSyntax with EntityEncoderSyntax with DecodeResultSyntax
-
final
case class
Boundary(value: String) extends AnyVal with Product with Serializable
Boundary marker for batch or changesets.
-
final
case class
ChangeSet[F[_]](parts: Seq[SinglePart[F]], boundary: Boundary = Boundary.mkBoundary("changeset_"), xtra: HttpHeaders = HttpHeaders.empty) extends Part with Product with Serializable
Changeset "part".
Changeset "part". Headers are written for Content-Type and Content-Transfer-Encoding at the start of each Part's boundary. These can be overwritten or added to using xtra. A random Content-ID is added if one is not present.
- xtra
Extra headers after the changeset boundary but not in the actual requests.
-
final
case class
Client[F[_]](open: Kleisli[F, HttpRequest[F], DisposableResponse[F]], dispose: F[Unit])(implicit F: MonadError[F, Throwable]) extends Product with Serializable
A thin layer over a HTTP service that adds implcit convenience for finding response decoders and handling unsuccessful (non 200 range) responses.
A thin layer over a HTTP service that adds implcit convenience for finding response decoders and handling unsuccessful (non 200 range) responses. Based on http4s design. The methods in this class do not deal with exceptions/errors but does, when expecting a successful result, translate a non-200 saus to an
UnexpectedStatus
exception and hence usesMonadError.raiseError
to signal the error. -
final
case class
CommunicationsFailure(details: String, cause: Option[Throwable] = None) extends MessageFailure with Product with Serializable
Error for a Client to throw when something happens underneath it e.g.
Error for a Client to throw when something happens underneath it e.g. in the OS.
-
trait
ConnectionInfo extends Object
User provided configuration informmation.
User provided configuration informmation.
- Annotations
- @ScalaJSDefined() @RawJSType()
-
sealed abstract
class
DecodeFailure extends MessageFailure
Error for a Client when decoding of a returned message fails.
-
type
DecodeResult[F[_], A] = EitherT[F, DecodeFailure, A]
When decoding a response body, either you get an A or a DecodeFailure.
When decoding a response body, either you get an A or a DecodeFailure. The effect may also carry an exception. EitherT has a bunch of combinators.
- See also
https://typelevel.org/cats/api/cats/data/EitherT.html
- final case class DecodeResultOps[F[_], T](dr: DecodeResult[F, T])(implicit F: MonadError[F, Throwable]) extends Product with Serializable
- trait DecodeResultSyntax extends AnyRef
-
final
case class
DisposableResponse[F[_]](response: HttpResponse[F], dispose: F[Unit]) extends Product with Serializable
A response that allows the response object to used then calls an effect after its has been consumed via
apply
.A response that allows the response object to used then calls an effect after its has been consumed via
apply
. This is essentially a resource management hook.- To do
Use some type of bracket capability, is that universal?
-
type
Entity = IO[String]
Non-streaming but good enough for our needs.
Non-streaming but good enough for our needs. IO is used explicitly but since we have strict bodies for dynamics, why not use "Id" in the short term? Entity is the body part of a Message.
- To do
Make F so we can use Id or something simpler.
-
trait
EntityDecoder[F[_], T] extends AnyRef
Decode a Message to a DecodeResult.
Decode a Message to a DecodeResult. After decoding you have a DecodeResult which is co-product (either) an error or a value. You can fold on the decode result to work with either side e.g.
mydecoderesult.fold(throw _, identity)
.- Annotations
- @implicitNotFound( ... )
-
trait
EntityDecoderInstances extends AnyRef
EntityDecoder instances specific to the type you want to "output" from the decoding process.
EntityDecoder instances specific to the type you want to "output" from the decoding process. Currently tied to
IO
. -
trait
EntityEncoder[A] extends AnyRef
Simple encoder that encodes to a strict value.
Simple encoder that encodes to a strict value.
- Annotations
- @implicitNotFound( ... )
- trait EntityEncoderInstances extends AnyRef
- final case class EntityEncoderOps[A](a: A) extends AnyVal with Product with Serializable
- trait EntityEncoderSyntax extends AnyRef
- trait HTTPExceptionsInstances extends AnyRef
-
type
HttpHeaders = Map[String, Seq[String]]
Basic headers are a dict of strings.
-
case class
HttpRequest[F[_]](method: Method, path: String, headers: HttpHeaders = HttpHeaders.empty, body: Entity = Entity.empty) extends Message[F] with Product with Serializable
A low-level request.
-
case class
HttpResponse[F[_]](status: Status, headers: HttpHeaders, body: Entity) extends Message[F] with Product with Serializable
A low-level response.
- type HttpService[F[_]] = Kleisli[F, HttpRequest[F], HttpResponse[F]]
-
trait
Message[F[_]] extends MessageOps[F]
Superclass of requests and responses.
Superclass of requests and responses. Holds headers and a body at a minimum.
- final case class MessageBodyFailure(details: String, cause: Option[Throwable] = None) extends DecodeFailure with Product with Serializable
-
sealed abstract
class
MessageFailure extends RuntimeException
Message failure in the http layer.
-
trait
MessageOps[F[_]] extends Any
Basic HTTP client code based mostly on http4s.
-
sealed
case class
Method extends Product with Serializable
Wrapper type for a Method.
- trait MethodInstances extends AnyRef
- type Middleware[F[_]] = (Client[F]) ⇒ Client[F]
- final case class MissingExpectedHeader(details: String, cause: Option[Throwable] = None) extends DecodeFailure with Product with Serializable
-
final
case class
Multipart(parts: Seq[Part], boundary: Boundary = Boundary.mkBoundary()) extends Product with Serializable
Multipart composed of a list of parts: individual requests and changesets.
Multipart composed of a list of parts: individual requests and changesets. Despite its name, it does not inherit from Part.
- parts
Sequence of Parts.
- boundary
Batch boundary.
- trait MultipartInstances extends AnyRef
- final case class MultipartOps[F[_]](r: HttpRequest[F]) extends Product with Serializable
- trait MultipartSyntax extends AnyRef
-
trait
NextLinkResponse[A] extends Object
Use this when you *only* care about the
@odata.nextLink
link.Use this when you *only* care about the
@odata.nextLink
link.- Annotations
- @RawJSType() @native()
- case class NodeFetchClientOptions(timeoutInMillis: Int = 0, compress: Boolean = true) extends Product with Serializable
- final case class OnlyOneExpected(details: String, cause: Option[Throwable] = None) extends DecodeFailure with Product with Serializable
-
sealed
trait
Part extends AnyRef
One part of a multipart request.
One part of a multipart request. There are only two subtypes, one for a request directly in the multipart message and the other for a changeset. Deletes, updates and inserts must be in a changeset.
- trait RenderConstants extends AnyRef
- trait Retry extends LazyLogger
-
trait
RetryMiddleware extends AnyRef
Implement retry transparently for a Client as Middleware.
Implement retry transparently for a Client as Middleware. For dynamics, this is a bit hard as the server could be busy but returns 500. Otherwise, other 500 errors maybe or maybe not should be retryable. The retry policies herein are based on specific statuses, specific OS likely retryable errors and errors caused potentially by mangled message bodies.
The new dynamics governer limits are in place and these retry policies take them into account via status TooManyRequests:
- See also
https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/api-limits
-
type
RetryPolicy[F[_], A] = (F[A]) ⇒ F[A]
Retry policies are added to an effect so that when run, a retry occurs as needed.
-
final
case class
SinglePart[F[_]](request: HttpRequest[F], xtra: HttpHeaders = HttpHeaders.empty) extends Part with Product with Serializable
Single request.
Single request. Either standalone or in a changeset. Content-Type and Content-Transfer-Encoding is added to each part prior to the request being written. Headers in request can be overriden and added to using xtra.
- xtra
Extra headers after the boundary but not in the actual request.
-
trait
SingleValueResponse[A <: Any] extends Object
The shape when using navigation properties to a single value it is returned in the fieldname "value".
The shape when using navigation properties to a single value it is returned in the fieldname "value".
- Annotations
- @RawJSType() @native()
-
final
case class
Status(code: Int)(reason: String) extends Ordered[Status] with Product with Serializable
Represents a Status.
Represents a Status. Allows us to manage status values in web calls more easily. Provide a way to match a response to a status or other criteria in a DSL-sort of way.
client.fetch(...) { case Status(200)(response) => decode response case failedResponse => Task.fail(...) }
Copied from http4s.
- type StreamingClient[F[_], A] = (Stream[F, HttpRequest[F]]) ⇒ Stream[F, F[A]]
-
final
case class
UnexpectedStatus[F[_]](status: Status, request: Option[HttpRequest[F]] = None, response: Option[HttpResponse[F]] = None) extends RuntimeException with Product with Serializable
Unexpected status returned, the original request and response may be available.
Unexpected status returned, the original request and response may be available. Potentiailly having the request/response available forces the F parameter to be available.
-
trait
ValueArrayResponse[A <: Any] extends Object with NextLinkResponse[A]
General response envelope when an array of values is returned in "values"..
General response envelope when an array of values is returned in "values".. Use A=_ if you do not care about the values. This is only used to process return bodies and find the "value" array that may, or may not be there. You get this when querying for a list or when navigating to a collection valued property. If you use $expand on a collection value property it is listed under its attribute name on the target entity and is *not* under the "value" fieldname.
- Annotations
- @RawJSType() @native()
-
type
Service[F, A, B] = Kleisli[IO, A, B]
- Annotations
- @deprecated
- Deprecated
(Since version 0.1.0) Use Kleisli directly e.g. Kleisli[F, A, B]
Value Members
- object Boundary extends RenderConstants with Serializable
- object ChangeSet extends Serializable
-
object
DecodeResult
Helper objects to make creating DecodeResults easier.
- object Entity
- object EntityDecoder
- object EntityEncoder
- object HttpHeaders
- object Method extends Serializable
- object Multipart extends RenderConstants with Serializable
- object NodeFetch
- object NodeFetchClient extends LazyLogger
- object OData
- object Part
- object RetryMiddleware extends RetryMiddleware
- object Status extends Serializable
- object implicits extends AllSyntax with AllInstances
- object instances
- object retry extends Retry
- object syntax