After evaluating some of the other Req plugins in the wild I decided
that the run functions and the request steps added far too much
accidental complexity.
Specifically, we can remove the pass-thru run functions and let the
user invoke the equivalent Req function of their choosing. This change
puts the user back in charge of the type of request they are performing
and allows AbsintheClient to stop being prescriptive about some choices.
This refactor composes the following changes:
Replaces :query and :variables options with a :graphql option,
either a String.t() or a {String.t(), nil | map()} tuple.
Drops the subscribe!/3 pass-thru function.
Users should use Req.request!/2 and the :web_socket option.
Requires the :web_socket option to use the WebSocket adapter.
WebSocket.connect/2 returns a Request.t()
WebSocket.push/2 accepts graphql option from Request
In a change similar to the AbsintheClient refactor, we are no longer
providing a pass-thru function to perform a subscription operation.
Instead, users must use Req.request/2 and the :web_socket option.
To simplify the process of starting a WebSocket and using it with a
Request, WebSocket.connect/2 accepts a request and returns a request
configured to perform operations over a WebSocket.
Taken together, these changes are designed to provide more clarity
around what options are used to start the WebSocket, when the WebSocket
starts, and which WebSocket process will handle a given request.
Additionally WebSocket.push/3 is now WebSocket.push/2 and it accepts a
graphql arg in the same shape as the Request option– either a
String.t() or a {String.t(), nil | map()} tuple.
After evaluating some of the other Req plugins in the wild I decided that the run functions and the request steps added far too much accidental complexity.
Specifically, we can remove the pass-thru run functions and let the user invoke the equivalent Req function of their choosing. This change puts the user back in charge of the type of request they are performing and allows AbsintheClient to stop being prescriptive about some choices.
This refactor composes the following changes:
Replaces
:query
and:variables
options with a:graphql
option, either aString.t()
or a{String.t(), nil | map()}
tuple.Drops the
subscribe!/3
pass-thru function. Users should useReq.request!/2
and the:web_socket
option.Requires the
:web_socket
option to use the WebSocket adapter.WebSocket.connect/2
returns aRequest.t()
WebSocket.push/2
acceptsgraphql
option from RequestIn a change similar to the AbsintheClient refactor, we are no longer providing a pass-thru function to perform a subscription operation. Instead, users must use
Req.request/2
and the:web_socket
option.To simplify the process of starting a WebSocket and using it with a Request,
WebSocket.connect/2
accepts a request and returns a request configured to perform operations over a WebSocket.Taken together, these changes are designed to provide more clarity around what options are used to start the WebSocket, when the WebSocket starts, and which WebSocket process will handle a given request.
Additionally
WebSocket.push/3
is nowWebSocket.push/2
and it accepts a graphql arg in the same shape as the Request option– either aString.t()
or a{String.t(), nil | map()}
tuple.