Struct mwapi::client::Builder[][src]

pub struct Builder { /* fields omitted */ }
Expand description

Build a new API client.

let client: Client = Client::builder("https://example.org/w/api.php")
    .set_oauth2_token("foobar")
    .set_errorformat(mwapi::ErrorFormat::Html)
    .build().await?;

Implementations

Create a new Builder instance. Typically you will use Client::builder() instead.

Create a Builder with defaults aimed for interactive operation. Typically you will use Client::interactive_builder() instead.

Actually build the Client instance.

Set a custom User-agent. Ideally follow the Wikimedia User-agent policy.

Set an OAuth2 token for authentication

Set the format error messages from the API should be in

Set how many requests should be processed in parallel. On Wikimedia wikis, you shouldn’t exceed the default of 1 without getting permission from a sysadmin.

Pause when the servers are lagged for how many seconds? Typically bots should set this to 5, while interactive usage should be much higher.

See mediawiki.org for more details.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more