Struct kuon::ClientBuilder [−][src]
A ClientBuilder
can help construct a TwitterAPI
instance with your configuration.
Before calling build
method, you must set four values:
Access token
Access token secret
API key
API secret key
The four setter methods can be called with any order.
Example
use kuon::ClientBuilder; let builder = ClientBuilder::new(); // The order of setter methods can be changed. let api_client = builder .access_token("YOUR_ACCESS_TOKEN") .access_token_secret("YOUR_ACCESS_TOKEN_SECRET") .api_key("YOUR_API_KEY") .api_secret_key("YOUR_API_SECRET_KEY") .build() // This can be called only after all values have been set. .await?;
Implementations
impl ClientBuilder<(), (), (), ()>
[src]
pub fn new() -> Self
[src]
Creates a builder instance.
This is exactly equivalent to TwitterAPI::builder
.
impl ClientBuilder<(), (), String, String>
[src]
pub async fn pre_build(&self, callback: Callback) -> Result<OAuthRequestToken>
[src]
pub async fn build(
self,
request_token: OAuthRequestToken,
verifier: &str
) -> Result<TwitterAPI>
[src]
self,
request_token: OAuthRequestToken,
verifier: &str
) -> Result<TwitterAPI>
impl ClientBuilder<String, String, String, String>
[src]
pub async fn build(self) -> Result<TwitterAPI>
[src]
Builds a TwitterAPI
instance with the values you’ve set.
You can call this method only after the four required values have been set.
Error
This method fails if there is an error when obtaining a bearer token.
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
[src]
pub fn access_token(
self,
access_token: impl Into<String>
) -> ClientBuilder<String, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
[src]
self,
access_token: impl Into<String>
) -> ClientBuilder<String, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
Sets the access token.
pub fn access_token_secret(
self,
access_token_secret: impl Into<String>
) -> ClientBuilder<AccessTokenType, String, ApiKeyType, ApiKeySecretType>
[src]
self,
access_token_secret: impl Into<String>
) -> ClientBuilder<AccessTokenType, String, ApiKeyType, ApiKeySecretType>
Sets the access token secret.
pub fn api_key(
self,
api_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, String, ApiKeySecretType>
[src]
self,
api_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, String, ApiKeySecretType>
Sets the api key.
pub fn api_secret_key(
self,
api_secret_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, String>
[src]
self,
api_secret_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, String>
Sets the api secret key.
Trait Implementations
impl<AccessTokenType: Debug, AccessTokenSecretType: Debug, ApiKeyType: Debug, ApiKeySecretType: Debug> Debug for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
[src]
impl<AccessTokenType: Default, AccessTokenSecretType: Default, ApiKeyType: Default, ApiKeySecretType: Default> Default for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
[src]
fn default(
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
[src]
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType>
Auto Trait Implementations
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> RefUnwindSafe for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
AccessTokenSecretType: RefUnwindSafe,
AccessTokenType: RefUnwindSafe,
ApiKeySecretType: RefUnwindSafe,
ApiKeyType: RefUnwindSafe,
AccessTokenSecretType: RefUnwindSafe,
AccessTokenType: RefUnwindSafe,
ApiKeySecretType: RefUnwindSafe,
ApiKeyType: RefUnwindSafe,
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> Send for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
AccessTokenSecretType: Send,
AccessTokenType: Send,
ApiKeySecretType: Send,
ApiKeyType: Send,
AccessTokenSecretType: Send,
AccessTokenType: Send,
ApiKeySecretType: Send,
ApiKeyType: Send,
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> Sync for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
AccessTokenSecretType: Sync,
AccessTokenType: Sync,
ApiKeySecretType: Sync,
ApiKeyType: Sync,
AccessTokenSecretType: Sync,
AccessTokenType: Sync,
ApiKeySecretType: Sync,
ApiKeyType: Sync,
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> Unpin for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
AccessTokenSecretType: Unpin,
AccessTokenType: Unpin,
ApiKeySecretType: Unpin,
ApiKeyType: Unpin,
AccessTokenSecretType: Unpin,
AccessTokenType: Unpin,
ApiKeySecretType: Unpin,
ApiKeyType: Unpin,
impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> UnwindSafe for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
AccessTokenSecretType: UnwindSafe,
AccessTokenType: UnwindSafe,
ApiKeySecretType: UnwindSafe,
ApiKeyType: UnwindSafe,
AccessTokenSecretType: UnwindSafe,
AccessTokenType: UnwindSafe,
ApiKeySecretType: UnwindSafe,
ApiKeyType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,