Some things that can be customized are:
HTTP
method, url
, etcbody
.Generally, this customization can be done:
First, before providing us with examples, some parts of the structure will be explained that is related to it.
graph TD
IR[Incoming request]
OR[Outgoing request]
RI[Resource]
AI[Adapter#parseResponse]
BO[Builder#action]
AO[Adapter#action]
subgraph Incoming requests
IR --> AI
AI -->|Resource#Factory| RI
end
subgraph Outgoing requests
RO[Resource] --> AO
AO --> BO
BO --> OR
end
Callee | Pipeline | Outgoing request: Adapter method involved | Outgoing request: Builder method involved | HTTP Verb used | Incoming response: Adapter method involved |
---|---|---|---|---|---|
Resource class | fetch | none | SimpleBuilder#fetch | GET | SimpleAdapter#parseResponse |
Resource instance | save | none | SimpleBuilder#save | POST | SimpleAdapter#parseResponse |
Resource instance | update | SimpleAdapter#fetch | SimpleBuilder#update | PATCH | none |
Resource instance | delete | none | SimpleBuilder#delete | DELETE | none |
ToOneRelation instance | set | ToOneAdapter#set | ToOneBuilder#set | PATCH | none |
ToOneRelation instance | remove | ToOneAdapter#remove | ToOneBuilder#remove | DELETE | none |
ToManyRelation instance | add | ToManyAdapter#add | ToManyBuilder#add | PATCH | none |
ToManyRelation instance | remove | ToManyAdapter#remove | ToManyBuilder#remove | DELETE | none |