golgi/lib.rs
1#![warn(missing_docs)]
2
3//! # golgi
4//!
5//! _The Golgi complex (aka. Golgi apparatus or Golgi body) packages proteins
6//! into membrane-bound vesicles inside the cell before the vesicles are sent
7//! to their destination._
8//!
9//! -----
10//!
11//! ## Introduction
12//!
13//! Golgi is an asynchronous, experimental Scuttlebutt client that aims to
14//! facilitate Scuttlebutt application development. It provides a high-level
15//! API for interacting with an sbot instance and uses the
16//! [kuska-ssb](https://github.com/Kuska-ssb) libraries to make RPC calls.
17//! Development efforts are currently oriented towards
18//! [go-sbot](https://github.com/cryptoscope/ssb) interoperability.
19//!
20//! ## Features
21//!
22//! Golgi offers the ability to invoke individual RPC methods while also
23//! providing a number of convenience methods which may involve multiple RPC
24//! calls and / or the processing of data received from those calls. The
25//! [`Sbot`](crate::sbot::Sbot) `struct` is the primary means of interacting
26//! with the library.
27//!
28//! Features include the ability to publish messages of various kinds; to
29//! retrieve messages (e.g. `about` and `description` messages) and formulate
30//! queries; to follow, unfollow, block and unblock a peer; to query the social
31//! graph; and to generate pub invite codes.
32//!
33//! Visit the [API modules](crate::api) to view the available methods.
34//!
35//! ## Example Usage
36//!
37//! Basic usage is demonstrated below. Visit the [examples directory](https://git.coopcloud.tech/golgi-ssb/golgi/src/branch/main/examples) in the `golgi` repository for
38//! more comprehensive examples.
39//!
40//! ```rust
41//! use golgi::{messages::SsbMessageContent, GolgiError, Sbot};
42//!
43//! pub async fn run() -> Result<(), GolgiError> {
44//! // Attempt to connect to an sbot instance using the default IP address,
45//! // port and network key (aka. capabilities key).
46//! let mut sbot_client = Sbot::init(None, None).await?;
47//!
48//! // Call the `whoami` RPC method to retrieve the public key for the sbot
49//! // identity.
50//! let id = sbot_client.whoami().await?;
51//!
52//! // Print the public key (identity) to `stdout`.
53//! println!("{}", id);
54//!
55//! // Compose an SSB post message type.
56//! let post = SsbMessageContent::Post {
57//! text: "Biology, eh?!".to_string(),
58//! mentions: None,
59//! };
60//!
61//! // Publish the post.
62//! let post_msg_reference = sbot_client.publish(post).await?;
63//!
64//! // Print the reference (sigil-link) for the published post.
65//! println!("{}", post_msg_reference);
66//!
67//! Ok(())
68//! }
69//! ```
70
71pub mod api;
72pub mod blobs;
73pub mod error;
74pub mod messages;
75pub mod sbot;
76pub mod utils;
77
78pub use crate::{error::GolgiError, sbot::Sbot};