Skip to content

Commit 797fb9d

Browse files
authored
Merge pull request #44 from WordPress/provider-operator-interfaces
Adds interfaces for provider-based operations
2 parents 258f7c9 + d55e2ec commit 797fb9d

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Contracts;
6+
7+
use InvalidArgumentException;
8+
use WordPress\AiClient\Operations\DTO\GenerativeAiOperation;
9+
10+
/**
11+
* Interface for handling provider-level operations.
12+
*
13+
* Provides methods to retrieve and manage long-running operations
14+
* across all models within a provider. Operations are tracked at the
15+
* provider level rather than per-model.
16+
*
17+
* @since n.e.x.t
18+
*/
19+
interface ProviderOperationsHandlerInterface
20+
{
21+
/**
22+
* Gets an operation by ID.
23+
*
24+
* @since n.e.x.t
25+
*
26+
* @param string $operationId Operation identifier.
27+
* @return GenerativeAiOperation The operation.
28+
* @throws InvalidArgumentException If operation not found.
29+
*/
30+
public function getOperation(string $operationId): GenerativeAiOperation;
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Contracts;
6+
7+
/**
8+
* Interface for providers that support operations handlers.
9+
*
10+
* Providers implementing this interface can return an operations handler
11+
* for managing long-running operations across all their models.
12+
*
13+
* @since n.e.x.t
14+
*/
15+
interface ProviderWithOperationsHandlerInterface
16+
{
17+
/**
18+
* Gets the operations handler for this provider.
19+
*
20+
* @since n.e.x.t
21+
*
22+
* @return ProviderOperationsHandlerInterface The operations handler.
23+
*/
24+
public static function operationsHandler(): ProviderOperationsHandlerInterface;
25+
}

0 commit comments

Comments
 (0)