pub struct AnsClientBuilder { /* private fields */ }Expand description
Builder for constructing an AnsClient.
Implementations§
Source§impl AnsClientBuilder
impl AnsClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Set the base URL for API requests.
§Examples
use ans_client::AnsClient;
let client = AnsClient::builder()
.base_url("https://api.godaddy.com")
.build();Sourcepub fn jwt(self, token: impl Into<String>) -> Self
pub fn jwt(self, token: impl Into<String>) -> Self
Set JWT authentication (for internal endpoints).
Use this when connecting to internal RA endpoints like
api.{env}-godaddy.com.
Sourcepub fn api_key(self, key: impl Into<String>, secret: impl Into<String>) -> Self
pub fn api_key(self, key: impl Into<String>, secret: impl Into<String>) -> Self
Set API key authentication (for public gateway).
Use this when connecting to public API gateway endpoints like
api.godaddy.com.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a custom header to include with every request.
Header names and values are validated when build() is called.
Use this for API gateway headers, correlation IDs, or other
headers required by your environment.
Sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn headers( self, headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
Add multiple custom headers to include with every request.
Header names and values are validated when build() is called.
Sourcepub fn allow_insecure(self) -> Self
pub fn allow_insecure(self) -> Self
Allow insecure (non-HTTPS) base URLs.
By default, the builder rejects http:// base URLs because this SDK
sends authentication credentials (JWT tokens, API key secrets) in the
Authorization header on every request. Sending credentials over
plaintext HTTP is a security risk.
Only use this for local development or testing against mock servers.
§Example
use ans_client::AnsClient;
let client = AnsClient::builder()
.base_url("http://localhost:8080")
.allow_insecure()
.build()
.unwrap();