pub struct ClientConfiguration { /* private fields */ }Expand description
A configuration suitable for use as a QCS API Client.
This configuration can be constructed in a few ways.
The most common way is to use ClientConfiguration::load_default. This will load the
configuration associated with your default QCS profile.
When loading your config, any values set by environment variables will override the values in your configuration files.
You can also build a configuration from scratch using ClientConfigurationBuilder. Using a
builder bypasses configuration files and environment overrides.
Implementations§
Source§impl ClientConfiguration
impl ClientConfiguration
Sourcepub fn get_oauth_session(&self, py: Python<'_>) -> PyResult<OAuthSession>
pub fn get_oauth_session(&self, py: Python<'_>) -> PyResult<OAuthSession>
Source§impl ClientConfiguration
impl ClientConfiguration
Sourcepub fn load_default() -> Result<Self, LoadError>
pub fn load_default() -> Result<Self, LoadError>
Sourcepub fn load_profile(profile_name: String) -> Result<Self, LoadError>
pub fn load_profile(profile_name: String) -> Result<Self, LoadError>
Attempts to load a QCS configuration and creates a ClientConfiguration using the
specified profile.
§Errors
See LoadError
Sourcepub async fn load_with_login(
cancel_token: CancellationToken,
profile_name: Option<String>,
) -> Result<Self, LoadError>
pub async fn load_with_login( cancel_token: CancellationToken, profile_name: Option<String>, ) -> Result<Self, LoadError>
Attempts to load a QCS configuration and creates a ClientConfiguration using the
specified profile. If no profile_name is provided, then a default configuration is
loaded. When stored OAuth credentials are unavailable, this method falls back to an
interactive PKCE login flow.
§Errors
See LoadError
Sourcepub fn builder() -> ClientConfigurationBuilder
pub fn builder() -> ClientConfigurationBuilder
Sourcepub fn grpc_api_url(&self) -> &str
pub fn grpc_api_url(&self) -> &str
Get the URL of the QCS gRPC API.
Sourcepub const fn source(&self) -> &ConfigSource
pub const fn source(&self) -> &ConfigSource
Get the source of the configuration.
Sourcepub async fn oauth_session(&self) -> Result<OAuthSession, TokenError>
pub async fn oauth_session(&self) -> Result<OAuthSession, TokenError>
Get a copy of the current OAuthSession.
Note: This is a copy, the contained tokens will become stale once they expire.
§Errors
See TokenError
Sourcepub async fn get_bearer_access_token(&self) -> Result<String, TokenError>
pub async fn get_bearer_access_token(&self) -> Result<String, TokenError>
Sourcepub async fn refresh(&self) -> Result<OAuthSession, TokenError>
pub async fn refresh(&self) -> Result<OAuthSession, TokenError>
Trait Implementations§
Source§impl Clone for ClientConfiguration
impl Clone for ClientConfiguration
Source§fn clone(&self) -> ClientConfiguration
fn clone(&self) -> ClientConfiguration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientConfiguration
impl Debug for ClientConfiguration
Source§impl PyClass for ClientConfiguration
impl PyClass for ClientConfiguration
Source§impl PyClassImpl for ClientConfiguration
impl PyClassImpl for ClientConfiguration
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<ClientConfiguration>
type ThreadChecker = SendablePyClass<ClientConfiguration>
type Inventory = Pyo3MethodsInventoryForClientConfiguration
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a ClientConfiguration
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a ClientConfiguration
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut ClientConfiguration
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut ClientConfiguration
Source§impl PyTypeInfo for ClientConfiguration
impl PyTypeInfo for ClientConfiguration
Source§type AsRefTarget = PyCell<ClientConfiguration>
type AsRefTarget = PyCell<ClientConfiguration>
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object is an instance of this type or a subclass of this type.Source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object is an instance of this type.Source§impl TokenRefresher for ClientConfiguration
impl TokenRefresher for ClientConfiguration
Source§type Error = TokenError
type Error = TokenError
Source§fn validated_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validated_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn refresh_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn should_trace(&self, url: &UrlPatternMatchInput) -> bool
fn should_trace(&self, url: &UrlPatternMatchInput) -> bool
TracingConfiguration::is_enabled], this defaults to true.Auto Trait Implementations§
impl Freeze for ClientConfiguration
impl !RefUnwindSafe for ClientConfiguration
impl Send for ClientConfiguration
impl Sync for ClientConfiguration
impl Unpin for ClientConfiguration
impl !UnwindSafe for ClientConfiguration
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);