My agentic slop goes here. Not intended for anyone else!
1(** Karakeep API client interface (Eio version) *)
2
3(** Type representing a Karakeep client session *)
4type t
5
6(** Create a new Karakeep client
7 @param sw Eio switch for resource management
8 @param env Eio environment (provides clock and network)
9 @param api_key API key for authentication
10 @param base_url Base URL of the Karakeep instance
11 @return A client instance *)
12val create :
13 sw:Eio.Switch.t ->
14 env:< clock: float Eio.Time.clock_ty Eio.Resource.t;
15 net: [`Generic | `Unix] Eio.Net.ty Eio.Resource.t;
16 fs: Eio.Fs.dir_ty Eio.Path.t; .. > ->
17 api_key:string ->
18 base_url:string ->
19 t
20
21(** Type representing a Karakeep bookmark *)
22type bookmark
23
24(** Bookmark accessors *)
25val bookmark_id : bookmark -> string
26val bookmark_title : bookmark -> string option
27val bookmark_url : bookmark -> string
28val bookmark_note : bookmark -> string option
29val bookmark_created_at : bookmark -> Ptime.t
30val bookmark_updated_at : bookmark -> Ptime.t option
31val bookmark_favourited : bookmark -> bool
32val bookmark_archived : bookmark -> bool
33val bookmark_tags : bookmark -> string list
34val bookmark_tagging_status : bookmark -> string option
35val bookmark_summary : bookmark -> string option
36val bookmark_content : bookmark -> (string * string) list
37val bookmark_assets : bookmark -> (string * string) list
38
39(** Type for Karakeep API response containing bookmarks *)
40type bookmark_response
41
42(** Bookmark response accessors *)
43val response_total : bookmark_response -> int
44val response_data : bookmark_response -> bookmark list
45val response_next_cursor : bookmark_response -> string option
46
47(** Parse a Karakeep bookmark response from a JSON string *)
48val parse_bookmark_response : string -> bookmark_response
49
50(** Fetch bookmarks from a Karakeep instance with pagination support
51 @param client Karakeep client instance
52 @param limit Number of bookmarks to fetch per page (default: 50)
53 @param offset Starting index for pagination (0-based) (default: 0)
54 @param cursor Optional pagination cursor for cursor-based pagination (overrides offset when provided)
55 @param include_content Whether to include full content (default: false)
56 @param filter_tags Optional list of tags to filter by
57 @return The bookmark response *)
58val fetch_bookmarks :
59 t ->
60 ?limit:int ->
61 ?offset:int ->
62 ?cursor:string ->
63 ?include_content:bool ->
64 ?filter_tags:string list ->
65 unit ->
66 bookmark_response
67
68(** Fetch all bookmarks from a Karakeep instance using pagination
69 @param client Karakeep client instance
70 @param page_size Number of bookmarks to fetch per page (default: 50)
71 @param max_pages Maximum number of pages to fetch (None for all pages)
72 @param max_bookmarks Maximum total number of bookmarks to return (None for all)
73 @param filter_tags Optional list of tags to filter by
74 @param include_content Whether to include full content (default: false)
75 @return All bookmarks combined *)
76val fetch_all_bookmarks :
77 t ->
78 ?page_size:int ->
79 ?max_pages:int ->
80 ?max_bookmarks:int ->
81 ?filter_tags:string list ->
82 ?include_content:bool ->
83 unit ->
84 bookmark list
85
86(** Fetch detailed information for a single bookmark by ID
87 @param client Karakeep client instance
88 @param bookmark_id ID of the bookmark to fetch
89 @return The complete bookmark details *)
90val fetch_bookmark_details :
91 t ->
92 string ->
93 bookmark
94
95(** Fetch an asset from the Karakeep server as a binary string
96 @param client Karakeep client instance
97 @param asset_id ID of the asset to fetch
98 @return The binary asset data *)
99val fetch_asset :
100 t ->
101 string ->
102 string
103
104(** Get the asset URL for a given client and asset ID
105 @param client Karakeep client instance
106 @param asset_id ID of the asset
107 @return The full URL to the asset *)
108val get_asset_url :
109 t ->
110 string ->
111 string
112
113(** Create a new bookmark in Karakeep with optional tags
114 @param client Karakeep client instance
115 @param url The URL to bookmark
116 @param title Optional title for the bookmark
117 @param note Optional note to add to the bookmark
118 @param tags Optional list of tag names to add to the bookmark
119 @param favourited Whether the bookmark should be marked as favourite (default: false)
120 @param archived Whether the bookmark should be archived (default: false)
121 @return The created bookmark *)
122val create_bookmark :
123 t ->
124 url:string ->
125 ?title:string ->
126 ?note:string ->
127 ?tags:string list ->
128 ?favourited:bool ->
129 ?archived:bool ->
130 unit ->
131 bookmark