Crate blockpalettes_client

Crate blockpalettes_client 

Source
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§

BlockPalettesClient
An asynchronous client for the Block Palettes API.
Palette
Represents a single palette returned by the Block Palettes API.
PaletteDetails
Represents detailed information for a single palette, including the username.
PalettePageDetails
Represents details scraped directly from a palette’s HTML page.
PaletteResponse
Represents the response structure when fetching a list of palettes.
PopularBlock
Represents a popular block returned by the API.

Enums§

BlockPalettesError
Represents the possible errors that can occur when interacting with the Block Palettes API.
SortOrder
Represents the different sorting orders available for retrieving palettes.

Type Aliases§

Result
A specialized Result type for Block Palettes operations.