Skip to content

Releases

v0.2.4

Choose a tag to compare

@CrucifiedPain CrucifiedPain released this 12 Aug 09:22
7fd2f2e

What's New in v0.2.4

This release represents a unified jump over v0.2.3 and brings four major features: request cancellation, persistent caching, telemetry observability, and request priority queuing, along with an overhauled MkDocs documentation system and critical bug fixes in the war, company, and worker namespaces.

1. Request Cancellation (AbortController)

Gracefully abort in-flight API requests using CancellationScope, the Python equivalent of JavaScript's AbortController.

  • CancellationScope Context Manager: Seamlessly wrap API calls in an async with CancellationScope() as scope: block. Calling scope.cancel() will instantly abort any pending tasks within that scope. Works with both async with and synchronous with (via warera.sync).
  • Pre-flight Batch Pruning: Cancelled requests are removed from the internal batch queue before they ever hit the network, saving bandwidth and rate-limit points.

2. Persistent Caching & Data Backends

The SWR (Stale-While-Revalidate) cache now supports pluggable storage backends via the CacheBackend protocol.

  • SQLite Support: You can now initialize the client with SQLiteCacheBackend("cache.db") to persist API responses across application restarts! This eliminates cold-start latency on bot restarts.

3. Network Telemetry & Request Priority

  • Telemetry Hooks: Observe internal SDK behaviour by injecting a TelemetryHooks implementation at client initialization (e.g., on_rate_limit_sleep, on_batch_flush, on_cache_hit).
  • Request Priority Queue: Tag individual requests with RequestPriority.HIGH to bypass background traffic in the auto-batching queue.
  • .env Auto-loading: WARERA_API_KEY is now automatically read from os.environ during client initialization.

4. Documentation Overhaul

  • MkDocs Migration: We've completely removed the legacy GitHub Wiki and migrated to a powerful, searchable MkDocs-based documentation site.
  • Dynamic API Reference: The API reference is now dynamically generated straight from the library's Pydantic models, ensuring it never goes out of sync with the code.
  • Automated Deployment: Set up a .github/workflows/docs.yml pipeline that automatically builds and deploys the documentation site to GitHub Pages whenever a new v* release tag is pushed.

5. Parameter Renames

  • batch_size → max_batch_size: The batch_size argument was renamed across the board to clarify that it represents a hard-cap limit (enforced at 50 by the server).
    • Affected: WareraClient(max_batch_size=...)
    • Affected: client.batch(max_batch_size=...)
    • Affected: warera._batch.fetch_many_by_ids(max_batch_size=...)

6. New Resource Endpoints

Several new resource methods were wired up directly to the TRPC endpoints:

  • client.search.search_mus(query: str)
  • client.search.search_users(query: str)
  • client.tournament.get_by_id(tournament_id: str)
  • client.user.get_users_by_country(country_id: str)
  • client.region.get_all_list()
  • client.government.get_by_country_id(country_id: str)
  • client.company.get_recommended_region_ids_by_item_code(item_code: str)
  • client.ranking.get_ranking(ranking_type: str, country_id: str | None)
  • client.battle.get_ranking(battle_id: str)

7. New Enums & Options

  • New ItemCode enum: A massive StrEnum mapping every single in-game item (e.g. ItemCode.HEAVY_AMMO, ItemCode.BOOTS6, ItemCode.CONCRETE, etc.) for strict typing.
  • New SortBy & SortOrder enums: Added to standardize market and item sorting.
  • ArticleType updates: Added MU, USER, and COUNTRY feed filters.
  • RankingType updates: Added USER_SKINS_OWNED to track the new cosmetic leaderboards.

8. Bug Fixes

  • war.getById Schema & Parameter Fix: The WarResource was completely broken: it was incorrectly passing id instead of warId to the API, and the Pydantic model (War) was missing all its nested fields (attacker, defender, is_active, etc.). It has been rewritten to perfectly match the live API's payload structure and successfully parses all objects.
  • company.getCompanies ID dropping: The API returns a page of company ID strings, but the parser was strictly looking for dictionaries and dropping the string IDs. This caused get_companies, get_by_user, and collect_by_users to always appear empty. The client now properly captures the ID strings. get_companies and collect_all now return a stream of those IDs, while get_by_user and collect_by_users transparently fetch and hydrate the IDs into full Company objects under the hood.
  • worker.getWorkers empty list: The API returns a {type, workers: [...]} payload, but the client only read items/data, causing get_workers() to always return []. It now correctly reads from the workers key and successfully maps the user, company, wage, and joinedAt data into the strict Worker model.

Full Changelog: v0.2.3...v0.2.4

v0.2.3

Choose a tag to compare

@bipinkrish bipinkrish released this 10 Aug 11:52
830faee

What's Changed

  • Enhance company resource methods by @bipinkrish in #17
  • Add documentation and CI workflows for MkDocs site generation by @bipinkrish in #18

Full Changelog: v0.2.2...v0.2.3

v0.2.2

Choose a tag to compare

@CrucifiedPain CrucifiedPain released this 26 Jun 17:20
a8e4a78

What's Changed

Full Changelog: v0.2.1...v0.2.2

v0.2.1

Choose a tag to compare

@bipinkrish bipinkrish released this 24 Jun 10:03
a4eec6e

What's Changed

Full Changelog: v0.2.0...v0.2.1

v0.2.0

Choose a tag to compare

@bipinkrish bipinkrish released this 13 Jun 12:04
6cbba8f

What's Changed

  • Refactor and complete v0.2.0 with schema validation and auth improvements by @bipinkrish in #11

Full Changelog: v0.1.9...v0.2.0

v0.1.9

Choose a tag to compare

@bipinkrish bipinkrish released this 26 May 13:24
f8b8cda

What's Changed

Full Changelog: v0.1.8...v0.1.9

v0.1.8

Choose a tag to compare

@bipinkrish bipinkrish released this 11 May 12:09
4a6f15b

What's Changed

Full Changelog: v0.1.7...v0.1.8

v0.1.7

Choose a tag to compare

@bipinkrish bipinkrish released this 30 Mar 15:05

Full Changelog: v0.1.6...v0.1.7

v0.1.6

Choose a tag to compare

@bipinkrish bipinkrish released this 30 Mar 13:57

Full Changelog: v0.1.5...v0.1.6

v0.1.5

Choose a tag to compare

@bipinkrish bipinkrish released this 29 Mar 18:59
94599bb

What's Changed

  • Add WarEra v0.24.1 compliant changes. by @PAIN7177 in #6

Full Changelog: v0.1.4...v0.1.5