Skip to content

Commit b9af770

Browse files
committed
chore: updates architecture doc
1 parent a4d4004 commit b9af770

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

docs/ARCHITECTURE.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,11 @@ This section describes the HTTP communication architecture that differs from the
810810

811811
1. **Custom Request/Response Objects**: Models create and receive custom Request and Response objects specific to this library
812812
2. **HttpTransporter**: A dedicated class that handles the translation between custom objects and PSR standards
813-
3. **PSR Compliance**: The transporter uses PSR-7 (HTTP messages), PSR-17 (HTTP factories), and PSR-18 (HTTP client) internally
814-
4. **No Direct Coupling**: The library remains decoupled from any specific HTTP client implementation
813+
3. **HTTPlug Integration**: Uses HTTPlug's Discovery component for automatic detection of available HTTP clients and factories
814+
4. **PSR Compliance**: The transporter uses PSR-7 (HTTP messages), PSR-17 (HTTP factories), and PSR-18 (HTTP client) internally
815+
5. **No Direct Coupling**: The library remains decoupled from any specific HTTP client implementation
816+
6. **Provider Domain Location**: HTTP components are located within the Providers domain (`src/Providers/Http/`) as they are provider-specific infrastructure
817+
7. **Synchronous Only**: Currently supports only synchronous HTTP requests. Async support may be added in the future if needed
815818

816819
### HTTP Communication Flow
817820

@@ -842,7 +845,7 @@ config:
842845
---
843846
classDiagram
844847
direction TB
845-
namespace AiClientNamespace.Http.DTO {
848+
namespace AiClientNamespace.Providers.Http.DTO {
846849
class Request {
847850
+getMethod() string
848851
+getUri() string
@@ -863,22 +866,26 @@ direction TB
863866
}
864867
}
865868
866-
namespace AiClientNamespace.Http.Contracts {
869+
namespace AiClientNamespace.Providers.Http.Contracts {
867870
class HttpTransporterInterface {
868871
+send(Request $request) Response
869872
}
870873
}
871874
872-
namespace AiClientNamespace.Http {
875+
namespace AiClientNamespace.Providers.Http {
873876
class HttpTransporter {
874877
-requestFactory Psr17RequestFactoryInterface
875-
-streamFactory Psr17StreamFactoryInterface
878+
-streamFactory Psr17StreamFactoryInterface
876879
-client Psr18ClientInterface
877-
+__construct(Psr17RequestFactoryInterface $requestFactory, Psr17StreamFactoryInterface $streamFactory, Psr18ClientInterface $client)
880+
+__construct(?Psr18ClientInterface $client, ?Psr17RequestFactoryInterface $requestFactory, ?Psr17StreamFactoryInterface $streamFactory)
878881
+send(Request $request) Response
879882
-convertToPsr7Request(Request $request) Psr7RequestInterface
880883
-convertFromPsr7Response(Psr7ResponseInterface $response) Response
881884
}
885+
886+
class HttpTransporterFactory {
887+
+createTransporter() HttpTransporterInterface$
888+
}
882889
}
883890
884891
namespace PSR {
@@ -912,6 +919,7 @@ direction TB
912919
HttpTransporter --> Psr17RequestFactoryInterface : uses
913920
HttpTransporter --> Psr17StreamFactoryInterface : uses
914921
HttpTransporter --> Psr18ClientInterface : uses
922+
HttpTransporterFactory ..> HttpTransporter : creates
915923
HttpTransporter ..> Request : receives
916924
HttpTransporter ..> Response : creates
917925
HttpTransporter ..> Psr7RequestInterface : creates

0 commit comments

Comments
 (0)