1use reqwest;
12use serde::{Deserialize, Serialize, de::Error as _};
13
14use super::{ContentType, Error, configuration};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum AddDomainError {
21 Status400(models::GetFinances400Response),
22 Status401(models::GetFinances401Response),
23 Status409(models::CreateDatabaseBackup409Response),
24 Status429(models::GetFinances429Response),
25 Status500(models::GetFinances500Response),
26 UnknownValue(serde_json::Value)
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum AddSubdomainError {
33 Status400(models::GetFinances400Response),
34 Status401(models::GetFinances401Response),
35 Status404(models::GetImage404Response),
36 Status429(models::GetFinances429Response),
37 Status500(models::GetFinances500Response),
38 UnknownValue(serde_json::Value)
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(untagged)]
44pub enum CheckDomainError {
45 Status400(models::GetFinances400Response),
46 Status401(models::GetFinances401Response),
47 Status429(models::GetFinances429Response),
48 Status500(models::GetFinances500Response),
49 UnknownValue(serde_json::Value)
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum CreateDomainDnsRecordError {
56 Status400(models::GetFinances400Response),
57 Status401(models::GetFinances401Response),
58 Status404(models::GetImage404Response),
59 Status429(models::GetFinances429Response),
60 Status500(models::GetFinances500Response),
61 UnknownValue(serde_json::Value)
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum CreateDomainDnsRecordV2Error {
68 Status400(models::GetFinances400Response),
69 Status401(models::GetFinances401Response),
70 Status404(models::GetImage404Response),
71 Status409(models::CreateDatabaseBackup409Response),
72 Status429(models::GetFinances429Response),
73 Status500(models::GetFinances500Response),
74 UnknownValue(serde_json::Value)
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum CreateDomainRequestError {
81 Status400(models::GetFinances400Response),
82 Status401(models::GetFinances401Response),
83 Status409(models::CreateDatabaseBackup409Response),
84 Status429(models::GetFinances429Response),
85 Status500(models::GetFinances500Response),
86 UnknownValue(serde_json::Value)
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum DeleteDomainError {
93 Status400(models::GetFinances400Response),
94 Status401(models::GetFinances401Response),
95 Status404(models::GetImage404Response),
96 Status409(models::CreateDatabaseBackup409Response),
97 Status429(models::GetFinances429Response),
98 Status500(models::GetFinances500Response),
99 UnknownValue(serde_json::Value)
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum DeleteDomainDnsRecordError {
106 Status400(models::GetFinances400Response),
107 Status401(models::GetFinances401Response),
108 Status404(models::GetImage404Response),
109 Status429(models::GetFinances429Response),
110 Status500(models::GetFinances500Response),
111 UnknownValue(serde_json::Value)
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum DeleteDomainDnsRecordV2Error {
118 Status400(models::GetFinances400Response),
119 Status401(models::GetFinances401Response),
120 Status404(models::GetImage404Response),
121 Status429(models::GetFinances429Response),
122 Status500(models::GetFinances500Response),
123 UnknownValue(serde_json::Value)
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum DeleteSubdomainError {
130 Status400(models::GetFinances400Response),
131 Status401(models::GetFinances401Response),
132 Status404(models::GetImage404Response),
133 Status409(models::CreateDatabaseBackup409Response),
134 Status429(models::GetFinances429Response),
135 Status500(models::GetFinances500Response),
136 UnknownValue(serde_json::Value)
137}
138
139#[derive(Debug, Clone, Serialize, Deserialize)]
141#[serde(untagged)]
142pub enum GetDomainError {
143 Status400(models::GetFinances400Response),
144 Status401(models::GetFinances401Response),
145 Status404(models::GetImage404Response),
146 Status429(models::GetFinances429Response),
147 Status500(models::GetFinances500Response),
148 UnknownValue(serde_json::Value)
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetDomainDefaultDnsRecordsError {
155 Status400(models::GetFinances400Response),
156 Status401(models::GetFinances401Response),
157 Status404(models::GetImage404Response),
158 Status429(models::GetFinances429Response),
159 Status500(models::GetFinances500Response),
160 UnknownValue(serde_json::Value)
161}
162
163#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum GetDomainDnsRecordsError {
167 Status400(models::GetFinances400Response),
168 Status401(models::GetFinances401Response),
169 Status404(models::GetImage404Response),
170 Status429(models::GetFinances429Response),
171 Status500(models::GetFinances500Response),
172 UnknownValue(serde_json::Value)
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum GetDomainNameServersError {
179 Status400(models::GetFinances400Response),
180 Status401(models::GetFinances401Response),
181 Status404(models::GetImage404Response),
182 Status429(models::GetFinances429Response),
183 Status500(models::GetFinances500Response),
184 UnknownValue(serde_json::Value)
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetDomainRequestError {
191 Status400(models::GetFinances400Response),
192 Status401(models::GetFinances401Response),
193 Status404(models::GetImage404Response),
194 Status429(models::GetFinances429Response),
195 Status500(models::GetFinances500Response),
196 UnknownValue(serde_json::Value)
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum GetDomainRequestsError {
203 Status400(models::GetFinances400Response),
204 Status401(models::GetFinances401Response),
205 Status429(models::GetFinances429Response),
206 Status500(models::GetFinances500Response),
207 UnknownValue(serde_json::Value)
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum GetDomainsError {
214 Status400(models::GetFinances400Response),
215 Status401(models::GetFinances401Response),
216 Status429(models::GetFinances429Response),
217 Status500(models::GetFinances500Response),
218 UnknownValue(serde_json::Value)
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum GetTldError {
225 Status400(models::GetFinances400Response),
226 Status401(models::GetFinances401Response),
227 Status404(models::GetImage404Response),
228 Status429(models::GetFinances429Response),
229 Status500(models::GetFinances500Response),
230 UnknownValue(serde_json::Value)
231}
232
233#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum GetTldsError {
237 Status400(models::GetFinances400Response),
238 Status401(models::GetFinances401Response),
239 Status429(models::GetFinances429Response),
240 Status500(models::GetFinances500Response),
241 UnknownValue(serde_json::Value)
242}
243
244#[derive(Debug, Clone, Serialize, Deserialize)]
246#[serde(untagged)]
247pub enum UpdateDomainAutoProlongationError {
248 Status400(models::GetFinances400Response),
249 Status401(models::GetFinances401Response),
250 Status404(models::GetImage404Response),
251 Status409(models::CreateDatabaseBackup409Response),
252 Status429(models::GetFinances429Response),
253 Status500(models::GetFinances500Response),
254 UnknownValue(serde_json::Value)
255}
256
257#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum UpdateDomainDnsRecordError {
261 Status400(models::GetFinances400Response),
262 Status401(models::GetFinances401Response),
263 Status404(models::GetImage404Response),
264 Status429(models::GetFinances429Response),
265 Status500(models::GetFinances500Response),
266 UnknownValue(serde_json::Value)
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum UpdateDomainDnsRecordV2Error {
273 Status400(models::GetFinances400Response),
274 Status401(models::GetFinances401Response),
275 Status404(models::GetImage404Response),
276 Status409(models::CreateDatabaseBackup409Response),
277 Status429(models::GetFinances429Response),
278 Status500(models::GetFinances500Response),
279 UnknownValue(serde_json::Value)
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum UpdateDomainNameServersError {
286 Status400(models::GetFinances400Response),
287 Status401(models::GetFinances401Response),
288 Status404(models::GetImage404Response),
289 Status429(models::GetFinances429Response),
290 Status500(models::GetFinances500Response),
291 UnknownValue(serde_json::Value)
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum UpdateDomainRequestError {
298 Status400(models::GetFinances400Response),
299 Status401(models::GetFinances401Response),
300 Status404(models::GetImage404Response),
301 Status409(models::CreateDatabaseBackup409Response),
302 Status429(models::GetFinances429Response),
303 Status500(models::GetFinances500Response),
304 UnknownValue(serde_json::Value)
305}
306
307pub async fn add_domain(
310 configuration: &configuration::Configuration,
311 fqdn: &str
312) -> Result<(), Error<AddDomainError>> {
313 let p_path_fqdn = fqdn;
315
316 let uri_str = format!(
317 "{}/api/v1/add-domain/{fqdn}",
318 configuration.base_path,
319 fqdn = crate::apis::urlencode(p_path_fqdn)
320 );
321 let mut req_builder = configuration
322 .client
323 .request(reqwest::Method::POST, &uri_str);
324
325 if let Some(ref user_agent) = configuration.user_agent {
326 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
327 }
328 if let Some(ref token) = configuration.bearer_access_token {
329 req_builder = req_builder.bearer_auth(token.to_owned());
330 };
331
332 let req = req_builder.build()?;
333 let resp = configuration.client.execute(req).await?;
334
335 let status = resp.status();
336
337 if !status.is_client_error() && !status.is_server_error() {
338 Ok(())
339 } else {
340 let content = resp.text().await?;
341 let entity: Option<AddDomainError> = serde_json::from_str(&content).ok();
342 Err(Error::ResponseError(ResponseContent {
343 status,
344 content,
345 entity
346 }))
347 }
348}
349
350pub async fn add_subdomain(
356 configuration: &configuration::Configuration,
357 fqdn: &str,
358 subdomain_fqdn: &str
359) -> Result<models::AddSubdomain201Response, Error<AddSubdomainError>> {
360 let p_path_fqdn = fqdn;
362 let p_path_subdomain_fqdn = subdomain_fqdn;
363
364 let uri_str = format!(
365 "{}/api/v1/domains/{fqdn}/subdomains/{subdomain_fqdn}",
366 configuration.base_path,
367 fqdn = crate::apis::urlencode(p_path_fqdn),
368 subdomain_fqdn = crate::apis::urlencode(p_path_subdomain_fqdn)
369 );
370 let mut req_builder = configuration
371 .client
372 .request(reqwest::Method::POST, &uri_str);
373
374 if let Some(ref user_agent) = configuration.user_agent {
375 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
376 }
377 if let Some(ref token) = configuration.bearer_access_token {
378 req_builder = req_builder.bearer_auth(token.to_owned());
379 };
380
381 let req = req_builder.build()?;
382 let resp = configuration.client.execute(req).await?;
383
384 let status = resp.status();
385 let content_type = resp
386 .headers()
387 .get("content-type")
388 .and_then(|v| v.to_str().ok())
389 .unwrap_or("application/octet-stream");
390 let content_type = super::ContentType::from(content_type);
391
392 if !status.is_client_error() && !status.is_server_error() {
393 let content = resp.text().await?;
394 match content_type {
395 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
396 ContentType::Text => {
397 return Err(Error::from(serde_json::Error::custom(
398 "Received `text/plain` content type response that cannot be converted to `models::AddSubdomain201Response`"
399 )));
400 }
401 ContentType::Unsupported(unknown_type) => {
402 return Err(Error::from(serde_json::Error::custom(format!(
403 "Received `{unknown_type}` content type response that cannot be converted to `models::AddSubdomain201Response`"
404 ))));
405 }
406 }
407 } else {
408 let content = resp.text().await?;
409 let entity: Option<AddSubdomainError> = serde_json::from_str(&content).ok();
410 Err(Error::ResponseError(ResponseContent {
411 status,
412 content,
413 entity
414 }))
415 }
416}
417
418pub async fn check_domain(
421 configuration: &configuration::Configuration,
422 fqdn: &str
423) -> Result<models::CheckDomain200Response, Error<CheckDomainError>> {
424 let p_path_fqdn = fqdn;
426
427 let uri_str = format!(
428 "{}/api/v1/check-domain/{fqdn}",
429 configuration.base_path,
430 fqdn = crate::apis::urlencode(p_path_fqdn)
431 );
432 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
433
434 if let Some(ref user_agent) = configuration.user_agent {
435 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
436 }
437 if let Some(ref token) = configuration.bearer_access_token {
438 req_builder = req_builder.bearer_auth(token.to_owned());
439 };
440
441 let req = req_builder.build()?;
442 let resp = configuration.client.execute(req).await?;
443
444 let status = resp.status();
445 let content_type = resp
446 .headers()
447 .get("content-type")
448 .and_then(|v| v.to_str().ok())
449 .unwrap_or("application/octet-stream");
450 let content_type = super::ContentType::from(content_type);
451
452 if !status.is_client_error() && !status.is_server_error() {
453 let content = resp.text().await?;
454 match content_type {
455 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
456 ContentType::Text => {
457 return Err(Error::from(serde_json::Error::custom(
458 "Received `text/plain` content type response that cannot be converted to `models::CheckDomain200Response`"
459 )));
460 }
461 ContentType::Unsupported(unknown_type) => {
462 return Err(Error::from(serde_json::Error::custom(format!(
463 "Received `{unknown_type}` content type response that cannot be converted to `models::CheckDomain200Response`"
464 ))));
465 }
466 }
467 } else {
468 let content = resp.text().await?;
469 let entity: Option<CheckDomainError> = serde_json::from_str(&content).ok();
470 Err(Error::ResponseError(ResponseContent {
471 status,
472 content,
473 entity
474 }))
475 }
476}
477
478#[deprecated]
484pub async fn create_domain_dns_record(
485 configuration: &configuration::Configuration,
486 fqdn: &str,
487 create_dns: models::CreateDns
488) -> Result<models::CreateDomainDnsRecord201Response, Error<CreateDomainDnsRecordError>> {
489 let p_path_fqdn = fqdn;
491 let p_body_create_dns = create_dns;
492
493 let uri_str = format!(
494 "{}/api/v1/domains/{fqdn}/dns-records",
495 configuration.base_path,
496 fqdn = crate::apis::urlencode(p_path_fqdn)
497 );
498 let mut req_builder = configuration
499 .client
500 .request(reqwest::Method::POST, &uri_str);
501
502 if let Some(ref user_agent) = configuration.user_agent {
503 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
504 }
505 if let Some(ref token) = configuration.bearer_access_token {
506 req_builder = req_builder.bearer_auth(token.to_owned());
507 };
508 req_builder = req_builder.json(&p_body_create_dns);
509
510 let req = req_builder.build()?;
511 let resp = configuration.client.execute(req).await?;
512
513 let status = resp.status();
514 let content_type = resp
515 .headers()
516 .get("content-type")
517 .and_then(|v| v.to_str().ok())
518 .unwrap_or("application/octet-stream");
519 let content_type = super::ContentType::from(content_type);
520
521 if !status.is_client_error() && !status.is_server_error() {
522 let content = resp.text().await?;
523 match content_type {
524 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
525 ContentType::Text => {
526 return Err(Error::from(serde_json::Error::custom(
527 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainDnsRecord201Response`"
528 )));
529 }
530 ContentType::Unsupported(unknown_type) => {
531 return Err(Error::from(serde_json::Error::custom(format!(
532 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainDnsRecord201Response`"
533 ))));
534 }
535 }
536 } else {
537 let content = resp.text().await?;
538 let entity: Option<CreateDomainDnsRecordError> = serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent {
540 status,
541 content,
542 entity
543 }))
544 }
545}
546
547pub async fn create_domain_dns_record_v2(
553 configuration: &configuration::Configuration,
554 fqdn: &str,
555 create_dns_v2: models::CreateDnsV2
556) -> Result<models::CreateDomainDnsRecordV2201Response, Error<CreateDomainDnsRecordV2Error>> {
557 let p_path_fqdn = fqdn;
559 let p_body_create_dns_v2 = create_dns_v2;
560
561 let uri_str = format!(
562 "{}/api/v2/domains/{fqdn}/dns-records",
563 configuration.base_path,
564 fqdn = crate::apis::urlencode(p_path_fqdn)
565 );
566 let mut req_builder = configuration
567 .client
568 .request(reqwest::Method::POST, &uri_str);
569
570 if let Some(ref user_agent) = configuration.user_agent {
571 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572 }
573 if let Some(ref token) = configuration.bearer_access_token {
574 req_builder = req_builder.bearer_auth(token.to_owned());
575 };
576 req_builder = req_builder.json(&p_body_create_dns_v2);
577
578 let req = req_builder.build()?;
579 let resp = configuration.client.execute(req).await?;
580
581 let status = resp.status();
582 let content_type = resp
583 .headers()
584 .get("content-type")
585 .and_then(|v| v.to_str().ok())
586 .unwrap_or("application/octet-stream");
587 let content_type = super::ContentType::from(content_type);
588
589 if !status.is_client_error() && !status.is_server_error() {
590 let content = resp.text().await?;
591 match content_type {
592 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
593 ContentType::Text => {
594 return Err(Error::from(serde_json::Error::custom(
595 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainDnsRecordV2201Response`"
596 )));
597 }
598 ContentType::Unsupported(unknown_type) => {
599 return Err(Error::from(serde_json::Error::custom(format!(
600 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainDnsRecordV2201Response`"
601 ))));
602 }
603 }
604 } else {
605 let content = resp.text().await?;
606 let entity: Option<CreateDomainDnsRecordV2Error> = serde_json::from_str(&content).ok();
607 Err(Error::ResponseError(ResponseContent {
608 status,
609 content,
610 entity
611 }))
612 }
613}
614
615pub async fn create_domain_request(
620 configuration: &configuration::Configuration,
621 create_domain_request_request: models::CreateDomainRequestRequest
622) -> Result<models::CreateDomainRequest201Response, Error<CreateDomainRequestError>> {
623 let p_body_create_domain_request_request = create_domain_request_request;
625
626 let uri_str = format!("{}/api/v1/domains-requests", configuration.base_path);
627 let mut req_builder = configuration
628 .client
629 .request(reqwest::Method::POST, &uri_str);
630
631 if let Some(ref user_agent) = configuration.user_agent {
632 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
633 }
634 if let Some(ref token) = configuration.bearer_access_token {
635 req_builder = req_builder.bearer_auth(token.to_owned());
636 };
637 req_builder = req_builder.json(&p_body_create_domain_request_request);
638
639 let req = req_builder.build()?;
640 let resp = configuration.client.execute(req).await?;
641
642 let status = resp.status();
643 let content_type = resp
644 .headers()
645 .get("content-type")
646 .and_then(|v| v.to_str().ok())
647 .unwrap_or("application/octet-stream");
648 let content_type = super::ContentType::from(content_type);
649
650 if !status.is_client_error() && !status.is_server_error() {
651 let content = resp.text().await?;
652 match content_type {
653 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
654 ContentType::Text => {
655 return Err(Error::from(serde_json::Error::custom(
656 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
657 )));
658 }
659 ContentType::Unsupported(unknown_type) => {
660 return Err(Error::from(serde_json::Error::custom(format!(
661 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
662 ))));
663 }
664 }
665 } else {
666 let content = resp.text().await?;
667 let entity: Option<CreateDomainRequestError> = serde_json::from_str(&content).ok();
668 Err(Error::ResponseError(ResponseContent {
669 status,
670 content,
671 entity
672 }))
673 }
674}
675
676pub async fn delete_domain(
678 configuration: &configuration::Configuration,
679 fqdn: &str
680) -> Result<(), Error<DeleteDomainError>> {
681 let p_path_fqdn = fqdn;
683
684 let uri_str = format!(
685 "{}/api/v1/domains/{fqdn}",
686 configuration.base_path,
687 fqdn = crate::apis::urlencode(p_path_fqdn)
688 );
689 let mut req_builder = configuration
690 .client
691 .request(reqwest::Method::DELETE, &uri_str);
692
693 if let Some(ref user_agent) = configuration.user_agent {
694 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
695 }
696 if let Some(ref token) = configuration.bearer_access_token {
697 req_builder = req_builder.bearer_auth(token.to_owned());
698 };
699
700 let req = req_builder.build()?;
701 let resp = configuration.client.execute(req).await?;
702
703 let status = resp.status();
704
705 if !status.is_client_error() && !status.is_server_error() {
706 Ok(())
707 } else {
708 let content = resp.text().await?;
709 let entity: Option<DeleteDomainError> = serde_json::from_str(&content).ok();
710 Err(Error::ResponseError(ResponseContent {
711 status,
712 content,
713 entity
714 }))
715 }
716}
717
718#[deprecated]
721pub async fn delete_domain_dns_record(
722 configuration: &configuration::Configuration,
723 fqdn: &str,
724 record_id: i32
725) -> Result<(), Error<DeleteDomainDnsRecordError>> {
726 let p_path_fqdn = fqdn;
728 let p_path_record_id = record_id;
729
730 let uri_str = format!(
731 "{}/api/v1/domains/{fqdn}/dns-records/{record_id}",
732 configuration.base_path,
733 fqdn = crate::apis::urlencode(p_path_fqdn),
734 record_id = p_path_record_id
735 );
736 let mut req_builder = configuration
737 .client
738 .request(reqwest::Method::DELETE, &uri_str);
739
740 if let Some(ref user_agent) = configuration.user_agent {
741 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
742 }
743 if let Some(ref token) = configuration.bearer_access_token {
744 req_builder = req_builder.bearer_auth(token.to_owned());
745 };
746
747 let req = req_builder.build()?;
748 let resp = configuration.client.execute(req).await?;
749
750 let status = resp.status();
751
752 if !status.is_client_error() && !status.is_server_error() {
753 Ok(())
754 } else {
755 let content = resp.text().await?;
756 let entity: Option<DeleteDomainDnsRecordError> = serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent {
758 status,
759 content,
760 entity
761 }))
762 }
763}
764
765pub async fn delete_domain_dns_record_v2(
768 configuration: &configuration::Configuration,
769 fqdn: &str,
770 record_id: i32
771) -> Result<(), Error<DeleteDomainDnsRecordV2Error>> {
772 let p_path_fqdn = fqdn;
774 let p_path_record_id = record_id;
775
776 let uri_str = format!(
777 "{}/api/v2/domains/{fqdn}/dns-records/{record_id}",
778 configuration.base_path,
779 fqdn = crate::apis::urlencode(p_path_fqdn),
780 record_id = p_path_record_id
781 );
782 let mut req_builder = configuration
783 .client
784 .request(reqwest::Method::DELETE, &uri_str);
785
786 if let Some(ref user_agent) = configuration.user_agent {
787 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
788 }
789 if let Some(ref token) = configuration.bearer_access_token {
790 req_builder = req_builder.bearer_auth(token.to_owned());
791 };
792
793 let req = req_builder.build()?;
794 let resp = configuration.client.execute(req).await?;
795
796 let status = resp.status();
797
798 if !status.is_client_error() && !status.is_server_error() {
799 Ok(())
800 } else {
801 let content = resp.text().await?;
802 let entity: Option<DeleteDomainDnsRecordV2Error> = serde_json::from_str(&content).ok();
803 Err(Error::ResponseError(ResponseContent {
804 status,
805 content,
806 entity
807 }))
808 }
809}
810
811pub async fn delete_subdomain(
814 configuration: &configuration::Configuration,
815 fqdn: &str,
816 subdomain_fqdn: &str
817) -> Result<(), Error<DeleteSubdomainError>> {
818 let p_path_fqdn = fqdn;
820 let p_path_subdomain_fqdn = subdomain_fqdn;
821
822 let uri_str = format!(
823 "{}/api/v1/domains/{fqdn}/subdomains/{subdomain_fqdn}",
824 configuration.base_path,
825 fqdn = crate::apis::urlencode(p_path_fqdn),
826 subdomain_fqdn = crate::apis::urlencode(p_path_subdomain_fqdn)
827 );
828 let mut req_builder = configuration
829 .client
830 .request(reqwest::Method::DELETE, &uri_str);
831
832 if let Some(ref user_agent) = configuration.user_agent {
833 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
834 }
835 if let Some(ref token) = configuration.bearer_access_token {
836 req_builder = req_builder.bearer_auth(token.to_owned());
837 };
838
839 let req = req_builder.build()?;
840 let resp = configuration.client.execute(req).await?;
841
842 let status = resp.status();
843
844 if !status.is_client_error() && !status.is_server_error() {
845 Ok(())
846 } else {
847 let content = resp.text().await?;
848 let entity: Option<DeleteSubdomainError> = serde_json::from_str(&content).ok();
849 Err(Error::ResponseError(ResponseContent {
850 status,
851 content,
852 entity
853 }))
854 }
855}
856
857pub async fn get_domain(
860 configuration: &configuration::Configuration,
861 fqdn: &str
862) -> Result<models::GetDomain200Response, Error<GetDomainError>> {
863 let p_path_fqdn = fqdn;
865
866 let uri_str = format!(
867 "{}/api/v1/domains/{fqdn}",
868 configuration.base_path,
869 fqdn = crate::apis::urlencode(p_path_fqdn)
870 );
871 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
872
873 if let Some(ref user_agent) = configuration.user_agent {
874 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
875 }
876 if let Some(ref token) = configuration.bearer_access_token {
877 req_builder = req_builder.bearer_auth(token.to_owned());
878 };
879
880 let req = req_builder.build()?;
881 let resp = configuration.client.execute(req).await?;
882
883 let status = resp.status();
884 let content_type = resp
885 .headers()
886 .get("content-type")
887 .and_then(|v| v.to_str().ok())
888 .unwrap_or("application/octet-stream");
889 let content_type = super::ContentType::from(content_type);
890
891 if !status.is_client_error() && !status.is_server_error() {
892 let content = resp.text().await?;
893 match content_type {
894 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895 ContentType::Text => {
896 return Err(Error::from(serde_json::Error::custom(
897 "Received `text/plain` content type response that cannot be converted to `models::GetDomain200Response`"
898 )));
899 }
900 ContentType::Unsupported(unknown_type) => {
901 return Err(Error::from(serde_json::Error::custom(format!(
902 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomain200Response`"
903 ))));
904 }
905 }
906 } else {
907 let content = resp.text().await?;
908 let entity: Option<GetDomainError> = serde_json::from_str(&content).ok();
909 Err(Error::ResponseError(ResponseContent {
910 status,
911 content,
912 entity
913 }))
914 }
915}
916
917pub async fn get_domain_default_dns_records(
921 configuration: &configuration::Configuration,
922 fqdn: &str,
923 limit: Option<i32>,
924 offset: Option<i32>
925) -> Result<models::GetDomainDnsRecords200Response, Error<GetDomainDefaultDnsRecordsError>> {
926 let p_path_fqdn = fqdn;
928 let p_query_limit = limit;
929 let p_query_offset = offset;
930
931 let uri_str = format!(
932 "{}/api/v1/domains/{fqdn}/default-dns-records",
933 configuration.base_path,
934 fqdn = crate::apis::urlencode(p_path_fqdn)
935 );
936 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
937
938 if let Some(ref param_value) = p_query_limit {
939 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
940 }
941 if let Some(ref param_value) = p_query_offset {
942 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
943 }
944 if let Some(ref user_agent) = configuration.user_agent {
945 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
946 }
947 if let Some(ref token) = configuration.bearer_access_token {
948 req_builder = req_builder.bearer_auth(token.to_owned());
949 };
950
951 let req = req_builder.build()?;
952 let resp = configuration.client.execute(req).await?;
953
954 let status = resp.status();
955 let content_type = resp
956 .headers()
957 .get("content-type")
958 .and_then(|v| v.to_str().ok())
959 .unwrap_or("application/octet-stream");
960 let content_type = super::ContentType::from(content_type);
961
962 if !status.is_client_error() && !status.is_server_error() {
963 let content = resp.text().await?;
964 match content_type {
965 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
966 ContentType::Text => {
967 return Err(Error::from(serde_json::Error::custom(
968 "Received `text/plain` content type response that cannot be converted to `models::GetDomainDnsRecords200Response`"
969 )));
970 }
971 ContentType::Unsupported(unknown_type) => {
972 return Err(Error::from(serde_json::Error::custom(format!(
973 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomainDnsRecords200Response`"
974 ))));
975 }
976 }
977 } else {
978 let content = resp.text().await?;
979 let entity: Option<GetDomainDefaultDnsRecordsError> = serde_json::from_str(&content).ok();
980 Err(Error::ResponseError(ResponseContent {
981 status,
982 content,
983 entity
984 }))
985 }
986}
987
988pub async fn get_domain_dns_records(
991 configuration: &configuration::Configuration,
992 fqdn: &str,
993 limit: Option<i32>,
994 offset: Option<i32>
995) -> Result<models::GetDomainDnsRecords200Response, Error<GetDomainDnsRecordsError>> {
996 let p_path_fqdn = fqdn;
998 let p_query_limit = limit;
999 let p_query_offset = offset;
1000
1001 let uri_str = format!(
1002 "{}/api/v1/domains/{fqdn}/dns-records",
1003 configuration.base_path,
1004 fqdn = crate::apis::urlencode(p_path_fqdn)
1005 );
1006 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1007
1008 if let Some(ref param_value) = p_query_limit {
1009 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1010 }
1011 if let Some(ref param_value) = p_query_offset {
1012 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
1013 }
1014 if let Some(ref user_agent) = configuration.user_agent {
1015 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1016 }
1017 if let Some(ref token) = configuration.bearer_access_token {
1018 req_builder = req_builder.bearer_auth(token.to_owned());
1019 };
1020
1021 let req = req_builder.build()?;
1022 let resp = configuration.client.execute(req).await?;
1023
1024 let status = resp.status();
1025 let content_type = resp
1026 .headers()
1027 .get("content-type")
1028 .and_then(|v| v.to_str().ok())
1029 .unwrap_or("application/octet-stream");
1030 let content_type = super::ContentType::from(content_type);
1031
1032 if !status.is_client_error() && !status.is_server_error() {
1033 let content = resp.text().await?;
1034 match content_type {
1035 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1036 ContentType::Text => {
1037 return Err(Error::from(serde_json::Error::custom(
1038 "Received `text/plain` content type response that cannot be converted to `models::GetDomainDnsRecords200Response`"
1039 )));
1040 }
1041 ContentType::Unsupported(unknown_type) => {
1042 return Err(Error::from(serde_json::Error::custom(format!(
1043 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomainDnsRecords200Response`"
1044 ))));
1045 }
1046 }
1047 } else {
1048 let content = resp.text().await?;
1049 let entity: Option<GetDomainDnsRecordsError> = serde_json::from_str(&content).ok();
1050 Err(Error::ResponseError(ResponseContent {
1051 status,
1052 content,
1053 entity
1054 }))
1055 }
1056}
1057
1058pub async fn get_domain_name_servers(
1061 configuration: &configuration::Configuration,
1062 fqdn: &str
1063) -> Result<models::GetDomainNameServers200Response, Error<GetDomainNameServersError>> {
1064 let p_path_fqdn = fqdn;
1066
1067 let uri_str = format!(
1068 "{}/api/v1/domains/{fqdn}/name-servers",
1069 configuration.base_path,
1070 fqdn = crate::apis::urlencode(p_path_fqdn)
1071 );
1072 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1073
1074 if let Some(ref user_agent) = configuration.user_agent {
1075 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1076 }
1077 if let Some(ref token) = configuration.bearer_access_token {
1078 req_builder = req_builder.bearer_auth(token.to_owned());
1079 };
1080
1081 let req = req_builder.build()?;
1082 let resp = configuration.client.execute(req).await?;
1083
1084 let status = resp.status();
1085 let content_type = resp
1086 .headers()
1087 .get("content-type")
1088 .and_then(|v| v.to_str().ok())
1089 .unwrap_or("application/octet-stream");
1090 let content_type = super::ContentType::from(content_type);
1091
1092 if !status.is_client_error() && !status.is_server_error() {
1093 let content = resp.text().await?;
1094 match content_type {
1095 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1096 ContentType::Text => {
1097 return Err(Error::from(serde_json::Error::custom(
1098 "Received `text/plain` content type response that cannot be converted to `models::GetDomainNameServers200Response`"
1099 )));
1100 }
1101 ContentType::Unsupported(unknown_type) => {
1102 return Err(Error::from(serde_json::Error::custom(format!(
1103 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomainNameServers200Response`"
1104 ))));
1105 }
1106 }
1107 } else {
1108 let content = resp.text().await?;
1109 let entity: Option<GetDomainNameServersError> = serde_json::from_str(&content).ok();
1110 Err(Error::ResponseError(ResponseContent {
1111 status,
1112 content,
1113 entity
1114 }))
1115 }
1116}
1117
1118pub async fn get_domain_request(
1121 configuration: &configuration::Configuration,
1122 request_id: i32
1123) -> Result<models::CreateDomainRequest201Response, Error<GetDomainRequestError>> {
1124 let p_path_request_id = request_id;
1126
1127 let uri_str = format!(
1128 "{}/api/v1/domains-requests/{request_id}",
1129 configuration.base_path,
1130 request_id = p_path_request_id
1131 );
1132 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1133
1134 if let Some(ref user_agent) = configuration.user_agent {
1135 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1136 }
1137 if let Some(ref token) = configuration.bearer_access_token {
1138 req_builder = req_builder.bearer_auth(token.to_owned());
1139 };
1140
1141 let req = req_builder.build()?;
1142 let resp = configuration.client.execute(req).await?;
1143
1144 let status = resp.status();
1145 let content_type = resp
1146 .headers()
1147 .get("content-type")
1148 .and_then(|v| v.to_str().ok())
1149 .unwrap_or("application/octet-stream");
1150 let content_type = super::ContentType::from(content_type);
1151
1152 if !status.is_client_error() && !status.is_server_error() {
1153 let content = resp.text().await?;
1154 match content_type {
1155 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1156 ContentType::Text => {
1157 return Err(Error::from(serde_json::Error::custom(
1158 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
1159 )));
1160 }
1161 ContentType::Unsupported(unknown_type) => {
1162 return Err(Error::from(serde_json::Error::custom(format!(
1163 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
1164 ))));
1165 }
1166 }
1167 } else {
1168 let content = resp.text().await?;
1169 let entity: Option<GetDomainRequestError> = serde_json::from_str(&content).ok();
1170 Err(Error::ResponseError(ResponseContent {
1171 status,
1172 content,
1173 entity
1174 }))
1175 }
1176}
1177
1178pub async fn get_domain_requests(
1181 configuration: &configuration::Configuration,
1182 person_id: Option<i32>
1183) -> Result<models::GetDomainRequests200Response, Error<GetDomainRequestsError>> {
1184 let p_query_person_id = person_id;
1186
1187 let uri_str = format!("{}/api/v1/domains-requests", configuration.base_path);
1188 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1189
1190 if let Some(ref param_value) = p_query_person_id {
1191 req_builder = req_builder.query(&[("person_id", ¶m_value.to_string())]);
1192 }
1193 if let Some(ref user_agent) = configuration.user_agent {
1194 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1195 }
1196 if let Some(ref token) = configuration.bearer_access_token {
1197 req_builder = req_builder.bearer_auth(token.to_owned());
1198 };
1199
1200 let req = req_builder.build()?;
1201 let resp = configuration.client.execute(req).await?;
1202
1203 let status = resp.status();
1204 let content_type = resp
1205 .headers()
1206 .get("content-type")
1207 .and_then(|v| v.to_str().ok())
1208 .unwrap_or("application/octet-stream");
1209 let content_type = super::ContentType::from(content_type);
1210
1211 if !status.is_client_error() && !status.is_server_error() {
1212 let content = resp.text().await?;
1213 match content_type {
1214 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1215 ContentType::Text => {
1216 return Err(Error::from(serde_json::Error::custom(
1217 "Received `text/plain` content type response that cannot be converted to `models::GetDomainRequests200Response`"
1218 )));
1219 }
1220 ContentType::Unsupported(unknown_type) => {
1221 return Err(Error::from(serde_json::Error::custom(format!(
1222 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomainRequests200Response`"
1223 ))));
1224 }
1225 }
1226 } else {
1227 let content = resp.text().await?;
1228 let entity: Option<GetDomainRequestsError> = serde_json::from_str(&content).ok();
1229 Err(Error::ResponseError(ResponseContent {
1230 status,
1231 content,
1232 entity
1233 }))
1234 }
1235}
1236
1237pub async fn get_domains(
1241 configuration: &configuration::Configuration,
1242 limit: Option<i32>,
1243 offset: Option<i32>,
1244 idn_name: Option<&str>,
1245 linked_ip: Option<&str>,
1246 order: Option<&str>,
1247 sort: Option<&str>
1248) -> Result<models::GetDomains200Response, Error<GetDomainsError>> {
1249 let p_query_limit = limit;
1251 let p_query_offset = offset;
1252 let p_query_idn_name = idn_name;
1253 let p_query_linked_ip = linked_ip;
1254 let p_query_order = order;
1255 let p_query_sort = sort;
1256
1257 let uri_str = format!("{}/api/v1/domains", configuration.base_path);
1258 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1259
1260 if let Some(ref param_value) = p_query_limit {
1261 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1262 }
1263 if let Some(ref param_value) = p_query_offset {
1264 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
1265 }
1266 if let Some(ref param_value) = p_query_idn_name {
1267 req_builder = req_builder.query(&[("idn_name", ¶m_value.to_string())]);
1268 }
1269 if let Some(ref param_value) = p_query_linked_ip {
1270 req_builder = req_builder.query(&[("linked_ip", ¶m_value.to_string())]);
1271 }
1272 if let Some(ref param_value) = p_query_order {
1273 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
1274 }
1275 if let Some(ref param_value) = p_query_sort {
1276 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
1277 }
1278 if let Some(ref user_agent) = configuration.user_agent {
1279 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1280 }
1281 if let Some(ref token) = configuration.bearer_access_token {
1282 req_builder = req_builder.bearer_auth(token.to_owned());
1283 };
1284
1285 let req = req_builder.build()?;
1286 let resp = configuration.client.execute(req).await?;
1287
1288 let status = resp.status();
1289 let content_type = resp
1290 .headers()
1291 .get("content-type")
1292 .and_then(|v| v.to_str().ok())
1293 .unwrap_or("application/octet-stream");
1294 let content_type = super::ContentType::from(content_type);
1295
1296 if !status.is_client_error() && !status.is_server_error() {
1297 let content = resp.text().await?;
1298 match content_type {
1299 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1300 ContentType::Text => {
1301 return Err(Error::from(serde_json::Error::custom(
1302 "Received `text/plain` content type response that cannot be converted to `models::GetDomains200Response`"
1303 )));
1304 }
1305 ContentType::Unsupported(unknown_type) => {
1306 return Err(Error::from(serde_json::Error::custom(format!(
1307 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomains200Response`"
1308 ))));
1309 }
1310 }
1311 } else {
1312 let content = resp.text().await?;
1313 let entity: Option<GetDomainsError> = serde_json::from_str(&content).ok();
1314 Err(Error::ResponseError(ResponseContent {
1315 status,
1316 content,
1317 entity
1318 }))
1319 }
1320}
1321
1322pub async fn get_tld(
1325 configuration: &configuration::Configuration,
1326 tld_id: i32
1327) -> Result<models::GetTld200Response, Error<GetTldError>> {
1328 let p_path_tld_id = tld_id;
1330
1331 let uri_str = format!(
1332 "{}/api/v1/tlds/{tld_id}",
1333 configuration.base_path,
1334 tld_id = p_path_tld_id
1335 );
1336 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1337
1338 if let Some(ref user_agent) = configuration.user_agent {
1339 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1340 }
1341 if let Some(ref token) = configuration.bearer_access_token {
1342 req_builder = req_builder.bearer_auth(token.to_owned());
1343 };
1344
1345 let req = req_builder.build()?;
1346 let resp = configuration.client.execute(req).await?;
1347
1348 let status = resp.status();
1349 let content_type = resp
1350 .headers()
1351 .get("content-type")
1352 .and_then(|v| v.to_str().ok())
1353 .unwrap_or("application/octet-stream");
1354 let content_type = super::ContentType::from(content_type);
1355
1356 if !status.is_client_error() && !status.is_server_error() {
1357 let content = resp.text().await?;
1358 match content_type {
1359 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1360 ContentType::Text => {
1361 return Err(Error::from(serde_json::Error::custom(
1362 "Received `text/plain` content type response that cannot be converted to `models::GetTld200Response`"
1363 )));
1364 }
1365 ContentType::Unsupported(unknown_type) => {
1366 return Err(Error::from(serde_json::Error::custom(format!(
1367 "Received `{unknown_type}` content type response that cannot be converted to `models::GetTld200Response`"
1368 ))));
1369 }
1370 }
1371 } else {
1372 let content = resp.text().await?;
1373 let entity: Option<GetTldError> = serde_json::from_str(&content).ok();
1374 Err(Error::ResponseError(ResponseContent {
1375 status,
1376 content,
1377 entity
1378 }))
1379 }
1380}
1381
1382pub async fn get_tlds(
1385 configuration: &configuration::Configuration,
1386 is_published: Option<bool>,
1387 is_registered: Option<bool>
1388) -> Result<models::GetTlds200Response, Error<GetTldsError>> {
1389 let p_query_is_published = is_published;
1391 let p_query_is_registered = is_registered;
1392
1393 let uri_str = format!("{}/api/v1/tlds", configuration.base_path);
1394 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1395
1396 if let Some(ref param_value) = p_query_is_published {
1397 req_builder = req_builder.query(&[("is_published", ¶m_value.to_string())]);
1398 }
1399 if let Some(ref param_value) = p_query_is_registered {
1400 req_builder = req_builder.query(&[("is_registered", ¶m_value.to_string())]);
1401 }
1402 if let Some(ref user_agent) = configuration.user_agent {
1403 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1404 }
1405 if let Some(ref token) = configuration.bearer_access_token {
1406 req_builder = req_builder.bearer_auth(token.to_owned());
1407 };
1408
1409 let req = req_builder.build()?;
1410 let resp = configuration.client.execute(req).await?;
1411
1412 let status = resp.status();
1413 let content_type = resp
1414 .headers()
1415 .get("content-type")
1416 .and_then(|v| v.to_str().ok())
1417 .unwrap_or("application/octet-stream");
1418 let content_type = super::ContentType::from(content_type);
1419
1420 if !status.is_client_error() && !status.is_server_error() {
1421 let content = resp.text().await?;
1422 match content_type {
1423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1424 ContentType::Text => {
1425 return Err(Error::from(serde_json::Error::custom(
1426 "Received `text/plain` content type response that cannot be converted to `models::GetTlds200Response`"
1427 )));
1428 }
1429 ContentType::Unsupported(unknown_type) => {
1430 return Err(Error::from(serde_json::Error::custom(format!(
1431 "Received `{unknown_type}` content type response that cannot be converted to `models::GetTlds200Response`"
1432 ))));
1433 }
1434 }
1435 } else {
1436 let content = resp.text().await?;
1437 let entity: Option<GetTldsError> = serde_json::from_str(&content).ok();
1438 Err(Error::ResponseError(ResponseContent {
1439 status,
1440 content,
1441 entity
1442 }))
1443 }
1444}
1445
1446pub async fn update_domain_auto_prolongation(
1450 configuration: &configuration::Configuration,
1451 fqdn: &str,
1452 update_domain: models::UpdateDomain
1453) -> Result<
1454 models::UpdateDomainAutoProlongation200Response,
1455 Error<UpdateDomainAutoProlongationError>
1456> {
1457 let p_path_fqdn = fqdn;
1459 let p_body_update_domain = update_domain;
1460
1461 let uri_str = format!(
1462 "{}/api/v1/domains/{fqdn}",
1463 configuration.base_path,
1464 fqdn = crate::apis::urlencode(p_path_fqdn)
1465 );
1466 let mut req_builder = configuration
1467 .client
1468 .request(reqwest::Method::PATCH, &uri_str);
1469
1470 if let Some(ref user_agent) = configuration.user_agent {
1471 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1472 }
1473 if let Some(ref token) = configuration.bearer_access_token {
1474 req_builder = req_builder.bearer_auth(token.to_owned());
1475 };
1476 req_builder = req_builder.json(&p_body_update_domain);
1477
1478 let req = req_builder.build()?;
1479 let resp = configuration.client.execute(req).await?;
1480
1481 let status = resp.status();
1482 let content_type = resp
1483 .headers()
1484 .get("content-type")
1485 .and_then(|v| v.to_str().ok())
1486 .unwrap_or("application/octet-stream");
1487 let content_type = super::ContentType::from(content_type);
1488
1489 if !status.is_client_error() && !status.is_server_error() {
1490 let content = resp.text().await?;
1491 match content_type {
1492 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1493 ContentType::Text => {
1494 return Err(Error::from(serde_json::Error::custom(
1495 "Received `text/plain` content type response that cannot be converted to `models::UpdateDomainAutoProlongation200Response`"
1496 )));
1497 }
1498 ContentType::Unsupported(unknown_type) => {
1499 return Err(Error::from(serde_json::Error::custom(format!(
1500 "Received `{unknown_type}` content type response that cannot be converted to `models::UpdateDomainAutoProlongation200Response`"
1501 ))));
1502 }
1503 }
1504 } else {
1505 let content = resp.text().await?;
1506 let entity: Option<UpdateDomainAutoProlongationError> =
1507 serde_json::from_str(&content).ok();
1508 Err(Error::ResponseError(ResponseContent {
1509 status,
1510 content,
1511 entity
1512 }))
1513 }
1514}
1515
1516#[deprecated]
1522pub async fn update_domain_dns_record(
1523 configuration: &configuration::Configuration,
1524 fqdn: &str,
1525 record_id: i32,
1526 create_dns: models::CreateDns
1527) -> Result<models::CreateDomainDnsRecord201Response, Error<UpdateDomainDnsRecordError>> {
1528 let p_path_fqdn = fqdn;
1530 let p_path_record_id = record_id;
1531 let p_body_create_dns = create_dns;
1532
1533 let uri_str = format!(
1534 "{}/api/v1/domains/{fqdn}/dns-records/{record_id}",
1535 configuration.base_path,
1536 fqdn = crate::apis::urlencode(p_path_fqdn),
1537 record_id = p_path_record_id
1538 );
1539 let mut req_builder = configuration
1540 .client
1541 .request(reqwest::Method::PATCH, &uri_str);
1542
1543 if let Some(ref user_agent) = configuration.user_agent {
1544 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1545 }
1546 if let Some(ref token) = configuration.bearer_access_token {
1547 req_builder = req_builder.bearer_auth(token.to_owned());
1548 };
1549 req_builder = req_builder.json(&p_body_create_dns);
1550
1551 let req = req_builder.build()?;
1552 let resp = configuration.client.execute(req).await?;
1553
1554 let status = resp.status();
1555 let content_type = resp
1556 .headers()
1557 .get("content-type")
1558 .and_then(|v| v.to_str().ok())
1559 .unwrap_or("application/octet-stream");
1560 let content_type = super::ContentType::from(content_type);
1561
1562 if !status.is_client_error() && !status.is_server_error() {
1563 let content = resp.text().await?;
1564 match content_type {
1565 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1566 ContentType::Text => {
1567 return Err(Error::from(serde_json::Error::custom(
1568 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainDnsRecord201Response`"
1569 )));
1570 }
1571 ContentType::Unsupported(unknown_type) => {
1572 return Err(Error::from(serde_json::Error::custom(format!(
1573 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainDnsRecord201Response`"
1574 ))));
1575 }
1576 }
1577 } else {
1578 let content = resp.text().await?;
1579 let entity: Option<UpdateDomainDnsRecordError> = serde_json::from_str(&content).ok();
1580 Err(Error::ResponseError(ResponseContent {
1581 status,
1582 content,
1583 entity
1584 }))
1585 }
1586}
1587
1588pub async fn update_domain_dns_record_v2(
1594 configuration: &configuration::Configuration,
1595 fqdn: &str,
1596 record_id: i32,
1597 create_dns_v2: models::CreateDnsV2
1598) -> Result<models::CreateDomainDnsRecordV2201Response, Error<UpdateDomainDnsRecordV2Error>> {
1599 let p_path_fqdn = fqdn;
1601 let p_path_record_id = record_id;
1602 let p_body_create_dns_v2 = create_dns_v2;
1603
1604 let uri_str = format!(
1605 "{}/api/v2/domains/{fqdn}/dns-records/{record_id}",
1606 configuration.base_path,
1607 fqdn = crate::apis::urlencode(p_path_fqdn),
1608 record_id = p_path_record_id
1609 );
1610 let mut req_builder = configuration
1611 .client
1612 .request(reqwest::Method::PATCH, &uri_str);
1613
1614 if let Some(ref user_agent) = configuration.user_agent {
1615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1616 }
1617 if let Some(ref token) = configuration.bearer_access_token {
1618 req_builder = req_builder.bearer_auth(token.to_owned());
1619 };
1620 req_builder = req_builder.json(&p_body_create_dns_v2);
1621
1622 let req = req_builder.build()?;
1623 let resp = configuration.client.execute(req).await?;
1624
1625 let status = resp.status();
1626 let content_type = resp
1627 .headers()
1628 .get("content-type")
1629 .and_then(|v| v.to_str().ok())
1630 .unwrap_or("application/octet-stream");
1631 let content_type = super::ContentType::from(content_type);
1632
1633 if !status.is_client_error() && !status.is_server_error() {
1634 let content = resp.text().await?;
1635 match content_type {
1636 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1637 ContentType::Text => {
1638 return Err(Error::from(serde_json::Error::custom(
1639 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainDnsRecordV2201Response`"
1640 )));
1641 }
1642 ContentType::Unsupported(unknown_type) => {
1643 return Err(Error::from(serde_json::Error::custom(format!(
1644 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainDnsRecordV2201Response`"
1645 ))));
1646 }
1647 }
1648 } else {
1649 let content = resp.text().await?;
1650 let entity: Option<UpdateDomainDnsRecordV2Error> = serde_json::from_str(&content).ok();
1651 Err(Error::ResponseError(ResponseContent {
1652 status,
1653 content,
1654 entity
1655 }))
1656 }
1657}
1658
1659pub async fn update_domain_name_servers(
1665 configuration: &configuration::Configuration,
1666 fqdn: &str,
1667 update_domain_name_servers: models::UpdateDomainNameServers
1668) -> Result<models::GetDomainNameServers200Response, Error<UpdateDomainNameServersError>> {
1669 let p_path_fqdn = fqdn;
1671 let p_body_update_domain_name_servers = update_domain_name_servers;
1672
1673 let uri_str = format!(
1674 "{}/api/v1/domains/{fqdn}/name-servers",
1675 configuration.base_path,
1676 fqdn = crate::apis::urlencode(p_path_fqdn)
1677 );
1678 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1679
1680 if let Some(ref user_agent) = configuration.user_agent {
1681 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1682 }
1683 if let Some(ref token) = configuration.bearer_access_token {
1684 req_builder = req_builder.bearer_auth(token.to_owned());
1685 };
1686 req_builder = req_builder.json(&p_body_update_domain_name_servers);
1687
1688 let req = req_builder.build()?;
1689 let resp = configuration.client.execute(req).await?;
1690
1691 let status = resp.status();
1692 let content_type = resp
1693 .headers()
1694 .get("content-type")
1695 .and_then(|v| v.to_str().ok())
1696 .unwrap_or("application/octet-stream");
1697 let content_type = super::ContentType::from(content_type);
1698
1699 if !status.is_client_error() && !status.is_server_error() {
1700 let content = resp.text().await?;
1701 match content_type {
1702 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1703 ContentType::Text => {
1704 return Err(Error::from(serde_json::Error::custom(
1705 "Received `text/plain` content type response that cannot be converted to `models::GetDomainNameServers200Response`"
1706 )));
1707 }
1708 ContentType::Unsupported(unknown_type) => {
1709 return Err(Error::from(serde_json::Error::custom(format!(
1710 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDomainNameServers200Response`"
1711 ))));
1712 }
1713 }
1714 } else {
1715 let content = resp.text().await?;
1716 let entity: Option<UpdateDomainNameServersError> = serde_json::from_str(&content).ok();
1717 Err(Error::ResponseError(ResponseContent {
1718 status,
1719 content,
1720 entity
1721 }))
1722 }
1723}
1724
1725pub async fn update_domain_request(
1731 configuration: &configuration::Configuration,
1732 request_id: i32,
1733 update_domain_request_request: models::UpdateDomainRequestRequest
1734) -> Result<models::CreateDomainRequest201Response, Error<UpdateDomainRequestError>> {
1735 let p_path_request_id = request_id;
1737 let p_body_update_domain_request_request = update_domain_request_request;
1738
1739 let uri_str = format!(
1740 "{}/api/v1/domains-requests/{request_id}",
1741 configuration.base_path,
1742 request_id = p_path_request_id
1743 );
1744 let mut req_builder = configuration
1745 .client
1746 .request(reqwest::Method::PATCH, &uri_str);
1747
1748 if let Some(ref user_agent) = configuration.user_agent {
1749 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1750 }
1751 if let Some(ref token) = configuration.bearer_access_token {
1752 req_builder = req_builder.bearer_auth(token.to_owned());
1753 };
1754 req_builder = req_builder.json(&p_body_update_domain_request_request);
1755
1756 let req = req_builder.build()?;
1757 let resp = configuration.client.execute(req).await?;
1758
1759 let status = resp.status();
1760 let content_type = resp
1761 .headers()
1762 .get("content-type")
1763 .and_then(|v| v.to_str().ok())
1764 .unwrap_or("application/octet-stream");
1765 let content_type = super::ContentType::from(content_type);
1766
1767 if !status.is_client_error() && !status.is_server_error() {
1768 let content = resp.text().await?;
1769 match content_type {
1770 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1771 ContentType::Text => {
1772 return Err(Error::from(serde_json::Error::custom(
1773 "Received `text/plain` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
1774 )));
1775 }
1776 ContentType::Unsupported(unknown_type) => {
1777 return Err(Error::from(serde_json::Error::custom(format!(
1778 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDomainRequest201Response`"
1779 ))));
1780 }
1781 }
1782 } else {
1783 let content = resp.text().await?;
1784 let entity: Option<UpdateDomainRequestError> = serde_json::from_str(&content).ok();
1785 Err(Error::ResponseError(ResponseContent {
1786 status,
1787 content,
1788 entity
1789 }))
1790 }
1791}