silly me; revert to

This commit is contained in:
glyph 2022-02-08 15:04:44 +02:00
parent d2a0c38f68
commit 7aa32e24c7
9 changed files with 140 additions and 8 deletions

65
api_design_notes Normal file
View File

@ -0,0 +1,65 @@
Higher level functions:
```rust
let mut sbot_client = Sbot::connect();
// second parameter is `Option<id>`; if `None`, return our relationship with `id`
// if second parameter is `Some(dest_id)`, return id's relationship with dest_id
match sbot_client.get_relationship(id, None) {
Relationship::Following => ,
Relationship::NotFollowing => ,
Relationship::Blocking => ,
Relationship::Muting => ,
}
sbot_client.set_relationship(id,
```
data structures
```rust
enum Relationship {
Following,
NotFollowing,
Blocking,
Muting
}
struct Profile {
id: String,
name: String,
description: String,
// blob reference (maybe?)
image: String,
}
```
-----
whoami - id: String
name(id) -> name: String
description(id) -> description: String
publish_description(id, text) -> msg_ref: String
publish_name(id, text) -> msg_ref: String
publish_post(text) -> msg_ref: String
follows(id) -> Vec<SsbId>
followers(id) -> Vec<SsbId>
friends(id) -> Vec<SsbId>
blocks(id) -> Vec<SsbId>
follow(id) -> msg_ref
unfollow(id) -> msg_ref
block(id) -> msg_ref
profile_image(id)
-----
```
let mut sbot_client = Sbot::init();
```
-----

View File

@ -3,7 +3,7 @@ use std::process;
use golgi::{messages::SsbMessageContent, GolgiError, Sbot};
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::connect(None, None).await?;
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("whoami: {}", id);
@ -31,7 +31,7 @@ async fn run() -> Result<(), GolgiError> {
println!("post_msg_ref: {}", post_msg_ref);
let post_msg_ref = sbot_client
.publish_description("this is a description7")
.publish_description("this is a description")
.await?;
println!("description: {}", post_msg_ref);

View File

@ -6,7 +6,7 @@ use golgi::{
};
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::connect(None, None).await?;
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("whoami: {}", id);

View File

@ -5,7 +5,7 @@ use kuska_ssb::api::dto::content::PubAddress;
use golgi::{messages::SsbMessageContent, GolgiError, Sbot};
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::connect(None, None).await?;
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("whoami: {}", id);

View File

@ -9,7 +9,7 @@ use golgi::{
};
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::connect(None, None).await?;
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("whoami: {}", id);

33
muxrpc_notes Normal file
View File

@ -0,0 +1,33 @@
[ how to use subset query ]
name of the muxrpc call: `paritalReplication.getSubset`
https://github.com/cryptoscope/ssb/blob/a781ad4ee51523df1d3858d9859c285d0eeb2fb1/sbot/manifest.go#L75-L76
subset query tests
https://github.com/cryptoscope/ssb/blob/a781ad4ee51523df1d3858d9859c285d0eeb2fb1/query/subsetquery_test.go
[ subset query args ]
get all msgs of type `foo`:
{"op":"type","string":"foo"}
get all msgs by author `feed`:
{"op":"author","feed":"@AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=.ed25519"}
get all msgs of type `foo` by author `feed`:
{"op":"and","args":[{"op":"author","feed":"@AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=.ed25519"},{"op":"type","string":"foo"}]}
get all msgs of type `foo` or `bar`:
{"op":"or","args":[{"op":"type","string":"foo"},{"op":"type","string":"bar"}]}
get all msgs of type `foo` and `bar` by author `feed`:
{"op":"and","args":[{"op":"author","feed":"@AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=.ed25519"},{"op":"or","args":[{"op":"type","string":"foo"},{"op":"type","string":"bar"}]}]}

34
notes Normal file
View File

@ -0,0 +1,34 @@
[ current ]
src
├── error.rs
├── lib.rs
├── messages.rs
├── sbot
│ ├── about.rs
│ ├── friends.rs
│ ├── get_subset.rs
│ ├── history_stream.rs
│ ├── invite.rs
│ ├── mod.rs
│ ├── publish.rs
│ └── sbot_connection.rs
└── utils.rs
[ experiment ]
src
├── api
│ ├── about.rs
│ ├── friends.rs
│ ├── get_subset.rs
│ ├── history_stream.rs
│ ├── invite.rs
│ ├── mod.rs
│ └── publish.rs
├── error.rs
├── lib.rs
├── messages.rs
├── sbot.rs
└── utils.rs

View File

@ -41,7 +41,7 @@
//! pub async fn run() -> Result<(), GolgiError> {
//! // Attempt to connect to an sbot instance using the default IP address,
//! // port and network key (aka. capabilities key).
//! let mut sbot_client = Sbot::connect(None, None).await?;
//! let mut sbot_client = Sbot::init(None, None).await?;
//!
//! // Call the `whoami` RPC method to retrieve the public key for the sbot
//! // identity.

View File

@ -17,7 +17,7 @@ use crate::error::GolgiError;
/// and read the responses.
/// Note there can be multiple SbotConnection at the same time.
pub struct SbotConnection {
/// client for writing requests to go-bot
/// Client for writing requests to go-bot
pub client: ApiCaller<TcpStream>,
/// RpcReader object for reading responses from go-sbot
pub rpc_reader: RpcReader<TcpStream>,
@ -93,7 +93,7 @@ impl Sbot {
.await
.map_err(|source| GolgiError::Io {
source,
context: "socket error; failed to initiate tcp stream connection".to_string(),
context: "failed to initiate tcp stream connection".to_string(),
})?;
let handshake = kuska_handshake::async_std::handshake_client(