Skip to content

Commit

Permalink
doc: Add example of how to create a Post on bsky (#255)
Browse files Browse the repository at this point in the history
Adds an example to the README in the `bsky-sdk`. This is often the first
thing new users will want to try when interacting with the SDK.
  • Loading branch information
irbull authored Nov 19, 2024
1 parent c892ece commit f94fcf4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions bsky-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,36 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

### Posts

Create a BlueSky post:

```rust,no_run
use atrium_api::types::string::Datetime;
use bsky_sdk::BskyAgent;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let agent = BskyAgent::builder().build().await?;
agent.login("...", "...").await?;
agent
.create_record(atrium_api::app::bsky::feed::post::RecordData {
created_at: Datetime::now(),
embed: None,
entities: None,
facets: None,
labels: None,
langs: None,
reply: None,
tags: None,
text: "Hello world, from Rust!".to_string(),
})
.await?;
Ok(())
}
```

### RichText

Creating a RichText object from a string:
Expand Down

0 comments on commit f94fcf4

Please sign in to comment.