//!
//! AUTO-GENERATED CODE - DO NOT EDIT!
//!
//! Intersection Union Test
//! Source: crates/oas3-gen/fixtures/intersection_union.json
//! Version: 1.0.0
//! Generated by `oas3-gen v0.26.0`
//!

use anyhow::Context;
use reqwest::{Client, Url};

pub const BASE_URL: &str = "https://example.com/";
#[derive(Debug, Clone)]
pub struct IntersectionUnionTestClient {
  pub client: Client,
  pub base_url: Url,
}
impl Default for IntersectionUnionTestClient {
  fn default() -> Self {
    Self::new()
  }
}
impl IntersectionUnionTestClient {
  /// Create a client using the OpenAPI `servers[0]` URL.
  #[must_use]
  #[track_caller]
  pub fn new() -> Self {
    Self {
      client: Client::builder().build().expect("client"),
      base_url: Url::parse(BASE_URL).expect("valid base url"),
    }
  }
  /// Create a client with a custom base URL.
  pub fn with_base_url(base_url: impl AsRef<str>) -> anyhow::Result<Self> {
    Ok(Self {
      client: Client::builder().build().context("building reqwest client")?,
      base_url: Url::parse(base_url.as_ref()).context("parsing base url")?,
    })
  }
  /// Create a client from an existing `reqwest::Client`.
  pub fn with_client(base_url: impl AsRef<str>, client: Client) -> anyhow::Result<Self> {
    let url = Url::parse(base_url.as_ref()).context("parsing base url")?;
    Ok(Self { client, base_url: url })
  }
}
