Tags: firecrawl/firecrawl
Tags
feat(rust-sdk): add v2 API namespace with agent support (#2778) * feat(rust-sdk): add v2 API namespace with agent support Add a new v2 module to the Rust SDK that provides access to the v2 API endpoints while maintaining backward compatibility with v1. New v2 endpoints: - scrape: scrape(), scrape_with_schema() - search: search(), search_and_scrape() - map: map(), map_urls() - crawl: start_crawl(), crawl(), get_crawl_status(), cancel_crawl() - batch_scrape: start_batch_scrape(), batch_scrape(), get_batch_scrape_status() - agent (new): start_agent(), agent(), get_agent_status(), cancel_agent() Also includes: - Comprehensive type definitions for v2 API - Unit tests with mocking for all endpoints - E2E test file for v2 API - Example demonstrating all v2 features - Fixed broken tests using non-existent types Co-Authored-By: Claude Opus 4.5 <[email protected]> * ci(rust-sdk): add CI workflow for build and tests Add GitHub Actions workflow that runs on PRs affecting the Rust SDK: - Check code formatting with cargo fmt - Build all targets - Run clippy linter - Run unit tests (mocked, no API calls) - Build examples Also applies cargo fmt to fix formatting issues. Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(rust-sdk): allow dead_code in test struct for clippy Add #[allow(dead_code)] to WebsiteInfo test struct since its fields are only used for deserialization, not direct access. Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(rust-sdk): make e2e tests fail properly on errors Previously, e2e tests would swallow API errors by logging them with eprintln instead of failing the test. This made it impossible to detect actual failures when running tests with API access. Changes: - Mark all API-requiring tests with #[ignore = "Requires API access"] - Use .expect() to properly fail tests on errors - Remove match blocks that silently swallowed errors - Add run instructions to module docs Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(rust-sdk): address code review issues Fixes identified by cubic code review: 1. SearchResultOrDocument enum order (search.rs:72) - Put WebResult before Document in untagged enum - Document has all optional fields and would match any JSON, preventing WebResult from ever matching 2. Empty API key validation (client.rs:90) - Reject empty or whitespace-only API keys for cloud service - Previously only checked for None, not empty strings 3. Header parsing safety (client.rs:114/122) - Replace unwrap() with HeaderValue::from_static for constant - Use if-let Ok() pattern for dynamic header values - Gracefully skip invalid values instead of panicking Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(rust-sdk): address additional code review issues Fixes identified by cubic: 1. URL trailing slash bypass (client.rs:92) - Normalize URL by trimming trailing slashes before comparison - Prevents bypassing cloud API key requirement with trailing slash 2. Search result deserialization (search.rs:75) - Implement custom deserializer for SearchResultOrDocument - Check for document-specific fields (markdown, html, metadata) - Properly distinguishes scraped documents from simple web results - Prevents loss of scraped content when both url and markdown exist 3. Fixed code formatting (cargo fmt) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
PreviousNext