[][src]Struct kuon::ClientBuilder

pub struct ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> { /* fields omitted */ }

A ClientBuilder can help construct a TwitterAPI instance with your configuration. Before calling build method, you must set four values:

  1. Access token
  2. Access token secret
  3. API key
  4. 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, 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]

Sets the access token.

pub fn access_token_secret(
    self,
    access_token_secret: impl Into<String>
) -> ClientBuilder<AccessTokenType, String, ApiKeyType, ApiKeySecretType>
[src]

Sets the access token secret.

pub fn api_key(
    self,
    api_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, String, ApiKeySecretType>
[src]

Sets the api key.

pub fn api_secret_key(
    self,
    api_secret_key: impl Into<String>
) -> ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, String>
[src]

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]

Auto Trait Implementations

impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> RefUnwindSafe for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
    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

impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> Sync for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
    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

impl<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> UnwindSafe for ClientBuilder<AccessTokenType, AccessTokenSecretType, ApiKeyType, ApiKeySecretType> where
    AccessTokenSecretType: UnwindSafe,
    AccessTokenType: UnwindSafe,
    ApiKeySecretType: UnwindSafe,
    ApiKeyType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.