Struct kuon::ClientBuilder[][src]

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>[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]

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]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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]

Returns the “default value” for a type. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V