File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments