Skip to content

Releases: FriendsOfOuro/http-batch-contract

v3.0.0 - Breaking Interface Changes

26 Sep 14:34

Choose a tag to compare

🚨 Breaking Changes

This release contains breaking changes to the ResponseBatchInterface:

Method Signature Changes

  • filter() now returns static instead of array for better fluent interface support
  • getSuccessfulResults() renamed to getResponses() and returns ResponseInterface[]
  • getFailedResults() renamed to getExceptions() and returns ClientExceptionInterface[]

Migration Guide

Before (v2.x):

$batch = $client->batch($requests);
$results = $batch->getSuccessfulResults(); // BatchItemInterface[]
$failures = $batch->getFailedResults();   // BatchItemInterface[]
$filtered = $batch->filter($predicate);   // BatchItemInterface[]

After (v3.x):

$batch = $client->batch($requests);
$responses = $batch->getResponses();       // ResponseInterface[]
$exceptions = $batch->getExceptions();     // ClientExceptionInterface[]
$filtered = $batch->filter($predicate);   // static (same type as $batch)

Benefits

  • βœ… Better type safety with specific return types
  • βœ… More semantic method names (getResponses vs getSuccessfulResults)
  • βœ… Fluent interface support with filter() returning static
  • βœ… Direct access to responses and exceptions without wrapping

πŸ€– Generated with Claude Code

v2.0.0

26 Sep 14:08

Choose a tag to compare

πŸš€ Major Release: Complete Interface Redesign

Breaking Changes

  • ClientInterface: sendRequestBatch() now returns ResponseBatchInterface instead of array
  • New Interface Hierarchy: Complete redesign for better type safety and usability
    • BatchItemInterface: Individual request/response pairs with getRequest(), isSuccess(), getResponse(), getException()
    • ResponseBatchInterface: Batch container with utility methods (extends Countable)
  • Exception Redesign: Clear exception hierarchy for access violations
    • AccessExceptionInterface: Base interface extending Throwable
    • ResponseUnavailableExceptionInterface: When accessing response on failed requests
    • ExceptionUnavailableExceptionInterface: When accessing exception on successful requests

New Features

  • Rich Utility Methods: isCompleteSuccess(), hasAnyFailures(), hasAnySuccesses(), getSuccessfulResults(), getFailedResults()
  • Flexible Filtering: filter() method with callable predicates for custom result filtering
  • Countable Interface: ResponseBatchInterface extends Countable for direct count() support
  • Type Safety: Eliminated union types in favor of clean holder patterns
  • Better Semantics: isSuccess() indicates transport success, not HTTP status codes

Migration Guide

Before (v1.x):

$responses = $client->sendRequestBatch($requests); // array of ResponseInterface
foreach ($responses as $response) {
    // Handle response
}

After (v2.0):

$batch = $client->sendRequestBatch($requests); // ResponseBatchInterface

// Check overall success
if ($batch->isCompleteSuccess()) {
    foreach ($batch->getResults() as $item) {
        $response = $item->getResponse();
        // Handle successful response
    }
} else {
    // Handle mixed results
    foreach ($batch->getSuccessfulResults() as $item) {
        $response = $item->getResponse();
        // Process successful responses
    }
    
    foreach ($batch->getFailedResults() as $item) {
        $exception = $item->getException();
        // Handle network failures
    }
}

// Direct counting support
$totalRequests = count($batch);

Full Changelog: v1.0.1...v2.0.0

v1.0.1

26 Sep 10:27

Choose a tag to compare

Bug Fixes

  • Update exception type in ClientInterface from generic \Exception to more specific ClientExceptionInterface to align with PSR-18 standards and improve type safety

What's Changed

Full Changelog: v1.0.0...v1.0.1