My agentic slop goes here. Not intended for anyone else!
1(** PeerTube API client interface (Eio version) *)
2
3(** Type representing a PeerTube client *)
4type t
5
6(** Create a new PeerTube client
7 @param requests_session Shared Requests session for connection pooling
8 @param base_url Base URL of the PeerTube instance
9 @return A PeerTube client configured for the specified instance *)
10val create :
11 requests_session:Requests.t ->
12 base_url:string ->
13 t
14
15(** Type representing a PeerTube video *)
16type video = {
17 id: int;
18 uuid: string;
19 name: string;
20 description: string option;
21 url: string;
22 embed_path: string;
23 published_at: Ptime.t;
24 originally_published_at: Ptime.t option;
25 thumbnail_path: string option;
26 tags: string list option;
27 unknown: Jsont.json;
28}
29
30(** Type for PeerTube API response containing videos *)
31type video_response = {
32 total: int;
33 data: video list;
34 unknown: Jsont.json;
35}
36
37(** Accessor functions for video *)
38val video_id : video -> int
39val video_uuid : video -> string
40val video_name : video -> string
41val video_description : video -> string option
42val video_url : video -> string
43val video_embed_path : video -> string
44val video_published_at : video -> Ptime.t
45val video_originally_published_at : video -> Ptime.t option
46val video_thumbnail_path : video -> string option
47val video_tags : video -> string list option
48val video_unknown : video -> Jsont.json
49
50(** Accessor functions for video_response *)
51val video_response_total : video_response -> int
52val video_response_data : video_response -> video list
53val video_response_unknown : video_response -> Jsont.json
54
55(** RFC3339 timestamp handling *)
56module Rfc3339 : sig
57 val parse : string -> Ptime.t option
58 val format : Ptime.t -> string
59 val pp : Format.formatter -> Ptime.t -> unit
60 val jsont : Ptime.t Jsont.t
61end
62
63(** Parse a single video from JSON string *)
64val parse_video_string : string -> video
65
66(** Parse a PeerTube video response from JSON string *)
67val parse_video_response_string : string -> video_response
68
69(** Fetch videos from a PeerTube instance channel with pagination support
70 @param client The PeerTube client
71 @param count Number of videos to fetch per page (default: 20)
72 @param start Starting index for pagination (0-based) (default: 0)
73 @param channel Channel name to fetch videos from *)
74val fetch_channel_videos : t -> ?count:int -> ?start:int -> string -> video_response
75
76(** Fetch all videos from a PeerTube instance channel using pagination
77 @param client The PeerTube client
78 @param page_size Number of videos to fetch per page (default: 20)
79 @param max_pages Maximum number of pages to fetch (None for all pages)
80 @param channel Channel name to fetch videos from *)
81val fetch_all_channel_videos : t -> ?page_size:int -> ?max_pages:int -> string -> video list
82
83(** Fetch detailed information for a single video by UUID
84 @param client The PeerTube client
85 @param uuid UUID of the video to fetch *)
86val fetch_video_details : t -> string -> video
87
88(** Convert a PeerTube video to Bushel.Video.t compatible structure
89 Returns (description, published_date, title, url, uuid, slug) *)
90val to_bushel_video : video -> string * Ptime.t * string * string * string * string
91
92(** Get the thumbnail URL for a video
93 @param client The PeerTube client
94 @param video The video to get the thumbnail URL for *)
95val thumbnail_url : t -> video -> string option
96
97(** Download a thumbnail to a file
98 @param client The PeerTube client
99 @param fs The Eio filesystem capability
100 @param video The video to download the thumbnail for
101 @param output_path Path where to save the thumbnail *)
102val download_thumbnail : t -> fs:_ Eio.Path.t -> video -> string -> (unit, [> `Msg of string]) result