2021-12-03 09:37:22 +00:00
#![ warn(missing_docs) ]
//! # golgi
//!
2022-02-07 14:10:08 +00:00
//! _The Golgi complex (aka. Golgi apparatus or Golgi body) packages proteins
//! into membrane-bound vesicles inside the cell before the vesicles are sent
//! to their destination._
2021-12-03 09:37:22 +00:00
//!
//! -----
//!
2022-02-07 14:10:08 +00:00
//! ## Introduction
//!
2022-02-08 07:22:59 +00:00
//! Golgi is an asynchronous, experimental Scuttlebutt client that aims to
//! facilitate Scuttlebutt application development. It provides a high-level
//! API for interacting with an sbot instance and uses the
//! [kuska-ssb](https://github.com/Kuska-ssb) libraries to make RPC calls.
//! Development efforts are currently oriented towards
2022-11-17 18:07:20 +00:00
//! [go-sbot](https://github.com/ssbc/go-ssb) interoperability.
2022-02-07 14:10:08 +00:00
//!
//! ## Features
//!
2022-02-08 07:22:59 +00:00
//! Golgi offers the ability to invoke individual RPC methods while also
2022-02-07 14:10:08 +00:00
//! providing a number of convenience methods which may involve multiple RPC
2022-02-08 07:22:59 +00:00
//! calls and / or the processing of data received from those calls. The
//! [`Sbot`](crate::sbot::Sbot) `struct` is the primary means of interacting
//! with the library.
2022-02-07 14:10:08 +00:00
//!
//! Features include the ability to publish messages of various kinds; to
//! retrieve messages (e.g. `about` and `description` messages) and formulate
2022-02-08 07:22:59 +00:00
//! queries; to follow, unfollow, block and unblock a peer; to query the social
2022-02-07 14:10:08 +00:00
//! graph; and to generate pub invite codes.
2021-12-03 09:37:22 +00:00
//!
2022-02-14 10:23:34 +00:00
//! Visit the [API modules](crate::api) to view the available methods.
//!
2021-12-03 09:37:22 +00:00
//! ## Example Usage
//!
2022-02-07 14:10:08 +00:00
//! 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
//! more comprehensive examples.
//!
2021-12-03 09:37:22 +00:00
//! ```rust
2022-05-11 12:14:25 +00:00
//! use golgi::{messages::SsbMessageContent, GolgiError, Sbot, sbot::Keystore};
2021-12-03 09:37:22 +00:00
//!
//! pub async fn run() -> Result<(), GolgiError> {
2022-02-07 14:10:08 +00:00
//! // Attempt to connect to an sbot instance using the default IP address,
//! // port and network key (aka. capabilities key).
2022-05-11 12:14:25 +00:00
//! let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?;
2021-12-03 09:37:22 +00:00
//!
2022-02-07 14:10:08 +00:00
//! // Call the `whoami` RPC method to retrieve the public key for the sbot
//! // identity.
2021-12-03 09:37:22 +00:00
//! let id = sbot_client.whoami().await?;
2022-07-06 10:40:58 +00:00
//!
2022-02-07 14:10:08 +00:00
//! // Print the public key (identity) to `stdout`.
2021-12-03 09:37:22 +00:00
//! println!("{}", id);
//!
2022-02-07 14:10:08 +00:00
//! // Compose an SSB post message type.
//! let post = SsbMessageContent::Post {
//! text: "Biology, eh?!".to_string(),
//! mentions: None,
//! };
//!
//! // Publish the post.
//! let post_msg_reference = sbot_client.publish(post).await?;
//!
//! // Print the reference (sigil-link) for the published post.
//! println!("{}", post_msg_reference);
//!
2021-12-03 09:37:22 +00:00
//! Ok(())
//! }
//! ```
2021-12-02 17:55:31 +00:00
2022-02-08 09:53:27 +00:00
pub mod api ;
2022-02-24 09:02:21 +00:00
pub mod blobs ;
2021-12-02 17:48:16 +00:00
pub mod error ;
2021-12-29 15:59:05 +00:00
pub mod messages ;
2021-12-29 16:31:53 +00:00
pub mod sbot ;
2021-12-29 01:35:46 +00:00
pub mod utils ;
2021-12-02 13:12:52 +00:00
2022-02-08 09:53:27 +00:00
pub use crate ::{ error ::GolgiError , sbot ::Sbot } ;
2022-07-06 10:40:58 +00:00
pub use kuska_ssb ;