1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//! # ANS API Client
//!
//! This crate provides a client for interacting with the ANS (Agent Name Service) API
//! for agent registration, certificate management, and discovery operations.
//!
//! ## Features
//!
//! - Agent registration and renewal
//! - Certificate signing request submission
//! - Agent search and resolution
//! - Domain validation (ACME, DNS)
//! - Agent revocation
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use ans_client::{AnsClient, models::*};
//!
//! #[tokio::main]
//! async fn main() -> ans_client::Result<()> {
//! // Create a client with JWT authentication
//! let client = AnsClient::builder()
//! .base_url("https://api.godaddy.com")
//! .jwt("your-jwt-token")
//! .build()?;
//!
//! // Search for agents
//! let mut criteria = SearchCriteria::default();
//! criteria.agent_host = Some("example.com".into());
//! let results = client.search_agents(&criteria, Some(10), None).await?;
//!
//! for agent in results.agents {
//! println!("{}: {}", agent.ans_name, agent.agent_display_name);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Authentication
//!
//! The ANS API supports two authentication methods:
//!
//! - **JWT**: For endpoints at `api.{env}-godaddy.com`
//! ```rust
//! # use ans_client::AnsClient;
//! let client = AnsClient::builder()
//! .jwt("your-jwt-token")
//! .build();
//! ```
//!
//! - **API Key**: For public gateway (`api.godaddy.com`)
//! ```rust
//! # use ans_client::AnsClient;
//! let client = AnsClient::builder()
//! .api_key("your-key", "your-secret")
//! .build();
//! ```
//!
//! ## Registration Flow
//!
//! Agent registration is a multi-step process:
//!
//! 1. Submit registration request with CSRs
//! 2. Configure ACME challenge (DNS-01 or HTTP-01)
//! 3. Call `verify_acme()` to validate domain ownership
//! 4. Configure required DNS records
//! 5. Call `verify_dns()` to complete registration
//!
//! ```rust,no_run
//! # use ans_client::{AnsClient, models::*};
//! # async fn example() -> ans_client::Result<()> {
//! let client = AnsClient::builder()
//! .base_url("https://api.godaddy.com")
//! .jwt("token")
//! .build()?;
//!
//! // Step 1: Register
//! let endpoint = AgentEndpoint::new("https://agent.example.com/mcp", Protocol::Mcp)
//! .with_transports(vec![Transport::StreamableHttp]);
//!
//! let request = AgentRegistrationRequest::new(
//! "my-agent",
//! "agent.example.com",
//! "1.0.0",
//! "-----BEGIN CERTIFICATE REQUEST-----...",
//! vec![endpoint],
//! )
//! .with_server_csr_pem("-----BEGIN CERTIFICATE REQUEST-----...");
//!
//! let pending = client.register_agent(&request).await?;
//! let agent_id = pending.agent_id.expect("agent_id");
//!
//! // Step 2-3: Configure challenge, then verify
//! // ... configure DNS or HTTP challenge ...
//! let status = client.verify_acme(&agent_id).await?;
//!
//! // Step 4-5: Configure DNS records, then verify
//! // ... configure DNS records from pending.dns_records ...
//! let status = client.verify_dns(&agent_id).await?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
// Re-export types from ans-types for convenience
pub use ;