Skip to content

Commit d3dfa92

Browse files
committed
refactor: moves authentication interfaces to HTTP domain
1 parent 71f3594 commit d3dfa92

File tree

5 files changed

+98
-66
lines changed

5 files changed

+98
-66
lines changed

src/Providers/Contracts/AuthenticationInterface.php

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Http\Contracts;
6+
7+
use WordPress\AiClient\Providers\Http\DTO\Request;
8+
9+
/**
10+
* Interface for HTTP request authentication.
11+
*
12+
* @since 1.0.0
13+
*/
14+
interface RequestAuthenticationInterface
15+
{
16+
/**
17+
* Authenticates an HTTP request.
18+
*
19+
* @since 1.0.0
20+
*
21+
* @param Request $request The request to authenticate.
22+
* @return void
23+
*/
24+
public function authenticate(Request $request): void;
25+
26+
/**
27+
* Returns the JSON schema for this authentication.
28+
*
29+
* @since 1.0.0
30+
*
31+
* @return array<string, mixed> The JSON schema.
32+
*/
33+
public static function getJsonSchema(): array;
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Http\Contracts;
6+
7+
/**
8+
* Interface for models that require HTTP transport capabilities.
9+
*
10+
* @since 1.0.0
11+
*/
12+
interface WithHttpTransporterInterface
13+
{
14+
/**
15+
* Sets the HTTP transporter.
16+
*
17+
* @since 1.0.0
18+
*
19+
* @param HttpTransporterInterface $transporter The HTTP transporter instance.
20+
* @return void
21+
*/
22+
public function setHttpTransporter(HttpTransporterInterface $transporter): void;
23+
24+
/**
25+
* Returns the HTTP transporter.
26+
*
27+
* @since 1.0.0
28+
*
29+
* @return HttpTransporterInterface The HTTP transporter instance.
30+
*/
31+
public function getHttpTransporter(): HttpTransporterInterface;
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WordPress\AiClient\Providers\Http\Contracts;
6+
7+
/**
8+
* Interface for models that support request authentication.
9+
*
10+
* @since 1.0.0
11+
*/
12+
interface WithRequestAuthenticationInterface
13+
{
14+
/**
15+
* Sets the request authentication.
16+
*
17+
* @since 1.0.0
18+
*
19+
* @param RequestAuthenticationInterface $authentication The authentication instance.
20+
* @return void
21+
*/
22+
public function setRequestAuthentication(RequestAuthenticationInterface $authentication): void;
23+
24+
/**
25+
* Returns the request authentication.
26+
*
27+
* @since 1.0.0
28+
*
29+
* @return RequestAuthenticationInterface The authentication instance.
30+
*/
31+
public function getRequestAuthentication(): RequestAuthenticationInterface;
32+
}

src/Providers/Models/Contracts/WithAuthenticationInterface.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)