My agentic slop goes here. Not intended for anyone else!
at jsont 2.2 kB view raw
1(* 2 * Copyright (c) 2014, OCaml.org project 3 * Copyright (c) 2015 KC Sivaramakrishnan <sk826@cl.cam.ac.uk> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 *) 17 18(** River HTTP client using Requests library. 19 20 This module provides a session-based HTTP client for fetching RSS/Atom feeds. 21 The client manages a Requests session with appropriate defaults for feed fetching. *) 22 23(** The type of a River HTTP client *) 24type t 25 26(** [create ~sw env] creates a new River client with a Requests session. 27 28 The session is configured with: 29 - User-Agent: "OCaml-River/1.0" 30 - Automatic redirect following (max 5 redirects) 31 - TLS verification enabled 32 33 @param sw The switch for resource management 34 @param env The Eio environment providing network and time resources *) 35val create : 36 sw:Eio.Switch.t -> 37 < clock : float Eio.Time.clock_ty Eio.Resource.t; 38 fs : Eio.Fs.dir_ty Eio.Path.t; 39 net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > -> 40 t 41 42(** [with_client env f] creates a client and automatically manages its lifecycle. 43 44 This is the recommended way to use the client as it ensures proper cleanup. 45 46 @param env The Eio environment 47 @param f The function to run with the client *) 48val with_client : 49 < clock : float Eio.Time.clock_ty Eio.Resource.t; 50 fs : Eio.Fs.dir_ty Eio.Path.t; 51 net : [ `Generic | `Unix ] Eio.Net.ty Eio.Resource.t; .. > -> 52 (t -> 'a) -> 'a 53 54(** [session t] returns the underlying Requests session. 55 56 This is used internally by River's HTTP functions. *) 57val session : t -> Requests.t