Skip to content

Commit 4d8cafe

Browse files
committed
feat: adds auth files
1 parent 059fbf7 commit 4d8cafe

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Contracts;
6+
7+
use WordPress\AiClient\Common\Contracts\WithJsonSchemaInterface;
8+
use WordPress\AiClient\Http\DTO\Request;
9+
10+
/**
11+
* Interface for authentication implementations.
12+
*
13+
* Provides a contract for different authentication mechanisms
14+
* to modify HTTP requests with appropriate credentials.
15+
*
16+
* @since n.e.x.t
17+
*/
18+
interface AuthenticationInterface extends WithJsonSchemaInterface
19+
{
20+
/**
21+
* Authenticates a request.
22+
*
23+
* @since n.e.x.t
24+
*
25+
* @param Request $request The request to authenticate.
26+
* @return Request The authenticated request.
27+
*/
28+
public function authenticate(Request $request): Request;
29+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Models\Contracts;
6+
7+
use WordPress\AiClient\Providers\Contracts\AuthenticationInterface;
8+
9+
/**
10+
* Interface for models that support authentication.
11+
*
12+
* Models implementing this interface can have authentication
13+
* mechanisms configured for API requests.
14+
*
15+
* @since n.e.x.t
16+
*/
17+
interface WithAuthenticationInterface
18+
{
19+
/**
20+
* Sets the authentication mechanism.
21+
*
22+
* @since n.e.x.t
23+
*
24+
* @param AuthenticationInterface $authentication The authentication implementation.
25+
* @return void
26+
*/
27+
public function setAuthentication(AuthenticationInterface $authentication): void;
28+
29+
/**
30+
* Gets the authentication mechanism.
31+
*
32+
* @since n.e.x.t
33+
*
34+
* @return AuthenticationInterface The authentication implementation.
35+
*/
36+
public function getAuthentication(): AuthenticationInterface;
37+
}

0 commit comments

Comments
 (0)