porkbun-api

Crates.ioporkbun-api
lib.rsporkbun-api
version1.0.1
created_at2025-01-29 16:27:28.112208+00
updated_at2025-03-23 13:41:54.326585+00
descriptionan async implementation of porkbun's domain management api.
homepage
repositoryhttps://github.com/HayleyDeckers/porkbun-api
max_upload_size
id1534957
size109,337
Hayley Deckers (HayleyDeckers)

documentation

README

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.

Commit count: 40

cargo fmt