atproto libraries implementation in ocaml
1(** AT Protocol High-Level API.
2
3 This package provides a user-friendly interface for common AT Protocol
4 operations. It wraps the lower-level XRPC client with convenient functions
5 for authentication, posting, social actions, and reading feeds.
6
7 {2 Quick Start}
8
9 {[
10 (* Create agent *)
11 let agent = Agent.create ~pds:(Uri.of_string "https://bsky.social") in
12
13 (* Login *)
14 let agent =
15 Agent.login agent ~identifier:"alice.bsky.social" ~password:"..."
16 |> Result.get_ok
17 in
18
19 (* Create a post *)
20 let _ = Agent.create_post agent ~text:"Hello from OCaml!" () in
21
22 (* Get timeline *)
23 let feed = Agent.get_timeline agent () |> Result.get_ok in
24 List.iter
25 (fun item -> Printf.printf "%s: %s\n" item.author_handle item.text)
26 feed.items
27 ]}
28
29 {2 RichText}
30
31 For posts with mentions, links, or hashtags, use the {!Richtext} module:
32
33 {[
34 let text = "Check out @alice.bsky.social and https://example.com!" in
35 let richtext = Richtext.detect_facets text in
36 let _ = Agent.create_post_richtext agent ~richtext ()
37 ]} *)
38
39module Agent = Agent
40module Richtext = Richtext