MCPcopy Create free account
hub / github.com/Louisym/MiniCC / with_auth_token

Method with_auth_token

rust/crates/api/src/client.rs:149–171  ·  view source on GitHub ↗
(mut self, auth_token: Option<String>)

Source from the content-addressed store, hash-verified

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 {

Calls 1

api_keyMethod · 0.80