| Crates.io | porkbun-api |
| lib.rs | porkbun-api |
| version | 1.0.1 |
| created_at | 2025-01-29 16:27:28.112208+00 |
| updated_at | 2025-03-23 13:41:54.326585+00 |
| description | an async implementation of porkbun's domain management api. |
| homepage | |
| repository | https://github.com/HayleyDeckers/porkbun-api |
| max_upload_size | |
| id | 1534957 |
| size | 109,337 |
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.
#[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(())
}
This project is licensed under the MIT license.
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.