Crates.io | bonfire |
lib.rs | bonfire |
version | 0.1.0 |
source | src |
created_at | 2024-05-17 11:57:30.584572 |
updated_at | 2024-05-17 11:57:30.584572 |
description | Client library for the Bonfire API |
homepage | |
repository | https://github.com/Camper-CoolDie/bonfire-rust |
max_upload_size | |
id | 1243065 |
size | 17,878 |
An asynchronous client library for the Bonfire API. For now, there is only an interface to communicate with the server.
Creating a session to send a simple request to the real server and print the response.
use std::net::{SocketAddr, IpAddr, Ipv4Addr};
use bonfire::Session;
use bonfire::session::{Result, RequestKind, SecureConnector};
#[tokio::main]
async fn main() -> Result<()> {
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(116, 202, 162, 215)), 443);
let host = "cf2.bonfire.moe";
let connector = SecureConnector::new(host, addr);
let object = json::object!{ J_REQUEST_NAME: "RProjectVersionGet" };
let mut session = Session::builder()
.kind(RequestKind::Bonfire)
.connect(connector).await?;
let response = session.request("/", object).await?;
println!("{}", response);
Ok(())
}