| 147 | |
| 148 | #[must_use] |
| 149 | pub fn with_auth_token(mut self, auth_token: Option<String>) -> Self { |
| 150 | match ( |
| 151 | self.auth.api_key().map(ToOwned::to_owned), |
| 152 | auth_token.filter(|token| !token.is_empty()), |
| 153 | ) { |
| 154 | (Some(api_key), Some(bearer_token)) => { |
| 155 | self.auth = AuthSource::ApiKeyAndBearer { |
| 156 | api_key, |
| 157 | bearer_token, |
| 158 | }; |
| 159 | } |
| 160 | (Some(api_key), None) => { |
| 161 | self.auth = AuthSource::ApiKey(api_key); |
| 162 | } |
| 163 | (None, Some(bearer_token)) => { |
| 164 | self.auth = AuthSource::BearerToken(bearer_token); |
| 165 | } |
| 166 | (None, None) => { |
| 167 | self.auth = AuthSource::None; |
| 168 | } |
| 169 | } |
| 170 | self |
| 171 | } |
| 172 | |
| 173 | #[must_use] |
| 174 | pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self { |