Crate eggbug

Source
Expand description

eggbug-rs is a bot library for cohost.org, providing an interface to create, read, edit, and delete posts.

use eggbug::{Post, Session};

// Log in
let session = Session::login("eggbug@website.invalid", "hunter2").await?;

// Describe a post
let mut post = Post {
    headline: "hello from eggbug-rs!".into(),
    markdown: "wow it's like a website in here".into(),
    ..Default::default()
};

// Create the post on the eggbug page
let id = session.create_post("eggbug", &mut post).await?;

// Oh wait we want to make that a link
post.markdown = "wow it's [like a website in here](https://cohost.org/hthrflwrs/post/25147-empty)".into();
session.edit_post("eggbug", id, &mut post).await?;

// Good job!

§License

eggbug-rs is released under the terms of the Anti-Capitalist Software License, version 1.4.

Structs§

Ask
Describes the contents of an ask. Asks can’t be created client-side, only decoded when reading content from the server.
AskId
An ask ID.
Asker
Describes the project that sent an ask.
Attachment
Describes an attachment.
AttachmentId
An attachment ID.
Client
HTTP client.
Post
Describes a post’s contents.
PostId
A post ID.
PostLocations
All identifying information about where to find a post, from its ID to how to edit it.
PostMetadata
Metadata returned by the cohost API for posts retrieved from post pages.
Session
Logged-in session.

Enums§

Error
Errors that might occur when using the library.
MediaMetadata
Attachment metadata specific to a supported type of media.