Skip to content

Rename trustee JSON fields and refresh v2 API fixtures#112

Merged
juankuquintana merged 1 commit into
mainfrom
change/trustee-api-fields
May 4, 2026
Merged

Rename trustee JSON fields and refresh v2 API fixtures#112
juankuquintana merged 1 commit into
mainfrom
change/trustee-api-fields

Conversation

@juankuquintana

@juankuquintana juankuquintana commented May 1, 2026

Copy link
Copy Markdown
Contributor

Belongs to https://github.com/dnsimple/dnsimple-business/issues/2641

Rename trustee JSON fields and refresh v2 API fixtures

🔍 QA

From the rake console

//! From the repository root:
//!   1. `cargo run --bin test_local`

use std::collections::HashMap;

use dnsimple::dnsimple::registrar::DomainRegistrationPayload;
use dnsimple::dnsimple::{new_client, Client, Filters, RequestOptions};

fn main() {
    let account_id: u64 = 2;
    let registrant_id: u64 = 1;
    let tld_name = "com";
    let domain_name = "asdf.com";
    let new_domain_name = "rustdomain";

    let token = "dnsimpletest_a_FSYtfYn7p74jfPd3GBUUsnLoOXia8hkR";
    let mut client: Client = new_client(false, String::from(token));
    client.set_base_url("http://api.localhost:5000");

    let list = client
        .tlds()
        .list_tlds(None)
        .expect("list_tlds");
    for t in list.data.expect("tlds data") {
        println!(
            "tld={} trustee_service_enabled={} trustee_service_required={}",
            t.tld, t.trustee_service_enabled, t.trustee_service_required
        );
    }

    let tld = client
        .tlds()
        .get_tld(String::from(tld_name))
        .expect("get_tld");
    let t = tld.data.expect("tld data");
    println!(
        "tld={} trustee_service_enabled={} trustee_service_required={}",
        t.tld, t.trustee_service_enabled, t.trustee_service_required
    );

    let mut filters = HashMap::new();
    filters.insert("name_like".to_string(), domain_name.to_string());
    let list_opts = RequestOptions {
        filters: Some(Filters { filters }),
        sort: None,
        paginate: None,
    };
    let listed = client
        .domains()
        .list_domains(account_id, Some(list_opts))
        .expect("list_domains");
    let domain_id = listed
        .data
        .as_ref()
        .and_then(|domains| domains.first())
        .map(|d| d.id)
        .expect("domain not found in account (check domain_name)");

    let domain = client
        .domains()
        .get_domain(account_id, domain_id)
        .expect("get_domain");
    let d = domain.data.expect("domain data");
    println!("domain={} trustee={}", d.name, d.trustee);

    let prices = client
        .registrar()
        .get_domain_prices(account_id, domain_name)
        .expect("get_domain_prices");
    let p = prices.data.expect("prices data");
    println!(
        "prices domain={} trustee_price={:?}",
        p.domain, p.trustee_price
    );

    let registration = client
        .registrar()
        .register_domain(
            account_id,
            &format!("{new_domain_name}.com"),
            DomainRegistrationPayload {
                registrant_id,
                whois_privacy: None,
                trustee: None,
                auto_renew: None,
                extended_attributes: None,
                premium_price: None,
            },
        )
        .expect("register_domain");
    let r = registration.data.expect("registration data");
    println!(
        "registration domain_id={} trustee={}",
        r.domain_id, r.trustee
    );
}

📋 Deployment Pre/Post tasks

:shipit: Deployment Verification

  • QAd

@juankuquintana juankuquintana self-assigned this May 1, 2026
@juankuquintana juankuquintana added the enhancement New feature, enhancement or code changes, not related to defects label May 1, 2026
@juankuquintana juankuquintana requested a review from lokst May 1, 2026 02:31
@juankuquintana juankuquintana merged commit 56d4af5 into main May 4, 2026
5 checks passed
@juankuquintana juankuquintana deleted the change/trustee-api-fields branch May 4, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, enhancement or code changes, not related to defects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants