Crate octoapp

Source
Expand description

Octoapp

GitHub Crates.io Version Crates.io Downloads (recent) GitHub Stars GitHub Issues Licence

ยงOverview

Octoapp is a Rust library for building GitHub Apps. It provides a simple interface for creating GitHub Apps and handling webhook events.

ยงโœจ Features

  • Focus on simplicity and ease of use.
  • Built-in support for handling GitHub webhook events.
  • Uses octocrab for interacting with the GitHub API.
  • Supports rocket web framework for handling incoming webhook events.
    • feature: rocket

ยง๐Ÿš€ Quick Start

Run the following command to add octoapp to your project:

cargo add octoapp

ยง๐Ÿƒ Getting Started

use anyhow::Result;
use octoapp::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    // [optional] Load .env file if it exists
    // dotenvy::dotenv().ok();

    // Load the configuration (from environment variables)
    // Or, you can set the configuration manually
    let config = OctoAppConfig::init()
        .app_name("My App")
        .app_id(12345)
        .client_id("client_id")
        .client_secret("client_secret")
        .webhook_secret("webhook_secret")
        .build()
        .expect("Failed to build OctoAppConfig");

    println!("{}", config);

    // Create a new Octocrab instance
    let octocrab = config.octocrab();

    if let Ok(client) = octocrab {
        let repos = client.issues("42ByteLabs", "octoapp")
            .list()
            .creator("GeekMasher")
            .send()
            .await?;
    }

    Ok(())
}

ยง๐Ÿ“š Documentation

You can find the documentation for this project on docs.rs.

ยงโ™ฅ๏ธ Maintainers / Contributors

ยง๐Ÿฆธ Support

Please create GitHub Issues if there are bugs or feature requests.

This project uses Semantic Versioning (v2) and with major releases, breaking changes will occur.

ยง๐Ÿ““ License

This project is licensed under the terms of the MIT open source license. Please refer to MIT for the full terms.

Re-exportsยง

pub use config::OctoAppConfig;
pub use error::OctoAppError;
pub use events::WebHook;
pub use crate::ghrocket::OctoAppResult;
pub use crate::ghrocket::OctoAppState;

Modulesยง

config
Configuration module for the OctoApp
error
Error handling for the OctoApp
events
GitHub Webhook Payloads
ghrocket
Rocket Module