Expand description
A client for the Block Palettes API.
This crate provides a convenient asynchronous client for interacting with the Block Palettes website’s API. It allows you to search for palettes, retrieve popular blocks, get detailed information about specific palettes, and even scrape some information directly from the website’s HTML pages.
The client is built on top of reqwest for HTTP requests and serde for
JSON serialization/deserialization. It also uses chrono for date parsing
and scraper for HTML parsing when scraping.
§Features
- Search for palettes based on contained blocks.
- Retrieve lists of popular blocks.
- Fetch detailed information for individual palettes.
- Get similar palettes based on a given palette ID.
- Scrape palette page details (blocks and similar palette IDs) directly from HTML.
- Robust error handling with custom error types.
§Error Handling
The crate defines a custom error type, BlockPalettesError, which
encapsulates various issues that can occur, such as HTTP errors, API-specific
errors, HTML parsing failures, and invalid date formats.
§Data Structures
Key data structures like Palette, PaletteDetails, and PopularBlock
are provided to represent the API responses.
Structs§
- Block
Palettes Client - An asynchronous client for the Block Palettes API.
- Palette
- Represents a single palette returned by the Block Palettes API.
- Palette
Details - Represents detailed information for a single palette, including the username.
- Palette
Page Details - Represents details scraped directly from a palette’s HTML page.
- Palette
Response - Represents the response structure when fetching a list of palettes.
- Popular
Block - Represents a popular block returned by the API.
Enums§
- Block
Palettes Error - Represents the possible errors that can occur when interacting with the Block Palettes API.
- Sort
Order - Represents the different sorting orders available for retrieving palettes.
Type Aliases§
- Result
- A specialized
Resulttype for Block Palettes operations.