Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/Providers/Contracts/ProviderOperationsHandlerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace WordPress\AiClient\Providers\Contracts;

use InvalidArgumentException;
use WordPress\AiClient\Operations\DTO\GenerativeAiOperation;

/**
* Interface for handling provider-level operations.
*
* Provides methods to retrieve and manage long-running operations
* across all models within a provider. Operations are tracked at the
* provider level rather than per-model.
*
* @since n.e.x.t
*/
interface ProviderOperationsHandlerInterface
{
/**
* Gets an operation by ID.
*
* @since n.e.x.t
*
* @param string $operationId Operation identifier.
* @return GenerativeAiOperation The operation.
* @throws InvalidArgumentException If operation not found.
*/
public function getOperation(string $operationId): GenerativeAiOperation;
}
25 changes: 25 additions & 0 deletions src/Providers/Contracts/ProviderWithOperationsHandlerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace WordPress\AiClient\Providers\Contracts;

/**
* Interface for providers that support operations handlers.
*
* Providers implementing this interface can return an operations handler
* for managing long-running operations across all their models.
*
* @since n.e.x.t
*/
interface ProviderWithOperationsHandlerInterface
{
/**
* Gets the operations handler for this provider.
*
* @since n.e.x.t
*
* @return ProviderOperationsHandlerInterface The operations handler.
*/
public static function operationsHandler(): ProviderOperationsHandlerInterface;
}