Skip to content

Commit

Permalink
refactor!: simpler client export names (#35)
Browse files Browse the repository at this point in the history
refactor!: rename DDragonClient to Client

refactor!: rename AsyncDDragonClient to AsyncClient

feat: clients now derive Clone

refactor!: rename DDragonClientError to ClientError

docs: reference new export names
  • Loading branch information
kade-robertson authored Feb 6, 2023
1 parent 1cee15d commit ab03f6a
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 189 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ Rust library for accessing the latest LoL patch's ddragon data.
## Usage

```rust
use ddragon::{cache_middleware::CacheMiddleware, DDragonClientError, DDragonClient};
use ddragon::{cache_middleware::CacheMiddleware, Client, ClientError};

fn main() -> Result<(), DDragonClientError> {
let client = DDragonClient::new("/path/to/your/cache/dir")?;
fn main() -> Result<(), ClientError> {
let client = Client::new("/path/to/your/cache/dir")?;

// If you want to use an existing agent
let my_agent = ureq::AgentBuilder::new()
.middleware(CacheMiddleware::new("/path/to/your/cache/dir"))
.build();
let client = DDragonClient::with_agent(my_agent)?;
let client = Client::with_agent(my_agent)?;

// See available options on the client and in the models folder.
let champions = client.champions()?;
Expand All @@ -41,11 +41,11 @@ The following crate features are available:

- `sync` (on by default) enables the synchronous client.
- Provides the `ddragon::client` and `ddragon::cache_middleware` module.
- Provides the re-exported `ddragon::DDragonClient` client.
- Provides the re-exported `ddragon::Client` client.
- Adds `cacache-sync`, `url`, `thiserror`, and `ureq` with the `json` feature enabled as dependencies.
- `async` enables the asynchronous client.
- Provides the `ddragon::async_client` module.
- Provides the re-exported `ddragon::AsyncDDragonClient` client.
- Provides the re-exported `ddragon::AsyncClient` client.
- Adds `reqwest` with the `json` feature, `reqwest-middleware` and `http-cache-reqwest` as dependencies.
- `image` enables image fetching and caching.
- Both clients will receive `image_of` and `sprite_of` for any model which implements `HasImage`.
Expand Down
Loading

0 comments on commit ab03f6a

Please sign in to comment.