package chatoyant
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=a885dcf4b3c6ede268e2027bedf6955a5c889f7ed01c40b719f8369655957d47
sha512=0bb8dfa12157ba2e482927717c2242c1ea914dce1427801e405987811550afbd6d6b11f07d1e1379259360d17f4ca43ff81963bf407cddb7bedd0dfbb93a55ee
doc/chatoyant.native/Chatoyant_native/Http/index.html
Module Chatoyant_native.HttpSource
type body = | Empty| Text of string| Json of Chatoyant_runtime.Json.t| Multipart of multipart_part list
Human-readable HTTP error rendering for app/tool handlers.
module type EFFECT =
Chatoyant_runtime.Effect.HTTP
with type multipart_part = multipart_part
and type body = body
and type request = request
and type response = response
and type error = errorHTTP effect module with types tied to Chatoyant.Http.
type client_certificate = {certificate_pem : string;private_key_pem : string;authenticator : X509.Authenticator.t option;
}PEM-encoded client certificate chain and private key for mTLS provider endpoints. When authenticator is omitted, system trust roots are used for server verification.
type https = | System(*Use system trust roots through
*)ca-certsand verify HTTPS hosts.| Authenticator of X509.Authenticator.t(*Build a TLS client from a caller-supplied X.509 authenticator.
*)| Mutual_tls of client_certificate(*Use system/server authentication plus a PEM client certificate.
*)| Tls_config of Tls.Config.client(*Use an already constructed TLS client config.
*)| Disabled(*Disable HTTPS. Plain HTTP URLs still work; HTTPS URLs fail fast.
*)
Default response body limit, currently 100 MiB.
val tls_config :
?authenticator:X509.Authenticator.t ->
unit ->
(Tls.Config.client, string) resultBuild the TLS client config used by System and Authenticator.
val mtls_config :
?authenticator:X509.Authenticator.t ->
certificate_pem:string ->
private_key_pem:string ->
unit ->
(Tls.Config.client, string) resultBuild a TLS client config with a PEM certificate chain/private key for mTLS endpoints such as xAI enterprise deployments.
val make :
?https:https ->
?max_response_size:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
unit ->
(module EFFECT)make ~net ~clock () creates a Chatoyant HTTP effect backed by cohttp-eio.
Multipart bodies are encoded at this boundary, JSON bodies receive a default content-type: application/json header when absent, and timeout_ms is enforced with Eio.Time.with_timeout.
val send :
?https:https ->
?max_response_size:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
request ->
(response, error) resultOne-shot HTTP request helper for Eio-native app/tool code. For provider clients that issue many requests, prefer make and reuse the returned effect module.
val get :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
(response, error) resultConvenience GET helper.
val get_json :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
(Chatoyant_runtime.Json.t, error) resultConvenience GET helper that parses a successful response body as JSON.
val post_json :
?https:https ->
?max_response_size:int ->
?headers:(string * string) list ->
?timeout_ms:int ->
net:_ Eio.Net.t ->
clock:_ Eio.Time.clock ->
string ->
Chatoyant_runtime.Json.t ->
(response, error) resultConvenience JSON POST helper.