#domain #management #api #async #porkbun #default #transport

porkbun-api

an async implementation of porkbun's domain management api

1 stable release

new 1.0.0 Jan 29, 2025

#288 in HTTP server

41 downloads per month

Custom license

54KB
1K SLoC

porbun-api 🐖

Docs.rs Crates.io MIT licensed

this crate provides an async implementation of porkbun's domain management api. It provides a transport-agnostic Client, and a default transport layer based on hyper suitable for use in tokio-based applications.

Example

#[tokio::main]
async fn main() -> porkbun_api::Result<()> {
    let api_key = porkbun_api::ApiKey::new("secret", "api_key");
    let client = porkbun_api::Client::new(api_key);
    let domain = &client.domains().await?[0].domain;
    let subdomain = Some("my.ip");
    let my_ip = client.ping().await?;
    let record = CreateOrEditDnsRecord::A_or_AAAA(subdomain, my_ip);
    let id = client.create(domain, record).await?;
    println!("added record {id}");
    client.delete(domain, &id).await?;
    println!("removed record {id}");
    Ok(())
}

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, shall be licensed as MIT, without any additional terms or conditions.

Dependencies

~8–19MB
~271K SLoC