pub struct CopilotConfig {
pub api_key: Secret,
pub base_url: String,
}Expand description
Copilot’s configuration: plain data, credential redacted.
The credential is an exchanged Copilot session token, not a GitHub
OAuth token: see the module docs and Self::from_auth.
Fields§
§api_key: SecretThe exchanged session token. Never serialized (see Secret).
base_url: StringThe API root every path resolves against.
Implementations§
Source§impl CopilotConfig
impl CopilotConfig
Sourcepub fn connect(self, http: impl HttpClientExt + 'static) -> Copilot
pub fn connect(self, http: impl HttpClientExt + 'static) -> Copilot
A client that sends this configuration’s requests through
http.
Source§impl CopilotConfig
impl CopilotConfig
Sourcepub fn new(api_key: impl Into<Secret>) -> Self
pub fn new(api_key: impl Into<Secret>) -> Self
Configure Copilot with an exchanged session token.
Derive a permitted endpoint from proxy-ep= when present, otherwise use
the default. Explicit base-URL settings override token-derived routing.
Sourcepub fn from_auth(context: &AuthContext) -> Self
pub fn from_auth(context: &AuthContext) -> Self
Configure Copilot from an exchanged auth context. The context’s API base takes precedence over token-derived routing.
Sourcepub fn from_env() -> Result<Self, EnvError>
pub fn from_env() -> Result<Self, EnvError>
Read an exchanged token from GITHUB_COPILOT_API_KEY or COPILOT_API_KEY.
Read the optional base URL from GITHUB_COPILOT_API_BASE or COPILOT_BASE_URL.
Earlier nonblank variables take precedence. Return an error for missing
credentials or invalid environment values; this does not perform token exchange.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the base URL.
Trait Implementations§
Source§impl Clone for CopilotConfig
impl Clone for CopilotConfig
Source§impl Debug for CopilotConfig
impl Debug for CopilotConfig
Source§impl<'de> Deserialize<'de> for CopilotConfig
impl<'de> Deserialize<'de> for CopilotConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CopilotConfig
impl PartialEq for CopilotConfig
Source§impl Serialize for CopilotConfig
impl Serialize for CopilotConfig
impl StructuralPartialEq for CopilotConfig
Auto Trait Implementations§
impl Freeze for CopilotConfig
impl RefUnwindSafe for CopilotConfig
impl Send for CopilotConfig
impl Sync for CopilotConfig
impl Unpin for CopilotConfig
impl UnsafeUnpin for CopilotConfig
impl UnwindSafe for CopilotConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more